How to see the javascript errors of PhoneGap app in Xcode?

Question: I want to debug my PhoneGap app in Xcode, but its Console can not show javascript errors.
Answer: The most elegant way to view and debug JavaScript errors in your Cordova/PhoneGap App is by attaching the Web Inspector from your Safari browser to the Web View in your iOS App (but, like Tom Clarkson already mentioned, you will need at least iOS 6).

On your iPad or iPhone use the Settings App to enable Web Inspector in the Advanced Settings for Safari
Connect your device to a Mac via USB (it will then appear under the Develop menu of Safari)
Start your App
Navigate to the Web View you want to debug
On the Mac, from the Safari Develop menu, select the name of your device and the App (its HTML-page), from its sub menu
A Web Inspector window will open, enabling you to browse the DOM, set breakpoints etc.

Apples documentation on setting this up
A thorough third party tutorial
Alternatively you could connect Chrome's Web Inspector to iOS devices after installing iOS WebKit Debug Proxy. This also opens up the ability to do the inspection from Linux or Windows.
Remote access to your iOS's HTML, CSS and JavaScript has gotten even more flexible nowadays because you can install the RemoteDebug iOS WebKit Adapter on top of aforementioned Debug Proxy. Because this adapter translates the WebKit Remote Debugging Protocol to the Chrome Debugging Protocol, these (on all their supported platforms) become available as alternative debugging and inspection tools:

Visual Studio Code
Chrome DevTools
Mozilla Debugger

BTW, remote debugging with the Safari Web Inspector works even in combination with the iOS Simulator.

Minimum version of Desktop Safari per iOS version
For each version of iOS you will need a specific minimum version of Desktop Safari in order to use remote web inspection, see the list below.

iOS 6
Safari 6+
iOS 7
Safari 6.1+
iOS 8
Safari 7.1+
iOS 9
Safari 8+
iOS 10
Safari 9+/10+? Please comment; always try Safari Technology Preview
iOS 11
Safari 11+
iOS 12
Safari 12+
Comment: Agreed. Using the safari web inspector is more robust than Weinre and much faster for finding errors than pasting into a JS lint tool. It also allows you to inspect and manipulate DOM elements which is fantastic. I'd recommend folk use this approach.
Comment: You can't see first loading messages since it take some time to connect.
Comment: what about production errors? App never crashes as far as the WebView is concerned, but the js inside can throw errors. Therefore you do not get any crash reports on iTunes Connect, but users see a white screen.
Comment: @Mirko The Web Inspector is only useful in debugging and has no relation to iTunes Connect.
Comment: @Mirko You could build your app with the [Cordova Crashlytics plug-in](https://www.npmjs.com/package/cordova-plugin-crashlytics) or use Google Firebase.
Answer: Paste the following somewhere near the start of your document so that it gets executed before any of your other JavaScript.

And enjoy viewing details of your Javascript errors in the Xcode console window.
UPDATE: The above technique will log errors such as undefined variables. But syntax errors such as missing commas will still cause the entire script to break without logging anything.
Therefore you should add the following to the start of your onDeviceReady function:
console.log('Javascript OK');

If you don't see "JavaScript OK" appearing in your log window when the app launches, then it means you have a syntax error somewhere.
To save hunting for missing commas, the easiest thing is to paste your code into a Javascript validator such as this one:
http://www.javascriptlint.com/online_lint.php
and let it find the error for you.
Hopefully that takes some of the pain out of debugging.
Answer: Note that with 0.9.2 (released today), console.log has been standardized across the platforms for logging (with debug.log deprecated).
There is a function that is available on the desktop WebView that is not exposed in the iOS UIWebView that will catch all errors (I'm trying to hack that functionality into a plugin, which uses private APIs, but the plugin would only be for development), but for now do what Kris suggested above and put try catch blocks on code and use console.log
To quickly catch possible syntax errors, when developing I have the page loaded in desktop Safari and quickly refresh it with the webkit error console viewable.
Comment: And the answer is... console.log doesn't work until after Phonegap has initialized itself. I was calling it in body.onload, which was too early.
Comment: This isn't working for me, with Phonegap 1.1.0, Xcode 4.2 beta, and both the iPhone w/ iOS 4.3 and iPhone w/ iOS 5.0 emulators.

I add console.log("message"); calls in places where alert("message"); works, but nothing gets written to the log.  Does anyone know what's going wrong?
Answer: debug.log will send messages to the XCode console in Phonegap (allowing you to either log the result of an exception or do some debugging), however, you are correct that you have to debug other javascript errors in Safari (either on the desktop or on the iphone with Debug Console turned on).  I have yet to find a Javascript error, that was caused by running on the iphone and wasn't present when debugging with the console turned on in Safari (though I know there are a few differences between the WebView and Safari on the iphone).
Answer: For making javascript debugging work in Xcode I would take a look at the following.
http://phonegap.com/2011/05/18/debugging-phonegap-javascript/
http://www.daveoncode.com/2010/01/12/debugging-phonegap-applications-using-xcode-console/
As as far as additional troubleshooting goes...
To start with you could run the app in safari on you pc and utilize safari's debugger (or chrome as both are running similar rendering engines). This won't hit on the advanced logic errors and many of your api issues but it at the very least should help with troubleshooting many issues (basic javascript, HTML5 etc....).
Answer: I just came across Weinre
It's a remote javascript debugger for phonegap. You can either setup your own Weinre server, or use the one at http://debug.phonegap.com/
It seems to work well - very impressed so far.
Comment: @asgep1 Both links are now dead! :(
Answer: If you use iOS 6, you can simply attach the safari web inspector (on the develop menu of desktop safari) to your app and get full javascript debugging.
There are a couple of areas where it is a bit limited - startup errors and plugin calls - but it works well for pretty much anything else.
Comment: This is by far the best way to do it. It works for both plugged in devices and the IOS simulator and is more reliable than trying to achieve the same thing with Weinre.
Answer: To view all errors in javascript console, I agree to use this event listener

However, unless you have the cordova plugin installed, it wont show on XCodes "console".  Go to your project folder and type this:
? cordova plugin add cordova-plugin-console

This will allow the javascript command 'console.log('some string') to show on XCode.
Note you will need git, etc... but if you are editing your phonegap project in xcode, you will most probably have it!
PS Make sure you put the cordova.js script plug-in before any use of console.log

Answer: Put this in the beginning of your index.html

Comment: The question says in the console, not in the view.
Answer: Here's a simple way that worked for me:

cd to the directory containing your index.html file in the terminal
Start a http server using python by invoking (I used python 2.7):
python -m SimpleHTTPServer
View the page in safari by entering the address of the HTTPServer in a browser, for me the URL was:
http://0.0.0.0:8000/

Open developer tools:
In chrome this is alt+command+i. View the console tab, may need to refresh the page.
In Safari: Safari --> Preferences --> Advanced --> check "Show Develop Menu". Develop menu --> Show error console (or alt+command+c). Refresh the page. Hitting CTRL+5 opens the issues tab.
Comment: This only works if your application is a simple web app. Calling into PhoneGap/device features won't work in a standard browser.


Please merge [tag:extended-desktop] [tag:multiple-desktop]

Question: Those 2 tags are exact duplicates : extended-desktopmultiple-desktop isn't it ?
Comment: This is an interesting one.  A lot of people use the terms interchangeably, and neither tag has guidance.  Some people differentiate adding screen real estate vs. managing multi-screen content, but there isn't consistency in which term is used for each.  There are 65 questions between them and only 6 are tagged with both.  But in practice, the two tags are used the same way.  So people have a preference and both terms should be accessible.  Any thoughts on which would be the better primary tag?  There are 25 desktops vs. 40 displays, so quantities would favor display.
Comment: @fixer1234 : I have no ideas.
Comment: I would recommend [tag:extended-desktop] as the primary tag. To me at least it is more immediately apparent as to the point of the question.
Comment: @Burgi : you should write it in an answer. I have really no ideas of what should be the primary tag. I want action to be taken.
Answer: Although extend-display would be the most correct in my opinion, I feel like a lot of people would use extend-desktop if they didn't think about it. But the tag usage frequency seems to prove me wrong.
When attempting to adjust the settings to extend your display, Windows does use the words 'Extend these displays`.
From all of my own personal experience, I noticed that almost everyone refers to their display as their desktop. "How do I extend my desktop?", "How do I mirror my desktop?", etc.
I went to the almighty Google to solve this and typed a query Extend d and 4 results were:

extend definition
extend display mac
extend display
extend display windows 7

So I vote extend-display.
Comment: @user2284570 I got looking into the questions that are tagged multiple-desktop and they are of the same nature as `extended-desktop`, yet differ enough from the tag `multiple-display`. The `multiple-display` tag has more hardware related questions, and `multiple-desktop` is more related to software. I'd say it could be merged with `extended-desktop`
Comment: "Display" can refer to either the hardware or the content.  "Desktop" refers to the content, and only sort of implies that you need hardware to accomplish it.  Display is probably the more universal term, and less likely to look like the "wrong" tag.
Comment: @fixer1234 : display doesn't have to display a windowed system. It can also be a full console.
Comment: @DrZoo : what about [tag:multiple-desktop] ?
Comment: @user2284570 is multiple-desktop the tag that was implemented?
Comment: @DrZoo : no, but it looks like to be a third duplicate I forgot in the original question.


"If we were in a physical relationship, you just lost sex tonight." Grammatically correct?

Question: "If we were in a physical relationship, you just lost sex tonight".
This is a line from the TV show, 'Big Bang Theory'. It seems incorrect but I may be wrong.
Comment: Thank you @tchrist for bringing this question to the fore. Questions about whether something is incorrect must indicate **what** the asker thinks is wrong.
Answer: Technically, the sentence is not grammatical. The speaker is using the subjunctive mood to express something hypothetical and/or counter-factual (in reality, they are not in a physical relationship). A more grammatically precise rendering would use the subjunctive past imperfect in conjunction with the conditional:

If we were in a physical relationship, you would have just lost sex tonight.

In spoken, colloquial language, the sentence rendered as it was in the TV programme is nonetheless perfectly intelligible, although I'm sure there are lots of self-declared English language authorities who would issue red-faced, frothy-mouthed diktats to the contrary. I will note, however, that as an Englishman this rendering sounds very American to my ear.
Edit:
Here's a webpage with some nice explanations of the subjunctive mood:
https://web.cn.edu/kwheeler/grammar_subjunctive.html
Comment: "...self-declared English language authorities who would issue red-faced, frothy-mouthed diktats..." -- There are, of course, none of those to be found in this forum... are there? (Nice turn of phrase, BTW.  :-) As you imply, the nub of this issue is the _register_ and _context_ of the utterance. I watched that episode: Sheldon was giving his platonic girlfriend Amy a mild telling-off. In that context, I find nothing to criticize in what he said (other than the fact that he actually said it.   ;-)
Comment: @ErikKowal ha! So it was arch-pedant Sheldon who was mis-matching his subjunctive and indicative moods :)
Comment: An untypical lapse on Sheldon's part. The dismay his friends must have felt when he made it can only be imagined.  :-)
Answer:
If we were in a physical relationship, you just lost sex tonight.

Seems perfectly fine to me.
The first part is expressing a conditional which is not real. We are not in a physical relationship, but if we were, then what follows would be true.
The second part means that the person who is addressed just did something that caused him not to have sex with the speaker. However, he was not going to have sex with the speaker, as the speaker and the addressee are not in a physical relationship.
For the us of this kind of conditional, I believe there is no better reference than the famous song If I were a carpenter:

If I were a carpenter
  And you were a lady,
  Would you marry me anyway?
  Would you have my baby?
Comment: I agree. It's a condition and a cause in a present tense.
Comment: I'm afraid it's not fine. After a past-tense "if" (representing a hypothetical/unreal condition), you need a conditional in the consequence. Even the song has it - "would," not "will."
Comment: The song illustrates the first clause. About needing a conditional in the second clause, 568ml has worded a nice opinion about that, which I gladly will second. As to whether the sentence as a whole would withstand the intense scrutiny of trigger-happy prescriptionists, I agree, it would not. I guess the question is whether grammar is what the rules say, or grammar is how people use the language in order to be understood without any problems. And for those who prefer the second definition, the sentence is _fine_ :)
Answer: There is a mis-match that is strictly incorrect, but which has rhetorical value.
The first clause is in the subjunctive mode, and so the second part should also be, or at the very least the switch should be less abrupt than it is.
However, consider that the indicative mode of the second clause is much more immediate. "you just lost sex" is much more of a "burn" than "you would have just lost sex".
There's also a further element of humour in this (it is a comedy show after all), in that the speaker has switched from talking about a hypothetical to talking as if it was the case. As well as being part of the increase in immediacy I just mentioned, this also addresses the nature of the relationship in the show, which is (as stated) not sexually intimate, but where it is known that the character addressed wants it to be.
As such, the "incorrect" grammar could be reasonably considered artistic license; not a good idea normally, but used here for effect.
Answer:
"If we were in a physical relationship, you just lost sex tonight."

seems to be a Mixed conditional sentence and is wrong.
The correct one should be :

"If we had been in a physical relationship, you would have just lost sex tonight."

*Edited
Comment: I think you must mean "If we had been in a physical relationship, you would **have** just lost sex tonight".


Geolocation necessary to get mayorship?

Question: It's well known foursquare users are not able to get the mayorship of a venue if checkin comes via mobile website. But is it also necessary to send the geolocation of a user via foursquare API to get mayorship? If yes, how accurate must the geo information be?
Answer: Yes, only check-ins that pass the user's actual lat/lng will be eligible for mayorship. The accuracy required depends on the venue, but the lat/lng reported must come from an independent source (i.e. the phone's GPS) and not be derived or set by the user.

Geolocation necessary to get mayorship?


New DDR2 RAM doesn't fit

Question: Just bought 2 4GB sticks of DDR2 RAM, and they don't fit in my motherboard.
The new sticks are Komputerbay 240 Pin 800MHz PC2-6400F DDR2 ECC Fully Buffered FB-DIMM Memory Modules (on the bottom in the picture), and my old sticks are Geil PC2-8500 DDR2-1066 Memory Modules (on the top in the picture).
My motherboard is an ASRock N68C-GS4FX.
My guess was that the new motherboard required non-ECC momory, but I really don't know.

Thanks in advance,
Will
Comment: Google is Your Friend! :) http://www.asrock.com/MB/NVIDIA/N68C-GS4%20FX/index.asp?cat=Manual  Found this in 30 seconds. You have the wrong kind.
Comment: Yes, your motherboard only supports non-ECC, un-buffered memory. [Here are the specifications](http://www.asrock.com/mb/NVIDIA/N68C-GS4%20FX/?cat=Specifications) for your motherboard.
Comment: if they dont fit, they are wrong, always. take that as life law.
Comment: The lower label is funny. **Unbufffered** 240 pin **unbuffered** dual in-line memory module. They are making very sure it is not registered memory. :)
Answer: It looks like you bought Fully Buffered DDR2, which is not compatible with DDR2 slots.
If you need further information, you can start with this Wikipedia article

240-pin DDR2 FB-DIMMs are notched differently from conventional 240-pin DDR2 DIMMs. As a result, those two DIMM types are neither mechanically nor electrically compatible.
Comment: also [referenced in Wikipedia here regarding DDR2 specifically and FB (fully-buffered) RAM](https://en.wikipedia.org/wiki/DDR2_SDRAM#Relative_speed_comparison_between_similar_modules). Also learned this the hard way...
Answer: If you somehow ended up with a boatload of the Fully Buffered DDR2 RAM (different architecture than standard DDR2) you might want to consider purchasing a used HP XW6400 Workstation Computer - around $100-$150 refurbished on eBay.  They take the Fully Buffered ECC Memory and Max out at 16gb. Makes for a superfast desktop replacement PC, faster than anything I've seen new if you get one with a Quadcore.
Comment: Your answer is good, i personally avoid to speak about money or prices because they go out to date pretty soon. fix it and i'll upvote.

New DDR2 RAM doesn't fit


Transaction - Timestamp Ordering. When is aborted transaction restarted

Question: (I don't know if this is the correct place to ask, since this is more like a theoretical question).
I have a question about restarting aborted transactions. I don't know when / at which point should restarting of the transaction(s) occur.
Example - using Basic Timestamp Ordering
w11(x), r12(x), r11(z), r13(x), w13(z), r12(z), w13(x), w14(x)

Initial values are:
read_ts(x) = write_ts(x) = read_ts(z) = write_ts(z) = 10

As we can see transaction 12 is aborted because it is trying to read value z, written already by T13 (older, T12 can't read it).
So in this case T12 is aborted and its timestamp is raised (to 15?). My question is when does the aborted transaction(s) restart?
(1) After all the non-aborted transactions are done, or (2) soon as possible (= restarts after next operation w13(x))?
In scenario 1, w14(x) would be done, and after that aborted transaction 12 would start (as T15).
In scenario 2 (soon as possible), transaction 12 (as T15) is restarted immediately after next operation w13(x). After that w14(x) is aborted (14 < 15) and restarted as T16
What is the correct order in this case? What does the restart actually mean? When do we restart an aborted transaction(s)?
I would like to see a practical example.
edit: changed the last operation to w14(x) instead of r14(x)
Answer: well, my teacher said that there is no clear answer since the methods varies. Some DBMSystems won't restart aborted transactions at all


Submenu or navigation bar at 10th level

Question: I am designing the webpage for content management system where user have to search content at submenu level(1-10th level sometime) .How to arrange menu navigation on the page .Please advice.
Comment: I advice you to reconsider your information architecture if your navigation needs to have ten levels.
Comment: As it stands, this question lacks the context needed to help you. Could you include some wireframe sketches of where you expect this navigation to go and what it is expected to do?
Comment: yes, if you have ten levels something has gone catastrophically wrong
Comment: Andrew Just attached the wireframe where each menu level leads to submenu its like peeling an onion.Can you suggest me organize way to handle
Answer: In your case, you are gone extreme of using sub-level menu. Navigation that are specific and do not overlap are the easiest to understand. This cuts both ways: In deep hierarchies, when there are only a few navigation categories on each level, they tend to be more generic and, thus, more confusing. A flatter hierarchy with more navigation categories at each level usually has more-specific labels that are easier to understand; but in broad hierarchies with a very large number of items, there is often some conceptual overlap between at least a few of the navigation categories. Users can also become overwhelmed with long, cluttered menus.
Source: Nelson Norman Group article "Flat vs. Deep Website Hierarchies"
I would suggest to reconsider your IA and use given below methods:

Card sorting
Tree Testing
Answer: Take a look at how OSX Finder can be viewed using Columns.
The same Columns approach is used in Jobs at Apple website.
If you take this approach, the menu navigation will need to be the full width of the container.

Submenu or navigation bar at 10th level


Affine connection notation

Question: Can ${g}^{\mu\sigma}{\Gamma}^{\rho}_{\sigma\nu}$ be written as ${\Gamma}^{\mu\rho}_{\nu}$? If so how come this symbol never appears in any GR book?
Answer: Well, you can of course simply define a new symbol and use that notation, but no one does that because raising and lowering indices is an operation that has a well-defined, coordinate-free meaning on tensors (it has to do with something called the tangent-cotangent isomorphism), but the connection coefficients are not the components of a tensor.
Addendum. Since there has been a downvote, I'd like to quote Carroll's Spactime and Geometry to corroborate my assertion that physicists tend to avoid raising and lowering indices on symbols such as the Christoffel symbols because they are not components of a tensor;

...the connection coefficients are not the components of a tensor...This is why we are not so careful about index placement on the connection coefficients; they are not a tensor, and therefore you should not try to raise and lower their indices.
Comment: @ChrisWhite: but that at least is less violent to the notation, because of the factor of $g^{rho\lambda}$ up front in the expression of $\Gamma^{\lambda}{}_{\mu\nu}$ in terms of the metric, so it's pretty safely coordinate independent.
Comment: Of course some authors do use $\Gamma_{\rho\mu\nu}$ for $g_{\rho\lambda} \Gamma^\lambda_{\mu\nu}$, but I find this somewhat confusing.
Comment: @ChrisWhite Agreed.
Answer: The real problem with your components ${\Gamma}^{\mu\rho}_{\nu} = {g}^{\mu\sigma}{\Gamma}^{\rho}_{\sigma\nu}$ and similarly with $\Gamma_{\rho\mu\nu}$ – the reason why the symbols are not used – is the symmetry, more precisely the absence of it.
While $\Gamma^{\alpha}_{\beta\gamma}$ is $\beta\gamma$ symmetric so it doesn't matter in which order the lower indices are written, the first two non-tensors don't enjoy the symmetry in the upper indices or the symmetry in the lower indices so one could easily misinterpret the symbol $\Gamma^{\mu\rho}_\nu$ as $\Gamma^{\rho\mu}_\nu$ which is actually something else. There is no way to uniquely determine whether the first upper index or the second upper index originated from a lower index that was raised. But the answer to this problematic question actually affects the values of the components.
Josh is right that the symbols are not tensors but if there were not the problem above, it would be very natural to define the new symbol according to your rule even for non-tensors.
To support my point by an additional argument, note that the Riemann tensor *is*a tensor but we must be very careful to write various raised components as $R^{\alpha}{}_{\beta\gamma\delta}$, for example, so that we may distinguish the first, second, third, and fourth index. Writing $R^\alpha_{\beta\gamma\delta}$ would be utterly ambiguous. But for $\Gamma^\alpha_{\beta\gamma}$, there is no unambiguous solution because in the standard notation I just wrote, the index $\alpha$ is directly above $\beta$ index so both of them are on the first spot and they consequently can't be raised or lowered.
To offer the "opposite" argument that the non-tensor character isn't the actual reason why the symbols are not used, note that $\partial^\alpha g_{\mu\nu}$ is used with the raised $\alpha$ index although the partial derivative isn't a tensor, either.

Affine connection notation


Drops from hoppers are not going into the nearby chest

Question: In Minecraft on the Xbox One, the drops from the hoppers are not going into the nearby chest. How do you connect them?
Comment: Welcome to Stack Exchange! Could you give us some more detail, such as version number, block setup, and/or screenshots?
Answer: The chest cannot just be "nearby" the hopper output must be right on the chest.
From the wiki:

To place a hopper, use the Place Block control while aiming at the surface to which its output should face (a hopper will not automatically orient itself to point at a container). To place a hopper so that it faces a container (or other block which has a Use Item interaction), sneak while placing the hopper. A hopper placed while aiming at the bottom of a block will re-orient to face down instead. Hoppers won't change their direction after being placed and aren't "attached" to the container they are facing -- the container can be removed and the hopper will continue to face in the same direction.


Probability of achieving a score using multiple normal distributions

Question: I am building an Excel optimization spreadsheet which calculates the probability that two or more basketball players will combine to score X amount of points or greater on any given night.  The historical data I have produces a normal curve for each player and I can calculate the mean and standard deviation for each player's population of historical scores.
I then create a list of potential scores between 1 and 50 (neither of the players has ever scored more than 50 points) and calculate a z-score for each potential point total for each player.
I then calculate the probability for each score (e.g. 1, 2, 3, 4, etc... through 50) for each player using the 1- normsdist Excel function.
This provides me with two lists of probabilities, one for Player A and one for Player B.  Each list starts at near 100% probability for each player for the scores of 1, 2 3, etc...  The mean of each player's scoring is listed at a 50% probability and numbers above the mean become progressively less probable as they become greater and greater.
My question is how do you mathematically calculate the probability of achieving a combined score of X (e.g. 1, 2, 3, 4 etc... through 100) for every point total possible?  I initially thought this could be done by multiplying the probabilities for each score but quickly realized that the problem was much more complex as there are multiple ways to score each point total that must be accounted for.  For example, if I want to know the probability of Player A and Player combining to score 10 points or more this could be achieved through Player A scoring 10 points and Player B scoring 0 or Player A scoring 9 and B scoring 1 etc...
Any input would be appreciated.  Thanks in advance!
Answer: The PMF of a sum of random variables is the discrete convolution of the two PMFs.
$$(f*g)[n]=\sum_{m=-\infty}^{\infty}f[n-m]g[m]$$
but since you don't have negative or infinite scores, I believe it should simplify to
$$(f*g)[n]=\sum_{m=0}^nf[n-m]g[m]$$
Comment: where f[n] and g[n] are the discrete probabilities of each player achieving a score of n


How to add parachains to parity signer?

Question: I'm setting up a metadata site for parachains. I have the github pages site working, and am currently adding parachains. I just have a few questions to make sure I do this properly.
For rpc_endpoint is there a list of rpc urls per parachain anywhere? Is it possible to add multiple rpcs to select from currently per chain?
For owner is that the name of the developer team?
For repo is that the teams github repo name?
I currently have for Acala this:
[[chains]]
name = "acala"
rpc_endpoint = "wss://"
color = "#645AFF"

[chains.github_release]
owner = "AcalaNetwork"
repo = "Acala"
genesis_hash = "0xfc41b9bd8ef8fe53d58c7ea67c794c7ec9a73daf05e6d54b14ff6342c99ba64c"

Answer:
Is it possible to add multiple rpcs to select from currently per chain?

Yes, you can use rpc_endpoints setting to specify a list of urls.

For owner is that the name of the developer team? For repo is that the teams github repo name?

Correct.

How to add parachains to parity signer?


change drive letters in triple boot

Question: i currently triple boot vista (c drive), xp (e drive) and linux (drive doesnt show up in windows)
My data is on d drive.
I want to get rid of vista installation and move xp to c drive (make default OS) and then i will install W7 RC on the e drive later.
Is there a way i can change the drive letters so i dont have to reinstall xp?
Im scared I wont be able to boot windows properly if i delete the C drive.
Comment: yeh the c drive is the system drive..
Comment: If you launch "Disk Management Console", which drive is listed as being the "System" drive?  That's the one that would hold the Windows Boot Manager and be required to boot any Windows OS currently installed on the system.
Answer: I had XP on the C:\ drive and installed Vista on D:. When I booted into Vista, it appeared it was on C:\, when I booted into XP, it also showed as C:. Vista functions differently from XP; when you start it, it shows it's on the C:\ drive. So all these letters don't really mean anything in the end.
Just try and install Windows 7 directly, without making all these changes. Just pop in the Windows 7 DVD, format the Vista partition from the installer and continue installing 7. When done, the Windows 7 bootloader will probably figure out what to do with XP.
Comment: yeh not a bad idea. thanks
not a perfect solution though because ive heard that some programs dont play nice if they are not installed on the c drive (i will be using xp as my main system).
cheers
Comment: I think you can play around wiht the drive letters. I know Paragon Partition Manager can change drive letters for you without needing to do anything else. Give that a try and see what happens. They have a trial version on their site: http://www.partition-manager.com/
Comment: i did what u said and it works well thanks
now i just have to figure out how to add linux to the boot list!
(ill try easy bcd)
Comment: It should be fairly easy with EasyBCD; I've actually done that a while back, although I can't really remember the way to do it. BTW, if you found my answer helpful, please consider marking it as the accepted answer. Thanks!
Answer: Actually Windows XP is very picky about being located on the C: drive especially if you have a prior install and have programs all up and running it gets messy; best I would say is to get a third party Drive managing software and do some adjusting; I use Acronis software ie Disk director no plug intended I've had it for over a year and it works very well.
Most important thing however is Backup, Backup, Backup acronis could help you there also or any other software; then open your disk software you can select change drive E: to C: and so on I can only speak for Acronis as that's all I use it will ask for a restart do all the drives in one simple pre boot screen and vala!
Good luck

change drive letters in triple boot


Why does energy conservation give me the wrong answer in this inelastic collision problem?

Question: Suppose there are two objects. The first object is stationary and has the next parameters: v1=0 m/s, m1= 4kg. The second object is heading towards the first one with speed v2= 8m/s and mass m2= 60 kg. Due to collision, objects merge into one and continue to move with the velocity v3. Suppose all the energy gets converted into speed. I want to know the magnitude of velocity v3. My question is : Why do we get slightly different results when using kinetic energy compared to conservation of momentum when solving for v3. If we assume no energy gets converted into heat, couldn't we set up equations like : Ek1=0 J and Ek2=$\frac{m_2*v_2^2}{2}$ . E3=E2+E1=$\frac{v_3^2}{2}*(m_1+m_2)$ . v3=$\sqrt{\frac{(E_1+E_2)*2}{(m_1+m_2)}}$ ? Why do we get different result this way comparing to the result when we calculate v3 using conservation of momentum?
Comment: Energy is not conserved in your setup.
Comment: @knzhou With this edit, the answer is right in the title...
Comment: @RalfKleberhoff This is where the energy *could* go, but in general the objects to not need to deform for the collision to be perfectly inelastic.
Comment: @Jasper Not at all! If somebody doesn't understand why inelastic collisions (i.e. sticking together) don't conserve energy, the title edit doesn't change _anything_. All it does is make the answer easier to see for people who _do_ know mechanics.
Comment: Imagine the two objct being cars. When they collide, they change their outer form (alas!), and that takes up some energy you don't get back. That's where the "missing energy" from the correct momentum-based calculation goes into.
Answer: The other answers are correct in saying that energy is not conserved, but I feel like they are lacking in truly showing why this is the case. So let's assume energy and momentum are both conserved in this process and see that we arrive at a contradiction.
So we have object 1 at rest and object 2 hits it and they stick together. Using momentum conservation:
$$m_2v_2=m_1v+m_2v$$
Using energy conservation (cancelling $1/2$ from each term):
$$m_2v_2^2=m_1v^2+m_2v^2$$
Now for fun tricks. In each of the above equations let's get all terms involving object 2 on the left and all terms involving object 1 on the right and then divide the energy equation by the momentum equation:
$$\frac{m_2(v_2^2-v^2)}{m_2(v_2-v)}=\frac{m_1v^2}{m_1v}$$
Now, $v_2^2-v^2=(v_2-v)(v_2+v)$, therefore (cancelling many things)
$$v_2+v=v$$
or
$$v_2=0$$
Uh oh. We see that before the collision object 2 is at rest. But object 1 was at rest also$^*$. Therefore no collision with these properties could have occurred. Therefore something is wrong with our assumptions of both energy and momentum conservation.
Momentum has to be conserved since there are no external forces on the system. Therefore it must be that energy is not conserved. There is nothing saying energy must be conserved here, but we have now shown that it actually cannot be conserved.

$^*$ In general if we had specified the velocity of $m_1$ by $v_1$ we would have arrived at $v_1=v_2$ using similar methods used above. This just means the objects started out with the same velocity and never actually collide. Therefore, the only way our system can conserve both energy and momentum and have equal "final" velocities is if no collision happened.
Answer: Momentum is conserved if there are no external forces involved. This is the case in your setup, so the final velocity you get from conservation of momentum is right.
If you start with conservation of energy, you'll see that you get a different velocity.
Since physicists strongly believe in conservation of energy, this means that some of the mechanical energy went somewhere. This is a strong hint that you can not assume conservation of mechanical energy at will. If you assume both conservation of momentum and energy, the bodies can't stick together and move as one.
The "sticking" eats up some energy that is lost on the mechanical side.
Comment: *Since physicists strongly believe in conservation of energy...* I don't think the belief in it makes the conclusions true. Conservation of energy isn't like Tinker Bell :)
Answer: The objects are merged, and an inelastic collision is one in which objects stick together after impact: kinetic energy is not conserved. Therefore, you can't assume that kinetic energy is conserved; merging takes a little bit of energy.
If this system is isolated, and no force acted upon neither of the two objects, then, momentum is conserved; hence, you can calculate the final velocity using the momentum's equation.
Answer:
Suppose all the energy gets converted into speed.

Uh oh! That's your error. You can't just suppose that something that doesn't happen, happens.
The collision was inelastic. That means some of the energy gets converted to heat, as the objects merge. This is the difference between your total before and after energy.
Answer: I think that the hypothesis of momentum conservation is flawed since the problem really doesn't state that. Also there's nothing saying that the system is isolated at all.
Hence you calculated what you can (assuming that "energy" in the problem statement refers only to the kinetic energy itself).
If the hypothesis of kinetic energy conversion is correct (I would assume so since it's stated) then your energy-based calculation is correct :) and the missing momentum is due to an external source.
Comment: Momentum is conserved in collisions. Why would you assume external forces? It seems like you are the one making additional assumptions, not the OP.
Comment: The problem isn't poorly formulated. Just before and just after the collision momentum has to be conserved. If there are external forces then you just have to look just before and just after. Momentum will not be lost due to the collision, and it seems like the OP is interested in the collision, not unspecified external forces that aren't involved with the collision.
Comment: @Aaron: I know what is momentum/energy conservation. I'm not making any additional assumptions and just using the conditions stated in the problem. If the problem is badly formulated this is another situation.
Comment: @AaronStevens The problem is badly formulated in the sense that it imposes two assumptions that contradict each other (given that there are no external forces), namely "objects merge into one" and "all the energy gets converted into speed."
Comment: No... The OP is incorrectly assuming that energy is conserved when the objects stick together. The "problem" (or you could say system) is just a perfectly inelastic collision where the objects stick together. Any incorrect assumptions come from the OP, not from the "problem" or system.


Grouped quantity

Question: I have a magento 126.96.36.199 platform and need something to group some quantities.
The site sell products on set and I have two grouped products ProductA (100pcs/set) and ProductB (50pcs/set). Now if a customer want to order 1xProductA (100pcs/set) than I need the quantity for ProductB to be 2xProductB or 2xProductA and the quantity for ProductB should be 4.
Could someone help me or point me to the right direction?
Answer: Use bundled product instead of grouped product, and create it with dynamic pricing like this:

Option A: Type "Checkbox", Required

Selection: ProductA, Default Qty 100

Option B: Type "Checkbox", Required

Selection: ProductB, Default Qty 50

Now the customer will not have any possibility to configure the bundle, he just can add the whole bundle to the cart. With bundle qty 1, they'll get 100xA and 50xB, with bundle qty 2, they'll get 200xA and 100xB and so on.
Answer: Are they two separate skus? Because you could set up something like a configurable inventory item. Where you have 1 product set at description of 50pcs and the other at 100pcs. Then when a customer clicks on the product, they can then select from a drop down menu of which pcs count they want.  See this link http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-a-configurable-product and then set up an attribute for "pcs" count.
Comment: Yes, they are two separate sku. I can't use configurable product because first I must enter a lot of variants because the stock is big and secondly the customers can be careless and they don't read everything. The thing is that they, now are able to order 2xProductA(total 200pcs) and just 1xProductB(total 50pcs) which is not good for our company. The pcs must be equal for both product. I think I need some jquery for auto updating the quantity for the ProductB and for the customer just to be able to enter the quantity for ProductB

Grouped quantity


Is it possible for a planetary system to orbit around something that wasn't a sun?

Question: Say for example that at the center of our solar system you replaced the sun, with something that wasn't a star, lets say that it was electrified and still produced the same amount of heat, would that planetary system be stable. If so that what else could a sun be replaced with, a water planet? a Gas giant? An Ice planet? A planet made of Uranium? what else could the center of a planetary system be replaced with?
Comment: Hello, and welcome to Physics SE.  Look around, and please take the [tour]. For this question, a little clarification of what your _real_ question is would be appreciated.  Can one object orbit another? Yes. If it isn't a "star", would the orbiting object be a planet? Beats me...
Comment: Purely hypothetically the mass of the central body matters
Answer: If we assume all of the rest of the planets are neutral in charge, then only the mass of the sun matters for the Solar system. The gravity between the star and planets and other objects forms the main force that maintains the rotation of smaller objects around the sun and be stable for a long time. No matter what you fill in the sun, the mass of the sun should be far larger than other objects. Otherwise, objects will be rotating around some mass center outside of the sun which may cause collapse under some complicated movements. On the other hand, if the mass of the sun is very large as the current sun, then giant cloud of gas and ice may clash into a denser body because of the gravity. In the end, the sun will be a body with high pressure and high temperature like the usual stars you can talk.
If we assume all the rest of planets can be charged and ionized to orbit a electrified sun mainly due to the electrical force among them, then the planets themselves will have to compensate the repulsing force due to the charges of particles forming the planets. The most likely way to overcome this force is the gravity which is formed by the mass of the planet. We know that gravity is a relatively weak force compared with electrical forces, and it is unlikely to hold the planet balanced with gravity and electrical force -- unless its so densed as a black hole. However, it is possible to replace the sun with a charged black hole which has a large gravity field to maintain a large "solar" system with planets for a relatively long time no matter whether the planets are charged or not.
Answer: orbiting, graviting, means only mass maters.
It could be gaz, diamon, a bag of cockroach, or even a black hole, it would not change gravitational behaviors that orbits are.
( NB: yes, black hole too. Nothing different occurs in gravity as well when a star turn into blackhole. And it was attracting distant matter before exactly as well.)


What happens if you don't pay booking.com cancellation fees?

Question: What happens if you book two hotels through booking.com and reach only one hotel without cancelling the other booking?
Would that hotel charge include cancellation charge of first hotel?
UPDATE
Not sure in case of no show. However if you cancel your booking, booking.com will try to charge you immediately even without CVV.
Comment: Merchants do not need the CVV to process a card payment.  The only consequence is they pay a net higher fee to do so.
Comment: Booking.com is allowed to charge you, as you have commited to booking a room which could not be cancelled.
Comment: Yes but it won't ask for the CVV while deducting the amount. So if one thinks he/she will cancel the cancelling operation once it asks for CVV it may deduct without CVV.
Comment: In fact, Booking.com might charge you actually. This applies if you pay with PayPal, Sofortbanking e.g., as well if you want to pay with a credit card, whilst the property only accepts cash, in case the accommodation accepts this kind of payment. Normally, the charges are done by the property and in any case they are subject to their policies. Regards
Answer: Hotels don't have access to information about your bookings at other hotels and can't charge you for cancelling your stay at the first hotel. Likewise Booking.com itself doesn't charge customers and only passes on credit card information to the hotels.
Therefore it will be up to the first hotel to try and charge your card after you fail to show up. If the stay was booked without a credit card, hotels usually won't bother with trying to charge you the cancellation fee.
Comment: I believe booking.com and similar sites will charge customers directly, at least sometimes. These sites often charge your card themselves and give the hotel a "virtual credit card number" belonging to the company which is used for your reservation. The hotel can't see how much you actually paid and has no control over your reservation without going through the booking site. Expedia [does this routinely](https://frzferoz.wordpress.com/2015/04/01/expedia-virtual-card-did-it-changed-how-travelvacation-industry-worked/). The exact details depend on the booking site, hotel, and cancellation rules.
Comment: @ZachLipton Booking.com never charges cards directly, even in the case of a no-show. Expedia is different, since they ask for pre-payment.
Comment: I made a reservation earlier this week for one night via booking.com and was neither asked for payment _nor_ for payment info.  So perhaps the hotels are offered different types of listings?  Of course I did have to pay on arrival.
Comment: Yes, right, only hotel charges, booking.com does not.
Comment: @WGroleau I've even seen different terms for the same hotel. Pay a higher rate for no prepayment and no cancellation fees, or pay a much lower rate with less favorable terms.
Answer: Most times, cancellations fees are not paid, they are charged. This is why even if you have to pay on check-out, you are asked for a credit card number, although some hotels reservations do not ask for a card, in which case they have no way to charge you.
For most reservations, when you press the Cancel button on Booking.com, any applicable fee will be charged to your card immediately. If instead, you do nothing and not show up, either Booking.com or the hotel will charge you something which could be the value of the entire stay or the first night, again this depends on the hotel policy.
Once the charge is on your credit card, then you will have to pay the balance unless you dispute the transaction with your credit card company. Since your booking was subject to certain rules, there is little chance of them agreeing in your favor.
As per another question on this site, if you did not provide a credit card, it seems that you generally won't be charged but a hotel could send you a bill the the cancellation fee if they were so inclined.


How do I teleport a player to a random position?

Question: I need a random number from -100 to 100 for a command block
/tp @p (random number 1) 200 (random number 2)
Comment: Strongly disagree with this proposed duplication. This is a classic example of [the XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). This question is not really asking how to generate a number, it is asking how to teleport a player to a random location within specified parameters.
Comment: Possible duplicate of [How can I make a random number generator with command blocks in Minecraft?](https://gaming.stackexchange.com/questions/229610/how-can-i-make-a-random-number-generator-with-command-blocks-in-minecraft)
Comment: Within the game? It's not clear from your post.
Comment: I'm trying to get a to command in a command block that goes /tp @p (random) 200 (random). The 2 random numbers need to be different. I've edited the post
Answer: As far as I know, there is no way to directly generate a random number using commands, and there definitely isn't any way to then plug that random number into another command block.
However, the spreadplayers command will do what you're after here. spreadplayers is designed to place groups of, or individual players, in random spots around the map.
The syntax is as follows for Java Edition: /spreadplayers <x> <z> <spreadDistance> <maxRange> <respectTeams> <player>. <x> <z> specifies the center of the map, <spreadDistance> specifies the minimum distance between the targets, <maxRange> specifies the maximum horizontal distance to place players from the center, <respectTeams> specifies whether or not teams should be kept together, and <player> specifies your targets.
In the particular case of sending a single @p to some location between x,z (-100,-100) and (100,100), the command would look like so:
/spreadplayers 0 0 0 100 false @p

Comment: I suspect what you're really after is spreading a bunch of players around the map to random spots, which can be accomplished by subbing in an `@a` to the final command here.
Comment: If this works in 1.12 (which I didn't specify in the question, sorry) I'll mark this as correct
Comment: @RobertLucas It should, it was added in 1.6.1 and I don't see anything to suggest that it has been changed since then for Java Edition, so it should work in 1.12.
Comment: It's for 1 person


What is phenomenal price?

Question: If we ignore the context, what is the meaning of 'phenomenal price?' Positive or negative?
Comment: I always read "phenomenal" as meaning "Perceptible by the senses" in this context, which is to say, I assume it's meaningless.
Comment: Depends on how much you are willing to spend to impress your peers. Context-free, it's positive.
Answer: How can you ignore the context, when you have an intensifier? Depending on the context, phenomenal can be either very positive or very negative.
Most frequently, it is used positively. For example, the tickets are offered at phenomenal prices.
In the following sentence, though, phenomenal means something bad:

It can thus avoid the forced choice of determinism or dualism, accounting for order and novelty without the heavy ontological price of a dualism or the unacceptable phenomenal price of the denial of order and novelty.  (John Protev, Notes on Materialism) [Edit: This sentence was a totally wrong example. See the comment by Janus Bahs Jacquet.]

.

The program was established by the Canadian government to raise cash for the phenomenal expense of the war. / Two further sources influence the historical development of New Zealand masculinity: the Depressions of the 1880s and 190s, and the phenomenal price of the wars: Land Wars of the 1860s, the South African War, both World Wars and the Viet Nam War. / That said, one of the most common criticisms of Sony is the phenomenal price of the Sony Chargers and Sony power cables.

Phenomenal can mean either really low or really high.
So, "I don't agree with the question."
Comment: Your example is a bit stilted. How about this: "The Cézanne was sold at auction for the phenomenal price of $259 million." vs. "The Cézanne was sold at a thrift store for the phenomenal price of $5."
Comment: I disagree with your example here. In Protev's context, 'phenomenal' is not an intensifier (positive or negative) at all, but a simple adjective meaning "capable of being known empirically, esp. through the senses or through immediate experience, perceptible" (OED), juxtaposed with 'ontological'. The price paid ontologically is heavy, and the price paid phenomenally is unacceptable.
Comment: Well, that kind of high happens to be really good for the auctioneer, and not all that terrible for the buyer (he got something he really wanted in return), so there's not much negativity, as in my example. Notwithstanding, all of the examples so far, show just how much the context is an inextricable part of this word's meaning.
Comment: Yes, good point. Phenomenal has more to do with being remarkable or unusual. As you say, context is needed to determine whether it should be interpreted negatively or positively. In the case of the auction, both the buyer and the seller would consider the price remarkable, but it doesn't mean either or both parties had a positive or negative experience. On the other hand, the person who finds out their Cézanne was sold at a thrift store is going to be (or should be) very upset, no doubt about it.
Comment: @JanusBahsJacquet You're right. An astute observation. The sentence is from Google and as soon as I glanced at it I though it was perfect for what I had in mind. I'll add an appropriate example. No sense now in deleting this one.
Answer: To me phenomenal price with no context means the exact same price as I would normally pay or even more but with the connotation that we are supposed to think something is discounted.
Answer: Phenomenal means "extremely impressive or surprising."
Sounds like a phenomenal endorsement to me.
Answer: I'd say that phenomenal is so overused nowadays and the phenomenality of prices is so ridiculously exaggerated that both within and without context it has negative connotation. To me it says "We'd like to emphasize the fact that we have the lowest prices possible. Our vocabulary is poor however, so we will call these prices… phenomenal".

What is phenomenal price?


Setting User Permission to hide products of other user

Question: I have a model where there will be many users. Each user has dashboard access and can add there products.. this all is done, but what I want is one user doesn't see other user products. Right now a user can see all products uploaded by all users. Currently Craft CMS doesn't have permission settings to hide entries of other user as they have for channel entries.. but I need that. Can anyone help me how can I achieve that. Any ideas would be helpful. Thanks in advance
Comment: This question has been rolled back to its original form. Please don't edit a question so dramatically after an answer has already been submitted.
Answer: This sounds like a feature request really.  And/or possible a use case for Craft 3s forthcoming multi-site features.  Although C3 + Commerce for it is a ways off yet (6 to 9 months apparently)
You could perhaps use something like a custom field for the 'owner' of each product, and Zenbu to set up filtered views for each of the editors (just guessing, I've not used Zenbu personally)
https://zenbustudio.com/software/zenbu-craftcms


Why is SIV a thing if MAC-and-encrypt is not the most secure way to go?

Question: The question that I am asking is exactly what I ask in the title.
Answer: Skimming these three papers should give you an idea (which I list roughly in the order I recommend you look at them):

Rogaway, Philip.  2004.  "Nonce-based symmetric encryption."
Namprempre, Chanathip, Phillip Rogaway and Thomas Shrimpton.  2014.  "Reconsidering Generic Composition."
Bellare, Mihir and Chanathip Namprempre.  2000.  "Authenticated Encryption: Relations among notions and analysis of the generic composition paradigm"

To make a long story short, results about generic composition of encryption and authentication are very sensitive to how you define the concept of "encryption."  In a classic textbook definition, encryption schemes are defined in terms of probabilistic algorithms.  As the Rogaway paper puts it:

Ever since Goldwasser and Micali's landmark paper [7], formalizations of encryption schemes have usually made the encryption algorithm probabilistic or
  stateful. In this paper we investigate a different formalization for symmetric encryption: the encryption algorithm is made to be a deterministic function, but
  one of its argument is a user-supplied initialization vector (IV). Effectively, the user and not the encryption algorithm is made responsible for flipping coins or maintaining state.

The Bellare and Namprempre's famous result that encrypt-then-MAC is the only secure composition uses the classic, probabilistic framework for encryption.  But if you start from Rogaway's IV- or nonce-based definitions, as the 2014 Namprempre et al paper does, you get more nuanced results.  Some but not all versions of MAC-and-encrypt—including SIV—turn out to be secure, whereas all versions of encrypt-then-MAC are secure.  As the paper puts it:

One might interpret our results as saying that the conventional wisdom—that Encrypt-then-MAC is the only safe GC method—is wrong, an artifact of early work having admitted sloppy schemes and considered only pE+MAC → pAE conversion. An alternative interpretation is that the conventional wisdom is essentially right, that Encrypt-then-MAC is the only safe GC method, for it works across multiple definitional settings, whereas the story becomes nuanced for other GC schemes.
Nothing in this paper should be understood as suggesting that there is anything wrong with BN. If that paper has been misconstrued, it was not for a lack of clarity. Our definitions and results are complementary.
Comment: How do you understand the question?  I took it to refer to the often-repeated statement that encrypt-then-MAC is the one composition of encryption and authentication, and the fact that SIV violates that seeming "rule," a question I once had myself.  Looking at the title again, it does seem to have a "not" that I missed at first glance, but now that I notice that I just don't understand the question, other than to speculate that perhaps the "not" is extraneous.
Comment: That was a mighty interesting read; I'm however not sure if it directly answers the question. Maybe some kind of final wrap up would be in order.
Comment: OK, we both have different angles on this one it seems. I'll remove the comment.
Comment: Just noticed that I too missed the "not", probably because without it the question makes more sense.
Answer: The main advantage of SIV over modes that came before it is its better resistance to nonce reuse1. While using the same nonce it becomes deterministic (allowing an attacker to see if two messages are equal), but otherwise retains its security – including the security of authentication which in many other systems is lost completely. E.g. AES-GCM authentication allows forgeries after just one nonce reuse.
SIV is not encrypt-then-MAC, but closer to encrypt-and-MAC. However, the potential problems with encrypt-and-MAC do not apply to SIV because it uses a PRF (rather than a weaker MAC) and an encryption system with some further restrictions as well.
1 SIV can also be used without a nonce, but then you only get deterministic encryption.
Comment: @Melab, because the whole plaintext affects the encryption nonce. When used with a nonce input it degrades to still otherwise secure deterministic encryption when you reuse nonces, rather than being completely insecure like most modes. E.g. with CTR known plaintext allows decrypting all messages with the same nonce (up to that length) and with GCM you can make forgeries after seeing just one message pair with the same nonse.
Comment: SIV is obviously only partly resistant against nonce-reuse; you will still get the same ciphertext if you input the same AAD / plaintext. That will keep the message confidential, but it will leak information about the message.
Comment: It's not good or wrong, it just requires additional explanation, as you do in above comment; you could possibly integrate it into he answer instead?
Comment: Why is it resistant to nonce reuse?
Comment: @MaartenBodewes, it is not *immune* to nonce-reuse, but it is resistant. Or is that terminology wrong? Anyway, the more important (IMO) part is that SIV authentication is strong even with reuse, unlike e.g. GCM which fails catastrophically.
Answer: With SIV it is not required to use a nonce at all. That is: the uniqueness that is required to make the deterministic SIV scheme secure must reside in the plaintext or additional authenticated data. From this uniqueness an authentication tag is constructed that doubles as authentication tag (which is required to have similar properties). This makes it different from all indeterministic schemes, including those based on encrypt-then-MAC.
This makes SIV especially useful for key wrapping; a key will always have some kind of uniqueness to it, as it contains a large amount of entropy. So as long as you remember that an adversary can distinguish copies, the algorithm is secure even without IV. That means that the nonce doesn't need to be generated; no additional RNG or counter required. The nonce or counter state doesn't need to be stored either.
If SIV is considered secure then the fact that encrypt-and-MAC is considered not-the-best is of course not a problem anymore. As long as this specific AEAD scheme is secure that isn't an issue. The answer of Luis Casillas dives deeper into the security arguments of SIV-mode.

You can and should of course still use SIV with some kind of explicit nonce if you expect that your plaintext can repeat. Otherwise you will get the same ciphertext and break CPA security.

[somewhat off topic discussion of SIV]
The necessary inclusion of the authentication tag in the ciphertext will still expand the ciphertext: something that is detrimental to the usability of the scheme. The fact that it is placed at the front unfortunately doesn't help either as it doesn't allow for in-place encryption and specifying where the authentication tag resides was a mistake, in my opinion.
Of course, this does come at a price; SIV is a full two-pass AEAD scheme that requires two keys (and sorry, no, just concatenating the keys doesn't hide this fact at all). SIV could do with an update and if anybody is looking for a good paper to write: one that specifies a single or 1/2 pass SIV mode (i.e. deterministic authenticated encryption with associated data) with a single key and separate authentication tag would be nice.
Comment: Isn't a single pass SIV mode impossible, if every bit of the plaintext must be consumed to generate the nonce, which must be computed before the plaintext can be encrypted?


Magento Product Meta Title Not Populating

Question: Maintaining a Magento site built by someone else, noticed the site owner had not populated Meta Title, Description & Keywords on a product level.  The default meta-information for the site populates into every product page.
After successfully populating these attributes for the store view, clearing cache, re-indexing, verifying the attributes are active, etc., the default meta-information for the site is still what populates the product page.
Seems like it would be a configuration issue, but at this point I'd like to rule out the chance that the original developer altered the core functionality somehow. I see where the getTitle() method populates the default meta-information when it can't find something more specific, so that's cool and it's doing so because there is no data for the title when it's rendering the page.
Where would I find the method that creates/populates data for the product object when building a product page?
If I find where that happens, I should be able to test for what is coming out of the database directly.
Or, if by reading this you realize I've missed checking a config option, would love to hear about that, too.
Answer: The product meta titles are set in Mage_Catalog_Block_Product_View in the _prepareLayout() method
See here


Producing closely fitting parts

Question: I would really like to be able to print moving parts that fit well enough to move without excessive friction, but also aren't excessively loose.  Using an Ultimaker 2, what should be my expectations be, and how would I go about produce well fitting parts?
Using a tool like Openscad to generate parametric parts is really useful because it facilitates the creation of geometrically precise parts such as cogs and drive shafts, which also have precise dimensions.  The problem arises when the parts are printed and joined together.
I recently printed some cogs that were supposed to be able to rotate freely around a shaft, which was also printed.  I made the shaft about 0.1 mm smaller than the center hole of the cog expecting it to be able to rotate freely, however I found that I had to bore out the center hole slightly and sand down the shaft.  I then found that the boring was imprecise and the center of rotation was off center.
Comment: Although it is an interesting question it is vague and broad. There are like a dozen of different parameters you should mention. For example what type of motion are you talking about? rotational or linear? what is excessive friction and excessive looseness in your opinion? what material are you using, what is the printing orientation? what are your printing parameters (speed, layer thickness...)? if you really need surface quality then post-processing is unavoidable. you may use acetone smoothing or machining. but as other guys have mentioned try and error is the final solution.
Comment: Most machine shops work with a +-.005" (.010" total) general tolerance on metal and you gave less than half of that for a 3D print.  You will have to experiment with your printer to find what it can do but I don't know of any printer (SLA, FFM, etc) that can hold .004" without some type of post processing on the print.
Answer: There are a lot of factors to 3D printing parts that work and fit together.
A lot of it will be discovered by trial and error, but let's try to put you on the right path.
First your material is what matters the most. Specifically their coefficient of thermal expansion, i.e. how much can the plastic change when heat is applied. PLA's coefficient is low compared to ABS, for example. Which is why the MakerBot can print without a heated bed, but it cannot print ABS with any success.
Here is a list of coefficient of thermal expansions by material.
What you want to do next is to print out a few test items and see for yourself. Below is an example of reality vs. expectation. As you can see the circle shrinks. It will never expand. So you will always make it bigger than you need. It is also good to note in this example below that the block itself is Larger than expected. The best solution is to not expect high tolerances and build a lot of flex into your designs.

Generally you want the hole size larger. If I wanted a 4 mm minimum hole, then I would likely make it 5+ mm.
The best thing you can do is print out a tray and document how different the sizes are. Also, do the same with a print of various peg sizes. Below is an example of such a tray.

Also, you might want to look into other materials such as Nylon and Carbon fiber.
A great source of more tips. Here is a great tutorial, Designing Mechanical Parts - The Whoosh Machine by shapeways, on designing parts.
A RepRap Wiki article on different lubricants in regards to 3D printers. Most people use silicon lube for parts to my knowledge. Again, it depends on your material.

Images taken from this link, The Innovation Station - Tips for Designing 3D Printed Parts.
Answer: I think that you've got the right idea in concept, but benchmarking is typically the best way to prove this out.
You should get in the habit of designing with assembly in mind. This means:

Hole sizes should be larger than intended and/or shafts should be smaller than intended
Scaling does not always solve the issue! Avoid relying on scale tools as it can result in reducing/enlarging features you did not intend to scale
My own experience has shown that a clearance of about 0.005" to 0.010" (~125μm to ~250μm) should be enough. However it may be different for your situation with a different printer, filament, climate, etc.
Also consider material shrinkage from the printing process!
Answer: I can't attest to the empirical data laid out in the first answer, but I've had to deal with a lot of components printed in two parts to be connected via design-incorporated channels. I always found that, as a reference, a box of width and length 0.98" will slide securely, but freely, into a square channel of width and length 1".
Comment: I agree completely and don't dispute that individual trial and error will yield your most reliable result. Different geometries and materials all produce different part-to-part characteristics, I just found that the aforementioned box-to-square-channel connection at the stated tolerances have worked pretty well in past.
Comment: I'll point out I explicitly state they should try themselves as there is no solid answer given the number of factors. Brand to brand of pla will be radically different. Even color to color of the same brand will be different as the pigments change the chemistry. Then we have printers with Fans. Age of materials. The humidity in the air. Ambient temp. There are just too many factors.

Producing closely fitting parts


Salesforce Email Service Debugging

Question: I have defined an email service which unfortunately isn't working. Is there a place I can monitor errors? The class doesn't appear in debug logs.
Answer: The likely answer comes from the comment by @MarcDBehr
Email Services can have several Email Addresses. Each Email Address has a context user (i.e. running user)

You need to enable debug logging for that Context User.  Well-designed email services do not use a specific individual as the Context user, rather, some dedicated headless user that serves as a traceability aid (as records will be created or modified using that context user and hence the audit fields become more useful)
Another possible answer is the email is sent from a domain not on the whitelist Accept Email from From. If you have set up the Email Service rules to Bounce the message rather than Discard, you gain additional insight as the sender will discover the problem.
And another debugging tool you have is the Email Snapshot feature available in Setup.
Answer: If everything is proper then debug log should appear.If debug log is not appearing you can check following points:
1. When you are replying to email, please make sure that replyto email id is same that you have added in replyto field on email addresses of email services.
2.Please make sure that you allowed all email addresses in 'Accept Email From' field of email service.
Comment: Are you monitoring (for debugging) the user that the email process is running as (it may not be running as you)?
Comment: I've already allowed all email addresses. I'm actually testing sending an email to the service from my own personal email. Nothing is showing up in the log
Answer: You can also verify the values being passed by giving an erroneous value to the required field on the object you are doing the operation.
This will trigger a response email when you send the email to the salesforce org from the receiver.
In that email the reason would be highlighted.
OR
You can check the logs in the developer console.

Salesforce Email Service Debugging


Ubuntu update to 14.04

Question: I wanted to update my Ubuntu 13.04 OS to 14.04 Os. I downloaded the 32-bit (.ISO) file for the 14.04. Since, i run both Ubuntu and windows on my laptop, i was wondering if i can just update Ubuntu without losing all my current win and Ubuntu files. Is it possible? or do i need to install it fresh?
if, in fact, update is possible, can anyone tell me how to do it? Also, i have tried to mount the .ISO file using various software, but my software center has gone nuts; it doesn't let me install any software.
Answer: Yes it is definitely possible
You can also do it from installation cd/bootable usb it won't bother your windows installation. You'll just update from 13.04 to 14.04.There will come an option while installation.
Prerequisites

Just run sudo apt-get update and sudo apt-get upgrade from terminal

Now

Run the update-manager application from the Unity Dash or a command line.
In Update Manager, click the Settings... button, and enter your password to start the Software Sources application.
Select the sub menu Updates from the Software Sources application.
Confirm the "Notify me of a new Ubuntu version:" option is set to "For any new version", and change it if otherwise.
Close the Software Sources application and return to Update Manager.
In Update Manager, click the Check button to check for new updates.
If there are any updates to install, use the Install Updates button to install them, and press Check again after that is complete.
A message will appear informing you of the availability of the new release.
Click Upgrade.
Follow the on-screen instructions.

Ubuntu update to 14.04


Would short Achilles tendons keep you from touching your toes?

Question: I am 69 and I do stretching exercises such as touching my toes.  Today I discovered that my nine year old granddaughter, who suffers with short achilles tendons, also can not bend over ... barely at all.  Would the short achilles tendons affect that?  It seems as though her entire body is very stiff.
Comment: Barbara, how do you know your (and your granddaughter's) achilles are short, and that it's not something like a tight soleus or calf muscle?
Answer: Generally the hamstrings are the biggest restriction in bending to touch your toes, but essentially anything on the back side of the body can restrict the motion of bending forward. A short achilles tendon, tight gastroc/soleus muscles, tight back extensors etc. can all add to limitation in forward bend.
Stretching:
To stretch the gastroc and soleus muscles you need two different stretches - one with the knee bent, and one with the knee straight.  The hamstrings cross both the knee joint and the hip joint so these also require two different stretches to affect the lower and the upper parts of the hamstrings.
Sitting:
Many kids these days sit a lot more than we used.  Tight hamstrings and hip flexors are common with prolonged sitting.  Postural exercises can help to balance out the front and back sides of the body.  Yoga, swimming, dance are a few examples of activities that may help to loosen up the body in general.  An exercise ball in the TV room can help increase activity and reduce static sitting.
Hydration:
Proper hydration is also important to keeping a flexible body.  It is not just the muscles and joints that need to have their full range.  The fascia (basically all the tissue that connects everything) needs to glide.  Hydration helps.
These are general things to consider.  However, if you think that something is not normal as always check with the doctor.
Comment: A short Achilles won't impede anything. It remains in a static position. The rest of it is absolutely spot on, though.
Comment: @JohnP, I was thinking in terms of Tom Myers' Anatomy Trains, where limitation of any of the superficial back line (plantar fascia, achilles, hams, erector spinae) can limit forward flexion.
Comment: Mmm...yeah, I never really subscribed to that for the connective tissue, as connective tissue doesn't really stretch at the best of times. Valid point for the muscle structures involved, but that's just a difference in interpretation.
Comment: @JohnP, yes I now tend to think in terms of the full fascial network mobility and the concept of tensegrity.


Is there a reason behind why Archimedes principle works?

Question: I think most of us are quite aware of Archimedes principle, but is there a reason to why it occurs?
Is it just an observed property? Why is the upthrust equal to the weight of the liquid?
Comment: Does this answer your question? [What is the basic reason behind buoyancy?](https://physics.stackexchange.com/q/150962/)
Answer: You can understand Archimedes' principle in a simple intuitive way,
like Archimedes himself did it.
(Search the internet for "archimedes eureka".)
First, the upthrust is independent of the material of the submerged body.
Therefore a submarine of iron feels the same upthrust force
like a body of water with the same shape.
Therefore, now let's consider a body of water.
The body of water doesn't move up or down.
So it is obviously in equilibrium.
That means the forces (the weight force pointing down,
and the upthrust force pointing up) must exactly cancel.
Answer: Imagine you submerse a closed container having zero mass in water. If you fill the container entirely with water it should be neutrally buoyant: it shouldn't rise or sink because if you removed the container the water also shouldn't rise or sink. Gravity pulls on the water inside the container with a force $F=\rho_w g V$ where $V$ is the volume and $\rho_w$ the density of the water. This means there has to be upwards buoyant force that cancels this effect. Now you can change the content of the container; you can either suck all the water out leaving a vacuum or replace the water with lead. The buoyant force shouldn't change because it works on the outside of the container and it doesn't know about what's inside. So since $\rho_wV$ is just the weight of the water displaced we see that Archimedes principle is true.
This might feel a bit like a magic trick so let's expand a bit on why this is true. Every point inside a liquid exerts a pressure in every direction. A pressure exerts a force but only over a tiny area. To calculate the force on a submersed object you have calculate the pressure for every point on the surface and them sum all the tiny forces (integrate) to get the total force. In liquids that are static the pressure is given by $p=p_s+\rho g d$ where $p_s$ is the pressure at the surface and $d$ the depth from the surface. The pressure has to increase as you go deeper because each parcel of fluid has to hold up the weight of the column above it. If you draw the pressure for a submersed square you get something like this:

Again, to get the net force you have to sum over all the forces on the surface. Most inward pointing forces cancel but some of the vertically pointing forces don't cancel because the pressure gets larger as you get deeper. You can prove this sum (integral) always gives $\rho_w gV$ but it requires a bit of calculus.
Answer: Buoyant force occurs due to the difference in pressure in the liquid.
Consider a cylinder of height h in water

The pressure along its curved side will cancel out because at each height equal pressure is applied from all directions (Pascal's Law).
Therefore only pressure on the flat surfaces contribute to the net force on it
$$F = F_2 - F_1$$
$$F = P_2A - P_1A$$
$$F = (\rho gh_2 - \rho gh_1)A$$
$$F = \rho gA(h_2 - h_1)$$
$$(h_2 - h_1 = h)$$
$$F = \rho gAh$$
$$(V = Ah)$$
$$F = \rho Vg$$ = weight of displaced fluid
Therefore the upward force(buoyant force) on a object in a liquid is equal to the weight of the fluid displaced by it.
Answer: If a fully or partially submerged object is removed, the volume of fluid which it displaced will return. Then the distributed pressure forces, which provided the buoyant force on the object, must now support the weight of the returned fluid.


An electric motor that does not reverse current flow

Question: If an electric motor did not reverse the direction of its current every half-turn, what would be observed in the armature? Would it spin from left to right clockwise, then spin back anti-clockwise from right to left? Or would it spin left to right clockwise and halt once it's turned 90º, halfway between the two magnetic poles (I saw this somewhere and it puzzled me)?
Comment: If there is no current change, it has no flux change, therefore it becomes an electromagnet which aligns itself.
You can look into homopolar motors if you like to know about concepts with unidirectional (DC) current flow. In these motors the aligning movement creates different conditions, these create a new aligned position, and so on.
Answer: If I guess at the type of motor involved, if the current is not reversed, the armature will spin to the point of equilibrium with the stationary magnets and it will stop.   I may due to momentum slightly overshoot the equilibrium point, but it will settle down to stationary.


Convert usb scale output to serial

Question: I would like to convert the usb output of a scale to a serial format so I can read it through a com port.
I saw this tutorial from adafruit Adafruit serial scale but that scale is not available anymore and scales with serial output tend to be expensive.
I would like to take DYMO 10 LB and attach the usb port on it to a USB to serial and then attach this serial output to a serial to usb converter. Then I will have a COM port and I can read the data through a serial monitor.
The question is will I be able to read the data coming out of this and interpret it as a weight?
And if not, how hard will it be to write my own driver to read data coming from the scale?
Comment: Have you considered probing it in case there already is a UART signal available?
Comment: I haven't purchased it yet. What do you mean by probing it?
Comment: You want to convert USB to serial to USB? Eh? You can't just convert USB to serial, you need a USB host with the correct drivers for the device type.
Answer: It is not a straight forward usb-cdc/virtual com port. The Scale uses a USB-HID slave/peripheral controller. This needs to be read using USB-HID. It is completely different from USB-CDC, a.k.a. a usb virtual com port. It does not use a USB to RS232/TTL adapter.
See http://steventsnyder.com/reading-a-dymo-usb-scale-using-python/ and https://stackoverflow.com/questions/1275974/program-for-hid-usb-scale and https://www.youtube.com/watch?v=srvtDNYR05U
Also, your idea of using a USB to Serial cable will not work that way. A USB to RS232 cable is not bi-directional. It can not be used in reverse. It will not connect to a USB peripheral/slave. It has to be connected to a USB host/master, like a computer.
Comment: This is a very good answer; concise, helpful, reasonably complete, links to useful information (which was new to me) and includes a link to an existing near-duplicate ee.se answer! Bravo, sir. Did you mean to say  "It **does not use** a USB to RS232/TTL adapter."? That sentence *seems* unnecessary, or am I missing the point?
Comment: @gbulmer some devices that were originally designed for serial, were upgraded to usb, by using a usb to serial adapter inside. The manufacturer could change little in manufacturing or software, but still get the usb "feature". So sometimes all you need to do to get serial access is to connect between the adapter and the serial signal.
Comment: Ah, ha! I get it.
Answer: To communicate with my Dymo scale I have used the software BillRedirect from BillProduction company ... This software communicate directly with my Dymmo scale USB and redirect the weight to my software... I use the Wedge Keyboard option but according the documentation this software can create a virtual com port that any software can use.

Convert usb scale output to serial


Error on findViewById after upgrading to compile sdk version

Question: After upgrading to compile SDK version 26, all findViewById showing error:

not enough information to infer parameter T in fun
  findViewById(id: Int): T!
Answer: This is because as of Android O, we don't need to cast it. There are a few options. Replace:
val textInput = findViewById(R.id.edit_text) as TextInputLayout

With either:
val textInput:TextInputLayout = findViewById(R.id.edit_text)

Or:
val textInput = findViewById<TextInputLayout>(R.id.edit_text)

If you want to know what happened under the covers, as of O underlying method changed to
public <T extends View> T findViewById(@IdRes int id) {
    return this.getDelegate().findViewById(id);
}

Answer: In pure Java you will have for example
TextView textView = findViewById(R.id.textview1);

In Kotlin you can go with this
val textView = findViewById<TextView>(R.id.textview1)

Answer: Because you are confusing java with kotlin , with android studio 3.0 you can use kotlin instead of java syntax or you can use both as mentioned on Android official blog
Also read about Get Started with Kotlin on Android
Update : The function signature
View findViewById(int id)
has been upgraded to <T extends View>T findViewById(int id) mean it's applying the inference mechanism for return type where T extends View mean the View or it's sub-types
Note : So as mentioned initially ,Applying cast still won't generate any error but just a lint warning for using unnecessary cast but could be a bug in kotlin type inference but not in java.
Comment: I should clarify, this question was for Kotlin project. With Android O, underlying findViewById method changed so we no longer have to cast it. In java, we no longer need to cast.
Answer: It's Kotlin some type expected error fix it
val result = findViewById <TextView>(R.id.textView_result) as TextView
val button_sum = findViewById<Button>(R.id.button_sum) as Button
val editText_i1 = findViewById<EditText>(R.id.editText_i1) as EditText

Comment: Strange "" this gives error and "as TextView" solves the error. Naughty Android


Doppler Cone: What exactly is it?

Question: I'm trying to understand Synthetic Aperture Radar (SAR). It appears that it makes use of what's called a "Doppler cone". I understand Doppler frequency shifts of light, but I'm not sure what the cone is. It seems like it's some kind of locus, but I can't exactly tell for what. Does anyone have the answer?
Comment: Welcome Adil to Physics SE. A google search on "Doppler cone" provides an impressive list of results and nice pictures, are none of them satisfying?
Comment: Tried that. They show how it's used, not what it is. So yes, they're unsatisfying.
Comment: From [page 9 in this paper](http://ei.rub.de/media/ei/lehrmaterialien/39/175fd48270158f2574a62b7184ba2a9217024303/Lecture_Ender_03_Airborne.pdf): The Doppler cone has its axis in flight direction and its corner at the antennas phase center, the cone angle $\alpha$ is related to the radial velocity by $v_r = -V \cos \alpha$ (see definitions page 4). I'm afraid I won't be able to help you more.
Comment: @Adil SAR radar is not that hard but you have to visualize it and analyze it to undestand first the basics (which starts with the cross range measurement done by synthesizing a measurement along the flight direction, using google Doppler shift as function of distance ahead or behind). Get a good book on radar and it'll have a SAR section. The Doppler cone are the iOS-Doppler curves. Too hat to explain in words only, and probably worse in a figures only presentation
Answer: When given the value of Doppler-shift, the physical directions that can potentially cause that Doppler-shift can be geometrically illustrated as a circular cone. In summary, the surface of Doppler-Cone represents the points in space which correspond to a given Doppler-shift.

Doppler Cone: What exactly is it?


have wanted to do/ have been wanting to do

Question: Could anyone tell me the difference between "have wanted to do" and "have been wanting to do"?
I often say "I've been wanting to go there!" when someone invite me to the restaurant that I got to know before and has been thinking I want to go since then.
But one of my friends said "I've wanted to go there." in the same situation today.
Which is correct/common usage?
Comment: *Wanted to do* is the clear winner for *common usage* on [Google N-Grams](https://books.google.com/ngrams/graph?content=wanting+to+do%2Cwanted+to+do&year_start=1800&year_end=2000&corpus=15&smoothing=3&share=&direct_url=t1%3B%2Cwanting%20to%20do%3B%2Cc0%3B.t1%3B%2Cwanted%20to%20do%3B%2Cc0)
Comment: But both are used, and have the same meaning.
Answer: In standard English, the word, "want" is a stative verb, according to the book, ABC of Common Grammatical Errors written by Nigel Turton. And in the Perfect English Grammar website at https://www.perfect-english-grammar.com/stative-verbs.html, it states, "Some English verbs, which we call state, non-continuous or stative verbs, aren't used in continuous tenses (like the present continuous, or the future continuous). These verbs often describe states that last for some time." Thus, "I have wanted" is the correct form, and "I have been wanting" sounds ungrammatical. Also, we don't say, "I have been knowing you for a long time", but we say, " I have known you for a long time."
Answer: It is not about what is common per se but what is correct.
The difference between I have been wanting to go there and I have wanted to go there is that the continuous form of the present perfect focuses on a process, something that has been happening over a recent period of time, while the simple form focuses on the end result of something that happened.
This is better understood with an example.

I have been wanting/taking too much alcohol lately. This means that in recent times and still now I drink or want too much alcohol everytime I get an opportunity.
I have taken too much alcohol. Here, the action is finished.

Present tense in the continuous form, focuses our attention on a series of events that began in the past, continues into the present, and may extend into the future. It is this continuing series of events which is important.
Present tense in the simple form, focuses our attention on the current situation or result: that the drinking and alcohol are both finished.
Read this to understand better the usage of present perfect simple and present perfect continuous.
Comment: No; with 'want', 'I've wanted to ...' is used, like 'I've been wanting to ...', to show a (durative) state that still obtains. They're synonymous. The usual rule for tenses fails.
Comment: Thanks. So, in the case I am invited to the restaurant and haven't actually go there yet at that moment, it's correct to say "I've been wanting to go there." Then, when I arrive the restaurant, I should say "I've wanted to come here!" Right?
Comment: @user168204 Exactly. You have that right.
Answer: Both verb forms are correct. "Want" is one of the verbs that can be used in the present perfect simple or continuous, and the meaning is the same.


Expansion Tank on Water Heater horizontal installed

Question: When I check the pressure on my horizontally installed expansion tank, I get a little water coming out as I depress the pressure gauge on the valve. The valve is on the lower side of the tank. Is that normal? I have a Watts PLT-12 expansion tank.
Comment: If the valve is in the water section, it should be normal.  Most newer tanks usually have a separate air chamber/bladder now and should not have water there.
Answer: You need a new expansion tank - regardless of the install direction, water coming out the air valve is a sign that the internal membrane, diaphragm or bladder has failed.
Some tanks claim to care about install direction, some claim to be fine in any direction - get one that is either specified for the direction yours is, or any direction, or re-plumb to suit the direction of the one you get. Yours appears to be "any direction," as the instructions show vertical up, vertical down, and horizontal as options.
Answer: A typical water expansion tank has a rubber bladder inside to keep the air separate from the water. Such a tank will have a ring (protrusion or uneven line) around the middle of the tank where the bladder is attached on the inside. These tanks can be installed in any direction.
In the olden days, an expansion tank was just an empty tank and contained no bladder. The water remained down low, the air remained on top. The water entered and exited the bottom of the tank. Such tanks needed drained yearly because the air would enter the water and eventually the water would fill the tank. Emptying the tank and letting air back in fixed the problem.
Expansion tanks with bladders are much smaller than tanks without. So much so that it is cheaper to purchase a tank with a bladder and expansion tanks without bladders don't exist any more unless in a heating system where the water runs out of oxygen to create rust.
I looked up the Watts PLT-12 expansion tank. In certainty, the bladder in your expansion tank is busted and you need a new one. Water does not smash. The purpose of the expansion tank is the smashed air creates a constant pressure on the water. It also keeps your well pump from short cycling (on/off all the time) every time you use water which will shorten the life of your well pump.


Celery: dynamic queues at object level

Question: I'm writing a django app to make polls which uses celery to put under control the voting system. Right now, I have two queues, default and polls, the first one with concurrency set to 8 and the second one set to 1.
$ celery multi start -A myproject.celery default polls -Q:default default -Q:polls polls -c:default 8 -c:polls 1

Celery routes:
CELERY_ROUTES = {
    'polls.tasks.option_add_vote': {
        'queue': 'polls',
    },
    'polls.tasks.option_subtract_vote': {
        'queue': 'polls',
    }
}

Task:
@app.task
def option_add_vote(pk):
    """
        Updates given option id and its poll increasing vote number by 1.
    """

    option = Option.objects.get(pk=pk)

    try:
        with transaction.atomic():

            option.vote_quantity += 1
            option.save()
            option.poll.total_votes += 1
            option.poll.save()

    except IntegrityError as exc:
        raise self.retry(exc=exc)

The option_add_vote method (task) updates the poll-object vote-number value adding 1 to the previous value. So, to avoid concurrency problems, I set the poll queue concurrency to 1. This allow the system to handle thousand of vote requests to be completed successfully.
The problem will be, as I can imagine, a bottle-neck when the system grows up.
So, I was thinking about some kind of dynamic queues where all vote requests to any options of a certain poll where routered to a custom queue. I think this will make the system more reliable and fast.
What do you think? How can I make it?
EDIT1:
I got a new idea thanks to Paul and Plahcinski. I'm storing the votes as objects in their own model (a user-options relationship). When someone votes an option it creates an object from this model, allowing me to count how many votes an option has. This free the system from the voting-concurrency problem, so it could be executed in parallel.
I'm thinking about using CELERYBEAT_SCHEDULE to cron a task that updates poll options based on the result of Vote.objects.get(pk=pk).count(). Maybe I could execute it every hour or do partial updates for those options that are getting new votes...
But, how do I give to the clients updated options in real time?
As Plahcinski says, I can have a cached value for my options in Redis (or any other mem-cached system?) and use it to temporally store this values, giving to any new request the cached value.
How can I mix this with my standar values in django models? Anyone could give me some code references or hints?
Am I in the good way or did I make mistakes?
Answer: What about just having a simple model that stores vote -1/+1 integers  then a celery task that reconciles those with the FK object for atomic transactions and updates?
Answer: What I would do is remove your incrementation for the database and move to redis and use the database model as your cached value. Have a celery beat that updates recently incremented redis keys to your database
http://redis.io/commands/INCR

Celery: dynamic queues at object level


Manual update to marshmallow possible for rooted phone

Question: Can an unlocked phone such as Moto be updated to Marshmellow upon release, or are we stuck waiting for Motorola or the carrier?
Answer: It depends if the manufacturer makes a version of the ROM for the device or not - if they do, then you'll probably be able to get your hands on a stock ROM and flash it onto your device. Some custom ROM developers may create custom ROMs which are based on marshmallow too, which would allow users of that device to experience marshmallow, especially if it won't be/isn't yet available for that specific device.