Why has Libertarianism achieved so little as a political ideology in the World?

Question: Since Libertarianism can be defined as a political philosophy that advocates only minimal state intervention in the free market and the private lives of citizens, but when it comes to actual policies, do they seem far-fetched to adopt? I think that reducing bureaucracy and improving government expenditure in terms of spending seems plausible but outright claims that the federal government is imposing tyranny seems excessive. Have any studies been conducted by political academics regarding this particular quandary?
Comment: @Trilarion Rather than "why not dominant?" the Q might be better thought of as "why so little success?".  Can you name a city or state that is run by a government elected on the Libertarian ticket?  Even with Communism, it's not hard to find some, somewhere.  Why not Libertarianism?  Esp in USA.
Comment: "...this particular quandary" I struggle to understand this? What is exactly meant here? From the question I would not have much ideas why Libertarianism would actually need to be a dominant ideology. Is this question simply asking about disadvantages of Libertarianism in a bit of a roundabout way?
Comment: @Trilarion Actually I'm using this website after a while, so my question may feel a bit vague, but tdlr  is why libertarianism policies are not being implemented in governments in general, and are still seem as unorthodox?
Answer: When transitioning from strongly state controlled economy to Libertianian one, it is possible to have a crash so hard that it results in dictatorships coming to power via democratic elections. Countries like Russia did have the post-Soviet Libertianian stage with mass privatization. Looks like the voters were not impressed. Even in Baltic states, the former Communist leaders suddenly came back to power after privatization and its consequences but happily did not went so badly there. And dictatorhsip is as bad thing to have. Every single Libertianian would agree.
Liberal thinking was dominated at the time by an almost neoconservative belief that generous social programs and labor protection were irrelevant or even harmful. Millions of Russians continue to hate liberals who oppose building a social welfare state. Many of the highly placed liberal politicians were unable to resist the temptations of enriching themselves through corruption. Some of those same liberals now occupy senior government posts in Putin's regime, further discrediting the word Liberalism in Russians' minds (and differences between Liberalism and Libertarianism are by many poorly understood). You can read more about the historical context in Russia here.
I agree with one of comments that the power gained can be used to seize more power, the process getting runaway. Finally those in power say they do not need Libertianianism anymore and it will be totalitarian regime now instead. Or, if this is wrong, this is a myth that makes Libertianianism unpopular and they should work on clarification.
Comment: How do you avoid robber barons and chicago mobs when you have minimal state? Having strong law enforcement alone makes your state not so small.
Comment: Not sure about the details but post-1991 Russia was more "Robber Barons meets Chicago Mobs to rob privatized SEOs" than Libertarianism.  Or free markets.  Or any thought-through political system, especially one minimizing state intervention IIRC tax rates were ministry-by-ministry and not coordinated, so you could in theory be liable for more taxes than your profits - hardly a study in state footprint minimization.
Comment: @justapasserby That's not a relevant factor (and the soviet education system would not have produced any free market experts anyway). "Intellectuals" are not what's needed to reform the economy of a collapsing state, economic experts are. And Russia spared no expense in getting free market experts from the west to reform their economy; things just did not pan out. Look up the efforts of Jeffrey Sachs, who was an American economist part of a team in the 90s sent to reform the Russian economy.
Comment: @uberhaxed Economic experts are intellectuals. But it's all irrelevant anyway. When the state is collapsing, facts go out the window - what matters is *power*. The ability to make other people follow your orders and shoot the other people who are trying to make people follow their orders instead. Whoever manages to come out with the most followers ends up dominating and becoming the state. See the phrase "power vacuum"
Comment: I agree that likely something was wrongly done there at the time.
Comment: I think that due to years of purges and expulsions of intellectuals, they did not have the expertise to reform the economy, so things went sour very quickly when they tried to implement free market and libertarian policies. What do you think?
Comment: @user253751 Usually when states collapse, neighbors come in to annex the territory. The power vacuum concept is really something more common in the last century because absorbing your neighbor is less common. Why this didn't happen with the post soviet states is obvious, the US (particularly) was not interested in another country having the soviet weapon arsenal when the treaties and agreements they had with the USSR allow them to keep a close eye on it. So they had a vested interest in keeping Russia as a stable state.
Comment: Additionally: The most stable state is some variety of three-layer dictatorship - dictators on top, then the middle layer of repressive police who gets rewarded by the top layer for keeping the lower layer from rising up. Democracies don't seem to be particularly stable. Nature tends towards stability.
Comment: @user253751 Sure. But there were still laws. Police. Traffic regulations. It's possible to have a totally failing economy and still have many strict laws. That's not Libertarianism.
Answer:
Since Libertarianism can be defined as a political philosophy that advocates only minimal state intervention in the free market and the private lives of citizens

Pretty much every popular ideology thinks it is removing bureaucracy and decreasing state intervention in areas where there shouldn't be any, as well as increasing it in areas that need more. Which is to say, every popular ideology thinks it advocates for the smallest possible government. Even fascists think a very strong government is necessary or else society will crumble.
For example, you may notice the Democrats want smaller government stopping people from being gay or transgender (because they believe it is not necessary and actively harmful) and bigger government spending on social welfare programs (because they believe the current amount is lower than what is actually necessary) while Republicans want the opposite, because they believe it is harmful to be gay or transgender or to spend any money on welfare.
Libertarianism is just another of those. It is no unique outlier. Libertarianism doesn't advocate for no government, but rather, it still advocates for the government to do certain things, such as enforcing private property boundaries, even more strongly than current governments do. Libertarian policies very frequently align with Republican policies and so a lot of Libertarians get absorbed into the Republican party. I expect this is true in most parts of the world that have similar parties, not just the USA.
An ideology that actually advocates for no government is anarchism, which is generally considered an extreme left-wing ideology. Libertarians do not agree with anarchists because the anarchist "state" does not protect private property rights.
The main difference between Libertarian and conservative ideology is that Libertarians do not support the government imposing restrictions on private behaviour such as homosexuality or drug use. However, they also do not support the government imposing restrictions on other people imposing restrictions on private behaviour. A Libertarian state would still require people, on average, to follow the most popular restrictions or else they would be unable to find employment, food or shelter. This is not really much different from a democratic state where the people vote for which restrictions the state should enforce.
Comment: Anarchism has adherents on both the far right and the far left. Compare anarcho-capitalists vs anarcho-communists. In my experience, the former are more common.
Comment: See also left-libertarianism though. Rather absent in the US.
Comment: @user253751 Anarcho-capitalism is no more of an "oxymoron" than anarcho-communism or anarcho-syndicalism are.
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/143273/discussion-between-user253751-and-user76284).
Answer: Mostly answering wrt the US Libertarian position, since I don't know if too many other countries have a significant explicit party in this domain.
Racism (by some of its members)
The Hill oped - blames it on racism
He probably has a point in practice, but I would not say racism is a feature of Libertarianism per se.

In May, the party was taken over at its national convention by the so-called Mises Caucus, a far-right group, some of whose members have been associated with racist and antisemitic ideas. The caucus is named after the libertarian economist Ludwig von Mises, whose philosophy was pretty crude (as I explained in the book) but who firmly condemned racism.
On Martin Luther King Jr. Day this year, the Libertarian Party of New Hampshire tweeted (in a later deleted post) that "America isn't in debt to black people. If anything it's the other way around." Caucus members have called for violent repression of antifa and Black Lives Matter protesters.

 Libertarian Party platform - positions that do not appeal to too many people.

Parents should have control of and responsibility for all funds expended for their children's education.
Retirement planning is the responsibility of the individual, not the government. Libertarians would phase out the current government-sponsored Social Security system and transition to a private voluntary system.
To further that end, we call for the repeal of the income tax, the abolishment of the Internal Revenue Service and all federal programs and services not required under the U.S. Constitution.
Therefore, we favor the repeal of all laws creating "crimes" without victims, such as gambling, the use of drugs for medicinal or recreational purposes, and consensual transactions involving sexual services.
We oppose the administration of the death penalty by the state.

It's not hard to see how some of these are not going to be very appealing across the US ideological landscape (the last 2 are going to be unpopular with religious conservatives).  Reform of pensions for example is a political live-wire everyone avoids.
Seems to me that US Libertarians are stuck in the same kind of rut Germans Greens wrt "fundis vs realos", with the fundis being in the ascendant within the party, but unappealing outside of it.  People often talk about big-L Libertarians - those are the people who are not getting elected.
It's also interesting, when you talk to hardcore Libertarians individually, how regulations will be replaced by legal arbitration and contract law.  The benefits of replacing regulation by litigation is not an entirely convincing argument.
Donald Trump and foreign policy.
For those libertarians hoping to get in via the Republican back door, times are tough, with the Reps ditching much of their small-government roots lately.

There are areas, certainly, in which Trumpism and libertarianism will peacefully co-exist; school choice, as evidenced by Trump's selection of Education Secretary Betsy DeVos, is one example. Deregulation is another. But by and large, they cannot be reconciled. Where libertarians champion the flow of people and capital across international borders, Trump aims to slow, or even stop, both. Where libertarians advocate drug legalization and criminal justice reform, Trump and his attorney general, Jeff Sessions, seek a return to law-and-order policies. Where libertarians push to protect the First and Fourth Amendments, Trump pushes back with threats of banning Muslims and expanding the surveillance state. And where Mulvaney has dedicated his career to the argument that dramatic fiscal measures are needed to prevent the United States from going bankrupt, Trump campaigned unambiguously on accumulating debt, increasing spending and not laying a finger on the entitlement programs that make up an ever-growing share of the federal budget.

And their avowed goal of isolationism can seem naive at times.

Polling suggested as much. In November 2013—when Rand Paul was riding high—43 percent of Republicans said U.S. anti-terrorism policies were going too far in restricting civil liberties, while 41 percent said they weren't going far enough to protect the homeland, according to Pew Research. In September 2014—during the immediate aftermath of the Foley and Sotloff execution videos—those figures were 24 percent and 64 percent, respectively. The shift in sentiment would only accelerate. A separate poll in September 2014, commissioned by CBS News, found that 39 percent of Americans favored sending U.S. ground troops to Iraq and Syria to fight ISIS, with 55 percent opposed.

Do they really have no success?
However, as an influence on politics in general, especially in the US, small-l libertarians, advocating for a smaller state, do have some influence within the Republican party.  And, really, cutting red tape, axing corporate subsidies and promoting individual liberties are views that are fairly popular in general.  Balancing budgets may not be all that popular, but there are intergenerational equity risks with running near-constant deficits.
In short, viewing the role of government through a watered down version of libertarianism when deciding on laws, regulations and policies is viewed as helpful, at least by some.
Which is, to some extent, not that dissimilar how Green parties struggle to get elected on their own ticket, but manage to get quite a few of their principles adopted by mainstream parties.
Pure big L-ibertarianism on other hand is unpopular because it is a reductio ad absurdum position with obvious shortcomings in its practical application and ethics.
Comment: I don't think this answer is wrong, but a problem with analyzing the popularity of third parties in the US is that first past the post voting discourages voting for third parties across the board.  Currently there are zero third party members of Congress.
Comment: https://en.wikipedia.org/wiki/List_of_third_party_and_independent_performances_in_United_States_elections assuming the accuracy of this page even at the state level 3rd party victories are rare.
Comment: The 3 elected Independents all caucus with Democrats (I think they're all even former Democratic party members).  Rand Paul and his father, are/were small-l libertarians but again are/were Republicans while in office.  Even Gary Johnson I don't think has ever actually held an elected position in government as a Libertarian, and he was the governor of New Mexico for awhile (again as a Republican).  My point I think actually aligns with what you're saying, the popularity of libertarianism in the US isn't exactly aligned with the popular vote records of the Libertarian Party, because of FPTP.
Comment: @IllusiveBrian There is a bit of truth to that.  But the lack of success seems to extend quite a bit downstream from the US congress, to state legislatures and town mayors.  Do you think the party duopoly is that strong on those levels?  It might be, but still. And Sanders for example is an independent.  Mind you, in a way shouldn't Rand Paul count as an elected Libertarian?
Answer: Apart from all the other reasons already mentioned, there is also the aspect that there are limited incentives for elected officials to reduce their own budget, and limited possibilities to reduce someone elses budget.
Even if a politician thinks that less money should be spent on some area they are responsible for, if they actually cut expenses there, without increasing expenses elsewhere at the same time, they will effectively loose some power. Founding government programs is more prestigious than shutting them down.
Comment: "Founding government programs is more prestigious than shutting them down." But that would be the job description, shutting down something, of any Libertarian politician by definition. I agree in general but not for Libertarians. They should rejoice at defunding, cutting and slashing and finally putting themselves out of the job, shouldn't they?
Comment: @Trilarion Yes. I guess what I'm trying to say is that politicians who want to  actually reduce the influence of the state would need to be either more idealistic than others, or have an alternative career plan that does not involve being reelected to the same position.
Answer: Libertarianism is the free market masquerading as a political philosophy. Markets are not known for either philosophy or politics. It's where you go to buy and sell stuff.
I do not expect a politician to tell me where to go to get the best deal on a mobile phone and nor do I expect a philosopher to tell how to best to sell a used car.
Why then we think we should go to business men to tell us about politics or philosophy or even political philosophy beats me. They'll only sell you a political philosophy that benefits them. And more fool you.


Does God really punish?

Question: Does God really punishes or take revenge from humans? For eg- If someone asked something from God and took a vow that if he gets that thing, he will do something. He gets that thing but he did not fulfil his vow to God.
Now..will God punish really him or take revenge to him?
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/99456/discussion-on-question-by-jacky-does-god-really-punish).
Comment: Yes. But that is karmic reaction. Like the Newton's third law pertaining to action and its reaction. God is always merciful. His material potency works in all these cases of action and reaction, rewards and punishments.
Answer:
Does God really punish?

Yes he does, according to the Vedas. Brahman is the giver of the fruits of action, meaning he rewards and punishes accordingly.
The Brahma Sutras are a summary of the Upanishads (part of Vedas), and here is what Ramanujacharya says in his commentary on the Brahma Sutras:

Sruti and Smriti alike declare that the connexion of the individual souls with bodies of different kinds--divine, human, animal, and so on--depends on the karman of those souls; compare 'He who performs good works becomes good, he who performs bad works becomes bad. He becomes pure by pure deeds, bad by bad deeds' (Bri. Up. IV, 4, 5). In the same way the reverend Parâsara declares that what causes the difference in nature and status between gods, men, and so on, is the power of the former deeds of the souls about to enter into a new creation--'He (the Lord) is the operative cause only in the creation of new beings; the material cause is constituted by the potentialities of the beings to be created. The being to be embodied requires nothing but an operative cause; it is its own potentiality which leads its being into that condition of being (which it is to occupy in the new creation).' Potentiality here means karman.

So, the Jivas do good and bad actions and Brahman (God) punishes them accordingly.

He gets that thing but he did not fulfil his vow to God. Now..will God punish really him or take revenge to him?

If you make a vow, but then fail to fulfill it, or break the vow, then it's a sin and the person is liable to punishment.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/99420/discussion-on-answer-by-ikshvaku-does-god-really-punish).
Answer: According to Hindu Texts, It is not the God that punishes but our own mind. The mind has its own memory which is divided into three stages, conscious, subconscious, and superconscious. Subconscious does remember everything and attracts similar thoughts to do so. Accordingly, we will act to get punishment or reward.
Source: Garuda Purana
Comment: You need to quote exact verses with chapter numbers from Garuda Purana
Comment: ...So you are saying that it's all in our mind? Then why people say that if you don't fulfill your promise made to God, then God will punish you.
Comment: 'Source: Garuda Purana' - can you add link to exact chapter/verse? You can find Garuda Purana [here](https://www.wisdomlib.org/hinduism/book/the-garuda-purana-dutt).
Comment: @sri tula si. ..Please reply
Comment: @Amit People say as per their knowledge. I said as per my knowledge. I don't on what basis people say God punishes us. May be to create a pang of guilt among us. It totally depends on how your perspective towards God.

Does God really punish?


Weird spacing in Views content after unspecified module update

Question: I'll preface this by saying, I am very new to Drupal and pretty much have no idea what I am doing.  I did not develop the site I am going to reference.  With that said, recently I updated a handful of modules, I couldn't say which ones (I can't remember) and now there is some weird spacing on one of our pages which was created with Views.
The page that is throwing a weird spacing issue is https://tarltontest.law.utexas.edu/about-the-library/hours
The issue is that the data range between parentheses is now on three lines, rather than inline with the title, ie Fall Semester Hours, Fall Finals Hours, etc.
I cannot figure out where the spacing is coming from.  I cannot see anything in the Views settings that would cause this.  IS this a template file>  CSS? I don't even know where the parentheses are coming from.
I would love any help in identifying where to possibly look to fix this.
Answer:

The issue is that the data range between parentheses is now on three
  lines, rather than inline with the title, ie Fall Semester Hours, Fall
  Finals Hours, etc.

looks fine to me...


Nested polygons, splitting by smallest to biggest using QGIS

Question: I have drainage catchments that sit within each other (i.e. a primary, secondary and major catchment area, nested). At the moment, if I was to click info in the red area in the example below, it would return three results (red, green, blue). In the green area I'd get two results (blue, green) and in the blue, just one result (blue). I'd like these separated out, so that the smallest (red) retains its shape, the next largest (green) is clipped to the smallest (red) and the largest (blue) is clipped to the green. Ultimately, I just need one answer in each polygon area.
Answer: Let's assume there is a polygon layer called 'overlaps' with its attribute table, see image below.

Step 1. Perform an intersection by means of the SAGA's "Polygon Self-Intersection" geoalgorithm

Step 2. Make use of the "Extract by expression" geoalgorithm with this expression:
regexp_match("ID",'\\|') or not is_empty_or_null($geometry)

and get the output

Additionally, the application of the "Join attributes by location" geoalgorithm can be relevant to get the initial attributes back.
Comment: Please review OP's comment under my answer.
Comment: Thank You Taras - I appreciate the above! It's given me something to work with. Much appreciated.
Answer: You can use "GRASS > Vector > v.clean" and "Vector general > Delete duplicate geometries" tools, respectively.

In v.clean window, click break as "Cleaning tool". This tool might generate some duplicate geometries.

Then, use "Delete duplicate geometries" tool.
Comment: You didn't mention that in your question body.
Comment: Thanks Kadir! This looks like it will work very well. I just need one more thing to make it correct. Each of the duplicate geometries have kept the area of the original catchment. When using the 'Delete Duplicate Geometries' I want to keep the smallest area of the duplicates. I tried using the 'Order by expression' tool first to order them smallest to largest and then delete duplicates but that didn't work. Any ideas on how to delete the duplicate geometries, keeping the smallest result from the area attribute? Many thanks again.
Comment: Duplicate polygons have the same area.
Comment: Thanks Kadir - The original overlapping polygons had an area (with the example above, the blue was 100 ha, the green is 60 ha and the red is 20 ha).  In the green, I'd have the areas 100ha and 60ha on the original attributes for the two polygons, the actual new shape has a new area all together (say 20ha) - for this one I'd like to delete the duplicate, and keep the one that has the 60 ha attribute. I hope that makes sense!
Answer: Extract the boundaries of the polygons as lines, cut the polygons with these lines and delete duplicate geometries:

Menu Vector / Geometry Tools / Polygons to Lines

Menu Processing / Toolbox / Split with lines

Menu Processing / Toolbox / Delete duplicate geometries


Is it possible to move Notepad++ window while in Post-It mode?

Question: The border disappears and the window is always on top.
Is it possible to move it on the screen without exiting the Post-It  mode (F12)?
Answer: No. All handlers regarding the moving of a window are disabled for Notepad++ when it is in Post-It mode.
I tried the following tricks with no avail, and they're pretty deep, so if none of these work, it has been disabled programatically and thus it was designed to never be moved.

move the mouse over the taskbar, wait for the preview window to show, right click it and choose move. The move option here is not present.
Using the WIN+arrow with optional shift modifier to move it that way or snap to the screen edge. Nothing happens.
I use a program called GRID Move. When holding the middle mouse button on any part of a program and moving the mouse, a grid shows up and based on where I move the mouse to, the window will be moved and sized according to this configuration. While in Post-it mode, the middle mouse button does not trigger the grid. Exiting the post-it mode, and everything works.

It is this last option that convinced me this is by design.
Comment: Just FYI you can also get the proper context menu by shift-rightclicking, rather than hovering over the preview and rightclicking.
Answer: I couldn't find a way to move NP++ while in Post-It mode. I had a good look through the documentation and the only mention of Post-It mode is how to enable it.
As Windows Snap or the Ctrl + Space menu don't work with NP++ while in Post-It mode, I would guess that it was designed to be unmovable while in that state.
Answer: You can move the post-it window using the third-party application AltMove: http://www.deskex.com/altmove/. You have to keep the Alt key pressed and then drag the window with the mouse.
Comment: Cool program ;)
Answer: There is an easy way: Just like feqwix said, you can use the tiny free utilities that allow you to grab a Window from anywhere. I use AltDrag: https://stefansundin.github.io/altdrag/
It has an installable and portable version, and it allows me to use a customizable modifier key (I just use Alt) to grab any Window from anywhere, and move it. It also comes with a few neat features. It's perfect in conjunction with the Notepad++ post-it mode.


Magento2: How can I modify custom order number?

Question: I want to modify order number 000000001 to 202000001.
Please help me in this.
Comment: https://www.mageplaza.com/magento-2-custom-order-number/
Answer: Go to your database from phpmyadmin,
Here _1 is used for store id after tablename.
Default Frontend store id is 1. if you have multi store then you have to set query for each store with table name like sequence_order_2 upto sequence_order_.*
Enter below query for table sequence_order_1 is used for default store. If you have multiple store you have to set tablename as per store id in below query.
For order placed from frontend.
sequence_order_1 is used for order id management in magento 2.
ALTER TABLE sequence_order_1 AUTO_INCREMENT=202000001;
Next order id is start from 202000001.
For INVOICE,
if you want to change invoice id
ALTER TABLE sequence_invoice_1 AUTO_INCREMENT=202000001;
For Shipment
ALTER TABLE sequence_shipment_1 AUTO_INCREMENT=202000001;
Answer:

Open your PHP Admin database.
Find & click on the table called: sequence_order_1  (it is located in database itself not in the information_schema )
Click on "Operations" tab & under "AUTO_INCREMENT" edit to desired order number.
Comment: I will check and update you. Thanks


SSL Certificates for a Citrix CAG - How to move from Thawte to GoDaddy

Question: I have a citrix CAG which currently uses Thawte's certificate. What is the process to start using GoDaddy's SSL certificate?
Answer: From the Citrix Forums - How to renew Citrix Access Gateway SSL certificate as posted by
Sam Jacobs and Jarian Gibson:
...the best way to generate a CSR for a (new or renewal of an) SSL certificate is to:

generate the CSR on any IIS server via the IIS Certificate Wizard,
send the CSR to your CA (GoDaddy in this case),
import the certificate received from your CA via the certificate wizard,
export the certificate ( including the private key! ) via the MMC Certificate Snap-in into a .pfx file,
convert the .pfx file to .pem format, and finally
import the .pem file onto your CAG


Can an editor make substantial edits and publish them without the author's permission?

Question: Can an editor make substantial edits to an author's book or paper and publish them without the author's permission?
Comment: No. The more interesting question might be what happens if someone does so anyway.
Comment: I think the situation might be different for books and articles. In my experience editors don't "edit" anything in submitter papers.
Answer: No.
Editorial review is an iterative process in which an editor, reviews and the author(s) have open (although usually blind) exchanges about the details of a manuscript. The process relies wholly on a full exchange of information between all parties.
A helpful and detailed account of a standard editorial process may be found at the National Institutes for Health website.
Comment: I will add that I'm sure some editors, using poor practice, make such changes and don't alert the author. But such practice greatly compromises editorial and scientific processes.
Comment: We tend to disprefer link-only answers. This might be flagged for further explication or for deletion.
Answer: As Cape Code remarks in a comment, things are probably different for books and papers.
For what concerns papers, it would be probably very difficult, if not impossible, for an editor to make substantial edits without author's approval for the following reasons:

The editor might not have access to the paper source files, which are frequently managed by another office.
The author usually has to approve the galley proofs before publication, and the editor changes would be easily detected. And if the editor makes a number of unapproved last minute changes, the author would be able to use the approved galley proof to put up a case against the editor.
Answer: If you have to ask the question, then it is not your original work.  As you said, you are "editing".   Editors are not the original writers.
When you change the structure of the sentence, you are paraphrasing the original passage and therefore, the original author gets credit for that!
In lieu of direct permission, a citation is an absolute must before you publish.
Comment: Welcome to Academia.SE. Sorry, but this does not answer the question, and there's nothing which suggests that the OP is the editor themselves.
Comment: Thank's for the feedback Massimo and I disagree.  I have certainly answered this question correctly.  Given the question, I don't believe we have enough information to get too specific.   What we do know is that Geramia or someone he knows [I use the term "you" in the general sense] wants to publish someone else's work after having edited it, of course in an academic paper  I assume because this is Academia and not Publishing.  Under these circumstances, I stand by my answer.


Do we distinguish two singular simplices if they have different vertex orders?

Question: We define a $\textbf{singular $n$-simplex}$ in $X$ to be a continuous map $\sigma:\Delta^n\to X$ where $\Delta^n$ is the standard $n$-simplex. Now, as an example, Let $X$ be a singleton $\{p\}$. Then is the number of $1$-simplices in $X$ one or two? I think it could be one because there is only one continuous map on $\Delta^1$ into $X$. But since $\Delta^1$ has two orders $[v_0,v_1]$ and $[v_1,v_0]$, I think the answer could be two (namely, $[v_0,v_1]\to X$ and $[v_1,v_0]\to X$).
Comment: The definition means exactly what it says, so you have already answered your question yourself.
Comment: @Eric So is the answer one? I don't know if the information about the vertex order is included in the definition of standard simplices. So I don't know whether I should say that there is just one $\Delta^1$ or two $\Delta^1$s.
Answer: The answer is one. There is only one continuous map here, so the answer is one. Actually, both the maps that you are mentioning are the same map.
Answer: This is an interesting question.
You got two answers conforming that there is only one continuous map on $\Delta^1$ into $X$, and of course this is correct. The standard $n$-simplex $\Delta^n$ is a topological space and nothing else, therefore the continuous maps living on $\Delta^n$ do not depend on a vertex ordering.
But if we consider the complete singular complex $C_*(X) = (C_n(X), \partial_n )$  of $X$, we see that the boundaries $\partial_n : C_n(X) \to C_{n-1}(X)$ depend on a particular vertex ordering of  $\Delta^n$. In fact, the standard $n$-simplex is the convex hull of the $n+1$ standard basis vectors $e^{n+1}_0,\ldots, e^{n+1}_n$ of $\mathbb R^{n+1}$. The indices $i = 0,\ldots,n$ give a natural vertex ordering of  $\Delta^n$. This allows to define $n+1$ face-emdeddings $\delta_i : \Delta^{n-1} \to  \Delta^n$, $i = 0,\ldots,n$, by mapping $e^n_j$ to $e^{n+1}_j$ for $i < j$ and to $e^{n+1}_{j+1}$ for $j  \ge i$. Then we define
$$\partial_n(\sigma) = \sum_{i=0}^n (-1)^i \sigma \delta_i .$$
You see that the face-emdeddings $\delta_i$ do depend on the vertex ordering. One could consider "ordered singular simplices" in form of pairs $(\sigma : \Delta^n \to X, o_n)$ with a vertex ordering $o_n$ of $\Delta^n$. This can be described in form of a sequence $e^{n+1}_{i_0},\ldots, e^{n+1}_{i_n}$. Any such ordering induces the following vertex ordering $\partial o_n$ of $\Delta^{n-1}$: Letting $i_k = n$, we take $e^n_{i_0}, \ldots, e^n_{i_{k-1}},e^n_{i_{k+1}},\ldots e^n_{i_n}$. Moreover, one could define face embeddings $ (\Delta^{n-1},\partial o_n) \to (\Delta^n, o_n)$ which depend on $o_n$. This would produce a variant of the singular complex. I am not going to further explore this construction, but I am sure that the resulting homology groups agree with the usual singular homology groups.
In other words: You get a more complicated construction, but do not have a benefit.
Comment: @Paul Frost I think the ordering still doesn't matter in the case OP mentions. The space being mentioned is just a single point. Any map going to it, is just going to be the constant map. However, I agree that we might have to care about how the vertices are being ordered, if the space is anything but the single point set.
Comment: Thanks. I also thought that the homology groups could be the same however I construct a chain complex. But it is indeed quite troublesome to check that.
Comment: @AspiringMathematician You are right, the standard singular simplices have nothing to with a  vertex ordering. I wanted to explain that the vertex ordering plays a role for the boundary operators.  This is normally overlooked because the $\Delta^n$ have a *natural vertex ordering*. But we could also work with more general orderings.
Answer: By definition, the "standard $n$-simplex" is one specific topological space (usually defined as $\{(x_0,\dots,x_n)\in[0,1]^{n+1}:\sum x_i=1\}$).  So, a singular $n$-simplex is literally just a map from this one specific topological space to $X$.  There is no other data involved--we don't pick an ordering of its vertices.  (Instead, just as the standard $n$-simplex is a specific topological space, it also has a specific canonical ordering of its vertices, given by the ordering of the coordinates in $[0,1]^{n+1}$.)  So, there is just one singular $n$-simplex in a singleton space.


Does the decay energy of a beta decaying isotope become lower as the half life becomes greater (or vice versa)?

Question: In other words, does half life have a correlation with decay energy of a beta particle?
Comment: Do you mean the energy of the beta particles?!?
Comment: Yes, I mean the energy of the beta particles
Comment: @LucJ.Bourhis yes, I mean the energy of the beta particles
Comment: Then no. The decays of past nuclei do not influence the decay of a nucleus in any way: they are all independent from each others.
Comment: @LucJ.Bourhis Please answer in an answer instead of in a comment.
Comment: Feel free to write a paragraph.
Answer: The short answer to this question is yes.
The reason is wrapped up in "weak universality": the idea that all weak interaction at low energy share a common underlying process that controls the one of the two factors that go into determining rates for spontaneous processes. That leaves the phase space available to the products as the thing that almost solely determined the lifetime.
In short the phase space available to the interaction depends to a large degree on the total energy and to a much smaller degree on the mass of the recoiling remnant nucleus.
I gave a rather more complete treatment in another answer about the free neutron lifetime.


Idea of a proof by contradiction

Question: Is the idea of a proof by contradiction to prove that the desired conclusion is both true and false or can it be any derived statement that is true and false (not necessarily relating to the conclusion)? Or can it simply be an absurdity that you know is false but through your derivation comes out true?
Comment: A proof by contradiction is you suppose something true and after some steps, you find that it is false (you contradict what you supposed). $$\mathrm{Suppose}\; x\geqslant1\;\cdots\; x=0.$$
Answer: No, the idea of a proof by contradiction is:

Assume that what you want to prove is actually false.
Determine the logical consequences of that assumption.
Find that this line of thought inevitably leads to a contradiction, showing it to be wrong, meaning therefore that what you want to prove is true.

I think the best example is the proof that there are infinitely many prime numbers.

Assume that the set of prime numbers is finite.
Since the total number of primes is finite, you can multiply them all together to obtain a number that is divisible by all the primes.
But what is the prime factorization of the number that is one more than the product of all primes? It must either be a "new" prime or it must be a composite number that is divisible by a prime we managed to overlook; but either way, the assumption that there are finitely many primes is wrong, meaning therefore that there are infinitely many primes.

Proof by contradiction can also be used to prove that certain numbers are irrational, like $\sqrt{2}$.
Comment: The contradiction can be any sort of contradiction, it does not have to involve the statement that was originally assumed to be true. The example stated here of the irrationality of $\sqrt{2}$ is this way, as you pointed out. Proofs where the contradiction is with the thing you originally assumed can usually be rewritten as proofs by contraposition instead of proofs by contradiction.
Comment: Although... someone could split hairs with me about the proof by contradiction that $\sqrt{2}$ is irrational. The step 1 assumption would be that it is rational. The first logical consequence in step 2 would be that then $\sqrt{2} = \frac{a}{b}$ with $a, b \in \mathbb{Z}$ and $\gcd(a, b) = 1$. The step 3 contradiction is that $\gcd(a, b) > 1$.
Comment: I guess my question should have elaborated a little more. My question is directly related to your step 3, what sort of contradiction are you trying to draw? Any sort of contradiction or does it have to be a statement that is at ends with the assumption you describe in step 1.
Comment: Good point, I've changed it accordingly.
Comment: For me to be convinced, it needs to be a contradiction of the step 1 assumption. Maybe there are examples of proof by contradiction where the contradiction drawn isn't a contradiction of the assumption, but if I was reading such a proof, I would wonder if it is a valid proof, I would wonder if the author didn't make some mistake along the way.
Answer: It can be both: take the following simple problem. Is is possible to cover an $8\times8$ chessboard which has had its two white corners removed using domino-like pieces of size $2\times1$?
Let us assume it is possible and we have somehow managed to do it. Notice we  covered $32$ black squares and $30$ white squares. Also notice a domino-like piece will cover 1 black and 1 white square.
Since each domino-like piece covers 1 black square and we covered $32$ white pieces the number of dominoes we used is $16$.
On the other hand  Since each domino-like piece covers 1 white square and we covered $30$ white pieces the number of dominoes we used is $15$.
Therefore $16=15\dots$ wait wut? In this case it wasn't a direct contradiction. It just lead to something that clearly can't happen.

Idea of a proof by contradiction


Debug JSF Phase with Seam 3 / Seam Faces

Question: I'm trying to resolve a weird behavior in my application, and to help me I would like to debug the JSF phases (i.e display the sequence)
I use Seam 3 with the SeamFaces Module.
I've trying to use the @Observes annotation as explained in the documentation, without success,
My class :
<code>// @Named ? With or without, it doesn't work.
public class PhaseListener {

    public void observeBefore(@Observes @Before PhaseEvent e)
    {
        System.out.println("Before phase :"+e.getPhaseId().toString());
    }

    public void observeAfter(@Observes @After PhaseEvent e)
    {
        System.out.println("After phase :"+e.getPhaseId().toString());
    }

}
</code>
Problem : I've set a breakpoint inside the functions, but this code is never executed.
Anybody could help me to achieve this objective?
Thank you.
Answer: Do you have a beans.xml in your WEB-INF? My guess is your WAR isn't being considered a bean archive so CDI isn't picking up your observers.


Do harmonic or melodic need to be serial row when we use in real sheet?

Question:
In No(b), it is said A minor with G sharp. I wanna know this does not look like a scale so does A minor(harmonic) with G sharp need to be in a row like A B C D E G# A ?
And when we use (A harmonic) in real music, do we use like a row or can we use break down randomly including G#? As shown in the above picture? Thank you.
Comment: The only example there with a G# is the bottom line - we can't read what number. But since there is also F# and C# in the line, along with G#, that line will be in A *major*, not A minor. Can you make the question clearer, please?
Comment: @Tim - The 2nd line from the top also has G#s in it.
Comment: @Dekkadeci - true - I missed the bass clef! Thanks.
Answer: The notes which constitute A harmonic minor are -A, B, C, D, E, F and G♯. They are of course used when playing the A harmonic minor scale, in that order (and reversed), but many many pieces use these particular notes and no others in any order needed.
That doesn't mean we say the piece is in 'A harmonic minor', but simply in 'A minor'.
The notes which constitute 'A minor' are chosen from the pool of - A, B, C, D, E, F, F♯, G, and G♯.
EDIT: it would be interesting to find out what the top line key is said to be. There are F and C sharps, but the last bar contains a C natural. Odd.
It's just that they can be used sequentially in three different forms, creating natural, harmonic and melodic minor scales.
Answer: No, the notes don't have to be in a scale.
I think the main thing to look for is the treatment of the sixth scale degree. If you see a raised sixth degree, it's good indicator the passage is using the "melodic minor."
Another thing to look for is various forms of these melodic patterns:

^5 ♭^6 ^5 and ^1 ♯^7 ^1 which happens a lot in harmonic minor
♯^6 ♯^7 ^1 which is characteristic of ascending melodic minor

Obviously those patterns will involve a lot of other melodic material, but you can think of them a common prototypes in minor key music.
Answer: What you have shown here is a set of questions asking to note down the key by looking at the accidentals. Playing and writing scales are fundamental exercises one should involve in to succeed in musical studies and career. But, the pieces that we come across comprise of tunes, not all notes of a tune are arranged in the same order of its key.
If we take a look at the first stave,  the only accidentals are F# and C#. So, the key is D major. In other words, it is a melody written in D major.
In the second stave(no b), G# is the only accidental.(This must be the one you are referring to) Here, the key is A minor. Try playing these notes on a piano and listen to the melody. Key signatures are a concept introduced to maintain proper standards of musical composition. Notes of a scale need not be in the same order of the scale when it comes to composition.
Comment: The last note in the top line looks very much like a C - but in a new bar, it'll be C Natural.
Answer: Do harmonic or melodic need to be serial row when we use in real sheet?
If you're writing serial/dodecaphonic music, then, of course, yes. Otherwise, no. As colleagues appointed, that's not a serial example here in the image.
But be aware that some degree of freedom exists in both worlds. And, also, there are very sophisticated serial techniques in which the real row is "hidden" underneath other series and rotations (Brian Ferneyhough, for example), and you may end up being insanely crazy looking for these relationships from scratch.


Unable to show hidden files on Mac

Question: I just received a new MacBook, running OS X El Capitan 10.11.5, from my new employer and I am unable to force hidden files to show in Finder.  This is my fourth MacBook, and in the past I have always used defaults write com.apple.finder AppleShowAllFiles YES to show hidden files; however, on my new Mac, this is not showing the hidden files. I also tried defaults write com.apple.finder AppleShowAllFiles TRUE but still cannot see hidden files in Terminal or in Finder.  I restarted my computer, but that didn't solve my issue either.  Any ideas on how to show my Mac's hidden files?
Answer: Try this:
defaults write com.apple.Finder AppleShowAllFiles -bool true; killall Finder

This sets AppleShowAllFiles to true which tells Finder to show all file. Note the -bool part, that tells will make sure you are setting a Boolean to it instead of string, integer etc. Finally it restarts Finder.
Comment: Welcome to Ask Different.  We like answers to be more than just a single line.  Ideally, you want to explain why your answer is *right."  It also helps to provide links, citations, and/or screen shots.  Please review our help section [How to Answer](http://apple.stackexchange.com/help/how-to-answer) on writing good answers to questions
Comment: @Allan Edited with explanation.
Answer: After you run the defaults write com.apple.finder AppleShowAllFiles YES command,
hold the 'option/alt' key, then right click on the Finder icon in the dock and click Relaunch.
Answer: Since High Sierra, you can show hidden files in the Finder with the key command: Command Shift Period. This also toggles the show/hide status.
No need for Terminal commands or third-party utilities, or relaunching the Finder.
Comment: RE: "No need for Terminal commands or third-party utilities, or relaunching the Finder." -- While that statement has been true since **macOS Sierra** (10.12) it was however not true at the time when the question was asked, as at that time the current **Apple** operating system was **OS X El Capitan** (10.11) and did require what the accepted answer states, or the use of a _third-party utility_.
Comment: RE: "This also toggles the view." --  What? The view in **Finder**  typically refers to, as Icons, as List, as Columns, as Gallery and pressing **⌘⇧.**  does not change the view.
Comment: @user3439894 OK, poorly phrased: this toggles the view status of hidden files. Will add "since High Sierra", too.
Answer: Detailed
You can make all hidden files visible with this command in the Finder.
defaults write com.apple.Finder AppleShowAllFiles 1 && killall Finder

However, I prefer not to display hidden system files via the terminal, but rather with a shortcut.
CMD + SHIFT + .

If you want, you can make a file (several files) visible or invisible again. - Even if you remove the "hidden" attribute with chflags, this has no effect if setfile has also stored an attribute
chflags hidden /path/to/file (Hides the file from the Finder)

chflags nohidden /path/to/file (Does not hide the file from the Finder)

If the file cannot be made visible again, it may have been hidden using setfile. SetFile
setfile -a V /path/to/file (Hides the file from the Finder)

setfile -a v /path/to/file (Does not hide the file from the Finder)

(To use this command you need the developer tools) xcode-select --install
Note: There are several types of "hidden" files: those that begin with a period and those that are hidden with chflags or the developer's command line utility Setfile.
You can see the hidden files that were hidden with chflags here
 ls -lO /path/to/directory

Comment: There are two types of "hidden" files: Those starting with a dot, and those set to hidden with `chflags hidden`. Your answer applies partially to either but doesn't clearly differentiate.

Unable to show hidden files on Mac


Making a follower a Blade and then still use them?

Question: Is it possible to make a follower a member of the blades, yet still be able to have them follow you to aid you on your quests?
Comment: I misinterpreted the title as "Making a follower into a sword and then using that sword" and had to try not to burst out laughing at the thought of the Dragonborn swinging Lydia around by the leg like a zweihander. Heck, it's Skyrim, I wouldn't be surprised if there's a mod (or a glitch) that lets you actually do that.
Comment: @F1Krazy  Different game, but that happened during a D&D session. A new player mistakenly picked up a cursed sword that had a mind of its own. The visual is definitely hilarious
Answer: Yes you can still use the follower after you've admitted them into the Blades. Simply find them at the temple and speak to them as you would any other follower to bring up the standard options for getting a follower to join you.
Followers you've recruited into the Blades will generally remain at the temple when they're not accompanying you, with few exceptions.
Do note that when you admit a follower into the Blades you lose them as a follower while they are doing the admittance ceremony. However, immediately following that, they should be available to re-recruit.


What is a Problem Statement?

Question: Can someone help me clarify what are the Problem Statements and Hypothesis Statements in UX Research?
Do you need to provide a single statement per project or multiple? What are the differences from User Stories?
Answer: Typically Problem Statements are used to define and clarify the problem to be solved in the context of a UX design activity. There are a number of ways to structure or write this, but as long as the problem is written in a simple and clear statement then it is sufficient.
In contrast, a Hypothesis Statement is used to propose an explanation or a suggested solution to a particular question. It is used to help frame the way that the research is carried out, and typically in scientific research one would try to prove the hypothesis to be incorrect so as to avoid certain biases in the methodology and analysis. For example, if your hypothesis is that changing the button colour will improve usability, then you would typically set up some experiments to show that changing the button colour has no effect on usability. And if your data shows that it does have an effect then your hypothesis will have been proven to be valid.
You can define problem statements and hypothesis statements at different levels of detail, depending on the size of the project and the nature of the problems that you are trying to solve. So this can mean one general problem statement for the whole project, and different problems statements for major milestones or challenges to be solved.
Writing user stories is one of the techniques used in agile software development to help with requirements definition. From the Atlassian Playbook:

A user story is an informal, general explanation of a software feature
written from the perspective of the end user. Its purpose is to
articulate how a software feature will provide value to the customer.

Basically it is a good way to help frame the particular design problem from the perspective of the end-user, in terms of the goals that they want to achieve and without prompting what the solution should look like.
Comment: Thanks a lot! That helped!
Comment: @PavelStarovoit what is your role at the moment? Is it UX related? Just wondering why you are asking the question and whether there are other references I can point you towards :)

What is a Problem Statement?


Processing: Migrating to 2.0b1 from 1.51 - Issues on video library

Question: I'm trying to migrate to new processing, as I use often in my life (it's an update, so I'm moving on...).
Here's my setup:

Mac OS X 10.7.3
Processing 2.0b1 (Launch Program in 32-bit mode)

<code>$ java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
</code>
My setup used to work on Processing 1.5 - and all the problems that I'm seeing right now I not had using that release.
First:
Any examples from libraries/video/capture simply don't work. Sometimes it crashes, sometimes it freezes.
The console log after AsciiVideo:

DVFreeThread - CFMachPortCreateWithPort hack = 0xc083b7c0,
  fPowerNotifyPort= 0xc085a0f0 DVFreeThread - CFMachPortCreateWithPort
  hack = 0xc0809a60, fPowerNotifyPort= 0xc0808080 DVFreeThread -
  CFMachPortCreateWithPort hack = 0xc08159a0, fPowerNotifyPort=
  0xc082add0

I use the GSVideo too, and I tried to run the AsciiVideo from there.
The console error:

GSVideo version: 1.0.0 19200 Invalid memory access of location 0x0
  eip=0x97cee3ba

and raised an error window

Process:         java [25673] Path:            /usr/bin/java
  Identifier:      com.apple.javajdk16.cmd Version:         1.0 (1.0)
  Code Type:       X86 (Native) Parent Process:  JavaApplicationStub
  [24849]
PlugIn Path:       /var/folders/*/libjogl_desktop.jnilib PlugIn
  Identifier: libjogl_desktop.jnilib PlugIn Version:    ??? (???)
Date/Time:       2012-09-05 17:04:08.993 -0300 OS Version:      Mac OS
  X 10.7.3 (11D50b) Report Version:  9
...

I work with SimpleOpenNI, GSVideo, GLgraphics, SurfaceMapper... I decided migrate yesterday, to increase performance using the same CPU when I render videos.
Answer: I think it's better to ask this question on the processing forum.
Reason why you get this error is that the video library is rewritten from scratch in Processing 2, and it's based on  GSVideo. Check the video examples in Processing 2.0b3.
Also, SurfaceMapper is currently not working with Processing 2.0, I'll look into that.
Best regards,
Jonas, Ixagon


Remove GPS Location

Question: I have a few pictures taken with the GPS on.
Now, I would like to share the photos with some of my friends, and let them guess where it is.
How can I remove the GPS location from the pictures?
I'm using a Windows 8.1 computer.
Answer: In recent versions of Windows (Vista or newer), you can do this as standard.

Right click on your photo, and click "Properties".
On the properties window, select the "Details" tab. At the bottom of that tab, click the option for "Remove Properties and Personal Information".
Then that lets you create a copy with all possible properties removed, or select specific properties to remove from the file. So you can just remove the tags for GPS latitude and longitude.

(screenshot from Windows 7, other versions may be slightly different)
Answer: Windows Explorer, conversely to much advice, cannot fully clean GPS metadata, and sometimes cannot recognize it (e.g., pictures taken with a Windows Phone).
I suggest you use exiftool, it's probably the best way to do tag management for pictures. It's a command-line tool, although there are also GUIs for it.
To remove (EXIF) GPS tags, you should use this command:
exiftool.exe -gps:all= FILENAME
e.g.,
exiftool.exe -gps:all= WP_20150928_22_47_06_Pro.jpg
to remove GPS tags from all the .jpg files in the current folder:
exiftool.exe -gps:all= *.jpg
You can find exif tool here:
https://sno.phy.queensu.ca/~phil/exiftool/
Here is a more specific thread on this topic:
http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=6037.0
Answer: On my iPad, where I now do most of my pre- and sometimes my post-production on images, I use an app called EXIF Editor.
This app will allow you to remove or change up to 29 GPS fields, including if your camera records the name of the satellite used, distances from where you live, altitude,  etc., and change just about every field except for the manufacturer's fields, such as camera name/model, serial number, owner's name (If you updated that) and firmware installed.
If I recall, I think you can select a group of images and do a batch edit.
The app is available in the App Store.
George.
Answer: In Digikam you can simply click on Tools/Edit Geolocation
and then remove the GPS data for all selected images by removing the check mark.
Answer: Use any file tag editor.Example: http://www.photome.de
Comment: What would you do with such a tag editor? Why that example?

Remove GPS Location


Insert automatically on new table?

Question: I will create 5 tables, namely data1, data2, data3, data4 and data5 tables. Each table can only store 1000 data records.
When a new entry or when I want to insert a new data, I must do a check,
$data1 = mysql_query(SELECT * FROM data1);
<?php
  if(mysql_num_rows($data1) > 1000){
    $data2 = mysql_query(SELECT * FROM data2);
    if(mysql_num_rows($data2 > 1000){
      and so on...
    }
  }

I think this is not the way right? I mean, if I am user 4500, it would take some time to do all the check. Is there any better way to solve this problem?
Comment: Could you expand on the reason for the 1000 records limit?
Comment: I haven decided the numbers, it can be 5000 or 10000 data. The reason is flexibility and portability? Well, one of my sql guru suggest me to do this way
Answer:
I haven decided the numbers, it can be 5000 or 10000 data. The reason is flexibility and portability? Well, one of my sql guru suggest me to do this way

Unless your guru was talking about something like Partitioning, I'd seriously doubt his advise. If your database can't handle more than 1000, 5000 or 10000 rows, look for another database. Unless you have a really specific example how a record limit will help you, it probably won't. With the amount of overhead it adds it probably only complicates things for no gain.
A properly set up database table can easily handle millions of records. Splitting it into separate tables will most likely increase neither flexibility nor portability. If you accumulate enough records to run into performance problems, congratulate yourself on a job well done and worry about it then.
Comment: +1. Always check for the validity of such statements. In fact, if the person in question calls *himself* a guru, then disregard his advice immediately. ;-)
Comment: +1 'cause I don't see any reason for this either. It does not make queries faster, it does not help with data security...the only reason I could think of is that the database-files should not be larger then xxxKB...but there's no reason for that either.
Answer: Read up on how to count rows in mysql.
Depending on what database engine you are using, doing count(*) operations on InnoDB tables is quite expensive, and those counts should be performed by triggers and tracked in a adjacent information table.
The structure you describe is often designed around a mapping table first. One queries the mapping table to find the destination table associated with a primary key.
Answer: You can keep a "tracking" table to keep track of the current table between requests.
Also be on alert for race conditions (use transactions, or insure only one process is running at a time.)
Also don't $data1 = mysql_query(SELECT * FROM data1); with nested if's, do something like:
$i = 1;
do {
  $rowCount = mysql_fetch_field(mysql_query("SELECT count(*) FROM data$i"));
  $i++;
} while ($rowCount >= 1000);

Answer: I'd be surprised if MySQL doesn't have some fancy-pants way to manage this automatically (or at least, better than what I'm about to propose), but here's one way to do it.
1. Insert record into 'data'
2. Check the length of 'data'
3. If >= 1000,
    - CREATE TABLE 'dataX' LIKE 'data';
      (X will be the number of tables you have + 1)
    - INSERT INTO 'dataX' SELECT * FROM 'data';
    - TRUNCATE 'data';

This means you will always be inserting into the 'data' table, and 'data1', 'data2', 'data3', etc are your archived versions of that table.
Answer: You can create a MERGE table like this:
CREATE TABLE all_data ([col_definitions]) ENGINE=MERGE UNION=(data1,data2,data3,data4,data5);

Then you would be able to count the total rows with a query like SELECT COUNT(*) FROM all_data.
Answer: If you're using MySQL 5.1 or above, you can let the database handle this (nearly) automatically using partitioning:
Read this article or the official documentation

Insert automatically on new table?


Cryptocurrency hourly historical prices

Question: I have found a variety of resources that provide daily historical prices for cryptocurrencies. However, I can hardly find any places where I can download hourly historical prices. Can anyone point me to a good place? More specifically, I want to download or web-scrape the historical hourly prices of Sashimi and Ethereum.
Answer: Your question is about hourly data, but I've never seen that available for free. It's generally the basis of paid service plans.
Coinecko has documentation on how to download their data with daily snapshots as you noticed.
Their link for Sashimi and Ethereum
If you start recording the data hourly on your PC, you can archive every hour going forward. Here is a description of how to do so.

Cryptocurrency hourly historical prices


Sign of correlation changes after taking log

Question: I have two variables, say A and B. Pearson's correlation between the raw data of A and B is positive (not significant). But after taking the logarithm of one variable, say correlation(A, log(B)), the sign of the correlation becomes negative. How is this possible?
Comment: The logarithm is a monotonic transformation. I don't think this should happen. How large is the positive & negative correlation coefficients? Are they both almost 0? Can you provide a scatterplot of your data?
Comment: One way this could be possible is that the positive sign is largely a side-effect of an outlier that is subdued by the transformation. Note that changes of sign sound dramatic, but a change between very small positive and very small negative could be quite unimportant
Comment: You can answer this yourself by examining the scatterplots of the pairwise variables.
Comment: @gung I've constructed a pair of random variables $A$ and $B$ in my answer that satisfy $\rho(A, B)\approx 1$ and $\rho(A, \log(B)) < 0$. The basic trick I used was assigning $B$ values very close to 0 when $A$ takes high values, meaning $log(B)$ takes values as close as I want to $-\infty$.
Comment: I saw that, @josliber, +1. But I think the data need that special setup. I think it will be more typical for a monotonic transformation to yield a correlation with the same sign.
Answer: Base Result
Random variables $A$ and $B$ can have a positive correlation but a negative correlation when one is logged. An easy way to see this is to consider two random variables that have positive correlation but where $B$ takes values arbitrarily close to 0 when $A$ is large; since $\log(B)$ will then take values arbitrarily close to $-\infty$ as $A$ gets large, $A$ and $\log(B)$ will be negatively correlated.
As a worked example, let $A$ and $B$ be discrete random variables whose values always coincide; for constants $x, y, \epsilon, \delta > 0$, let $(A, B)$ take value $(0, x)$ with probability $\frac{1-\delta}{2}$, let $(A, B)$ take value $(1, y)$ with probability $\frac{1-\delta}{2}$, and let $(A, B)$ take value $(2, \epsilon)$ with probability $\delta$. Then arithmetic shows:
\begin{align*}
\newcommand{\cov}{{\rm cov}}
\cov(A, B) &= -\frac{(1-\delta)(1+3\delta)}{4}x + \frac{(1-\delta)(1-3\delta)}{4}y + \frac{3\delta-3\delta^2}{2}\epsilon\\[7pt]
\cov(A, \log(B)) &= -\frac{(1-\delta)(1+3\delta)}{4}\log x + \frac{(1-\delta)(1-3\delta)}{4}\log y + \frac{3\delta-3\delta^2}{2}\log \epsilon
\end{align*}
Setting $x=1, y=2, \delta=0.01, \epsilon=e^{-100}$ yields the desired result:
\begin{align*}
\cov(A, B) &\approx 0.2252 \\
\cov(A, \log(B)) &\approx -2.8036
\end{align*}
Obtaining $\rho(A, B)\approx 1$ and $\rho(A, \log(B)) < 0$
We can construct a pair of random variables $A$ and $B$ with $\rho(A, B)\approx 1$ and $\rho(A, \log(B)) < 0$ using the above example with $0 < x < y$, setting $\epsilon = e^{-1/\delta^2}$ and taking the limit as $\delta\rightarrow 0$. Basically we are selecting very small $\epsilon$ and $\delta$, but $\epsilon$ is getting small much faster than $\delta$.
We have the following results from the equations above:
\begin{align*}
\cov(A, B) &\xrightarrow[\delta\rightarrow 0]{} \frac{y-x}{4}\\[7pt]
\cov(A, \log(B)) &= \frac{-3}{2\delta} + o(\frac{1}{\delta})
\end{align*}
As a result, we see that $\cov(A, \log(B)) < 0$ as $\delta\rightarrow 0$ and therefore $\rho(A, \log(B)) < 0$ (it approaches 0 from below with the selected $\epsilon$ and $\delta$). To calculate the correlation between $A$ and $B$, we need to compute the standard deviations of the random variables:
\begin{align*}
\sigma(A) &= \sqrt{\frac{1+8\delta-9\delta^2}{4}} \\[7pt]
\sigma(B) &= \sqrt{\frac{1-\delta^2}{4}(x^2+y^2) + \frac{(1-\delta)^2}{2}xy - 2(x+y)\frac{1-\delta}{2}\delta\epsilon + \epsilon^2\delta(1-\delta)}
\end{align*}
From these equations, we obtain $\sigma(A) \xrightarrow[\delta\rightarrow 0]{} 0.5$, $\sigma(B) \xrightarrow[\delta\rightarrow 0]{} \frac{y-x}{2}$, and therefore $\rho(A, B) \xrightarrow[\delta\rightarrow 0]{} 1$.


how to debug c++ runtime errors

Question: I'm using MinGW as compiler and CodeBlocks as IDE. When there's a runtime error, the program simply stop working without any error messages. Is it possible to get conventional error messages like the type of error and where it occurs?
Comment: Have you tried using GDB?
Comment: Note : Another approach could have been to handle the exceptions be yourself : http://spin.atomicobject.com/2013/01/13/exceptions-stack-traces-c/
Answer: I know this isn't a real 'answer', but I'm still new, so I can't comment on the questions yet.  Anyway, same thing as Mats said, try GDB.  Here is the download page http://www.gnu.org/software/gdb/
There are plenty of tutorials for using the debugger.  This one is fairly good.  http://www.cs.cmu.edu/~gilpin/tutorial/
If you never used a debugger, it basically runs your code line by line.  You can control how far you want to proceed and where you want the code to stop to check for errors.  Debuggers also keep track of other important information like variable values, variable addresses, loop counts, and so on.
If you don't want to use the debugger, you can always use print statements where you might suspect the program is crashing.  For instance, if you have a function foo(), you can put a print statement on the first line of that function saying something like "in function foo".   However, this method could become very tedious if you have a large piece of code.  You must also remember to remove the print statements when you are finished.
Comment: I don't know much about `CodeBlocks`, but to my experience `Eclipse` (for C/C++ developers - which includes cdt, gdb, ...) is a pretty good environment.
Answer: You can use a debugger, like GDB (documentation: http://www.gnu.org/software/gdb/documentation/) Personally, I think the best way of spotting the errors is by debugging your code by yourself. A useful code snippet:
#ifdef DEBUG
 #define debug(...) do { fprintf(stderr, __VA_ARGS__); } while(false)
#else
 #define debug(...) do { } while(false)
#endif

When you suspect that you are accessing an invalid position in an array, you can try the followings:
#include <cassert>
...
int main() {
  int a[5], i;
  ...
  assert(i >= 0 && i < 5);
}

or, if you like pure C++,
#include <stdexcept>
...
int main() {
  int a[5], i;
  ...
  if(i < 0 || i >= 5) {
    throw std::runtime_error("Error: trying to access invalid memory");
  }
}

When you want to debug a recursive function, a very common source of runtime errors, add checks at the begin and at the end of your function, and maybe before or after each recursive call. For example:
int fibo(int n) {
  return fibo(n-1) + fibo(n-2); // error recursion doesn't end, stuck at infinite loop
}

A simple check at the begin of the function will help you spot easily the mistake(I know here is trivial to find why the program crashes, but in a more complex function, like DFS on a graph(DFS: http://en.wikipedia.org/wiki/Depth-first_search), it might be more tricky to find why the program causes error.
int fibo(int n) {
  if(n < 0) {
    debug("Error!");
    return -1;
  }
  return fibo(n-1) + fibo(n-2); // mistake spotted!
}

Answer: To determine where your error occurs, run your program in debug mode (set a breakpoint by clicking next to the line number; a red stopsign will appear). This will cause your program to pause execution on the marked line. You can then step to the next line (F7) or continue to the next breakpoint (shift+F7). This will allow you to deduce where the error occurs.
As for error codes, once your program stops working, the console will output the error code. For example, the following:
Process returned -1073741819 (0xC0000005)   execution time : 1.045 s
Press any key to continue.

indicates a memory error, in this case that I attempted to delete a non-dynamic variable.
Simply google the hexadecimal code.
Answer: I know using gdb is a too much steep curve but here's a link to a tutorial for gdb from where you can start debugging with gdb.!!
Also if you are not familiar with compiling with terminal and using it then,
You compile the c++ program on Terminal using g++ file_name -o ouput_file_name
And then to run the program you do :  ./output_file_name
(though I am a beginner) Hope it Helps..!!!

how to debug c++ runtime errors


ArcGIS Pro and Delphi Development

Question: I've been creating tools for ArcMap using Delphi through COM even though it isn't officially supported and I'd like to know if that will still be possible with ArcGIS Pro?
Answer: No. ArcObjects will not be the development model for ArcGIS Pro. Your two development options in ArcGIS Pro are either via a new set of .Net APIs or via Python.
Comment: Apart from GP script tool, I've heard that Python add-ins are supported as well, so one more option for GUI customization.
Comment: No, there are no Python Add-Ins for Pro.

ArcGIS Pro and Delphi Development


Why are non-relativistic methods used in binary pulsar systems (gravitational waves)?

Question: Although gravitational waves are a subject of the General Relativity, why do most books use Newtonian equations of motion for power radiated and rate of change of eccentricity calculations? In most books ("Gravitation, Foundation and Frontiers", by T Padhmanabhan for instance) they calculate the energy-momentum tensor for fields through a General Relativistic approach. However, they switch to a non-relativistic approach once they come to the binary pulsar. If everything can be done through non-relativistic Newtonian (or Keplerian) methods, then why do we need to calculate everything in General Relativity?
Comment: What makes you think everything can be done with non relativistic methods? Gravitational waves don't exist in the Newtonian theory.
Comment: I don't have time to write a full answer now, but the reason is that the pulsar itself is moving nonrelativistically ($v/c\ll 1$), and to lowest order in that expansion you get the Newtonian answer. Roughly speaking the amplitude and frequency of the wave are set by the source and be computed nonrelativistically, but the actual propagation of the wave has to be treated using relativity. Indeed the final answer for the power emitted (the Peters-Matthews formula), which ultimately requires you to use relativity to compute the propagation of the wave), goes to zero as $c\rightarrow\infty$.
Comment: The confusion arises because, the author uses newtonian orbit equation for the calculatio of power radiated (that is expressions like dE/dt and for orbital period change he uses dT/dt..) from a binary source for gravitational waves (eg. binary pulsar) He didn't use the four vector formalism of relativistic theory. Why ?
Comment: There was a question a while back about why simple problems in electrodynamics don't have an easy solution. Imagine one particle (1 deg. Freedom) plus another particle (1 deg freedom) plus the field itself (infinite deg freedom). It's not difficult to see how this is like the three body problem but much more difficult. So those are avoided!
Answer: Systems of moving masses should emit gravitational waves in analogy with the emission of electromagnetic waves by a system of moving charges. Early attempts to calculate the energy in these waves were based on the use of pseudostress-energy tensor for finding the energy flux.

Example:

If we assume that the two bodies making up the binary lie in the x-y plane and their orbits to be circular, the non-vanishing components of the quadrupole tensor are:$$\boxed{Q_{xx}=-Q_{yy}=\frac{1}{2}(\mu)a^{2}\cos2\Omega t}$$ and
$$\boxed{Q_{xy}=Q_{yx}=\frac{1}{2}(\mu)a^{2}\sin2\Omega t}$$
Where $\Omega$ is the orbital velocity, $\mu=\dfrac{m_{1}m_{2}}{m}$ is the reduced mass and where $m=m_{1}+m_{2}$
Gravitational waves carry energy and cause a deformation of space-time. The stress-energy carried by these waves cannot be localized within a wavelength; rather it can be said that a certain amount of stress-energy is contained in a region of space which extends over several wavelengths.

The disadvantage associated with this method is that always a coordinate system can be chosen such that the energy flux would vanish in it; also this method is only valid for systems which are not gravitationally bound. So, the case of binaries remained unsolved back then.
Sir Arthur Eddington found radiation form systems by calculating the radiation reaction of the system itself. This too was not valid for gravitationally bound systems. For situations in which radiation is constant, the above mentioned  methods agree. However, for cases where the radiation is time-dependent, different methods are to be used. Analogy in the results obtained occur in electromagnetic radiation theory.
One approach to solve gravitational radiation is to consider only the exact solutions of the nonlinear field equations of GR. These equations are expanded in powers of gravitational coupling constant because of the weakness of the gravitational interaction. Once the field equations of GR are expanded in terms of the gravitational coupling constant, the integral conservation laws of energy, momentum, and angular momentum can be calculated. For a non-relativistic system, the radiation is given in terms of time derivatives of the matter distribution of the system. The binaries are treated as a system of two point masses moving in elliptical orbits under their mutual gravitational attraction. The system of binaries decay as a result of gravitational radiation and the changes in the orbit can be found during such a decay.
Given the field equations are valid:

$$\boxed{R_{\mu \nu}-\frac{g_{\mu \nu}R}{2}=-8\pi GT_{\mu \nu}}\tag{1}$$
Let $g_{\mu \nu}=\delta_{\mu \nu}+h_{\mu \nu}$, the field equations can be expanded in powers of $h_{\mu \nu}$ to get:
$$\boxed{\bar{h_{\mu \nu,\lambda \lambda}}-\bar{h_{\mu \lambda, \lambda \nu}}-\bar{h_{\nu \lambda \lambda \mu}}+\delta_{\mu \nu}\bar{h_{\lambda \sigma,\lambda \sigma}}=-16\pi GS_{\mu \nu}}\tag{2}$$
$S_{\mu \nu} $ is uniquely define de and the divergence of the LHS of the equation vanishes. Hence $S_{\mu \nu, \nu}=0$ and conservation laws can be written.

The invariance  of $(1)$ under arbitrary coordinate transformations implies that one may always choose a coordinate system in which $\bar{h_{\mu \nu, \nu}}=0$. This would simplify the case but then equation $(2)$ would become an inhomogeneous wave equation!
We can assume that the field equations are valid for large distances from the system, and the gravitational potentials $h_{\mu \nu}$ are inversely proportional to the distance From the system for large distances, then the energy of the system must decrease a small a result for the radiation of the gravitational waves, regardless of the coordinate system or conditions used.
Hence, in non-relativistic approximation, the radiation is the same as that found in gauge $\bar{h_{\mu \nu, \nu}}$.
Edit:
Just realised that this question is 2 years old,for anyone interested please check this out, this paper
Answer: Gravitational Waves are predicted by GR. There are no gravitational waves in Newton's theory.
A wild guess is that the author of this book uses classical potential theory to explain multipole expansion of GW's (as known from electrical potentials, basically fourier series on a sphere) and in the GW case for the hypothetical graviton spin 2, you should get a quadrupole moment.
Comment: *All wave solutions fitting to GR, e.g. quadrupoles, plain waves are still of highly theoretical nature.* Not true. As pointed out in the question, the predictions of GR have been verified to high precision through observations of binary pulsars.
Comment: To illustrate @BenCrowell's point, see http://www.nobelprize.org/nobel_prizes/physics/laureates/1993/press.html .
Comment: That is an indirect measurement form a lightyears away event. I do not call that high precision.
Comment: It's about as precise as we could reasonably get at the time.
Comment: The confusion arises because, the author uses newtonian orbit equation for the calculatio of power radiated (that is expressions like dE/dt and for orbital period change he uses dT/dt..) from a binary source for gravitational waves (eg. binary pulsar) He didn't use the four vector formalism of relativistic theory. Why ?
Answer:
If everything can be done through non-relativistic Newtonian (or Keplerian) methods, then why do we need to calculate everything in General Relativity?

The success of General Relativity shows that it is relevant and has to be taken into account in gravitational problems. But at the same time, the GR gravitational equations reduce to Newtonian equations where the gravitational fields are weak enough, and velocities non relativistic for the particular problem at hand.
In the Hulse-Tailor binary for example:

Orbital velocity of stars at periastron (relative to center of mass): 450 km/s

To use the mathematical panoply of general relativity when, for the accuracies needed for the problem, the newtonian approximation is good enough is a waste of intellectual effort.
So the guess is, since there is no link to read the specific problem, that the newtonian approximation is good enough for the problem at hand. It all depends on the accuracies needed. General Relativity is taken into account in the GPS system, just because great accuracy is needed, though I have not seen it used on the tide tables.


Is it possible to prosecute Booking.com if a scam was done by another party through their portal?

Question: Due to an in app message request to verify my credit card on Bookingcom I lost a lot of money. I reported it to my bank, Booking.com and the property whose account was compromised.The transaction was tracked to a gaming site and they said they suspended the user's account but they won't return my money. No one is taking accountability for it. I believe it was booking.com's responsibility to protect the user account from hacking. Would it be possible to prosecute them?
Comment: Have your bank issue a chargeback... else I would assume the terms of Booking.com shields them from any liabilty
Comment: I imagine companies have some duty to protect user data, but it's impossible to prevent all avenues of hacking. Booking.com could of course not prevent a user from divulging their information in a phishing scam, or from writing down their username and password and leaving it at a bus stop. If Booking.com did not adequately protect their own database, though, it might be a different story.
Comment: Consider your email address public. Anybody can create a fake email saying they are booking.com or any website. Nobody will take responsibility if you fall for a scam.
Comment: It sounds like you responded to a phishing method pretending to be from Booking.com. If so, then the actual Booking.com was not involved in any way; there's nothing they could have done to prevent it.
Comment: @Sneftel - The phishing link was sent through the in-app messaging module within Booking.com's official app. This is why I was trying to understand the nature of their accountability for this incident.
Answer:
I believe it was booking.com's responsibility to protect the user
account from hacking. Would it be possible to prosecute them?

You are probably wrong.
Section 230 of the Communications Decency Act generally immunizes people who provide services via the Internet from liability for the actions of their users except in cases of sexual exploitation.
Comment: Not sure if the Section 230 of Communications Decency Act would be applicable here, given that Booking.com's HQ is in Netherlands and I am not from the UK either.


Is this one of the incurable Canna Indica viruses?

Question:
More higher resolution images are here: https://i.stack.imgur.com/KbrrF.jpg
Comment: where are you located?  What are the current growing conditions?
Comment: Located in Israel. Currently rainy and 18 degrees celsius
Answer: Look like the virus pictures I see. Streaks parallel to the veins.
The other leaves looking good means it is not due to other growing conditions.
looking at ref. https://www.researchgate.net/figure/Leaf-symptoms-on-canna-cultivars-between-8-and-12weeks-of-age-Cultivar-Aida-healthy_fig3_264671027
If url not working, search "virus on canna indica" and "researchgate"
It might be good to know which virus in case it can infect other types of plant.
Answer: According to the Royal Horticultural Society;
'Canna yellow mottle virus (CaYMV) & Canna yellow streak virus (CaYSV) both  causes streaks of pale tissue between the leaf veins. These later die, resulting in streaks of dead brown tissue
Bean yellow mosaic virus (BYMV) causes a yellow mottling of the leaves'
I do not see either of the symptoms in your plants.
Canna prefer warm growing conditions, they are currently having to live through a cool wet season.  (You did not mention the night time temperatures, but I assume they are alittle cooler) They are not able to flourish under these conditions.  These conditions can lead to rot.  You are having symptoms of over-watering.  The plant is in a semi-dormant state or a state of slow growth.  During these periods they use less water than they do when the weather is warm outside.   I would remove any leaves that are very damaged.  If the plant's conditions continue into the warm season, you probably have a drainage problem.  It may be time to dig them up.   Then amend the soil with better drainage matter as deep as you can easily dig.  Then replant your Canna.  That is only if it continues when the weather either gets much warmer or the rain stops.  If the weather does not improve they may prefer to be completely dormant during this time of the year.  Some people lift their canna during the cool rainy seasons. Removing the stalks, air drying them a few days then, storing them in a dry medium in a cool, dry, dark location until the warm season returns.
RHS Canna Viruses


" The dynamic range of the human eye is huge, but within a scene, it is smaller. " I need an explanation for this statement

Question: Why the dynamic range within a scene is less for human eye? Also, what's the HDR contrast ratio for human eye to perceive?
Comment: Do you have a source for the statement? I get what they mean, but it could easily be taken out of context [or could be fully explained by the context].
Comment: No source as such. The doubt was asked to me by someone. If possible can you explain as per the context you got from the statement.
Comment: It's to do with the iris - small in bright daylight, large in a dark room - but I can't put any numbers around that to make it into an answer.
Answer: I presume the reason for this is that a human eye can adjust exposure from scene to scene, but within a scene, the exposure is fixed.
The same is true for cameras, by the way.
For example, a f/4-22 aperture, 1/8000 - 30 seconds exposure time, ISO 100-102400 camera+lens combination, has about 33 stops more dynamic range between scenes than it has within a single scene. So if the dynamic range of the camera within a scene is 13 stops, between scenes it's 33+13 = 46 stops.
Answer: The DR of the human eye is estimated to be approx 12 stops with a fixed iris opening (i.e. chemically dilated).
It is estimated to approximately double with the variable iris opening, which occurs near instantaneously as you scan a scene. I think this is about the maximum you would need to account for with an HDR image. Easy enough using a reasonably current DSLR w/ ~12 stops DR (base ISO), bracketed +/- 2 images, w/ a 3EV exposure step.
That is for daylight viewing. If you add in the ability of the eye to dark adapt, and the increased contrast of light points in a dark scene, the DR capability of the eye is even higher; exceeding 24 stops (low light/star viewing).
Comment: "Approximately double" meaning 13 stops? or 24?
Comment: @Zeus, 24 stops; some say 21.


Mask clouds in LandSat 8 surface refletance image

Question: I would like to know how to remove the clouds in a ImageCollection of LandSat 8 Surface Reflectance (SR) image and create a single image without clouds using google earth engine, to calculate NDVI. I wore a javaScrit code to remove clouds in Landsat 8 TOA Reflectance, but it doesn't work for SR imagens...
Answer: The Surface Reflectance products contain a band called 'cfmask' and 'cfmask_conf'. The documentation tells you that all pixels labelled 4 in the first band are clouds. If you just want to mask clouds from your NDVI calculation you just have to update the image mask. If you want to do an ImageCollection you simply have to .map it as a function.
An example image from the alps with only clouds masked from the NDVI as well as an NDVI time-series from the region. The great thing about the EarthEngine is that instead of the NDVI mean you can also look at the NDVI time-series for selected areas.
// single image
var lt8 = ee.Image('LANDSAT/LC8_SR/LC81930272016103')

var lt8_ndvi = lt8
  .normalizedDifference(['B4', 'B5'])  // calculate NDVI
  .updateMask(lt8.select(['cfmask']).neq(4))  // mask everything labeled 'cloud'

// Map.centerObject(lt8_ndvi, 10)
Map.addLayer(lt8_ndvi, {}, "LC81930272016103 NDVI cloud masked", 0)

// image collection
var lt8_ic = ee.ImageCollection('LANDSAT/LC8_SR')
  .filterBounds(aoi)  // filter to area-of-interest
  .filterDate(ee.Date("2016-01-01"),ee.Date("2016-12-31"))  // filter to 2016

var lt8_ndvi_ic = lt8_ic
  .map(function(img){  // add cloud free NDVI to all images
  return img.addBands(img.normalizedDifference(['B4', 'B5'])).updateMask(img.select(['cfmask']).neq(4))
  });

print(lt8_ndvi_ic)

Map.centerObject(testPoint, 10)
var ndvi_viz = {min:-0.8, max:0.3, palette:'000000,00FF00'};
Map.addLayer(lt8_ndvi_ic.select('nd').mean(), ndvi_viz, "LT8 2016 NDVI mean")

// NDVI time-series chart
// Create and print the chart.
print(ui.Chart.image.series(lt8_ndvi_ic.select('nd'), testPoint, ee.Reducer.mean(), 30));

Comment: Nice answer. I only discovered GEE recently, having done an MSc involving remote sensing nearly 20 years ago, but not used it since. It really is a game changer for introducing people to remote sensing and quick model building and investigation.
Comment: Thank you for the answer, is It possible to create .median() image without clouds before calculating the NDVI? I need to work with a year (eg. 2016-01-01, 2016-12-31), so I need to remove the clouds to create a sigle image free of clouds and then calculate the NDVI.
Comment: @UilsonRicardo I included an example for the NDVI mean for a full year with cloud masking.


Alternative ways to show $\int_{0}^{\infty}f(x)\, dx = \int_{0}^{1}f^{-1}(y)\, dy$

Question: Let $f$ be a continuous, strictly decreasing, real-valued function such that $\int_{0}^{\infty}f(x)\, dx$ is finite and $f(0) = 1$. In terms of $f^{-1}$, we see that $$\int_{0}^{\infty}f(x)\, dx = \int_{0}^{1}f^{-1}(y)\, dy.$$ The way I saw this was by drawing an $f(x)$ and noticing that if I integrate in $y$ instead, the left handed integral becomes the right handed integral. Is there a way to do this with change of variables/$u$-substitution or other ways (namely ones that don't require drawing a picture of $f$)?
Answer: \begin{align}
I&=\int_{y=0}^{y=1}f^{-1}(y)dy\\
\text{substitute $y\to f(x)$ and $dy\to \frac{df}{dx}dx$}\\
&=\int_{f^{-1}(0)}^{f^{-1}(1)}f^{-1}(f(x))\frac{df}{dx}dx\\
&=\int_\infty^0x\frac{df}{dx}dx\\
\text{apply integration by parts}\\
&=[xf(x)]_\infty^0-\int_\infty^0f(x)dx\\
\text{switching the bounds negates the integral}\\
&=(0f(0)-\lim_{x\to\infty}xf(x))+\int_0^\infty f(x)dx\\
\text{$\lim_{x\to\infty}xf(x)$ must be 0 if the integral converges, hence}\\
&=\int_0^\infty f(x)dx
\end{align}
Comment: I don't understand the change of variables here. How do you know that $f^{-1}(0)=\infty$ and $f^{-1}(1)=0$??
Comment: @tattwamasiamrutam I *know* that $f(0)=1$ because OP said so. That implies $f^{-1}(1)=0$. I *assume* that $f(\infty)=0$ because otherwise the integral of $f(x)$ wouldn't converge very easily. So if our integral is relatively sane, we can also assume that $f^{-1}(0)=\infty$ :)


Modal UINavigationController presented in wrong orientation

Question: I have a setup where an iPad app supports all orientations. In part of the application, a tap triggers the display of a modal view controller which requires a navigation controller. So I'm basically doing:
UIViewController *myViewController = [[UIViewController alloc] initWithNibName:@"MyView" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:myViewController];
NSLog(@"%d", nav.interfaceOrientation);

[window.rootViewController presentModalViewController:nav animated:YES];

This works fine when the iPad is in portrait (home button). In any other orientation, the modal view always appears in portrait from the home button rather than the current bottom of the device.
If I skip the navigation controller completely and just show myViewController modally, it appears correctly.
So, I tried subclassing the UINavigationViewController and explicitly overriding the shouldAutorotate: and supportedInterfaceOrientations: methods, but this doesn't have any effect. Interestingly if I override the viewWillAppear method and log the value of the interfaceOrientation property, this always returns 1 even if it returns the correct value when accessing it from the code above.
I've also checked that all orientations are supported in Info.plist.
So, what else could be happening to cause this behaviour? Any help greatly appreciated.
Answer: Try to implement preferredInterfaceOrientationForPresentation in your subclass of the navigation controller.
The following worked for me:
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return self.interfaceOrientation;
}


Taking into account power factor when calculating energy savings

Question: I am attempting to calculate the energy savings of a fan motor after a new runner and inlet cone was installed which claimed to improve fan efficiency.  I have logged amp draw before and after the upgrade.  The fan is in a large pulp and paper mill and is used for supplying combustion air to a Power Boiler.  The site claims to have near unity power factor however I believe the fan motor is very old and probably has a much lower PF.  My question is, do I need to take into account the site PF when calculating the energy consumption of the fan? or simply the PF of the fan itself?
Comment: How are you defining "efficiency"? The amount of real power (kilowatts) used by the motor? Or the number of billable power units charged by your power utility - which might be real power, or apparent power, depending on where you live?
Comment: I would guess that for a small change to the motor conditions, you can assume the power factor didn't change, so the amps ratio is the same as the power ratio.  The real question with the fan is how much work does it really do? How would you know if it moved 50% more air for the same electricity, did you measure velocity and pressure? Would the furnace run hotter? Would a controller turn the fan speed down? You need to know this too.
Comment: I do not want to get into too much detail of the work the fan is actually performing before and after the upgrade.  I am simply interested in the power consumption of the fan before and after the upgrade.  The facility is claiming their site is unity power factor due to large refiner motors and therefore they are calculating consumption of the fan with a PF of 1, using measured amps.  I believe the consumption of the fan should be calculated using the PF of the fan itself (<1).  Is that correct?
Comment: Ok. Yes, to calculate power consumption you need the PF, so you need a wattmeter or a digital power monitor. But I think it's safe to assume the power factor hasn't changed very much.
Answer: Neither you, nor the fan, can tell what the power factor of the site is, just by looking at the electrical socket (or however the fan connects).  The supply to the motor is an AC voltage, and the current drawn by the fan motor (and the phase relationship to voltage) is entirely dependent on the motor itself.  You are correct that you can ignore the "site power factor".
Note that reading the fan current may not tell you what you expect.  It might not change much, but the phase (and thus, the power factor) could, and that reflects the amount of actual work done by the motor.