Can nothing/nothingness really be?

Question: I've been thinking recently about the concept of ''nothing''.It doesn't make any sense to me because there will always BE something, even if you take an ''empty'' space in the air, you will still have something in that space. It just confuses me because the thought of nothing is very scary and it cannot be.
Comment: Nothing and zero are not the same thing. Nothing is the absence of anything, the opposite of existence. Zero is a number, the absence of magnitude.
Comment: Welcome to SE Philosophy! Please be aware that questions are subject to editing and closure, and that reflects the site's policies on acceptable questions and NOT a personal attack. [What to avoid in questions](http://philosophy.stackexchange.com/help/dont-ask). Questions, including those that are closed, can be edited to bring them within guidelines. [Keeping questions on-topic](https://philosophy.stackexchange.com/help/on-topic). Additional clarification at [the meta site](https://philosophy.meta.stackexchange.com/).
Comment: The thought of nothing needn't be scary. You sound like you're interested in [ontology](https://en.wikipedia.org/wiki/Ontology). A good place to start is reading about [Meinong](https://en.wikipedia.org/wiki/Alexius_Meinong).
Comment: I would agree with you and how you are looking at the idea of nothing. Most people use the word "nothing" in a colloquial sense of the word, without really thinking about whether or not "nothing" exists...I asked in the philosophystackexchange if zero (nothing) exists, and a good reply I got was " in empirical measurements you get zero when you subtract one measurement from another. "
Comment: Nothing is not just empty space, it is also the absence of space and time for anything to exist in (in standard cosmology it is the state causally preceding the Big Bang). It is the absence of being, even of abstract being. To ask whether "Nothing" exists is like asking whether black is white or whether bad is good.
Comment: "nothing" is a slippery word and "to be" also... If we equate *being* with physical existence: no way. If instead we use being to refer to "objects" in general, i.e. to whatever  thinkable, we have to face with the possibility (unique of human mind ?) to "conceive" concepts quite strange: God, unicorns, square circles, etc. The simple fact that we can conceive a concept does not mean that that concept is "instantiated" into some existing object. "Nothingness" seems a concept of this sort; the issue is: how we can "speak of" something of which we have no experience at all ?
Comment: Does this answer your question? [What is nothing?](https://philosophy.stackexchange.com/questions/23400/what-is-nothing)
Answer: Theoretically, practically and above these (I mean, in all aspects) your consciousness must be there to know about nothing/nothingness (to know even about that nothingness that makes you scary). Nothing/nothingness is meaningless/nonsense unless you give it a greater meaning; especially while perceiving this material world.
Will you be able to call it nothingness, if you 'see' nothing other than your consciousness everywhere? If you are saying 'Yes', that means you didn't consider 'that' (THIS+THAT) consciousness. I mean, the consciousness that doesn't even allow you to say this or that.
See: https://en.wikipedia.org/wiki/Nothing
"There is no [real] existence for what is non-existent."
https://en.wikipedia.org/wiki/Nothing_comes_from_nothing
Answer: A couple of non-elucidating quotes:

Starlight asked Non-entity, saying, 'Master, do you exist? or do you
  not exist?' He got no answer to his question, however, and looked
  stedfastly to the appearance of the other, which was that of a deep
  void. All day long he looked to it, but could see nothing; he listened
  for it, but could hear nothing; he clutched at it, but got hold of
  nothing. Starlight then said, 'Perfect! Who can attain to this? I can
  (conceive the ideas of) existence and non-existence, but I cannot
  (conceive the ideas of) non-existing non-existence, and still there be
  a non-existing existence. How is it possible to reach to this?'

Chuang Tzu (4th century BC)

"Beings"--this term names not only the actual (and certainly not if
  this is taken as the present at hand and the latter merely as the
  object of knowledge), not only the actual of any sort, but at the same
  time the possible, the necessary, and the accidental, everything that
  stands in beyng* in any way whatsoever, even including negativity and
  nothingness. ... "Beyng" does not simply mean the actuality of the
  actual, and not simply the possibility of the possible, and in general
  not simply being [Sien] understood on the basis of particular
  beings; instead, it means beyng out of its original essential
  occurrence in the full fissure.  Nor is "essential occurrence" limited
  to "presence."

Heidegger, Contributions to Philosophy, pp 59-60
* Spelt 'beyng' to signify use of archaic Seyn in the original German.
Suffice it to say the debate is ongoing, but it revolves around what you mean by "BE".  The meaning cannot be presumed or pre-judged.  Because it seems obvious it is often taken for granted.
"Can nothing/nothingness really be?  ... there will always BE something"
Answer: A way to view it:
Is there a fundamental entity of some sort?
E.g. your brains (solipsism)?
If this fundamental entity disappears, then do the things around it continue existing?
Therefore, is sensory input relative to this fundamental entity? Then what does (fundamental, ideal) nothingness relate to? Disappearance of fundamental entity? But can the outside of it still exist?
=> there exists different sorts of nothingness:

fundamental (your brains exist or don't exist)
conceptual (when we
say that a thing does not exist, e.g. an empty set is a set, which
does not have any members)

There may not exist other forms, because e.g.:

physical-conceptual nothingness, e.g. a banana disappeared, since I ate it. No, in terms of physics it didn't disappear, but it changed to a different form.

Does there exist physical nothingness, do there exist more forms than fundamental and conceptual?
Answer: According to my understanding, all mental concepts are grounded in or refer to some phenomena that exists and can be perceived with the five senses. Either physical phenomena, perceived through the five gross senses (ears, smell, touch, taste, and sight); emotions that are felt with the heart; cognition that is perceived in the brain... There are 7 major energy centers or chakras in human being. Therefore, non-being or nothingness is also non-conceptual. I have heard this from one Buddhist master.
I was used to or conditioned to think in term of concepts. Supposedly, this experience of nothingness is non-conceptual or cannot be conceived by the mind. It cannot be thought about; you cannot wrap your mind around nothingness. It must be that the mind is always concerned about or limited to the matters of being. Mind cannot exist in nothingness. I think this is why nothingness sounds very scary to the mind.
Answer: When I try to imagine 'nothing', I try to imagine that there is no matter, no space, no time, no colour, no one to describe that, no one to observe that, it has never existed and never will. The best I can get to is a black void, and I try to make that black void shrink and disappear but I fail each time. It's hard for me to imagine nothing.
Yes, I agree that it's a scary thing when you think about it, because we are biological creatures and we eager to exist. Our instincts scream in fear when we try to imagine ultimate non-existence, because we are built that way by our genes.
There is an interesting discussion by famous scientists and philosophers about the existence of 'nothing' on Isaac Asimov's memorial panel: https://www.youtube.com/watch?v=1OLz6uUuMp8
Well, to answer your question "Can nothing/nothingness really be?", I think no. Because 'something' and 'nothing' cannot coexist. And we know we are here. There should have been either total 'nothingness' or total 'somethingness' (and space-time is 'somethingness'). Otherwise 'nothing' will always be filled with that 'something'. Just like you inflate a balloon with air and if you release its neck, the air comes out because of the differences in pressure. 'Pressure' in 'something' is always greater than that of in 'nothing', that's why 'nothing' will always be filled with 'something'. That is my speculation.
Our universe is expanding, space-time itself is expending, and there is nothing to stop it from 'outside'. I think that is our best guess we can make about 'nothing', which is outside our space-time and which our space-time (universe) is expanding 'into'. Physicists would argue that it doesn't exist, but that's exactly the 'nothing' we are talking about, right? That doesn't exist.

Can nothing/nothingness really be?


Help with same note next to each other but different values?

Question: For the Treble Clef: Is The "D" played only once and at which value? What is the purpose of this notation?
Answer: Such notation shows several voices that you try bringing across with your play in the best manner even if you happen to be short of keys.  In this case, the upper voice in the treble clef shadows the melody line of the singer (in the manner of a prompter).  If the singer is sure of what he's doing (and there is a singer in the first place), you'll just leave off the upper line altogether.  For a-cappella or when helping the singer out, you'll strike the notes of the upper line so that they stand out (or are more subtle) and then should fit the strength of the first note strike into the line even if you are then not going to release the note for a while.
Comment: Thank you for the explanation, I understand it now!


Is there any difference between "monthly average" and "average per month"?

Question: I have trouble understanding if I should use "monthly average" or "average per month" when asking someone to calculate monthly average of a variable, e.g. heating expenses. Is there any difference, if this payment happens every month or quarterly, and I want to know average per month?
Answer: Average per month" or ("average monthly") and "monthly average" (or "monthly mean") have different meanings.
Rather than speak about the "Average per month" it would be clearer to use "average cost per month". It can be used and calculated as follows:

For payments that are made every month  - add up all the money spent on electricity during  12 months then divide by 12 to get the average per month (http://www.ehow.com/how_6391683_calculate-average-monthly-return.html)
For payments that are made at intervals greater than monthly divide by the number of months in the interval (eg. for electricity bills that come every quarter, divide the amount paid last quarter by 3 to get the Average per month.)
For amounts that are calculated more frequently than each month where you want to know the average you spend per month (eg Perhaps your phone bill lists your charges for each day, then to find the average per month you would add up, say, the 365 daily charges for a calendar year than divide by 12 to find the average per month.)

Monthly average (or monthly mean) would be used for something that is recorded more frequently than once per month when you want to know the average value of that quantity during a month. (http://www.answers.com/Q/How_do_you_calculate_monthly_average_balance)    For example:

If your phone bill lists your charges for each day you would find the monthly average of your daily phone charges by adding up the daily charges for the days of, say, July and then divide by 31 ( as there are 31 days in July)

Unfortunately "monthly average" is not always used correctly (http://stats.oecd.org/glossary/detail.asp?ID=3722) It is best to state explicitly what quantity is to be averaged, as in the above example ("monthly average of your daily phone charges") so that your meaning is clear.
Comment: I won't say whether I agree or disagree with these statements, but you do need to back them up by citing some external authorities on the matter, or at least cote unambiguous examples of people using the phrases this way.
Comment: @DanBron I disagree, these are mathematical concepts.  As someone who taught mathematics for several years, at higher secondary level where "word questions" are very important, I know what the terms mean. Mathematical language is not well understood by many people. People may mistakenly use "monthly average" when they actually want the 'average per month' but that doesn't change the meaning of those terms, just as people writing about "stationery cars"  does not change the meaning of "stationery" or "stationary".
Comment: Thanks Joanne.  Your answer is definitely improved, but I think what's lacking is not confirmation of the mathematics, but confirmation of the interpretations you've given to these phrases (and validation that the two meanings couldn't, for example, be switched).
Comment: JoAnne, that's all well and good; just find some reliable mathematical sources which support the interpretations you are promoting.
Comment: @DanBron I have noted your comment, however I have edited my answer since you made it and believe it no longer applies. What is needed now are references to examples that confirm the mathematics of the examples I have given.  These are not easy to find but I will keep looking.
Answer: For my electricity or gas bill, I would say:
My electricity bill is about $250 per month, on (the) average.
On (the) average, I spend $250 per month on gas heating.

"monthly average" is better used for "exchange rates", "temperatures", "rain and snowfall", prices, etc.

The monthly average price of gas to industrial users has ranged from...Natural Gas Monthly

The monthly average temperature for New York City is about 40ºF in January. New York City Weather
Comment: "rain and snowfall" are tricky ones.  In areas of high rainfall the "monthly average of the daily rainfall" might be quoted, but in areas with low rainfall the "average rainfall per month" might be quoted.
Answer: Suggestions to Authors of the Reports of the United States Geological Survey, Fifth Edition, 1958, page 44, says, "The terms "daily mean" and "mean daily" should not be used indiscriminately, nor should "monthly mean" and "mean monthly," "annual mean" and "mean annual," etc.  The daily mean discharge for any day is defined as the mean discharge for that one day; the mean daily discharge for any one day, October 10, for instance, is the arithmetic mean of the discharge on all October 10's of record, or during a specific period of years.  Likewise, the monthly mean discharge for October 1951 is simply the arithmetic mean of the 31 individual daily mean discharges during that month, whereas the mean monthly discharge for October is the arithmetic mean of all October means of record or during a specific period of years."


CLIP Paper or CLAP Paper (I dont understand the loss function) - Can you help?

Question:
Can somebody help me understand this Contrastive Learning pretraining paper? This explanation comes from https://arxiv.org/pdf/2206.04769.pdf  (page 2).
I understand that they apply an audio encoder to the signal and a text encoder to the text (equation 1) then they map both encoder into the same size through a linear layer (equation two) and after since both  learned linear projections have the same dimension, you can now compute the dot product or  cosine similarity just as they are doing in equation (3) with a temperature factor "Tau".
My question is here: So far C (equation 3)  is an NxN similarity matrix between the audio and text representation. I guess this matrix is symmetric right? In equation (4) they compute the average of the "audio loss" and the "text loss" and they say "l_k = 1/N  sum ( log (diag (softmax C) , but I 'm seeing that C is the same for Loss_text and Loss_audio ; why are they computing them twice? Are they the same? I've heard that in contrastive pretraining your loss should put every similar elements in a close space as well as dissimilar spaces far from each other, if this is considering only the diagonal matrix how is this actually happening?
Well there are a lot of questions but if you can help with at least one of them that's a huge advance for me.
Answer: Start with a batch of (audio, text) pairs denoted $( X_a, X_t )$.
The text data is passed through a text encoder $ f_t $ to produce a text embedding $ \hat{X}_t = f_t(X_t) $.
The audio data is passed through an audio encoder $ f_a $ to produce an audio embedding $ \hat{X}_a = f_a(X_a) $.
The embeddings $ (\hat{X}_t, \hat{X}_a) $ are different dimensions, so we pass each of them through a linear transformation to project them to the same dimensionality. This gives $ E_t = L_t(\hat{X}_t) $ and $ E_a = L_a(\hat{X}_a) $. The paper forgets the hat notation in equation 2.
Then we do a pair-wise comparison of all elements in $ E_a $ against all elements in $ E_t $ via $ C = \tau * (E_t • E_a^\top)  $
$ C $ is an $ N \times N $ matrix ($N$ being the batch size) where the rows represent text items and columns represent audio items.
We then define our loss function $ \ell_k = \dfrac{1}{N} \sum_{i=0}^{N} log(diag(softmax(C))$ and compute our loss $\mathcal{L} = 0.5 * (\ell_{text}(C) + \ell_{audio}(C))$
Now do your question - how is $\ell_{text}(C)$ different from $\ell_{audio}(C)$, and are we doing the same computation twice?
The answer is no because we are computing the softmax along different dimensions. Note the description along text and audio axis respectively.
When we compute $\ell_{text}(C)$, we compute the softmax along the rows of $C$, while $\ell_{audio}(C)$ computes the softmax along the columns of $C$.
Now to your next question about only considering the diagonal elements.
All the off-diagonal elements contribute to the softmax calculation. The loss basically says "make the softmax term along the main diagonal really big". To do this, the model has to increase the similarity of items on the diagonal (bringing the same items closer together), but also decrease the similarity of items off the diagonal (moving different items farther apart). The softmax along a row/column of $C$ accomplishes the contrastive task of maximizing/minimizing similarity between paired/unpaired items.
Comment: Nice explanation! My biggest error was to think that for some reason C matrix should be a symmetric matrix . I guess now I'm getting everything. Thanks a lot


Data Cleaning Techniques - What to drop?

Question: I have been struggling with this problem for a few weeks but it seems to be out of my league. I have a dataset of product sales over the course of 55 weeks. It contains information on the store ID, and the product ID. However, some of the data is missing. Some store IDs do not have continuous data for the 55 weeks, and some item IDs do not have continuous data. Also, combinations of store IDs and item IDs have missing data points. What is the most efficient way to decide what to drop and what to keep for the best results in my model? If the product I am forecasting is continuous that is a good start, but I am not sure what the best combination of stores and items to drop is.
Comment: various approaches, eg 1) remove some data and change scale so data you have is continous, 2) average and use moving averages instead (eg per store ID)
Answer: Check the percantege of missing values in each column. If it is high then you should remove this column, otherwise you are able to try to impute the missing values. For the latter you may replace them with the mean (median or mode etc) or try to predict them using the other known values. You should check if these are values are mising at random or not.


Search not rendering excerpt (or full text)

Question: anyone ever run into an issue with the simple search form where it won't render the excerpt or the full text?  I'm using the simple search form from the search module (EE module, not a 3rd party) ... I'm getting results with the title of pages but nothing more.
Comment: Have you set the excerpt fields in the channel preferences?
Answer: Have you checked the option to make your field searchable? go to admin > channel administration > channel fields and select the group and field you want to show up in results and make sure its searchable.
see attached screenshot.
Comment: yes, i did ... i actually was able to fix this by going into channel preferences and simply resaving the preference page.  weird.
Comment: glad to hear you got it working. Strange that you had to do that though.
Comment: it was weird - haven't had that happen before but sometimes the simple fix is overlooked!  was digging around in code and settings before just trying this on a whim.


MCPE multiplayer doesn't work

Question: When I open it from the world menu, when you press on play on the main menu, it says the multiplayer is on. When I go inside the world, the multiplayer button is off and grayed out.
Comment: I'm not sure how MCPE works, but on PC you have to open the world to LAN. Is there a MCPE equivalent that you could try
Answer: You can't actually change if the game is multiplayer or not while you are playing that world. What you'll have to do, is exit out of the world, click the pencil icon next to it, go down to multiplayer, and then you can select "On/Off"
Answer: The main menu multiplayer settings are the default and can be changed by a per world basis. You can't change this setting in game. Change it at the world list.

MCPE multiplayer doesn't work


Does Smart Contract pay gas fees in this case?

Question: Lets say there are 2 smart contracts A and B. A contracts approves B contract for some allowance, as B has approval to withdraw from A contract. Lets say contract B withdraw some X coins from A contract, Does A contract pay fees for this transaction (Sending X coins from A to B)?
Answer: Whoever initiates the transaction pays for the transaction fees. This is usually the end user interacting with the smart contract, but could be the smart contract in some cases of on-chain automation like Acala EVM+ Schedule predeploy.
Comment: Do you know of any EIP to allow normal EVM contracts to pay for their own gas?


Who should give high-level project estimates?

Question: I've just come from a discussion about who is best placed to give estimates on a given piece of work.
At a detailed level I'd always say that the best estimate comes from the person who actually has to do the work as they have the full understanding and this gives them complete buy-in to the , however at a higher level of abstraction (i.e. at overall project level) I'm not so sure.
I'm reminded of chapter 5 in Peopleware which gives the results of an Australian study from 1985 - best link I could find is here.
I'm particularly interested in your focus here - are you answering as a developer, architect, prject manager or whatever?
Comment: I'm voting to close this question as off-topic because it is not about programming.
Answer: I'm answering this as both manager (present) and developer (past).
High level estimates should come from the team/project leader, but with input from the developers.  They should also be given in the form of a range - most likely to worst case with an indication of the confidence level of each.
There's no way the team lead can know everything about the project in sufficient depth so they will need some input from the developers, but the danger with this is that you get bogged down in the details too early in the process.  Equally, individual developers will not have a broad enough knowledge of the project (unless it's really small) to be able to give estimates on everything.
The manager then integrates these estimates and looks for conflicts and synergies to get the "big picture" - after all that's what we're paid for.
As a developer I wouldn't trust a manager who gave estimates without checking with the developers, but equally I wouldn't trust one who just asked the developers and passed that information on without "editing" it in some way.
Comment: In agreement - I think ranges are needed at a high level and need to include high level risks and scope
Answer: The person responsible for signing off of an estimate should really be the project manager.  That's their niche.
I'm not saying that PMs should make up the estimates however.
I'm saying that the PMs will need to take estimates from a variety of sources--technical, business, etc--for different parts of the project.  In any project there'll be large parts that aren't technical.
Anything technical should be estimated by someone technical.
But, by the same token, anything non-technical should be estimated by an appropriate expert (CPA types call these SMEs--subject matter experts).  An architect could estimate the technical solution.  A BA the gap analysis.  A manager could do the business process implementation.  And so on.
But a PM is really needed to tie all those together into a high level estimate, particularly in terms of resourcing and working out the interdependencies and the critical path.
Answer:
Developers generally should make the initial estimate. The Manager should be able to add a risk factor to it depending on who implements it. (for example : If the developer implementing it has a better knowledge than the one who gave the estimate, the risk would be lower).
The developer also may not have an idea on the other development areas of the project(assuming its huge). This is where a Manager's estimate comes into picture. IF the project is small then a developer estimate is good enough.
Answer: Everyone should give an estimate to the project manager: functional analysts, test analysts and the senior developers.
It's the PM's task to make sure they are somewhat realistic and to sum them up.
Answer: The tongue-in-cheek Agile answer is: nobody should, because it will be wildly wrong anyway.
Answer: I think it depends on the piece of work. A lot of times the project manager is more than capable to estimate how long it would cost to say, add some additional data on screen, change layout, you name it.
However, there are times when things are more complicated, especially if they deeply touch the architecture of the system. In that case, the project manager should consult the developer, architect, or both for their estimate, and exactly why it takes that particular time to implement.
Moreover, I think project managers should use a developer's estimate to get to the final estimate, like schar says. They should add a percentage of overhead, test time, risk factors, etcetera.
Answer: I'm answering this as both manager (present) and developer (past).
In our company developers are always involved in making estimations. We do high-level estimates on user-stories created by a business consultant.
The business consultant communicates the user-stories to me (technical teammanager) and a developer.
We schedule an estimation meeting to discuss the user-stories and the context of the project (three people, business consultant, developer, technical manager). Within the meeting both me and the developer make notes and write down needed hours per user-story.
After the meeting the developer fills out an estimation form and we make sure we both agree on that estimation. When finished the estimation form goes back to the business consultant.
Usually a high level estimation will be given in a range from x to x times 3 days.
For example: 40 to 120 days.
Obviously we only estimate development/test/deployment time which is needed. X percentage will be added for project management and technical management, risks and overhead.


Why is it considered compulsory for brahmins to perform sandhyavandanam?

Question: Although it has been mentioned that it is considered compulsory, the reason why is not mentioned?
Also, are there any shortcuts? Like performing sandhyavandanam only once a day or once a week?
Also, what are the benefits gained by doing sandhyavandanam?
Comment: Sandhya = sun and moon together. Sandhyavandhanam directly is a method of worshiping the unmanifest Brahman which is in light form for brahmanas. Sandhya is Nithya karma where you should not work for benefit but if you do not do as Brahamana you incur sin. Sandhya one alone can take you to greater heights of you are brahmana
Comment: although it is mentioned that going to office is compulsory, the reason why is not mentioned. are there any shortcuts like going to office only 1 hour per day, or once a week ? also, what are the benefits of going to office and working.
Comment: @AkshayKumarS, i don't think it's sun and moon together - that is amavasya. also we can see moon many times during daytime. sandhya is day & night together.
Comment: @Ram your answer is cheeky, but I love it.  Instruction by analogy
Answer: The reason why Sandhyavandanam is recommended was told by Sri Ramakrishna to his disciples.
Gospel / Volume 1 / Pundit Shashadhar:

Without having realized God one cannot give up rituals altogether. How long should one practise the sandhya and other forms of ritualistic worship? As long as one does not shed tears of joy at the name of God and feel a thrill in one's body. You will know that your ritualistic worship has come to an end when your eyes become filled with tears as you repeat 'Om Rama'. Then you do not have to continue your sandhya or other rituals. When the fruit appears the blossom drops off.

As long as one is not realized, Sandhyavandanam should be practiced because after realization, one cannot perform such actions.
Gospel / Volume 1 / The Master And His Injured Arm:

In the case of a paramahamsa, like Sukadeva, all karmas — all puja, japa, tarpan, sandhya, and so forth — drop away. In this state a man communes with God through the mind alone. Sometimes he may be pleased to perform outward activities for the welfare of mankind. But his recollection and contemplation of God remain uninterrupted.

Gospel / Volume 1 / Pundit Shashadhar:

The sandhya merges in the Gayatri, the Gayatri in Om, and Om in samadhi. It is like the sound of a bell: t — a — m. The yogi, by following in the trail of the sound Om, gradually merges himself in the Supreme Brahman. His sandhya and other ritualistic duties disappear in samadhi. Thus the duties of the jnani come to an end.

At the start of one's spiritual journey, one should perform Sandhyavandanam but upon reaching higher level, these actions automatically drop off.


iPhone Web App - Stop body bounce/scrolling in iOS8

Question: Yes, I know. This question has been asked a thousand times before. Thanks to all you guys, I was able to find a solution that finally did the job for me in <= iOS7. However, after updating to iOS 8 - nothing seems to work!
What worked perfectly for me in iOS7
Css
html, body, .scrollable {
overflow: auto;
-webkit-overflow-scrolling: touch;
}

jQuery
$(function() {
  $(document).on("touchmove", function(evt) { evt.preventDefault() });
  $(document).on("touchmove", ".scrollable", function(evt) { evt.stopPropagation() });
});

Other solutions I've tried:
All here: iPhone Web App - Stop body scrolling
And here: iOS Safari – How to disable overscroll but allow scrollable divs to scroll normally?
And here: Disable iOS Overscroll but allow body scrolling
And more ...
So, does anyone know an iOS8 compatible way of disabling the body out of bounds scroll / bounce effect (besides from native solutions applied to phonegap projects)?
Comment: This is so wierd! Why doesn't it work in iOS 8? Really hope this is a bug that will be fixed in iOS 8.0.1
Comment: Unfortunately not, iOS 8.0.2 - still bouncy..
Comment: iOS 8.1 - same issue
Comment: This is one of the most infuriating things I've ever had to deal with...  I just want to make something awesome... and instead - I'm foiled.
Answer: So this has been bothering me for ages too and I finally found a solution!
Pre iOS8, Safari has no subpixel rendering.  Now that there is subpixel rendering, the reported element height is given as the subpixel decimal, and the scroll height is the actual rendered integer heigh.  If you specify sizes in percent, this can result in the height being a fraction of a pixel smaller than it should be.
Instead of testing for
if (elem[0].scrollHeight > height) {
                    e.stopPropagation();
}

Testing for this will give you the rounded number that matches up.
if (elem[0].scrollHeight > Math.ceil(height)) {
                    e.stopPropagation();
}

Answer: This, combined with the fact that position: fixed gets respected more reliably, allows for some interesting effects. You could do a pull to refresh with a simple fixed 'underlay' that stays put while body is pulled down, thus revealing it.
To answer your question:
A touchmove handler that throws away ( event.preventDefault() ) the event if the following conditions are met should work:

The event is further up than the last one
The current target element and body are at scrollTop == 0
Same for the above two conditions to take care of bottom rubber pull (scrollTop + innerHeigh == scrollHeight)

Please let me know if you're looking for a more detailled axplantion, happy to write it up.
Answer: this is a solved problem with preventOverScroll.js
Take a look to www.digitpro.it/Takashi the "Promozioni" and "Altro > Chi Siamo tabs provides an iframe with scroll and without scrolling bounce effect:) feel free to look at the source code JS + CSS
Comment: It's a 404. Just add the relevant code of preventOverScroll.js in your answer.


Midori block cipher design: importance of $S_b$ as the S-box

Question: With a use of almost MDS the Midori cipher provides a good diffusion. But why $S_b$ is used as S-box and what is its actual importance?
Comment: Did you mean an MDS matrix? I'm -eh- somewhat confused.
Answer: The lightweight Midori block cipher is a subtitution-permutation network where a round of cipher has a substitution phase where chunks of state are used as inputs to the $S$-box and the outputs represent the new state and a permutation phase where the bits of state are passed through an invertible linear function (in particular this function which makes the output chunks dependent on multiple input chunks and vice-versa, a property referred to as diffusion).
It is well-established that block ciphers with linearly combined key need to be highly non-linear in many senses. For example, a purely linear (or affine) block cipher with block size $B$ can be broken by collecting roughly $B$ matched plain and cipher pairs and applying Gaussian elimination. As the permutation step is a purely linear function, the non-linearity of the cipher can only arise from the $S$-box, making it an absolutely critical component of the design.
How then do we specify what properties an appropriately non-linear $S$-box should have? The two main lines of attack that use linear structure are linear cryptanalysis and differential cryptanalysis.
To block linear cryptanalysis, we would like for all pairs of non-zero masks $\alpha$ and $\beta$ (for 4-bit $S$-boxes we can think as these masks as 4-bit quantities $A_3A_2A_1A_0$ and $B_3B_2B_1B_0$) the proportion of $S$-box input-output pairs $(x,y)$ with $\alpha\cdot x\oplus\beta\cdot y=1$ (again, for 4-bit $S$-boxes think $A_3x_3\oplus A_2x_2\oplus A_1x_1\oplus A_0x_0\oplus B_3y_3\oplus B_2y_2\oplus B_1y_1\oplus B_0y_0=1$) is roughly 0.5.
To block differential cryptanalysis, we would like for all pairs of non-zero differences $D$ and $E$ that the proportion of input-output pairs such that $S(x\oplus D)=y\oplus E$ is close to zero.
There is some tension between these two goals. In the case of 4-bit $S$-boxes, it is possible to analyse all possible $S$-boxes for their linear and differential characteristics and this was done by Saarinen who showed that the best possible 4-bit $S$-boxes have some masks where the probability of the linear form being zero is at worst 0.25 or 0.75 and also have some differences where the proportion of undesirable pairs is 0.25. Given that these characteristics cannot be avoided, the Midori designers aimed to find $S$-boxes which were of this optimal form, but which were also involutions (so that the same $S$-box can be used for encryption and decryption) while being efficient in an energy consumption sense (see section 4.2 of their paper).


CNC Servo motor current measure

Question: What methods and equipments can I used to measure and record the current variation of CNC servo motor while machining.
Answer: There are two features of Motor control worth sampling.  The first is the current you mention.  There are two parts of the current path that are going to be interesting, and you probably need to measure them separately.  The first half is the rise current, the part of the commutation when the motor is connected to power.  The natural induction of the motor windings will cause the current to rise gradually, until the control loop shuts it off, either because it is using current limiting (chopper drive), or some other part of the control loop is turning the motor off.  In the case of a normal H-Bridge, this is the only current path.  In the off state, no current can flow in or out of the motor because it is completely disconnected.  More elaborate circuits may also use regeneration, in which the motor is connected to another part of the circuit to assist in deceleration, either a dump resistor or a battery recharging circuit.
For small currents (about 1A or less), the usual way to do this is with a low value current sense resistor, connected in series with the motor windings.  The current passing through the resistor causes a voltage difference on the opposite sides of the resistor, which can be measured quite easily.
Larger currents require fancier tricks, but a good option is a hall effect current sensor.  The result is quite similar, an output voltage in proportion to the instantaneous current.  This type of sensor has a slight propagation delay ( a few microseconds ) because of the multiple stages of amplification needed with the hall effect sensors.
The other feature of motor control worth looking at is Back EMF.  This can be useful in some types of (really simple) servo control to determine motor velocity, since back EMF is proportional to motor speed.  This feature can only be measured on windings that are 'off', since the voltage of the power supply will dominate the higher impedance windings.  In the case of a PMDC motor, Back emf would be measured during the off periods of motor control.  The back emf at the moment of switch-off will be equal to the supply voltage, but will decay, due to the natural inductance of the windings until it reaches the level determined by its speed.
Comment: Excellent answer: I spent 13 years in power electronics (motor control) and you've hit the major points. Depending on the accuracy required and whether he needs real power or not, he may have to sample the voltage and current simultaneously in order to calculate the RMS power draw. Hall effect sensors are often referred to as "LEMs", after one of the bigger companies that make them. Also, if he's measuring a switched current he may have to worry about the crest factor in his current sensing circuitry.
Comment: @Andrew: Thanks, I've only been looking into motor control (mostly related to electric vehicles) for a few months now, I'm glad my understanding meets the approval of a real expert!
Answer: One thing you can do to get an approximate measure, that isn't too complicated, is to measure the DC current going into the switching bridge. If you know the current and voltage of the DC supply, you get at least an upper limit to what the output power can be. This doesn't account for the efficiency of the switching network nor of the motor itself, but has the advantage that it's simpler to implement, and in some cases is sufficient.
Otherwise, you're going to have to measure the phase currents into the motor. First you need to know how many current sensors you will need, and how you determine that will depend on the number of phases and their connection. That done, you then need to deal with what amounts to AC current with a boatload of harmonics on it, and possibly under conditions of changing frequency due to changes in the mechanical load on the motor, so this is definitely a more complicated way to go.

CNC Servo motor current measure


Pair production mass

Question: I've read other questions on here, but I still don't have the answer that I need. In pair production, where does the mass come from that's found in the electron-positron pair? I'm extremely novice and recognize that part of my problem with understanding how mass comes from energy is due to the lack of understanding I have for energy's relation to mass. If someone could help me understand this, I would greatly appreciate it.
Comment: Photons have energy $E=h\nu$ even though they are massless. That energy goes to make the electron and positron.
Comment: A lot of information can be found here: https://en.m.wikipedia.org/wiki/Pair_production Are you familiar with Einstein's mass-energy equivalence principle (i.e. $\ce {E = mc^2}$ ) ?
Comment: @TanYongBoon Yes, I am. I think my problem is equating it to photons turning into things that have mass.
Comment: Are you ok with an electron & a positron annihilating each other & producing a couple of photons?
Comment: I think I am confused as to the photon turns into something that suddenly rest mass? Does it slow down, in layman terms? Is the energy put in a type of box, layman again?
Answer: The mass does not "come from" anywhere. You should view the produced electrons as excitations of the electron field. The electron field has the property that the energy $E$ and momentum $p$ of an excitation must satisfy the relation $E^2 = p^2 + m^2$, where $m$ is some parameter that we call the mass. Because the photon (or whatever) couples to the electron field, it can produce a pair of these excitations that we identify as electrons/positrons. Given the energy and momenta of the initial particles, the electron and positron are produced with energy and momenta that satisfy the relevant conservation laws and the above relation to the mass parameter of the electron field.
Answer: It comes from $ E = mc^2$. A photon of 1.022 MeV, will decay into an electron (rest mass = .511 MeV) and a positron (rest mass = .511 MeV). This is pair production. The photon ceases to exist. Its energy was converted to mass.
Comment: Photons do not decay. A further body is required here.
Answer: Here is a simple pair production diagram used to calculate crossections to compare with experiment:

Special relativity is necessary to understand it, in addition to quantum mechanics.
In special relativity all particles are described by  four vectors. The energy momentum four vector has a "length" , a quantity invariant under Lorentz transformations and in the case of a particle it is defined as its invariant mass. It is the mass that describes the electron or the positron in the diagram above.

When two four vectors are added , as in the diagram,  the invariant mass is the "length" of their added four vectors. In order for the reaction to happen, the incoming photon has to have the added energy of the two outgoing particles. That is how energy balances in special relativity.
Note the necessity of the off shell gamma at the lower end.  A single gamma cannot "decay" into a pair, as its invariant mass is zero and the invariant mass of the pair is at least two electron masses.
Comment: Thank you for taking the time to answer this. I notice that the wikipedia diagram has the arrow at the top pointing from e+ to the end of the photon line. Can you describe why the diagram is laid out this way? I've noticed that other pair production diagrams do not show the same.
Comment: @AllexKramer backwards arrows show antiparticle quantum numbers, thus e+
Answer: An isolated photon cannot decay into an electron + positron because that would disobey conservation of momentum. But a high energy photon in the vicinity of a nucleus can decay into an electron + positron because the nucleus can balance out the momentum.
Rest mass is just a form of energy (and in particle physics it is sometimes called rest energy), and there's no problem with converting other forms of energy to rest mass, or vice versa, as long as you obey all the conservation laws. For pair production or annihilation, that means energy, momentum, electric charge and lepton number must be the same before and after the reaction.

Pair production mass


Calculate the maximum power angle of a solar panel (photovoltaics)

Question: I want to calculate the maximum power angle of photovoltaics depending of the coordinates on Earth. That means at which angle I should align my solar panel to get the maximum power over the year?
I think to get the maximum power I should point the solar panel to the South. But at which angle I should align the solar panel?
Is it always south? When I am in australia then I should align the solar panel to the north? Or I am wrong?
Comment: Hi, welcome to Earth Sciences SE. Please describe your problem better. The angle will vary along the year. So, you solar panel will be fix year round? Or you can adjust the angle monthly? If it will be fix: do you want to optimize it for total year output? Or for maximum output in winter?
Comment: Hi, thx for the comment. I updated the question. I should be over the year. I want to optimize it to total year output
Comment: This is an interesting question and could be considered on-topic in several other sites as well, since it involves geometry, math, and relative position and orientation of the Earth with respect to the Sun. You might want to browse [Sustainability SE](https://sustainability.stackexchange.com/) and [Astronomy SE](https://astronomy.stackexchange.com/) to see if you find additional helpful information.
Answer: This question can be answered in many different ways that take into account, or ignore, the many factors that affect the total output of a fix solar panel over a year.
In general, all answers will agree that the solar panel will have to face the north in the southern hemisphere, and the south in the northern hemisphere. This is because that is the direction where the Sun will be when it reaches the maximum elevation during the day. Or if you are within the tropics ($\pm$23.5° of latitude), that's the direction where the Sun will be most of the days when it reaches the maximum elevation.
The tricky part is the inclination angle, because the solar elevation changes trough the day, and the maximum elevation changes trough the year. In general, the mean elevation at solar noon (that usually do not match the clocks noon due to standardized time zones), is given by:
$\overline{h_{max}}=90^o-\text{Latitude}$
And through the year it will vary $\pm$23.5°.
So in a first zero-order approach you can just use that mean value. Now, to find the optimum value you have to model the Sun's position trough the year and run a complex calculation to find the angle that maximizes output. Thankfully some people have done that, and they have reduced the output to simple empirical formulas. For example, in solarpaneltilt.com they provide the following formulas:
$\text{Optimim angle}=\left\{ \begin{array}{rcl} \text{Latitude} \times 0.87 & \mbox{if} & \text{Latitude}<25^o \\ \text{Latitude} \times 0.76 + 3.1 & \mbox{if} & 25^o<\text{Latitude}<50^o\end{array}\right.$
And if you don't want to put the fingers in a calculator they provide a table with some values for different latitudes:

However, this approach pinpoints to an angle with great accuracy, while neglecting what can be one of the main factors affecting the output of your solar panels: weather. Therefore, the above approach would be very accurate if you live in a desert, but misleading if you are in an area with clear weather in winter and rainy weather in summer.
To tackle this problem you can download weather statistics for your location and find the optimum angle yourself. Ideally you would do this by calculating solar output on each day, but I'll first show you also a simpler approach month by month that you can reproduce with very little computer skills and the results will be very similar.
The general workflow is as follows:

Find the typical solar radiation reaching the surface at your location each month/day of the year. Let's call this parameter $S$.
Find the typical solar elevation over the horizon at solar noon at your location each month/day of the year. Let's call this parameter $h$,
Find the maximum solar power that a solar panel could receive if directly facing the Sun, let's call this $S_{max}$ and it will be given by

$\hspace{12em} S_{max}=\frac{S}{\sin(h)}$

Find the effective power hitting a solar panel at a set angle $\theta$. Let's call this $S_{eff}$ and it will be given by

$\hspace{12em} S_{eff}=S_{max} \cos(90^o-h-\theta)$

Adding $S_{eff}$ for each month/day of the year. Let's call this $S_{total}$.
Put all these calculations in a spreadsheet and then play with different values of $\theta$ until you find the one that produces the maximum $S_{total}$.

Now, to get the typical $S$ values for each month you can go to the KNMI Climate Explorer, click the option "ERA-interim 1979-now", then select the variable "surface net solar/longwave radiation", and click "Select Filed" on the top.
Then, you will see a bunch of options, but only focus on the first box:

Fill, the coordinates, add half a degree around your location (this model resolution is ~ 80 km, so don't get picky with accurate locations), select the "max" option (mean would work too), and hit "make time series".
You will get a time series of solar radiation in your area, and the average per month from 1979 to 2019, it will look like this:

Now, you click the "raw data" link above the plot and you will get the numbers for $S$ to feed into your spread sheet, they are in the first data column:

For daily values you start from Daily fields, and select ERA-interim 1979-now rsds field. From there is the same as before. And the plot will look like this:

Now, to get the solar elevation for each month you can use this Solar elevation angle (for a year) Calculator and just take the day closer to the center of the month to feed it into your spredsheet. For getting angles for each day, you can use this Rise/Set/Transit Times for Major Solar System Bodies calculator, this is how I filled the form for my area of interest:

Note that I choose a leap year so it matches the number of days in the output from the KNMI Climate Explorer.
Whith all this, the formulas above and a bit of spreadsheet skils you can find the optimal angle for your location.
My monthly spreadsheet looks like this:

And the daily one like this:

As you can see, for my area of interest the angles differ only by 1° between the monthly and daily calculation. And about 4° with the formulas from solarpaneltilt.com. However, in other climates the differences could be much larger.
This method can be adjusted also if you want to maximize power during the winter months, that are usually the most challenging ones for a solar power supply.
If you area have large temperature variations and want to get fancy, you can also incorporate the effect of temperature in solar panels' efficiency.
Comment: I don't think this answers the question: one angle, optimized for total energy generated over a year.  Where is the annual optimization in your method?
Answer: In case you are interested in the final values or to benchmark your results, the optimum tilt for fix-mounted PV modules (OPTA) for maximum yearly yield is provided by Solargis Prospect map.
The algorithm behind is quite complex (I am not able to provide it). It not only consider the solar geometry throughout the year at the particular location on the Earth, but also:

time-series of global irradiation at tilted surface (GTI), calculated based on satellite data (cloud index), water vapour, and aerosol content in the atmosphere (time-series from atmospheric models)
monthly average values of ground albedo
local terrain horizon and properties
(... maybe some more sources?)

For such complexity, access to high resolution databases is needed and also reasonable computation power.
OPTA database is calculated in 2 arcmin (~4 km) resolution (pixel size).
Comment: Thanks, the Solargis Prospect map is the right approach!


workspace switcher in Ubuntu 14.04Lts

Question: How do I get a small "thumbnail" of Workspace switcher on my launcher using which I can view all my windows and click and open any one of them in Ubuntu 14.04LTS?
Answer: If you have workspace enabled then the launcher shows an icon for Workspace Switcher.
A better idea will be to use shortcut super + s, this displays all the workspaces, you can chose and select even using the arrow keys.
Another solution will be to install Unity Tweak and set up the hot corners if you want to use the mouse so much.
Comment: Thanks! But I found an easier way. Just type 'Appearance' in dashboard and when the dialog box opens select 'Behaviour' , then click on the 'enable workspaces ' option and the Workspace Switcher icon will appear on the launcher.

workspace switcher in Ubuntu 14.04Lts


Do I need to paint my house siding under my deck

Question: I have cedar siding on my Seattle home. I am repainting the house now and am wondering if I need to paint the siding that is below the deck level. My deck boards are pretty close together with about a cm gap between boards and the boards come flush and parallel to the side of the house. My deck is about 2 feet off the ground. Do I need to remove a few deck boards to paint the space under the deck? Any articles to support your answer would be great.
Answer: Cedar siding, while naturally rot-resistant, depends on a good sealer applied periodically to maintain its surface integrity and appearance. Whether you need to paint depends on the age of the existing finish, the conditions it's subjected to, and other factors not addressed in your post.
The bottom line is that you may extend the life of the siding by refreshing its sealer. Whether that's worth the effort is a judgement call.
Answer: Is the paint under the deck still in good shape, many times it is because the sun and rain are deflected by the deck. If the paint appears in good condition not peeling I would not try to do anything under the deck.


Irish naturalisation as British citizen?

Question: Reading about the Common Travel Area, it looks like I, as a British citizen, can live and work in Ireland without restrictions. What I can't see is whether this can eventually lead to naturalisation in Ireland, or whether there are any restrictions in this area?
Answer:
What I can't see is whether this can eventually lead to naturalisation in Ireland

It can

or whether there are any restrictions in this area?

There are.  See the Irish government's page Becoming an Irish citizen through naturalisation:

What Naturalisation is
A foreign national living in Ireland who meets certain standards may apply to become a "naturalised" Irish citizen. To apply, you must have been physically resident in Ireland for a certain length of time.
Qualifying
The conditions for Naturalisation were set out in the Irish Nationality and Citizenship Act 1956 as amended. These are:
Age
You must be over 18.
You can apply on behalf of a child if

the child was born in Ireland after 1 January 2005 and did not qualify for citizenship by birth – use Form 11 on the INIS website
the child is of Irish descent – use Form 10 on the INIS website
the parent is a naturalised citizen – use Form 9 on the INIS website

Character
You must be 'of good character.' To prove this, you must ask the Garda Síochána for a report about your background.
Residence in the State
You must have lived in the State for a certain length of time. You must:

have a period of 365 days* (1 year) continuous residence in the State immediately before the date of your application for naturalisation
have spent 1,460 day, or 4 years, in the State in the 8 years before that

You must have spent 5 of the past 9 years in residence in Ireland.
You can spend up to 6 weeks per year outside of Ireland and still be considered a resident. If you had to leave Ireland for longer than 6 weeks because of an emergency, you should explain this in your application.
If you spend more than 6 weeks outside of Ireland in the year immediately before your application, you may have to wait until the following year to make an application.
Apply
To apply, you must use the most up-to-date versions of the application forms on the Immigration Service Delivery website.
There is an application fee of €175. If you are successful, there may be an additional fee of up to €950.


Minor revised article will take how long time for final verdict?

Question: I submitted an article in June end and it came for minor revision on Sep first week. Then I submitted the revised manuscript within 10 days. After that, it took 2 and half months for getting reviewer scores, 3 weeks to get recommendation and now it is almost 2 weeks. Still the status is awaiting decision. Still how long will it take for the final verdict?
Thank you
Comment: Depends upon your specific editor and journal.
Answer: The reviewers and editors are people just like you and me. Today is the 3rd of January, thus, I would assume that they might still be on christmas vacation. In my personal experience, people often leave early for christmas, like in mid December. Some will return to work in the second week of January, so they might still be out of office.
Therefore I am not really surprised that you are waiting for almost two weeks now. Just give it some more time.
Comment: +1, since if I read the question right, the paper is waiting for the editors to make a decision, in which case your answer is the most likely scenario.


Synthetic Control Method: Why average pre-treatment controls?

Question: The help file of the `synth' package in Stata states that they average the value of each matching variables across the whole pre-treatment period. Why not match on the value of X in each pre-treatment period?
Answer: I asked myself the same question when studying SC. The averaging of covariates X is not motivated by modelling, but by technical complexity.
In traditional Synthetic Control, we have to find weights $\mathbf{W}^*=\left(w_1^*, \ldots, w_{N-1}^*\right)^{\prime}$ that minimise the Euclidean distance between the predictors of treated and untreated units in the pre-treatment periods, subject to the weights being positive and summing up to
1.
Formally,
\begin{aligned}
&\min _W\left\|\mathbf{X}_1-\mathbf{X}_0 \boldsymbol{W}\right\|=\sqrt{\left(\mathbf{X}_1-\mathbf{X}_0 \mathbf{W}\right)^{\prime} \mathbf{V}\left(\mathbf{X}_1-\mathbf{X}_0 \mathbf{W}\right)}\\
&=\left(\sum_{k=1}^K v_k\left(X_{k N}-w_1 X_{k 1}-\cdots-w_{N-1} X_{k N-1}\right)^2\right)^{1 / 2}\\
&\text { where } \mathcal{W}=\left\{\left(w_1, \ldots, w_{N-1}\right)^{\prime} \text { subject to } \quad w_1+\cdots+w_{N-1}=1,\right.\\
&w_i \geq 0 \text {, }\\
&\text { with } i=1, \ldots, N .\}
\end{aligned}
and where:

$i=1,...N$ is the unit index, $i=\{N\}$ is the only treated unit, while $i=\{N-1\}$ are the control (or donor) units;
$k=1,...K$ indexes covariates;
and
$t$ indexes time;
$w_1,...w_{N-1}$ are the weights that, once optimised, are used to build the synthetic control unit.

If we did not take the mean or median or some other statistic of the covariates, the problem (if formulated this way) would not be solvable as $\mathbf{X_1}$ and $\mathbf{X_0}$ would no longer be matrices, but 3D objects (tensors).
Long response to the comment:
In the problem statement above, $X_{k N}-w_1 X_{k 1}-\cdots-w_{N-1} X_{k N-1}$, the covariates change per each unit, $i=1,...N$, but not over time. Notice also that the averages you mentioned in your question are one "long average" per each unit. E.g. you follow the GDP of a region over 10 years and take the average of those values, and then you do this for each donor region in your dataset.
Your dataset should look like a matrix where each row is a unit-period (each unit has multiple rows, one per time period) and each column is a single variable, changing over time as you go down the column.
If you make one column per variable per year per unit, you end up with $N \times T$ columns with only one non-missing element each. Your variables have become constants and hence useless for statistical purposes.
If you make one column per variable per year, the data is not shaped in the correct way and your statistical software is misinterpreting your input and giving you the wrong results. In practice, it is still taking averages, but the wrong ones. It is taking one average per year (across units) instead of one average per unit (across years).
I hope this helps!
Comment: Thanks a lot! I see the point about dimensions if we include time-varying $X$. But we can include each pre-treatment period's $X_{tki}$ as a separate covariate. This also works computationally in the Stata. Why is this not the preferred way?
Comment: Apologies in advance for the probably unclear notation—it should be clearer after some edits. See the main reply for the answer to your comment.
Answer: Complementary to Marti's answer (+1): when we have multiple matching variables it becomes increasingly harder to find a single match/near-neighbour that is satisfactory. By "averaging" we get a synthetic match that is optimal based on our selected metric. Of course, if we could find a control instance that directly matches our treated instance perfectly in all the matching pre-treatment variables we should use it! :)
Answer: The main reason is to 1) prevent overfitting and  2) ease interpretation.
To understand 1), compare two cases; in one case we only use pre-period averages and in another case we use every individual time period. Both cases have very good pre-treatment fit of the dependent variable of interest between the synthetic control and our treated unit. We will be much more trusting in our synthetic control that uses averages because then we have essentially shown that there is co-movement in the outcome of interest across the control units and treated unit, without directly targeting this co-movement to fit on. If we included all time periods, we are ex-ante forcing the model to choose a synthetic control that fit all of the pre-period well, i.e., we at risk of overfitting. That doesn't mean that by fitting all time periods always overfits, but it could be and thus isn't very credible.
For 2), note that subject context is extremely important when doing synthetic controls. With enough varied controls we can get a perfect pre-treatment fit but that synthetic control would be garbage. The only time we can use synthetic controls is if we have a case where we don't have a perfect control but rather have a pool of similar non-treated units to compare to. For a credible synthetic control exercise we need to show that the weights/controls make sense logically. The clarity of the exercise is stronger when we have fewer measures. Synthetic controls is not magic, we need to really believe in the validity of the synthetic control we create.
There is absolutely no mathematical reason why you could not include every period instead of taking the average! We can treat each time period as a completely separate piece of data (i.e., then the canned code would take a mean over a singleton). For this reason I disagree with Marti's answer.


How can I transfer [content] from one page to another in MODx?

Question: There is a link on the page of the MODx site. By clicking on this link I turn to another page. I want to transfer all [content] from the first page to a new page and display it. How can I do this
Answer: Use a TV with the @DOCUMENT binding or the getField-Snippet. Both methods work for MODx Evolution.
On MODx-questions, please include whether your are using Evolution or Revolution, since the code base differs heavily, as so does the functionality.
Comment: Thanx feela, I just did not happen. In both proposed methods for solving my problem, I get the message "Unable to locate document" I use Evolution MODx
Comment: If i use [!GetField? &docid=`???` &field=`content`!] in second page, what i must set in &docid ? Second page can run from any of handreds pages.
Comment: @Astraport if there is a message "Unable to locate document", your document-id seems to be wrong. If you don't know what a doc-id within MODx is, you should refer to their documentation. Your second question: I don't know, what in your terminology is "first-" or "second-page". If you don't want to set a static doc-id, you can use another snippet within the GetField-snippet-call, to determine the document-id. This may be something like [UltimateParent](http://modx.com/extras/package/ultimateparent) or a self-created snippet, which may read the referer or a session-variable, to output a doc-id.
Comment: Solution: http://modxcms.com/forums/index.php/topic,64009.msg362155.html


Directional derivative and normalization of the direction vector.

Question: This issue has been discussed before but I still have some doubt about it. I understand while defining directional derivatives, some authors normalize the direction vector v while some don't. However, intuitively I am thinking directional derivative at a point as the slope of the straight line lying on the tangent plane of the graph at that point in the direction of v. If we don't normalize v, different vectors on the same direction will give different values of directional derivative. However, they all lie on the same straight line on the tangent plane and that line should have the same slope!
Answer: Some authors do not normalize the vectors $v$ because they are working with a general version of the directional derivative applied to arbitrary topological vector spaces, and not just to Euclidean vector spaces or normed vector spaces. Without a normed space, there is no notion of normalization to speak of, but having a theory of derivatives for non-normed spaces is still useful/necessary, so we simply get rid of the requirement to normalize. This general version of the derivative is called the Gateux derivative. Simply put, $$dF(x;v)=\lim_{t\to0}\frac{F(x+tv)-F(x)}{t},$$ where, here, $x$ and $v$ are elements of the vector space $X,$ and $t$ is a scalar element (specifically, a real number). The idea now is that if $v=au,$ for some scalar $a$ and vector $u,$ then $$dF(x;au)=a\cdot{dF(x;u)}.$$ Here, $\cdot$ denotes scalar multiplication (because simply using juxtaposition gets confusing at this stage). The geometric interpretation is that the magnitude of the vector multiplies the directional derivative. This makes sense, because a longer directional vector represents a gradient along a direction for a longer distance, so to speak.
Comment: Is it correct to say that for real valued functions, if we don't normalize v, then the directional derivative can no longer be interpreted as the slope of the straight line lying on the tangent plane in the direction of v?
Comment: Yes, that would be correct.


Is 2 1/4 x 3 1/4sheet film still availiable, or will I have to purchase 4x5 and cut it down?

Question: I'm thinking of purchasing a Baby Speed Graphics Press Camera, it's smaller than the Speed Graphics and takes 2 1/4 x 3 1/4 film. I have a 4x5 camera but it's a big monorail camera that weighs a lot, needs a tripod, and I need to put my head under a blanket to take a photo. I want to start taking large format street photography, so I've been looking for a press camera, this fully functional Baby Speed Graphics is like 1/3 of the price of 4x5 cameras that are being sold for parts or repair, so I'm tempted, but if there is no film for it then it's useless.
Comment: You don't *have* to put your head under a blanket to take a photo. You could just "point and hope" with the 4X5 the same as will be required when using a press camera with no glass screen or other method of seeing the scene through the lens of the camera. [Like this one.](https://i.stack.imgur.com/yfENk.jpg)
Comment: @MichaelClark I just *knew* the Weegee photograph would make it into this conversation - it is so iconic! But yes, the guy who coined "f8 and be there" phrase has something to teach us about focusing...
Answer: The smallest sheet film that I know that is still being manufactured is Foma 6.4 × 8.9 cm, which is about 2.5 × 3.5 inches. Whether this would fit your camera is a question.
Also a question is whether you could get enough holders and an enlarger (such tiny contacts would likely not cut it...)
You might be better off with a regular size press camera with a rangefinder - such as the Mamiya Press.


JDK points to wrong JRE

Question: I had a portable JDK on a flashdrive and brought it over to my computer, however, it can not be used because the JDK points to the JRE on the flashdrive. How do I change this? Where are the java configuration files and what are they called?
Comment: which os do you use? Windows? then look in the registry under  HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
Answer: simplest way in windows creat batch file
set JDK_HOME= .\
set PATH=%PATH%;%JDK_HOME%\BIN
Answer: Set the (system) environment variable to point to the flashdrive JDK location.  Also if you open a command prompt after doing this you will be able to execute javac and see some output.
Answer: If you are using Windows, try opening Control Panel and clicking on "Java".  You can edit a number of different settings from this panel.

JDK points to wrong JRE


How can I make a program to verify file integrity?

Question: How to make a program that calculates a checksum of a file? What is the exact process of calculating a checksum?
Comment: See http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/md5sum.c
Comment: Do you know how to program in any language? If so, have you tried searching for "sha256 "?
Answer: Checksums are simply numbers that help verify that a particular set of data (a file, for example) is unchanged from the last time it was checked.  I can create a message here, compute the checksum is 42, then send you the message.  You compute the checksum of the message you received, and if you also get the same number I told you (42), you have increased confidence that the two messages are identical.  We say that the message's integrity was preserved.
But checksums are math operations, so how do they work on things like word documents and letters and pictures?  Keep in mind that a file (or any set of data) is just a collection of bytes to a computer.  It doesn't matter if it's a text file, a spreadsheet, or a digital picture, it's just a series of bytes.  And all bytes are just numbers - they only mean things like letters and pictures when we use programs to display them that way.  (Some common translations of text to numbers you may have heard of include ASCII and Unicode.)
The important thing is that to a computer, any file is just a series of numbers.  And that's helpful for making a checksum routine work.
Creating the simplest kind of checksum can be done by literally adding up each byte of a file, and printing the sum total of all the bytes.  If I have a file containing the five bytes that represent HELLO using ASCII, the checksum using this simple approach would be 72+69+76+76+79=372.
However, that's not a very good checksum.  Remember, we want to make sure the file isn't changed.  But if I rearrange those same letters into a different word, like HOLLE or OHELL, the checksum is still 372.  I could even replace letters with other letters that add up to the same sum.  So most checksum algorithms do something to take into account the order of the bytes.  A simple checksum algorithm in very common use today is called the Luhn algorithm. It uses a multiplier that doubles every other character.  These are used on virtually every credit card account number to make sure that someone doesn't accidentally make a typo when entering the credit card number into a computer.
(In the case of the Luhn algorithnm, instead of telling you the checksum in a separate message, an extra digit is added to the account number to make the checksum of the algorithm equal to zero.  Anyone who wants to validate the credit card number was entered correctly just adds up all the digits in the appropriate way, uses modulo division by 10 on the sum, and ensures their result is zero.)
So that's how you'll have to make your program.  Determine an appropriate checksum algorithm, read a file, compute the checksum as you go, then when you've reached the end of the file, print the checksum and exit.
Comment: Thank you so much for the help! Really appreciate your time.
Comment: But can you explain how a SHA256 or MD5 checksum of a file is calculated?
Comment: You'll have to look at a description of the SHA256 algorithm to understand how it works.  See https://en.wikipedia.org/wiki/SHA-2 for more info including a pseudocode example of the algorithm.
Answer: By checksum you are probably referring to hashing.
Hashing libraries are available in practically every programming language. Depending on how you want to use it, you could use it in a shell script (bash or Powershell for example) too.
All of them do the same thing. Take your file as input and spit out the hash.
e.g., In a shell script:
md5sum myfile
sha25sum myfile

In python (one similar question here on StackOverflow -- please look at the answer, not the example in the question!):
import hashlib
myhash=hashlib.md5(open('path_to_myfile', 'rb').read()).hexdigest()


List of allowable Linux password characters

Question: Sadly, I have been doing Linux Administration for a short while and I still have NO idea where to find a comprehensive list of allowable characters for a linux password.  My guess is that this may be because the configuration might be different on different systems depending on the configuration, for example:  passwd file vs Open LDAP.  Is there any comprehensive list of allowed Linux credentials when using authz/passwd/shadow files?
Comment: Old versions of `agetty` interpreted characters `@` and `#` in a special way. You could not have those characters in username or password to be able to login on the local text console. See [Special characters in agetty.c](https://stackoverflow.com/q/11445504/320437)
Answer: Anything you can type is fair game in a standard Unix password - I'm not aware of any Linux-specific restrictions. With the caveat that a newline (Return/Enter) usually ends password input, any character you see on your keyboard is fair game.
Special keys are also allowed (arrow keys, function keys, page up/page down), as are some things you CAN'T type (you can go ahead and put a vertical tab in your password if you want to - it's just going to be VERY inconvenient to use that to log in unless you can cut and paste the character).
Be aware that these keys/characters may not work the same over a network connection as they do on a console though -- typically they aren't used for that reason.

The one "special case" I'm aware of is that a NUL character (ASCII 0) would probably be interpreted as "END OF STRING" and anything after that in your password might be discarded.
Comment: Some applications will add additional restrictions.  Maybe a terminal emulator accepts `[` as starting a control sequence, for example, or a poorly-written web application improperly reads `\ `.  When I was generating initial passwords to be used by application accounts at a previous employer, I limited the set of non-alphanumerics to just a few characters known to work in all of our applications, because we had hired some spectacularly bad developers & bought truly junk software over the years.
Comment: This is definitely not true. I just found one counter-example. On Ubuntu, the Unicode character u00a4 does not work. You can set such a password, but the login screen will not accept it. Whether this is by design, or simply an edge case that has not been tested, I don't know. So unfortunately, you might be stuck with just using ASCII characters.
Answer: It will help if you can provide your Linux distribution. This can be defined per system and as you rightly point out if something like LDAP is in place it may be defined there.
If using pam_cracklib(8), this is defined in
/etc/pam.d/system-auth on Red Hat/CentOS/Fedora systems. If defined you should see something like this:
password required pam_cracklib.so minlen=12 lcredit=1 ucredit=1 dcredit=2 ocredit=1

On Ubuntu systems this would be under /etc/pam.d/common-password. See https://askubuntu.com/questions/156850/setting-minimum-password-requirements
Comment: This answers the question `How do you set requirements for (stronger) passwords?` (complexity, length, etc.). It *does not* appear to answer the question asked above (`What characters may I use in a password?`)
Comment: I use mostly RHEL, specifically CentOS with some Ubuntu peppered in.  I am surprised to hear that it is distro specific.  If we are strictly talking about /etc/passwd and /etc/shadow with a default install, where are the allowed characters defined?
Answer: Just stick to the 95 printable characters in ASCII for Linux passwords and you should be fine.
In a LDAP tree the Schema is responsible for information constraints. You should study your implementation specific schemas.


How can I "require('web3')" on Amazon AWS Lambda?

Question: If I understand the documentation correctly, I need to build web3.js on AWS Lambda. How can I do that and which version should I use?
Answer: Just npm install web3 locally. On my Mac machine the only issue then was the building of the scrypt package. You can add an install script to your package.json to build it locally:
"install": "[ -e node_modules/scrypt/build/Release/scrypt.node ] || docker run --rm -v $PWD:/data -w /data node:6 npm install scrypt"

Note: You need docker installed. Solution from https://stackoverflow.com/a/48487001/5887673.
Answer: If anyone is still having issues with running web3 > 1.0.0 and you're using SAM local to test it, consider running sam build --use-container prior to executing the lambda with sam invoke local .
This will build and install any dependencies inside of a amazon linux container instead of building it locally.
Answer: If you are still looking to build web3 on aws lambda, use a combination of serverless framework, serverless-plugin-scripts and docker to prebuild the node modules before deploying, more details here: web3 serverless


Error while installing updates in Ubuntu 18.4

Question: I have this error while installing updates in Ubuntu 18.4. I have followed the troubleshooting steps mentioned earlier but I still get the same error
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
                                                                                dpkg: error processing package linux-headers-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-headers-generic (= 220.127.116.11.45); however:
  Package linux-headers-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-headers-4.15.0-43
 linux-headers-4.15.0-43-generic
 linux-headers-generic
 linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can you help on this regard.
here is the output of the df-h
Filesystem      Size  Used Avail Use% Mounted on
udev            915M     0  915M   0% /dev
tmpfs           189M  3.3M  186M   2% /run
/dev/sda6       273G   99G  160G  39% /
tmpfs           945M   28M  917M   3% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           945M     0  945M   0% /sys/fs/cgroup
/dev/loop0       21M   21M     0 100% /snap/gnome-logs/25
/dev/loop2      4.8M  4.8M     0 100% /snap/notepad-plus-plus/171
/dev/loop4      1.7M  1.7M     0 100% /snap/gnome-calculator/154
/dev/loop3       13M   13M     0 100% /snap/gnome-characters/69
/dev/loop1      411M  411M     0 100% /snap/wine-platform/58
/dev/loop5      1.5M  1.5M     0 100% /snap/notepad3/91
/dev/loop6       90M   90M     0 100% /snap/core/6130
/dev/loop7      6.4M  6.4M     0 100% /snap/gnome-clocks/85
/dev/loop8      203M  203M     0 100% /snap/vlc/768
/dev/loop10      13M   13M     0 100% /snap/gnome-characters/139
/dev/loop12     3.8M  3.8M     0 100% /snap/gnome-system-monitor/57
/dev/loop13     411M  411M     0 100% /snap/wine-platform/74
/dev/loop11      54M   54M     0 100% /snap/core18/536
/dev/loop9      131M  131M     0 100% /snap/gnome-3-28-1804/4
/dev/loop14     2.0M  2.0M     0 100% /snap/notepad3/94
/dev/loop15      54M   54M     0 100% /snap/core18/594
/dev/loop16      54M   54M     0 100% /snap/core18/677
/dev/loop19     4.8M  4.8M     0 100% /snap/notepad-plus-plus/184
/dev/loop18     203M  203M     0 100% /snap/vlc/770
/dev/loop22      92M   92M     0 100% /snap/core/6259
/dev/loop21      91M   91M     0 100% /snap/core/6350
/dev/loop17     3.4M  3.4M     0 100% /snap/gnome-system-monitor/36
/dev/loop20     410M  410M     0 100% /snap/wine-platform/56
/dev/loop23     136M  136M     0 100% /snap/gnome-3-28-1804/9
/dev/loop24      35M   35M     0 100% /snap/gtk-common-themes/818
/dev/loop25      15M   15M     0 100% /snap/gnome-logs/45
/dev/loop27     2.3M  2.3M     0 100% /snap/gnome-calculator/260
/dev/loop26     4.8M  4.8M     0 100% /snap/notepad-plus-plus/173
/dev/loop28     196M  196M     0 100% /snap/vlc/555
/dev/loop29     1.5M  1.5M     0 100% /snap/notepad3/89
tmpfs           189M   16K  189M   1% /run/user/120
tmpfs           189M   40K  189M   1% /run/user/1000

output of sudo apt install  -f
[sudo] password for seshagiri:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package linux-headers-4.15.0-43 needs to be reinstalled, but I can't
find an archive for it.

I did try other things to resolve the issue
I tried to remove and install the packages using the following commands commands: remove - remove packages and autoremove - Remove automatically all unused packages update - update list of available Configuration options apt.conf(5).
Hello N0rbert I tried the following steps again still I get the same error I am unable to fix this issue.
sudo dpkg --configure -a [sudo] password for seshagiri: dpkg: error processing package linux-headers-4.15.0-43 (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration dpkg: dependency problems prevent configuration of linux-headers-4.15.0-43-generic: linux-headers-4.15.0-43-generic depends on linux-headers-4.15.0-43; however: Package linux-headers-4.15.0-43 is not configured yet. – Seshagiri Rao Jan 30 at 12:57
dpkg: error processing package linux-headers-4.15.0-43-generic (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic –
I am really worried, I don't want reinstall the Operating system. My apologies.
I still get the same error message "Package operation failed
The installation or removal of a software package failed". any solution to this problem  is a big welcome.
There was no issue with the first command.
I just ran the following command and this is the output I get
apt-get remove --purge linux-headers-4.15.0-43
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-headers-4.15.0-43* linux-headers-4.15.0-43-generic*
0 upgraded, 0 newly installed, 2 to remove and 4 not upgraded.
2 not fully installed or removed.
After this operation, 89.9 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 205737 files and directories currently installed.)
Removing linux-headers-4.15.0-43-generic (4.15.0-43.46) ...
dpkg: error processing package linux-headers-4.15.0-43 (--remove):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting a removal
Errors were encountered while processing:
 linux-headers-4.15.0-43
E: Sub-process /usr/bin/dpkg returned an error code (1)
You are correct, my system keeps freezing every time I have some or the other updates to install.
I searched again over the net and found the following set of commands has resolved the issue.thanks guys
sudo dpkg --remove --force-remove-reinstreq  linux-headers-4.15.0-43.
apt install linux-headers-4.15.0-43
Comment: Please add output of `df -h` and `sudo apt install -f` to the question.
Comment: tmpfs           189M   16K  189M   1% /run/user/120
tmpfs           189M   44K  189M   1% /run/user/1000
Comment: Please add such information inside question - not in comments! Consider to remove all comments and add info to question.
Answer:
remove package info from apt cache with rm -rf /var/cache/apt/archives/*
run apt-get remove --purge linux-headers-4.15.0-43
run apt-get update
run apt-get -f install

Let me know what state  you're in. might be there was some issue when you have downloaded the package earlier.


iPhone 5 contacts app

Question: On my contacts app it says "me" next to my mom's contact but I'm not entirely sure what that means. Does this mean she's using my number on her phone for imessage or is it simply that I am on the same Apple ID as her?
Answer: That means that contact has been designated for Siri to use when she needs personal information about you.
For example, if you have a contact created with your home address you can then ask Siri for "directions to home".  She will look up the home address attached to the "me" contact.
You can change which contact the "me" is attached to by going to Settings > General  > Siri > My Info and selecting a different contact.
Apparently this setting also can be changed here: Settings > Mail, Contacts, Calendars> My Info.
Answer: settings>> mail, contacts, calendars>> scroll to contacts>> my info... Select yourself...
Done

iPhone 5 contacts app


How to map a standard field like phone to custom field in opportunity to a custom field

Question: I'm new to sfdc.In my organization i tried to map phone standard field in lead to opportunity custom field.But i didn't get mapping field in map fields.I also create a formula field and tried to do mapping with that field.But i didn't get my custom field in that section.Can anyone help me to resolve this issue.And in lead field some data is available.
Comment: you should be able to map custom formula fields on Lead to custom Oppo fields of the same type. Please be more specific
Comment: I want to map a standard field called phone in lead object to map to a custom field in opportunity..@crop1645
Answer: Here is how to do this

Create a custom text formula field on Lead Phone as Text. The formula is simply Phone.
Map this field in Lead Field Mapping to a custom Opportunity field (also of type text)

You can't map fields from Lead of type X to an Opportunity field of some different type.  And, you can't create formula fields of type Phone.
Should you absolutely have to have a field on Opportunity of type Phone, you'll need to

Create a custom (non-formula) field of type Phone on Lead
Create a workflow or process that on create and every edit, does a field update from Lead.Phone to Lead.PhoneCustom__c
Create a custom field of type Phone on Opportunity
Lead field map Lead.PhoneCustom__c to Opportunity.Phone__c
Comment: Already i had created a new custom text field in lead and created a workflow based on lead status every time edited it works fine and i can map easily but is it best practice to do so because so many times lead status has changed every time workflow will fire right even unnecessarily.is there any other way to do so.@crop1645
Comment: The options I outlined above are the only ways point-and-click I know of (plus Blair's answer). Otherwise, you end up with  trigger work to do the mapping yourself from the convertedLead.  I wouldn't worry about the overhead of the workflow
Answer: You cannot map standard fields but you could build a process to insert that value into opportunity using Process Builder.

Select "Lead" as the object.
For the criteria select the "Converted" field and make it equal to true. You can also define more criteria as you see fit.
Then go under Create >Flows and click on "New".
Add a "Record Update" element.
Name it and select the object you want to update "Opportunity".
Select any criteria you have for the records and then choose the field.
Set the field you want to map to another value.
Create a new sobject variable choosing "Lead" as the object.
Then select the field you would want the opportunity field to match.
Select the element as the starting element.
Go back to the process and click on immediate actions.
Choose the flow option and add the flow.
Set the flow variable, save, and activate.
Comment: Can you add some detail around how you would use `Process Builder`? This answer is likely to get flagged for deletion as it stands, because it is very short and contains little more than a link.
Comment: can you share or show create a process means like define criteria and action how to specify a condition lead is converted. @Blair Kristin


Forgot google account?

Question: Ok so my girlfriend changed her google account after she bought a new phone but she still had the old Google account before she changed it on the new phone cuz that's what she set up on it when she bought it but now she can't remember the new one cuz we had to factory reset the phone.  So the question is can we back the phone up to the old Google account on it or not?   Or is there nothing at all we can do unles she remembers the password?
Answer: You can try to recover your girlfriend's account with this link - Google Account Recovery
Hope this helps and she manages to retrieve her account =)

Forgot google account?


How to check if alarm is set

Question: I'm trying to check if my alarm is active or not. The alarmIsSet method will return false before the alarm is set, true when the alarm is set. So far so good, however, after the alarm i canceled alarmIsSet will continue to return true until I reboot the device.
How do I fix this?
public class Alarm extends Activity {
    private Intent intent = new Intent("PROPOSE_A_TOAST");

    private void alarm (boolean activate) {
        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
        PendingIntent pi = PendingIntent.getBroadcast(this, 0, intent, 0);

        if(activate == true) {
            int type = AlarmManager.ELAPSED_REALTIME_WAKEUP;
            long interval = 3000;
            long triggerTime = SystemClock.elapsedRealtime();
            am.setRepeating(type, triggerTime, interval, pi);
        } else {
            am.cancel(pi);
        }
    }

    private boolean alarmIsSet() {
        return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_NO_CREATE) != null;
    }
}

Answer: You just have to add
pi.cancel();

after
am.cancel(pi);

Answer: After having some headaches with this stuff myself, I found out that if I somehow had created a pending intent while testing stuff, that it actually was not cleared between tests. Even killing the app didn't do it. The intent still stayed in the system and kept returning true when checking for it. I actually had to write some code to kill it before it tested right.
Answer: Easiest way is to check the values of the (date and) time in the alarm variable, if it is not the same value as when an alarm has not been set (for you to check once what that is) then it would indicate the alarm is active and at the time of the check in the program it is either a time that has passed and the alarm has sounded or it is  a time that is yet to arrive and the alarm has not yet sounded or gone off. Note that the rules may permit only one alarm activation per device session before a reboot or power off or every 12 or 24 hours and that could be why the status is not cleared.

How to check if alarm is set


How to translate the phrases "both worlds" and "the best of both worlds" into Classical Latin?

Question: How to properly write the expression "the best of both worlds" and the shorter phrase "both worlds" (meant in the same context as in the larger phrase) in Classical Latin?
Answer: An alternative, more classical phrase for "world" would be orbis terrarum (literally, circle of lands).  So "both worlds" would be orbes ambo terrarum and "best of both worlds" would be optima orbium amborum terrarum.  This is awkward, so prefer optima mundorum amborum if you are OK with post-classical usage.  Also, if the context is clear, optima orbium amborum would work (cf. the papal blessing urbi et orbi, "to the city and the world").
Note optima (plural).  The English is short for "the best things of both worlds".  The "best thing of both worlds" would hardly make sense as it would just be from one of them.
Answer: The standard word for "both" is ambō, which inflects like duō "two", and the most common word I know for "world" (though it was a poetic calque until post-Classical times) is mundus.
So "both worlds" would be mundī ambō. For "the best of…" you would want a partitive genitive, optimum mundōrum ambōrum.
Comment: This actually is NOT a partitive genitive; it's a genitive of possession (since "the best" here presumably includes aspects of each world, like scientific advancement, for instance, that are not composite parts of them, but that are abstract qualities they possess...you also wouldn't say "a girl's beauty" is a partitive either, I hope).  A partitive genitive would be "the better of two worlds" (*melior orbium duorum terrarum*) or the "the best of all the worlds (*optimus orbium omnium terrarum*).
Comment: Thank you.

Would _mundōrum ambōrum_ also be grammatically correct on its own, or or is _mundī ambō_ the only correct way to write "both worlds" without "the best of "?
Comment: @JCG _Mundōrum ambōrum_ means "…of both worlds".
Comment: C Monsour: Allen & Greenough p.346 (213 reprint): "Partitive Genitive 2. Numerals, Comparatives, Superlatives, and Pronomial words....". The use of superlative "best" indicates that "the best (parts) of both worlds" is an ex. of the partitive genitive. A & G p342 (211 reprint): "Possessive Genitive: Footnote (1) section (2): "the person or thing that possesses some feeling or quality...In the latter use it is sometimes called the Subjective Genitive; but this term properly includes the possessive genitive and several other genitive constructions..."; "beauty of the girl" --subjective genitive.
Comment: @tony Sometimes "the best of X" does refer to the best parts of X.  Sometimes it refers to the best qualities of X.  In the former case, it would be a partitive genitive.  I would maintain that this is an example of the latter case.


Capitalization of Bayesianist and frequentist

Question: I wonder how Bayesianist and frequentist are correctly capitalized. I figure that Bayesianist is spelled with a capital B (named after Thomas Bayes), yet frequentist with a miniscule f as it doesn't contain a proper name. Am I right?
Comment: This would be the usual assumption.  But it's not unusual for a term derived from a proper name to become lower-cased in practice, after several transformations.  Only very rarely does a term that is not derived from a proper name become capitalized in practice -- I can't think of any examples just now, but I'm sure I've run across a few.  Ultimately, what is "correct" for technical terms is determined by the corresponding technical community.
Comment: This is a very localized question and is probably best answered by asking that particular community or by looking at texts and articles to see how they tend to do it. google for those two keywords together to see examples and use the most common pattern. Or ask at [Crossvalidated SE](http://stats.stackexchange.com/)
Answer: From Wikipedia on the capitalization of eponyms:

Because proper nouns are capitalized in English, the usual default for eponyms is to capitalize the eponymous part of a term. When used as proper adjectives they are normally capitalized, for example Victorian, Shakespearean, and Kafkaesque.
However, some eponymous adjectives and noun adjuncts are nowadays entered in many dictionaries as lowercase when they have evolved a common status, no longer deriving their meaning from the proper-noun origin. For example, Herculean when referring to Hercules himself, but often herculean when referring to the figurative, generalized extension sense; and quixotic and diesel engine [lowercase only].
Comment: This provides some background, but it doesn't actually answer the question. Which camp does *bayesian* or *bayesianist* fall into? The class containing *Kafkaesque* or the class containing *diesel*? And why should it be classified that way?
Comment: @AndrewLeach It should be capitalized. I doubt that Thomas Bayes has earned such a place in common reference as Hercules, warranting the "generalized extension sense," stated above, with lower case. Bayesianist and Bayesian should always be capitalized, unless the reference becomes a common adjective like "herculean," which can be either.