Is it possible to synchronize managed metadata term store across dev-test-prod?

Question: Using the managed metadata service with SharePoint 2010, is it possible to synchronize term sets across different farms (or to export an existing term set to CSV so it can be imported on another farm)?
Answer: Does http://termsetimporter.codeplex.com/ help you?
You can try http://metadataexportsps.codeplex.com/ also
Answer: Maybe you would find this helpful:
http://termsetimporter.codeplex.com/
To be honest you could probably knock up a PowerShell script to extract a termset using the object model fairly quickly - but if this works then why reinvent the wheel.
Answer: We recently moved our term set from test to production simply by attaching the managed metadata database on our production site and moving it along with our content database.
The reason this approach was chosen was, that the users had already starting filling in content in the test environment. Be aware that any import/export solution like the one on codeplex will detach any existing term usage on the content database. For example if you use the taxonomy to tag up documents, the data will stay after migrating the content database, but if you just import the existing terms rather than move the taxonomy database, the items on the documents will be read-only since the lists/TaxonomyHiddenList wont be able to identify the "new" terms as they have completely different GUIDS than the original terms.
Note that this is only an issue if you move both content database and terms from one farm to another, not if you move it to a clean content database that doesnt use the terms yet!
Remember to point to existing taxonomy database when creating a new service application http://technet.microsoft.com/en-us/library/cc263299.aspx
Comment: This is the process we use, bring down both databases and then relink the Term Store URL to the local environment after attaching both databases.  Works great for us!
Answer: Another possible approach (with source code) here: Exporting taxonomies from a Microsoft SharePoint 2010 Term Store
Answer: Have a look at MatchPoint for SharePoint. It provides a TermImporter with various sources like Sql databases, Active Directory, SharePoint lists or any other custom source and it even keeps the managed metadata synchronized.
http://getmatchpoint.com/media-center/news/preview-matchpoint-term-store-importer
Comment: Just a warning that spam is not welcome here. It's OK to advertise your product where it answers a question, but you must disclose that you work for the company in the post, and participate elsewhere in the site without advertising.
Answer: Yes, using 3rd party tools like Taxonomy Manager for SharePoint 2010:

You can try here:
http://www.layer2.de/en/products/Pages/Taxonomy-Manager-SharePoint-2010.aspx
Thanks, Frank
Answer: Yes. You can use a SharePoint Add-In like ServiceAware Term Store Sync to do either manual or scheduled synchronization. There is support for both SharePoint 2013 and SharePoint Online in Office365.

You can download a fully functional free 30-days trial from http://www.serviceaware.com/Product/Download
Thanks
Charlotte, ServiceAware
Answer: By far the best free Sharepoint powershell tool to do this is by Gary Lapoint (installed as .wsp package):
http://www.falchionconsulting.com/PowerShellViewer/Default.aspx?Version=SP2013&Cmdlet=Export-SPTerms
http://www.falchionconsulting.com/PowerShellViewer/Default.aspx?Version=SP2013&Cmdlet=Import-SPTerms
Export is in a convenient XML format where one can bulk find and replace the term owner="domain\farmer" with owner="" blank. Then import into any farm.
Answer: The really easy way to do this would be to share the service between Farms. My preference is to maintain the "REAL" one of Production and use it over on Development by creating a Managed Metadata Service Proxy on Development.. That way it's transparent and any of the odd bits that you can use on a term in SharePoint 2013+ are automatically carried over...


Missing time when using timer

Question: I have set up Timer2 to count every tick at 16MHz, or 62.5ns per tick. Then I run the following code:
<code>int t = 0;
    for (int i=0;i<64;i++){
  data[4*i] = TCNT2;
  data[4*i+1] = TCNT2;
  byte now = data[4*i+1];
  byte last = data[4*i];
  t += now > last? (long)(now-last) : 256 -(long)(last-now);
  data[4*i+2] = TCNT2;
  data[4*i+3] = TCNT2;
  }
}
for (int i=0;i<255;i++){
  Serial.println(data[i]-data[i+1]);
}
</code>
and I get the output: "4 4 4 11" (repeated) which makes sense, 4 clock cycles to read TCNT2 and write it to the correct place in data and 11 cycles when also evaluating the loop condition. However, I can't understand when the variable t is updated. I have tried running with and without t and both give the same timings. From my (obviously lacking) understanding updating a variable is at minimum one instruction, so how can it do it under one clock cycle? Am I misunderstanding what one instruction is or does the TCNT2 counter for the timer not update accurately here?
Answer: Ops, I just realized it's the compiler working it's magic. I never used t, thus the compiler said "Wtf is this guy doing, this t is useless and I'll remove it!". When I used t I got sensible results.

Missing time when using timer


Nginx to default to index.php

Question: Using raspbian stretch, and have configured a site using:
server {
    listen 80 default_server;
    # what does this do? listen [::]:80 default_server;
    root /var/www/html;
    index index.php;
    server_name localhost;
    # First attempt to serve request as file, then as directory, then fall back to displaying a 404.  Maybe change?
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    # Causes too many redirects
    #location / {
    #    index index.php;
    #    try_files  / =404;
    #}
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;

        # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        # With php-cgi (or other tcp sockets):
        # fastcgi_pass 127.0.0.1:9000;
    }
    # If desired, deny locations: location ~* /(.git|cache|bin|logs|backups|tests)/.*$ { return 403; }
}

The out-of-the-box snippets/fastcgi-php.conf is:
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;

# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;

# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;

fastcgi_index index.php;
include fastcgi.conf;

http://10.120.11.40/index.php works but http://10.120.11.40 and http://10.120.11.40/ do not.
Adding fastcgi_split_path_info ^(.+\.php)(/.*)$;, however, allows them to work.
Is the default snippets/fastcgi-php.conf incorrect, or am I doing something wrong?
Answer: you can try
index index.php index.htm index.html;

Comment: Already have `index index.php;`

Nginx to default to index.php


Is there a formal definition of what a distinguisher is?

Question: I've often been reading about (polynomially bounded) distinguishers in books or papers. Although by name and intuition it is somewhat clear what a distinguisher is and does, but i am asking myself whether there is a concrete formal definition. Despite the concept being used frequently, i wasn't able to find one.
Comment: The Wikipedia article on [cryptographic advantage](https://en.wikipedia.org/wiki/Advantage_(cryptography)) may be of use.
Answer: A distinguisher is an arbitrary algorithm. In fact, we do NOT want to formalize anything about the distinguisher (except that its output is a single bit, although we don't even really need to do this). In definitions, we require that no distinguisher should succeed with non-negligible probability. So, this should hold for any algorithm.
Of course, we do specify the complexity class of the distinguisher (either probabilistic polynomial-time or non-uniform polynomial-time).
Comment: I think that should be "non-negligible advantage", not probability.
Comment: Well, it just depends on what you mean by "succeed". But, yes, this is the intention.
Comment: How would you define "succeed" to fit in this case? I can't think of a natural definition.
Comment: Formally, I meant what you meant. I wouldn't define it differently...
Answer: If you need further reading I strongly recommend you having a look at the paper "On the Role of Definitions in and Beyond Cryptography", by Rogaway. There he explains clearly the concept of distinguisher.


Erdas Imagine DN to TOA reflectance for SPOT images

Question: I would like to convet DN to TOA reflectance in Erdas Imagine 2013. I see there is a way of doing this for Landsat7 in the Radiometric tab. How can I do this for SPOT2,4,5 images?
Answer: As far as I know there is indeed no pre-implemented module for the automated conversion of SPOT DN values to reflectance. If you insist on doing it in ERDAS Imagine, then you should use the Spatial Modeler for the conversion. Maybe this might help you getting started.
You need to look up the gain parameters of the SPOT sensors in order to apply the right formulas in Spatial Modeler.


Gauss's Law understanding

Question: In the case of a point charge $q$ at the origin, the flux of $\vec{E}$ through a sphere of radius  r is,
\begin{equation}
\oint \vec{E}\cdot d\vec{a} = \int \frac{1}{4 \pi \epsilon_0 }(\frac{q}{r^2}\hat{r})\cdot (r^2 \sin\theta d\theta d\phi \hat{r})=\frac{1}{\epsilon_0}q.
\end{equation}
I want to know that, how the above equation has the value of $\frac{1}{\epsilon_0}q$?
Comment: The integral is pretty trivial... what do you get when you simplify the terms?
Answer: Notice that the factors of $r^2$ cancel, and $\hat r\cdot\hat r = 1$ so the integral expression you wrote down reduces to
$$
  \frac{q}{4\pi\epsilon_0}\int \sin\theta \,d\theta \,d\phi
$$
The bounds of integration are $0<\theta<\pi$ and $0<\phi<2\pi$ so we really need to compute
$$
  \int_0^\pi \sin\theta\,d\theta\int_0^{2\pi}d\phi = 2(2\pi) = 4\pi
$$
so the factors of $4\pi$ cancel and we are left with $q/\epsilon_0$ as desired.
Answer: Because $\hat{r}\cdot\hat{r}=1$, hence $\frac{q\hat{r}}{r^2}\cdot r^2\sin\theta d\theta d\phi\hat{r}=q\sin\theta d\theta d\phi$, and the integral of that over a sphere is $4\pi q$, giving the result.

Gauss's Law understanding


Get Label For SObject API Name

Question: I have an exhaustive list of custom objects whose API Names and labels does not match. I end up opening each object in order to determine if the label has matching API Name.I want to see the API Name displayed along with label on the result page of custom Objects. Is there a better way to get label for a custom object when its API Name is known?
Answer: You can get the label using the DescribeSObjectResult:
DescribeSObjectResult describe = SObjectType.MyApiName__c;
system.debug(describe.getLabel());

Another common syntax is:
DescribeSObjectResult describe = MyApiName__c.sObjectType.getDescribe();

You can also just one-line it:
system.debug(SObjectType.MyApiName__c.getLabel());

Comment: You are really not making yourself clear. Sorry.
Comment: I am looking to do it from the platform, not from the code. A soql query will also help.
Comment: You cannot use a query. What do you mean by *from the platform*?
Comment: When I log into my org I do a search for objects which has more than 500 objects. I know the API Name and want to navigate to that object but I end of opening each object to see if that is the object I am looking for or not.
Answer: The OP asked how to handle an

exhaustive list of custom objects

not just 1 at a time.
For built-in sObjects, the Label is usually the same as the API name but with spaces. Unfortunately there are exceptions for example
API Name: OpportunityLineItem
UI Label: Opportunity Product
Custom sObjects can be anything, so you'll need to get a map of all of their API names and Labels. Much of that comes out of the box with Schema.getGlobalDescribe();
The code below worked for me to put the API Name next to the Label.
    Map<String, SObjectType> sObjects = Schema.getGlobalDescribe();
    for (String apiName : sObjects.keySet()) {
        // As far as I know all custom sObject API names end in __c
        if (!sObjects.get(apiName).getDescribe().getName().endsWith('__c')) {
            // Replace spaces with empty string
            System.debug(sObjects.get(apiName).getDescribe().getName() + ' - ' + sObjects.get(apiName.replaceAll('\\s+', '')).getDescribe().getLabel());
        } else {
            System.debug(sObjects.get(apiName).getDescribe().getName() + ' - ' + sObjects.get(apiName).getDescribe().getLabel());
        }
    }

Now that the SFDX CLI is available however, I would install it and write a fake test that runs the code above and then redirect it to the CLI.
From there, you could further redirect that output to a file, which would be pretty easy to convert to a basic HTML or VisualForce table.
You probably have the same issue with custom fields. There are now browser plugins for Firefox and Chrome which do an OK job of displaying the fields in Classic Mode

Get Label For SObject API Name


What is the meaning of a large p-value?

Question: I understand that the $p$-value is the conditional probability of observing the test statistic or something more extreme given that the null hypothesis is true. I have read the great explanation by @user28 in this post: What is the meaning of p values and t values in statistical tests? However, do large $p$-values say anything? Does a larger $p$-value lend greater support to the null hypothesis? If I set rejection region to be $<0.05$, then does it make a difference if I get $p$-value $0.06$ or $0.99$? (After all, $0.05$ is arbitrary, and $0.06$ is so close to being rejected that if I arbitrarily set $0.05$ as $0.1$ instead, the null hypothesis would have been rejected.) Can one make any statistical use of a non-rejecting $p$-value?
Comment: One example is mentioned at the end of [this answer](http://stats.stackexchange.com/a/22350/919): Fisher's re-examination of Mendel's pea experiments.
Comment: You cannot conclude that a test statistic supports the null hypothesis when the calculation of that statistic is conditional on the assumption that the null is true.  That is to say, if $E$ and $H_0$ are events, you cannot say $H_0$ is true if $\Pr[E \mid H_0]$ is "large."
Comment: @heropup By the same reasoning we can't say that $H_0$ is false if $p$-value is very small?
Answer: How you should 'use' the p-value depends on how you have designed your study with regard to the analyses you will run.  I discuss two different philosophies about p-values in my answer here: When to use Fisher and Neyman-Pearson framework?  You may find it helpful to read that.  If you have, for example, run a power analysis and intend to use the p-value to make a final decision, you should not use close to the line ('marginally significant') as a meaningful category.  It is fine to use a different alpha than $0.05$ (such as $0.10$), but once you decided on it and set your study up accordingly, you should stick with it.
In addition, you cannot use a large p-value as evidence for the null hypothesis.  I discussed that idea in my answer here: Why do statisticians say a non-significant result means "you cannot reject the null" as opposed to accepting the null hypothesis?  Reading that answer may be helpful to you as well.
Answer: In my view, everything boils down to assumptions, that is, how well the models fits them. If it does agree with all of them, treat the p-value as a probability. Then you can compare p-value of 0.06 with 0.99 by concluding which of the two are more likely. Also, a lot depend on circumstances: in some cases, marginal significance shouldn't be ignored, because as you stated, rejection region can be set rather arbitrarily. But if the models satisfies the assumptions, then you should not seek to reject your hypothesis to some arbitrary level but rather investigate, how likely is the outcome that you got.
Comment: It is problematic to (mis)interpret a p-value as a probability in this sense. You seem to be applying a Bayesian-like approach but without the usual care needed to consider and defend a prior distribution.  What justification can you provide to support your recommendations?
Comment: No, it would not.  There is a *lot* of debate about p-values, but practically everybody who has entered into it (on either side) has noted that this use of p-values is invalid.  Comparing p-values does not determine whether one model is more or less likely than another.
Comment: Yes, you are right. I started googling and two source made things more clear: Hubbard, R. (2004). Alphabet soup: Blurring the distinctions between p's and α's in psychological research. Theory and Psychology, 14 (3), 295-327; Hubbard, R., & Lindsay, R.M. (2008). Why P values are not a useful measure of evidence in statistical significance testing. Theory and Psychology, 18 (1), 69-88. Obviously, I had an incorrect view of the concept!
Comment: well, I was having a linear regression in mind satisfying all the conventional assumptions of the models and as a result regression coefficients having normal distributions. I suppose in this case it would be safe to treat p-value as a probability, wouldn't it?
Answer: It is true that the acceptance range for the p-value of a hypothesis test is rather arbitrary, but nevertheless a lower p-value means that the test result can be accepted with more certainty, because the p-value essentially defines the confidence interval for the estimate, so a narrower confidence interval should be regarded more significant for the test.

What is the meaning of a large p-value?


Why so many interviews for just 10 vacant positions?

Question: A company conducts campus placement in about 10 to 12 colleges. Overall they shortlist about 100 to 110 students from all the colleges and calls them for next round of interviews. After over 2 to 3 months of drama they provide offer to 10 to 15 students just in case if someone backs out. The position and salary is not that great but for a fresher its an average pay job with average skills required for that job and any graduate with average score can do the job. So why waste so much time ? This is not a one-time deal they do this annually ?
Is this normal or they just do it so the HR has something to do for that period ? Why waste so much resources for this ?
Comment: A couple of ideas at the top of my head. They may want to cultivate an aura of mystique and exclusivity at making the choice between so many applicants.  Also, legal requirements. They may be required by law to justify their hiring decisions. They may also feel pressured to interview students that have been referred to them by family members or friends (even if they have no intention of hiring any of them).
Comment: A campus recruitment doesn't require 2 to 3 months of drama. I got 3 job offers in campus recruitments, and the interviews lasted just 1 or 2 days per company. That aside, I don't see why you think this is a problem. When a company goes to a college for recruitment, they cannot just say we will interview some 20 students at random because we will only offer 10 jobs.
Answer: You didn't mention what kind of job this is, but I assume that it's a Junior Position.
110 Interviews for 10 positions is already stretching it, a lot. Its not uncommon for companies to interview hundreds of candidates per position, especially when they're big companies.
A junior position or a job "that everyone with a degree can do" is usually just a stepping stone to more responsibilities in the company. They want to make sure to get a decent employee who is useful in the role, a good fit for the company culture, gets along with prospective coworkers and (maybe) is fit to eventually moving to a more senior position. All of that takes lots of screening and usually lots of candidates.
Resources spent on finding the proper candidate as opposed to someone that could cause issues later aren't wasted. Hiring is a notoriously expensive process.
Answer:
So why waste so much time ?

Some possibilities:

Each college requires a specific number of interviews in order to take part in their campus placement activities
The company isn't 100% sure how many positions will be available
The company really wants to hire the best people
People generally like to feel selected/important, the lower the offer rate the more they might feel this way
Logistically it might be convenient - at my University, most companies have on-site interviews the next day. It is very quick/easy/cheap for them to schedule a full day of 30 minute interviews from the resumes they collect after the job fair

It is much easier/cheaper to interview 20 people this way than to bring 10 to the company for onsite interviews

Enough hiring managers are affiliated with all the universities and want to "interview a lot from my school"

The reality is every company has different approaches to recruiting. It might just be some manager having a power trip, too, it is hard to say.
Answer: In some companies HR gets quite top heavy and this sort of thing becomes the norm. I've seen a company go from one HR who was a very busy person for several years, to within 2 months having 6 HR personnel all trying to look busy.
It's pretty much up to each company and how their HR operates. My own opinion is that HR can at times become an industry within an industry not always for the benefit of the company and if not controlled properly they start making their own work. But that's just my opinion from an outsiders perspective.
Answer: If a company is interested in getting the top performers, this is the only feasible approach.
Sturgeon's Law states that 90% of everything is crap. This is true for many things -- also, and in particular, with people you hire.
It is a common misbelief among tech companies that they hire only the best of the best of the best. Almost every company with a bit of self-esteem says that. The fallacy is: "We interview 100 people and only hire the best two.". That's not how you get the best.
It has been known for many years (even Forbes and the NY times meanwhile noticed and wrote about it) that the best of the best are already employed. They are not on the market.
Companies only interviewing those who are looking for a job will eventually of course also find a few good ones, but they will not find the best, or the best of the best. For the most part, they will interview and re-interview the same people who keep applying for jobs unsuccessfully over and over again. Those are however exactly the people that they don't want.
If you want the best of the best, and in particular if you want them affordably, you must catch them before they leave university. Otherwise, you have to take what remains, or you have to pay very, very dearly.
Once employed, you will need to make an offer that is able to convince them to leave their current job, which means it has to be a quite good deal.
You can however only catch the good ones if you know who they are, which means you have to interview a lot of people, even if you only have one or two vacant positions, or maybe do not even have a position open at all (it may be worth creating one).
Comment: This is actually a really good point. Some companies like to interview people fresh out of uni on the off chance that they might catch a raw diamond and can get hands on it before they would later have to pay 10x more to do so.
Answer: One possibility is the company is hoping not only to get the best candidates now, but also to get a large pool of prospective employees in the future to be familiar with the company, and possibly to consider the company in the future when they are applying for more experienced jobs.
If you have a good interview process with a company, even if you don't end up getting (or taking) a job with them, it's very possible you will have a positive opinion of that company afterwards.  As such, you may be more likely to consider that company when you are looking for jobs three to five years later - when you've got enough experience to get that next level position.  Think of it as relatively inexpensive advertising, that does have an additional benefit (of giving you a slightly better incoming class).


Do ants also use the Earth magnetic field?

Question: A lot of animals, specially birds use the Earth magnetic field to orientate on their flight across the Earth. Now some scientist suggest that ants has on their antenna a kind of magnetite crystals by which they also can use the magnetic field. But for what would and could an ant use this huge magnetic field, while they just walk for only meters a day?
Comment: Do you know about compass termites? Their colonies are always North-South facing. I don't know that they are aware of it, but nature has selected them into the now, so it may have something to do with an accidental larval temperature regulation in the colony because the sun hits a larger surface area for a longer period of time, and so the colony is warmer longer over night.
Answer: Hard to say, but for at least one ant species (see below) it seems to be an orientation cue for (relatively short-distance) migration (even if you're only going a few meters, it can be important to walk in a straight line!). At present it seems we know something about the proximal mechanisms of magnetoreception, and a little bit about the observed behavioural patterns, but don't have much more than informed speculation about the ecological/evolutionary advantages of this form of spatial orientation.
Searching "ant magnetotaxis" gets to this article on magnetotaxis in the migratory ant Pachycondyla marginata:

The influence of geomagnetic field changes on the behavior of ants has been studied in the species Solenopsis invicta (Anderson and Vander Meer, 1993), Formica rufa (Çamlitepe and Stradling, 1995), and Oecophylla smaragdina (Jander and Jander, 1998) ... Another migratory insect species is the ant Pachycondyla marginata, which has very peculiar habits: a diet of living termites and migration in a preferential direction (Leal and Oliveira, 1995). These habits make such a migratory ant very attractive for the study of biomineralized magnetic materials.

From Leal and Oliveira 1995 ref above:

Migration by P. marginata colonies lasted over 2 days and covered distances of
  2-97 m (n=48).

Selections from Acosta-Avalos et al. 2001 Naturwissenschaften:

abstract: Migrations during the dry/cold season are significantly oriented 13 degrees with the magnetic North-South axis, while rainy/hot migrations do not exhibit a preferred direction. This result is discussed considering the hypothesis that P. marginata ants may use the geomagnetic field as an orientation cue for migrations in the dry/cold season.
Given that colonies resume nest relocation late
  in the afternoon of the second day, most of the migratory
  process takes place under darkness conditions.
On  the  other  hand,  nest  relocations  in  the  dry/cold
  season can be considered as typical migrations.
The  use  of  geomagnetic  cues  is  more  commonly  associated with darkness conditions, as reported for mole rats
  (Marhold et al. 1997) and also proposed for bumblebees
  (Chittka  et  al.  1999).  As
  P.  marginata
  ants  start  the
  migratory  process  in  the  afternoon,  they  can  use  any  of
  those  cues  in  their  orientation  during  the  migratory
  journey. However, it is intriguing that they prefer an axis
  around the North–South axis to migrate. The only possible
  cue  to  give  this  information  under  all  conditions  is  the
  one  provided  by  the  geomagnetic  field.


Differences between fork and exec

Question: What are the differences between fork and exec?
Comment: @Justin, because we want SO to become *the* place to go for programming questions.
Comment: A good, detailed summary of fork, exec, and other process control functions is at http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html
Comment: this tutorial is also very helpful! https://devconnected.com/understanding-processes-on-linux/
Comment: so `fork` is basically cloning :O
Answer: The use of fork and exec exemplifies the spirit of UNIX in that it provides a very simple way to start new processes.
The fork call basically makes a duplicate of the current process, identical in almost every way. Not everything is copied over (for example, resource limits in some implementations) but the idea is to create as close a copy as possible.
The new process (child) gets a different process ID (PID) and has the PID of the old process (parent) as its parent PID (PPID). Because the two processes are now running exactly the same code, they can tell which is which by the return code of fork - the child gets 0, the parent gets the PID of the child. This is all, of course, assuming the fork call works - if not, no child is created and the parent gets an error code.
The exec call is a way to basically replace the entire current process with a new program. It loads the program into the current process space and runs it from the entry point.
So, fork and exec are often used in sequence to get a new program running as a child of a current process. Shells typically do this whenever you try to run a program like find - the shell forks, then the child loads the find program into memory, setting up all command line arguments, standard I/O and so forth.
But they're not required to be used together. It's perfectly acceptable for a program to fork itself without execing if, for example, the program contains both parent and child code (you need to be careful what you do, each implementation may have restrictions). This was used quite a lot (and still is) for daemons which simply listen on a TCP port and fork a copy of themselves to process a specific request while the parent goes back to listening.
Similarly, programs that know they're finished and just want to run another program don't need to fork, exec and then wait for the child. They can just load the child directly into their process space.
Some UNIX implementations have an optimized fork which uses what they call copy-on-write. This is a trick to delay the copying of the process space in fork until the program attempts to change something in that space. This is useful for those programs using only fork and not exec in that they don't have to copy an entire process space.
If the exec is called following fork (and this is what happens mostly), that causes a write to the process space and it is then copied for the child process.
Note that there is a whole family of exec calls (execl, execle, execve and so on) but exec in context here means any of them.
The following diagram illustrates the typical fork/exec operation where the bash shell is used to list a directory with the ls command:
+--------+
| pid=7  |
| ppid=4 |
| bash   |
+--------+
    |
    | calls fork
    V
+--------+             +--------+
| pid=7  |    forks    | pid=22 |
| ppid=4 | ----------> | ppid=7 |
| bash   |             | bash   |
+--------+             +--------+
    |                      |
    | waits for pid 22     | calls exec to run ls
    |                      V
    |                  +--------+
    |                  | pid=22 |
    |                  | ppid=7 |
    |                  | ls     |
    V                  +--------+
+--------+                 |
| pid=7  |                 | exits
| ppid=4 | <---------------+
| bash   |
+--------+
    |
    | continues
    V

As an aside, there's an interesting answer over on the Retrocomputing Stack Exchange site that details some history of fork and exec.
Answer: fork() splits the current process into two processes. Or in other words, your nice linear easy to think of program suddenly becomes two separate programs running one piece of code:
 int pid = fork();

 if (pid == 0)
 {
     printf("I'm the child");
 }
 else
 {
     printf("I'm the parent, my child is %i", pid);
     // here we can kill the child, but that's not very parently of us
 }

This can kind of blow your mind. Now you have one piece of code with pretty much identical state being executed by two processes. The child process inherits all the code and memory of the process that just created it, including starting from where the fork() call just left off. The only difference is the fork() return code to tell you if you are the parent or the child. If you are the parent, the return value is the id of the child.
exec is a bit easier to grasp, you just tell exec to execute a process using the target executable and you don't have two processes running the same code or inheriting the same state. Like @Steve Hawkins says, exec can be used after you forkto execute in the current process the target executable.
Comment: there's also the condition when `pid < 0` and the `fork()` call failed
Comment: That doesn't blow my mind at all :-) One piece of code being executed by two processes happens every time a shared library or DLL is being used.
Answer: I think some concepts from "Advanced Unix Programming" by Marc Rochkind were helpful in understanding the different roles of fork()/exec(), especially for someone used to the Windows CreateProcess() model:

A program is a collection of instructions and data that is kept in a regular file on disk. (from 1.1.2 Programs, Processes, and Threads)

.

In order to run a program, the kernel is first asked to create a new process, which is an environment in which a program executes. (also from 1.1.2 Programs, Processes, and Threads)

.

It's impossible to understand the exec or fork system calls without fully understanding the distinction between a process and a program. If these terms are new to you, you may want to go back and review Section 1.1.2. If you're ready to proceed now, we'll summarize the distinction in one sentence: A process is an execution environment that consists of instruction, user-data, and system-data segments, as well as lots of other resources acquired at runtime, whereas a program is a file containing instructions and data that are used to initialize the instruction and user-data segments of a process. (from 5.3 exec System Calls)

Once you understand the distinction between a program and a process, the behavior of fork() and exec() function can be summarized as:

fork() creates a duplicate of the current process
exec() replaces the program in the current process with another program

(this is essentially a simplified 'for dummies' version of paxdiablo's much more detailed answer)
Answer: Fork creates a copy of a calling process.
generally follows the structure

int cpid = fork( );

if (cpid = = 0)
{

  //child code

  exit(0);

}

//parent code

wait(cpid);

// end

(for child process text(code),data,stack is same as calling process)
child process executes code in if block.
EXEC replaces the current process with new process's code,data,stack.
generally follows the structure

int cpid = fork( );

if (cpid = = 0)
{
  //child code

  exec(foo);

  exit(0);
}

//parent code

wait(cpid);

// end

(after exec call unix kernel clears the child process text,data,stack and fills with foo process related text/data)
thus child process is with different code (foo's code {not same as parent})
Comment: It' s a bit unrelated to the question but doesn't this code above cause a race condition if child process happen to finish it's code first? In that case, parent process would hang around forever waiting the child to terminate itself, right?
Comment: @stdout: it's a bit late answering your question but I don't think a race condition occurs. When a process exits before a parent waits on it, it enters a zombie state (it's dead but still hanging around somewhat). The bit that's hanging around is basically the exit code, so that the parent can eventually `wait` and receive that info. At that point, the zombie disappears fully. And, if the parent disappears first, the `init` process inherits the child and eventually reaps the exit process (when child exits).
Answer: They are use together to create a new child process.  First, calling fork creates a copy of the current process (the child process).  Then, exec is called from within the child process to "replace" the copy of the parent process with the new process.
The process goes something like this:
child = fork();  //Fork returns a PID for the parent process, or 0 for the child, or -1 for Fail

if (child < 0) {
    std::cout << "Failed to fork GUI process...Exiting" << std::endl;
    exit (-1);
} else if (child == 0) {       // This is the Child Process
    // Call one of the "exec" functions to create the child process
    execvp (argv[0], const_cast<char**>(argv));
} else {                       // This is the Parent Process
    //Continue executing parent process
}

Comment: In 7th line it is mentioned that exec() function creates the child process.. Is it really so because fork() has already created the child process and exec() call just replaces the program of the new process just created
Answer: The main difference between fork() and exec() is that,
The fork() system call creates a clone of the currently running program. The original program continues execution with the next line of code after the fork() function call. The clone also starts execution at the next line of code.
Look at the following code that i got from http://timmurphy.org/2014/04/26/using-fork-in-cc-a-minimum-working-example/
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
    printf("--beginning of program\n");
    int counter = 0;
    pid_t pid = fork();
    if (pid == 0)
    {
        // child process
        int i = 0;
        for (; i < 5; ++i)
        {
            printf("child process: counter=%d\n", ++counter);
        }
    }
    else if (pid > 0)
    {
        // parent process
        int j = 0;
        for (; j < 5; ++j)
        {
            printf("parent process: counter=%d\n", ++counter);
        }
    }
    else
    {
        // fork failed
        printf("fork() failed!\n");
        return 1;
    }
    printf("--end of program--\n");
    return 0;
}

This program declares a counter variable, set to zero, before fork()ing. After the fork call, we have two processes running in parallel, both incrementing their own version of counter. Each process will run to completion and exit. Because the processes run in parallel, we have no way of knowing which will finish first. Running this program will print something similar to what is shown below, though results may vary from one run to the next.
--beginning of program
parent process: counter=1
parent process: counter=2
parent process: counter=3
child process: counter=1
parent process: counter=4
child process: counter=2
parent process: counter=5
child process: counter=3
--end of program--
child process: counter=4
child process: counter=5
--end of program--

The exec() family of system calls replaces the currently executing code of a process with another piece of code. The process retains its PID but it becomes a new program. For example, consider the following code:
#include <stdio.h>
#include <unistd.h>
main() {
 char program[80],*args[3];
 int i;
printf("Ready to exec()...\n");
strcpy(program,"date");
args[0]="date";
args[1]="-u";
args[2]=NULL;
i=execvp(program,args);
printf("i=%d ... did it work?\n",i);
}

This program calls the execvp() function to replace its code with the date program. If the code is stored in a file named exec1.c, then executing it produces the following output:
Ready to exec()...
Tue Jul 15 20:17:53 UTC 2008

The program outputs the line ―Ready to exec() . . . ‖ and after calling the execvp() function, replaces its code with the date program. Note that the line ― . . . did it work‖ is not displayed, because at that point the code has been replaced. Instead, we see the output of executing ―date -u.‖
Answer: fork() creates a copy of the current process, with execution in the new child starting from just after the fork() call.  After the fork(), they're identical, except for the return value of the fork() function.  (RTFM for more details.)  The two processes can then diverge still further, with one unable to interfere with the other, except possibly through any shared file handles.
exec() replaces the current process with a new one.  It has nothing to do with fork(), except that an exec() often follows fork() when what's wanted is to launch a different child process, rather than replace the current one.
Answer: fork():
It creates a copy of running process. The running process is called parent process & newly created process is called child process. The  way to differentiate the two is by looking at the returned value:

fork() returns the process identifier (pid) of the child process in the parent
fork() returns 0 in the child.

exec():
It initiates a new process within a process. It  loads a new program into the current process, replacing the existing one.
fork() + exec():
When launching a new program is to firstly fork(), creating a new process, and then exec() (i.e. load into memory and execute) the program binary it is supposed to run.
int main( void )
{
    int pid = fork();
    if ( pid == 0 )
    {
        execvp( "find", argv );
    }

    //Put the parent to sleep for 2 sec,let the child finished executing
    wait( 2 );

    return 0;
}

Answer: The prime example to understand the fork() and exec() concept is the shell,the command interpreter program that users typically executes after logging into the system.The shell interprets the first word of command line as a command name
For many commands,the shell forks and the child process execs the command associated with the name treating the remaining words on the command line as parameters to the command.
The shell allows three types of commands. First, a command can be an
executable file that contains object code produced by compilation of source code (a C program for example). Second, a command can be an executable file that
contains a sequence of shell command lines. Finally, a command can be an internal shell command.(instead of an executable file ex->cd,ls etc.)

Differences between fork and exec


How high is the energy yield of photovoltaics compared to photosynthesis?

Question: I'm not an expert in plant physiology. I was wondering if, per square centimeter, leaves are converting more or less energy than photovoltaic systems. Can this be estimated? How?
Comment: In areas where our technology is advanced, you often get us doing better than nature because natural selection only does 'as good as necessary so as not to be outcompeted' whereas our technology can actually do 'as good as practically possible' :)
Comment: Your question could use some clarification. As stated, the premise is wrong because neither leaves nor PV cells produce energy. They can capture or store energy, they can also reflect or absorb and release energy. What pools or fluxes of energy are you interested in comparing? a common comparison is "quantum efficiency", but it is not clear if this is the comparison that you are looking for.
Comment: Does energy used to evaporate water count? Or the energy required to physically transport water from the soil to the air? PV cells don't evaporate or transport water. These are not accounted for in standard measures of quantum efficiency.
Comment: @David. Thanks, fixed the point: of course energy can not be produced/created. My curiosity indulges in the application: could we ever use plants for domestic energy requirements?. It seems photovoltaic are much better, do you agree?
Comment: I don't think either could meet domestic energy requirements alone, at least not in the near future. Your question could be improved with better definitions; it still says "converting", without saying to what. See, for example, [quantum efficiency](http://en.wikipedia.org/wiki/Quantum_efficiency) and [quantum yield](http://en.wikipedia.org/wiki/Quantum_yield).
Answer: According to wikipedia, plants typically convert around 5% of the energy of the sunlight that hit the leaves into energy usable by the plant.  Sugarcane seems to be the best, it converts up to 8% of the energy into actual biomass.
The best solar panels on the market, according to the Independent, convert 21% of energy from sunlight into usable electricity.  Experimental prototypes do much better, and there are some that get over 40%.  Wikipedia has a nice graph of the most efficient solar cell prototypes.
Comment: By the way, the Forbes article is only the best **poly**-crystalline, not the best PV in general. Poly is typically less efficient than mono. There are mono panels on the market that are better than 16%
Comment: Good point!  Replaced that with another link and a bigger number.
Answer: Photovoltaics made from organic sources, like Graphene, (OPVs) have the potential for efficiencies exceeding 24% in a stacked structure. A theoretical max efficiency has not been  proposed, but it is expected to be less than silicon. The main benefit of OPVs is the rock-bottom price and the ability to make very tiny panels.


To Confront or Not Confront...that is the question?

Question: ב"ה
I know the Rambam states that one must not ever get angry as ChAzal have also warned of its dangers which I agree with. But certain situations arise where a person needs to be stern or even confrontational at times to get people to get things done. I am aware of sefirah of gevurah, but everytime I am stern, I usually feel really bad. How does Judaism look at being stern with people, is it looked down upon or a necessary evil so to speak?
Comment: related: http://judaism.stackexchange.com/questions/28398/is-it-written-anywhere-that-one-must-stand-up-for-what-he-believes-is-right
Comment: Similar: http://judaism.stackexchange.com/q/13819
Answer: Rambam himself addresses this. He writes in Hilkhot De'ot (2:6) that although one should avoid anger, should the need for sternness arise, one should feign the emotions, while remaining cool, calm, and collected:

וכן הכעס, דעה רעה היא עד למאוד; וראוי לאדם שיתרחק ממנה עד הקצה האחר, וילמד עצמו שלא יכעוס, ואפילו על דבר שראוי לכעוס עליו.  ואם רצה להטיל אימה על בניו ובני ביתו, או על הציבור אם היה פרנס, ורצה לכעוס עליהם, כדי שיחזרו למוטב--יראה עצמו בפניהם שהוא כועס כדי לייסרם, ותהיה דעתו מיושבת בינו לבין עצמו, כאדם שהוא מידמה איש בשעת כעסו, והוא אינו כועס.
And so to anger is an extremely negative character trait, and it is proper for a person to distance himself from it to the opposite extreme, and he should train himself to not get angry, and even on something that it is normal to get angry over. And should he want to impose fear on his children or household, or on the community, were he a communal leader, and he should he want to get angry at them so that they return to the proper way, he should make himself appear to them as though he is angry in order to chastise them, but inside he should remain calm, like a person who is imitating an angry person, but is himself not angry. (Translation my own)

His son Rabbenu Avraham, similarly writes (HaMaspik L'ovdey Hashem ed. Wincelberg page 71) that anger is always inappropriate; even when it would seem normal in circumstances. External sternness however, is sometimes necessary. In fact, he writes that one [such as a ruler] who must administer punishment and does so with pure intentions and not out of anger is on a level of piety close to that of prophecy.
Evidently, sternness is not only sometimes warranted, but in cases where it is, if it is with pure intentions, it is appropriate and praiseworthy.


Is there a popular philosophical argument that purports to show or corroborate the claim that the reality is a computer simulation?

Question: Is there a popular philosophical argument that purports to show or corroborate the claim that the reality is a computer simulation? I am wondering if any philosopher tried to tackle this question with some strong philosophical arguments, because most of the arguments I've heard seem to rely on pseudoscience or highly speculative arguments based on certain scientific facts that aren't convincing.
Comment: Unfortunately, yes, see [simulation argument](https://en.wikipedia.org/wiki/Simulation_hypothesis#The_simulation_argument), but speculative and unconvincing is still an understatement even after it is tidied up into premises and inferences. It first appeared in Bostrom's paper [Are You Living in a Computer Simulation?](https://www.simulation-argument.com/simulation.html) and has the usual "merits" of anthropic reasoning and glossing over what the proposed fantasy, in this case "simulating", really amounts to.
Comment: As a ...hint, Plato's philosophy and the platonic tradition
centers on this topic, that the visible world is a simulation
of the world of ideas, with mathematics occupying an in-between position
and capable of getting in touch with either of them. Modern views are variations of an old theme.
Comment: @JohnForkosh - That study was just ruling out one particular idea about how a universe like ours might be simulated in an approximate way (using a lattice-like grid for space), it doesn't rule out simulations that don't use that approximation. David Deutsch proved in [this paper](https://web.archive.org/web/20180721014039/https://people.eecs.berkeley.edu/~christos/classics/Deutsch_quantum_theory.pdf) that any "finitely realizable" system obeying the rules of quantum mechanics can be simulated perfectly (no approximations that introduce errors).
Comment: I could be a Boltzmann brain. A momentary coherence of matter in an otherwise random and formless universe. https://en.wikipedia.org/wiki/Boltzmann_brain Speculations like this are part of metaphysics, not physics. They're beyond science. Can't be proved or disproved. Gotta go it's feeding time in the vat.
Comment: I wrote a series on this subject for "Partially Examined Life." Please check it out here: https://partiallyexaminedlife.com/?s=saints+and+simulators
Answer: The basic idea promoting the hypothesis is a statistical one (and that includes the Bostrum paper): An extrapolation of the amount of the physical substrate of computing resources available to a civilization as a function of the time it exists paired with an estimate of the amount of said resources needed to run the universe as we perceive it as a simulation.
It is argued that the proportion allows for running an very large number of simulations, much larger than the number of civilizations that could possibly evolve in the universe over its lifetime.
However, imho the reasoning is flawed:
1.
It is not addressed why any civilization should want to run the multitude of simulations.
2.
The reasoning is of no help to answer the specific question whether precisely our civilization is a simulation.
(of course, 'civilization' here is restricted to civs with a tech level at least comparable of ours; at least, engineered information processing should be commonplace)
Comment: As I discussed in my answer, Bostrom's reasoning turns on the self-sampling assumption, and given that premise it does address your 2) since if simulated versions of beings living before the posthuman breakout point significantly outnumber the real beings who lived before the posthuman breakout point, by the self-sampling assumption that significantly increases the probability that we are in the former class rather than the latter. As for 1) he does include as an option in his trilemma the possibility that few or no advanced civilizations will run multitudes of ancestor sims.
Comment: sorry, above should read "it does address your 2) since if simulated versions of beings living *after* the posthuman breakout point", not "before"
Answer: Philosopher Nick Bostrom's simulation argument is specifically based on a form of anthropic reasoning known as the self-sampling assumption, which is also used in the doomsday argument that is closely related to the simulation argument. The self-sampling assumption basically says that when you know you're part of a certain group of intelligent beings but don't know certain properties of the group (such as its size, or the size of different subsets), it often makes sense to reason as if your identity was randomly sampled from all the beings in the group. Bostrom had an FAQ on self-sampling and the doomsday argument on his old site which quoted the following thought-experiment from astrophysicist John Leslie:

A firm plan was formed to rear humans in two batches: the first batch to be of three humans of one sex, the second of five thousand of the other sex. The plan called for rearing the first batch in one century. Many centuries later, the five thousand humans of the other sex would be reared. Imagine that you learn you're one of the humans in question. You don't know which centuries the plan specified, but you are aware of being female. You very reasonably conclude that the large batch was to be female, almost certainly. If adopted by every human in the experiment, the policy of betting that the large batch was of the same sex as oneself would yield only three failures and five thousand successes. ... [Y]ou mustn't say: 'My genes are female, so I have to observe myself to be female, no matter whether the female batch was to be small or large. Hence I can have no special reason for believing it was to be large.

Leslie's example is perhaps a little ambiguous in that he doesn't say what the prior probabilities were that the large batch would be female vs. male, though perhaps he is assuming that in the absence of any other information you should assign a 50/50 subjective probability to each possibility, or perhaps he's implicitly assuming we know that the planners of the experiment made the choice using a random process with 50/50 odds like a coin flip. Either way, if you have some prior probabilities for each outcome, and you then treat yourself as a random sample of all the people who will be created in this experiment, then you can use Bayesian inference to update your prior probabilities, meaning if you are a female then you will upgrade the subjective probability that the large batch was female and downgrade the subjective probability that the large batch was male. The self-sampling assumption would say this is exactly analogous to a problem where an urn is filled with 3 balls of one color and 5000 of a different color, but you don't know which color is the majority one--then if you draw a ball and see it's a given color, say red, that should cause you to significantly upgrade your subjective probability that red is the majority color.
In the simplest case where you had 50/50 prior probability that red would be the majority color, after the draw you would update your probabilities to say there was a 5000/5003 chance that red was the majority color, and only a 3/5003 chance that red was the minority color. Similarly in Leslie's thought experiment, if our prior knowledge of the setup said that there was a 50/50 chance that the larger batch would be all-female (again, we could just assume the planners flipped a coin to decide the majority sex), then you should observe your own sex and update your subjective probabilities to a 5000/5003 that the larger batch was the same sex as you--if every individual in the experiment reasons the same way, 5000 will be right and only 3 will be wrong, so it seems like a good bet in that sense.
The doomsday argument is a very similar application of the self-sampling assumption. We don't know how many humans will ever be born (or human-like intelligences 'descended' from human civilization), but say that a priori you would assign some non-negligible probability to the hypothesis that some kind of doomsday is coming soon that will cause a collapse of civilization and a massive dieoff (say, nuclear war, or rampant global warming) so that the number of humans born in the future is smaller than (or at least not much larger than) the total number that have been born up until now, estimated at around 107 billion. And say that you would also assign a non-neglible a priori probability to the hypothesis that humans or their intelligent descendants will avoid doomsday, and have a long and wonderful future where they colonize many different regions of space and in doing so become very difficult to drive extinct, such that a trillion or more individuals will be exist in the future. Then according to the self-sampling assumption, the observation that you yourself are somewhere around the 100 billionth person to be born must sadly cause you to upgrade the subjective probability of the "doomsday soon" scenario, and downgrade the subjective probability of the long and glorious spacefaring future.
If you accept the self-sampling assumption, this is analogous to a situation where you know a numbered ball will be drawn from one of two urns, each containing a collection of balls labeled sequentially, where one urn has a much larger total than the others--for example, in urn A the balls might be labeled 1-100, in urn B they might be labeled labeled 1-10,000. If you don't know in advance which urn the ball is going to be drawn from, but you assign some subjective probability to each beforehand, then if you see the ball that's picked has the number 80 on it, that should significantly increase the subjective possibility you assign to the hypothesis it was drawn from urn A, and significantly decrease the subjective probability you assign to the hypothesis it was drawn from urn B.
I don't know of Bostrom has ever said this specifically, but I would bet that the doomsday argument was part of the inspiration for his simulation argument, since the simulation argument uses self-sampling in a similar way but exploits a kind of loophole that allows us to avoid the conclusion that a near-future doomsday is far more likely than long-term survival of technological civilization. The loophole here is that if a very long-lived advanced civilization acquires vast computing resources and performs "ancestor simulations" containing conscious minds that aren't aware they're part of a historical civilization, then these minds will be deceived about their "birth order". So even if you seem to be only the 100 millionth human (or humanlike mind) that ever arose, you might actually be the 100 trillionth, the 100 quintillionth, etc. And Bostrom is a transhumanist who seems hopeful that our civilization might develop into a "posthuman" one that spawns a vastly larger number of minds--see his paper The Future of Humanity where he discusses the possibility of posthuman civilizations and on p. 20 gives one of the qualifying features as a population greater than 1 trillion--so it seems natural that he'd be interested in any loophole that allows us to avoid the conclusion that our own birth order makes it far less likely that our world will give birth to such a super-civilization. On p. 25 of this paper he also comments that there are plausible (to him) arguments that "the current century, or the next few centuries, will be a critical phase for humanity, such that if we make it through this period then the life expectancy of human civilization could become extremely high", noting the possibility of superintelligent AI giving our civilization much improved "foresight and planning", along with the point that "once a human or posthuman civilization becomes dispersed over multiple planets and solar systems, the risk of extinction declines."
Note though that Bostrom tries to be somewhat "conservative" in the conclusions he actually draws from the self-sampling assumption and the possibility of ancestor simulations. He does not actually say the possibility that we live in a simulation is far more likely than any of the alternative, his conclusion as stated in his simulation argument FAQ is that we should believe in one of the three options in a trilemma:

The argument shows that at least one of the following propositions is true: (1) the human species is very likely to go extinct before reaching a "posthuman" stage; (2) any posthuman civilization is extremely unlikely to run a significant number of simulations of their evolutionary history (or variations thereof); (3) we are almost certainly living in a computer simulation. It follows that the belief that there is a significant chance that we will one day become posthumans who run ancestor-simulations is false, unless we are currently living in a simulation.

So our living in a computer simulation is just considered to be one of the three viable possibilities. If you apply the self-sampling assumption to human-like intelligences similar to ourselves, not just specifically to humans, then for (1) to be true, it would have to be true that the vast majority of civilizations at a level of development similar to ours fail to reach the technological breakout point discussed in The Future of Humanity, i.e. there would have to be a Great Filter lying in the near future of all civilizations at a point similar to ours, something close to an ironclad historical law that civilizations like ours almost never survive. And for (2) to be true, there would have to be a different sort of ironclad historical law that civilizations which do reach that breakout point almost never perform significant numbers of ancestor simulations, given the assumption that civilizations that do make it past this breakout point produce many orders of magnitude more intelligent beings than the 100 billion or so that have existed in our own (apparent) history. It also seems to me that whatever prior probability one assigns to (2), the self-sampling assumption should cause you to significantly downgrade the subjective probability of (2), since only an extreme minority of individuals will have an observed birth order so low in that scenario; I'm not sure why he includes this one with the others.
So if one accepts the arguments for Bostrom's trilemma (or for a dilemma just consisting of the scenarios (1) and (3)), but one finds historical laws required by (1) and (2) to be implausible compared to (3), that would be a reason to assign a larger subjective probability to the hypothesis that we're living in a simulation. Note that the only element of this argument that might be considered a properly philosophical issue is the use of the self-sampling assumption, the rest is just a non-philosophical argument about different possible plausible outcomes for future civilization.
Answer: The popular argument is simple: Civilisations capable of building conscious simulations will build many more than one. Typically they will be simulating their own civilisation. Furthermore, the conscious simulants they create will in turn build simulations of their world, in an ever-deeper nest of levels. Therefore there will be far more conscious beings living in simulations than in the top-level real world. Therefore, the chances are overwhelming that we are living in a simulation.
That's it in a nutshell. But I think it a mistake to compound "popular" and "philosophical" in the same sentence. They say that you can use statistics to prove anything, and I have seldom seen a better example of that in action.
The whole argument is based on the premise that any appropriately complex information system will become sentient. This assumption, exemplified by Integrated Information Theory, is based on the observation that wet hydrocarbons are nothing special, but that what is special about the sentient brain is the information it processes. This is treated not as a philosophical or metaphysical proposition but as scientifically demonstrable. Otherwise, creating simulants would not be possible.
Comment: "the conscious simulants they create ..." We can build simulations of civilizations, gravity, weather, and baseball. But we have no idea whatsoever as to how to implement self-awareness. Doesn't the argument fail on that point?
Comment: @user4894 It is assumed that any appropriately complex information system will become sentient. This assumption, exemplified by Integrated Information Theory, is based on the observation that wet hydrocarbons are noting special, but what is special about the sentient brain is the information it processes. This is regarded not as a philosophical or metaphysical proposition but a scientific fact. Should I preface my answer with that?
Comment: A scientific fact? You're having me on a bit mate. You are stating a metaphysical assumption with zero evidentiary support. Yes you SHOULD make your assumption clear, if only to clarify that it's an unscientific assumption. I'm familiar with Tononi by the way.
Comment: Secondly, I could even grant your premise without granting your conclusion. Perhaps consciousness is *physical but not computational*. So even if consciousness can arise in a non-living system (a proposition for which there is currently zero evidence), it might be that consciousness still can't be implemented by a Turing machine. Searle and Penrose would hold this position. So you have two un-evidenced assumptions, not just one
Comment: Then you will know that it is an explicitly stated premise of Tononi's Integrated Information Theory. It's no good arguing with me what he thinks is scientifically demonstrable, go argue with him. But yes, I'll add it to my answer
Comment: FWIW I accept the premise but reject the conclusion. Neurology tells us that any marginally less complex brain activity is unconscious. Consciousness is "what information feels like when it reaches a certain level of complexity" (--Max Tegmark). But I reject the simulant argument as one of those childish fallacies, including Boltzmann brains and parallel selves in alternate universes, brought about by profound ignorance of large numbers.
Comment: Do you also strongly reject the self-sampling assumption? If one accepts it that seems to point in the direction of believing that *either* there is a good probability we are living in a simulation *or* that that the doomsday argument is correct and the vast majority of civilizations like ours destroy themselves before they can colonize space and burgeon into huge long-lasting high-tech societies.
Comment: There are various self-sampling assumptions which all appear similar but have subtly different expressions and wildly differing consequences. In the present context some variants are valid, others not. For example I assume that I am a "typical" random sample but I have no reason to assume myself to be a mean, median or mode sample. Similarly, a six is a typical roll of a die, but it is none of those other three. Most arguments for simulants or doomsdays hopelessly confuse and conflate the four, under that mathematical no-no banner of "average". It's that profound ignorance of large numbers.
Answer: Pro: The hypothesis provides an elegant answer to the open question "Why is mathematics a language to express the laws of nature?"
Contra: We do not observe typical failures of the natural processes which can be explained as rounding errors due to the mathematical computation which governs the simulation.
"Brian Greene: The Hidden Reality. Penguin Books (2012). See Chap. 10 Universes, Computers, and Mathematical Reality. The Simulated and Ultimate Multiverses.
Comment: Is Heisenberg's Uncertainty Principle not due to rounding errors?
Comment: The uncertainty of the result of measurements due to the uncertainty principle has a different reason. Please look up any reference.
Comment: Isn't that what the programmers what you to think? Can you prove that complementarity is not a device introduced to hide the computational origin of the uncertainty from us simulants? Strikes me  as a very elegant solution to a potentially fatal flaw in the simulation.
Comment: @GuyInchbald If obscurity were the motive, I would expect that the magnitude of the 'rounding error' uncertainty should depend on the (observational) setting. However, as far as we know, it doesn't. However, a more fundamental flaw of the view may be that is assumes the computational model represented by our actual digital computers, which should be expected to be fairly primitive (in fact, being conceptually finite state machines, they _are_ primitive by our own theories of  computation). Why shouldn't a universe sim run on quantum devices or as an analog computer or sth much more advanced?


How can I cap the number of times an advertiser's ad is shown in a given day in Javascript?

Question: Here's the scenario:
On our site, we have 3 advertisers. The advertisers have us collecting emails for their product.
Each advertiser has a cap for the max amount of emails collected per day, say 500. Once we reach 500 emails in a given day, we need to stop showing that advertisers offer.
To build the advertiser stack, we have a Javascript array that determines which advertisers to be shown for a given user. We push each advertiser into the array. If we have no advertisers, we redirect the user to another page.
Basically what I need to do is build an iteration that counts up to '500', and if we get 500 emails in a given day, we don't show that advertiser.
<code>// what offers will be show
var offer_order = [];

// what needs to be written is an iteration that counts up to '500',
// then if its in a given day, do not show the respective offer

// add the advertisers to the order being shown
// if ( cap <= '500' ) {
offer_order.push('advertiser-1');
// }
// if ( cap <= '300' ) {
offer_order.push('advertiser-2');
// }
// this offer has no cap, so it will always be shown
offer_order.push('advertiser-3');

// I removed all of the functionality that sets the starting offer
// and controls showing the next offer, so don't worry about this not working

// send lead data on submit
$('.submit').on('click', function() {
    $.ajax({
        url: 'http://domain.com/send-data.php',
        data: $('#user_data').serialize(),
        type: 'POST',
    }).done(function(responseData) {
        // in our response data, we either get back 'success' or 'fail'

        // we need to build our iteration here

        // if the beginning offer is equal to whats next, then were done, so lets move to the next page
        if ( next == $(starting_offer).data("start") ) {
            window.location.href = "<?php echo $next_page; ?>";
        }

    }).fail(function() {

        // if the beginning offer is equal to whats next, then were done, so lets move to the next page
        if ( next == $(starting_offer).data("start") ) {
            window.location.href = "<?php echo $next_page; ?>";
        }

    });
</code>
Comment: well you need to maintain advertiser-display count on server and fetch the count via ajax.
Answer: To count the number and ad is displayed, you need to split the work between server and client.
The key here is server is maintaining the daily-views while client request for daily-views and ask to update them.
First you need to set up two endpoints for client and server to communicate via http/https:

HttpPost www.example.com/advertiser-1/daily-views [to tell the
server that advertiser-1 has been viewed and so increase its daily
views ]
HttpGet www.example.com/advertiser-1/daily-views [to get
daily views of  advertiser_1 from server]

On client side,

You need to make ajax call(Get request) to server to get the daily count.
When an advertisement is viewed, you need to make an ajax call(Post request) to server to update the advertisers daily views.

On server side,

For get request, return json object containing number of daily views
For post request, increment the count of daily views and return "ok" (or whatever you want)


How did Mr. Poopy-Butthole meet the Smiths?

Question:
Mr. Poopy-Butthole is a long time family friend of the Smith's in Rick and Morty. Has there been any explanation of how he met them?
Comment: I object to calling them Smiths.  We all know they are really the Sanchez family.
Answer: Unknown.
According to his Wikia page:

Mr. Poopybutthole is a long-time family friend of the Smiths. Rick clearly considers him to have long been a dependable person, although it's uncertain how long they've known each other. [...] Mr. Poopybutthole is a very good friend to the Smiths, and although his exact relation to them is unknown, he is described as a long-time friend of the family.

There is a theory that he never really existed, or was never a close friend of the family, and just a false memory implanted by the parasitic aliens. But this theory has been debunked in an interview with Rick and Morty co-creator Justin Roiland, who confirmed that Mr Poopybutthole was real.
Comment: *Rick and Morty* is a story set in multiverse. *Mr. Poopybutthole* is real, but nobody ever told that he's from the dimension **C-137**. Therefore most probable theory is that S02E04 happened in some alternate universe.
Comment: Mr. Poopybutthole is *real* though, he got shot and didn't turn into a parasite. And then he wen't through rehab therapy to learn to walk again, and well... now I'm just sad for him :(
Comment: @oski86 I believe they confirmed that multiple episodes in season 2 did not follow our normal Rick and Morty pair.
Comment: @LegoStormtroopr Yes, he's definitely real. I just mentioned that theory and its debunking in case you (or anyone else reading) might be a proponent of it :-)
Comment: That theory you linked has this comment: "Mr. Poopybutthole's origin episode, it's one of the S1 BluRay Easter Eggs."  Am I correct in assuming that person was a troll?


Can not record 2-channel in Audacity from DJM mixer

Question: Does anyone know a solution to this? Record setting in Audacity is stereo but because the input into the audio interface is only mono, the recording only turns out mono. This is how everything is connected: DJM-900 Nexus has RCA cord from Master 2 going to M-Audio audio interface, then from there to my iMac.  I don't know a better way of connection as the iMac does not have a sound input port, unless there is such a thing as RCA to USB cord...  I have tried using an RCA with 1/8" to go into the headphone jack but that doesn't seem to work as input source at all...
Comment: What is the model of your M-Audio interface ? Does it provide two mono inputs ?
Comment: I'm pretty sure the DJM900 has digital outputs. So you're much better off finding a way to get that digital signal into your iMac.
Answer: M-Audio does sell some interface models which don't have stereo line inputs.  If yours is one of them, then you will not be able to make a stereo recording using that interface.
But it is also possible that you are using the wrong cable.  Your cable should have two RCA plugs on the end going into the mixer.. and the other end should be either two 1/4 inch plugs, or two RCA plugs, depending on what your model of interface needs.  Any cable that has two RCA's on one end and just one plug (probably 1/4 inch TRS type) is incorrect.
But in your case, the answer is much simpler:  The DJM-900 Nexus mixer has a USB connection.. it can be connected directly to the computer where it will appear as sound input device, and you can record directly from it.  No audio interface required.
There are some settings you may need to change on the mixer, as well as some software or drivers you may need to install if you haven't already.  Look in the DJM-900 owners manual, it's all in there.


Is it possible to make deuterated organic compounds?

Question: Organic compounds always have a $\ce{C-H}$ bond. But can we make compounds having $\ce{C-D}$ bonds where  D is the deuterium part like $\ce{CD4}$, $\ce{C2D5CHO}$, $\ce{C6D6}$  and other complex organic compounds? Overall, can we make organic compounds containing deuterium? Also, can we consider those compounds organic? Are the compounds stable? Give some example of preparatory reaction of those compounds.
Comment: Yes, we can, and they can be quite useful probes of chemical and biological processes. Yes, they are still considered organic.
Comment: Just to give an example - $\ce{CDCl3}$ is widely used as an NMR solvent.
Comment: @NilayGhosh A solvent used for [NMR](https://en.wikipedia.org/wiki/Nuclear_magnetic_resonance). I'm going to quote from [the Wikipedia page on proton NMR](https://en.wikipedia.org/wiki/Proton_nuclear_magnetic_resonance) - "Simple NMR spectra are recorded in solution, and solvent protons must not be allowed to interfere. Deuterated solvents especially for use in NMR are preferred, e.g. deuterated water, D2O, deuterated acetone, (CD3)2CO, deuterated methanol, CD3OD, deuterated dimethyl sulfoxide, (CD3)2SO, and deuterated chloroform, CDCl3."
Comment: Um, I haven't heard of "deteurium bonds" to date. And don't forget to use Mathjax for chemical formulae formatting!
Comment: @orthocresol As is $\ce{C6D6}$, which the question specifically asks for ;)
Comment: @orthocresol, What is a NMR solvent?
Answer: Deuterium occurs at around the 0.02% level in nature (natural abundance level).  So all compounds that contain hydrogen will already contain a low level concentration of the deuterated isomer(s).  So in fact, deuterated compounds do exist in nature.
Despite this low level of natural deuterium incorporation, the deuterium can still be detected by various spectroscopic techniques (mass spectrometry and nmr for example).
Further, organic compounds can be synthesized with deuterium in specific locations. These deuterated compounds are still considered organic compounds. Since deuterium is a stable nucleus (e.g. does not undergo radioactive decay), the compounds containing deuterium are also stable.  Because the $\ce{C-D}$ bond is a bit shorter and therefore a bit stronger than the corresponding $\ce{C-H}$ bond, there is an isotope effect in reactions where these bonds are broken. Because the $\ce{C-H}$ bond is weaker, it will break up to 7 times faster than the corresponding $\ce{C-D}$ bond. This can have a significant effect on biological processes.
$\ce{D2O}$ and $\ce{D2}$ gas are relatively common and inexpensive materials that can be used to introduce deuterium into other molecules. Here are 2 examples involving the use of these materials for deuterium incorporation.  In the first example $\ce{D2O}$ is used as the source of deuterium, in the second example deuterium gas is used to introduce the deuterium.  If you google "organic preparation of deuterated compounds" you'll find many more examples.

image source

image source
Specifically deuterated compounds are widely used in many areas of research and industry.
Comment: Is halogen substitution always used? What about preparing deuterated acetylene C2D2 from CaC2 and heavy water?
Comment: @Rich Yes, that would be another (of many) useful approach.


Importing LT SPICE schematic design into Altium Designer 18

Question: I'm working on designing a front-end data acquisition board for signal analysis, and have completed the schematic in LT SPICE. Now I want to import the schematic design into Altium Designer 18 in order to create the layout and gerber files for manufacturing, but I'm having trouble doing so. From that I've figured out so far, such things are normally done inside of the import wizard, but there's no option for LT SPICE files, and certainly none for .asc anyway, which is the file type LT SPICE outputs. This is especially confusing as Altium owns SPICE. Can anyone help me?
Comment: As far as i know Altium doesn't import LTspice files. And Altium doesn't own SPICE. SPICE is an open source circuit simulator.
Answer: Just draw it again in Altium, with the real parts and database that will generate your BOM. There is no way to import much of value and it wouldn't save you much, if any, time anyway.
Then you will need to make sure you can find or create footprints for each part, and do the PCB layout in Altium.
Finally, you can generate the Gerber (and NC drill) files from the layout, from within Altium.
Comment: +1 To elaborate on "much of value", 95% of one's time making schematics is usually adding and managing real-world parts, their symbols and footprints, and LTSpice has none of that. Only 5%, if that, is actually spent drawing wires. Once all the parts are added, recreation of even a complicated schematic would usually only take a few minutes.
Answer: Nobody "owns SPICE". Spice stands for "Simulation Program with Integrated Circuit Emphasis" and is an open-source tool that is implemented by dozens upon dozens of different programs. Altium has its own built-in simulator based around SPICE but it does not "own SPICE". LTSpice and PSpice are other examples of programs that are built around the "SPICE" tool, but once again, Linear Technology and Cadence (the companies that make LTSpice and PSpice) do not "own" it.
To my knowledge Altium does not currently have an importer to pull in data from LTSpice.
Answer: If there is a way to run other spice netlists in altium, you could export a netlist from LT spice by using Tools->export netlist OR you can view the netlist in VIEW-> Spice Netlist
Altium doesn't own spice, it was a project started by UC Berkley. Many companies have their own version of spice.
Even if you do import a spice netlist into altium, you will still have to link up all of the models. It's going to be easier to redraw it in alitum.


Is there an additive homomorphic encryption that supports exponentation

Question: For example say we have two numbers a and b. Now is there any partial homomorphic encryption scheme that allows to compute (a-b)^2 over the ciphertexts of a and b without round trips.
Comment: Possible duplicate of [Homomorphic Encryption with Addition and Exponentiation](https://crypto.stackexchange.com/questions/30368/homomorphic-encryption-with-addition-and-exponentiation).
Comment: I'm agreeing with mikeazo on this one. If you could compute $(a-b)^2$, you could also compute $ab=-(a-0)^2-(b-0)^2-(a-b)^2$ which would allow fully homomorphic encryption (assuming exponentiating with $1$ is allowed). The answer to the referenced question is lacking though, therefore I do **not** vote for closing as dupe.
Answer: What you want is a cryptosystem that supports linear operations, and some bounded number of multiplications (supporting exponentiations by bounded values is equivalent to supporting multiplication, as to compute a*b homomorphically, you can always compute (a-b)²-a²-b² homomorphically and divide this by two). Without requiring a bound on the number of multiplications, this is just fully homomorphic encryption.
With a bound, it is known as somewhat homomorphic encryption (SHE). Most constructions for SHE are based on lattice assumptions (such as LWE). A noticeable exception is the Boneh-Goh-Nissim (BGN) cryptosystem which uses pairing based cryptography; the scheme is homomorphic for linear operations and one multiplication (e.g. one squaring as in your example), in any order (e.g. the function f:(a,b) -> a² + b² can be computed homomorphically with the BGN scheme). However, as decryption requires a discrete logarithm, the plaintexts must be small for the decryption algorithm to be efficient.
However, for your particular example, there is even a simpler way: there is a generic conversion from any linearly homomorphic encryption scheme (with some reasonable properties) to an homomorphic scheme that supports linear operations, then one multiplication, then a bounded number of linear operations (once the multiplication was performed, the ciphertext grows linearly with the number of additional linear operations you perform). The article is "Boosting Linearly-Homomorphic Encryption to Evaluate Degree-2 Functions on Encrypted Data". f:(a,b) -> (a-b)² is typically the kind of operations supported by this conversion. Such a cryptosystem can be constructed from the (additive variant of the) ElGamal cryptosystem, or the Paillier cryptosystem, for example. From the Paillier cryptosystem, you get such a degree-two homomorphic cryptosystem, with no restriction on the plaintext size as in ElGamal or BGN.


Is there an alternative wrapping for tamales?

Question: I'd like to have a go at making tamales, but the corn husk wrappers are hard to come by here. Is there anything I can use as a substitute wrapper?
Comment: I guess it's also hard to get fresh corn? It's just about the right time of year for that, depending where you are.
Comment: Not hard, but most fresh corn is usually trimmed and portioned so I can't get the husks from them.
Answer: I've had the same problem once. The first substitute is banana leaves. But they're not easy to find either.
The second one is using big leaves of chard. Tamales will be done in the same time and you could eat the leaf if you want. I've tried it once and it came out great.
Here it's a recipe for tamales from Michoacan made with chard. Here it is a graphic step by step recipe for tamales with chard. They are written in Spanish, let me know if you need a translator ;)
PS. My mexican mother in law used to do it with chard.
Comment: Banana leaves do work well and taste good.  They are often obtainable, frozen, at Asian markets as well as Latin ones.
Comment: Yes, I can get hold of banana leaves.
Answer: My mom (from Guadalajara) used to often wrap them in parchment paper, since it can withstand being heated/steamed. I don't know why she started doing it - probably because it annoyed her that the delicious filling often oozed out of the tamales during the steaming. Anyway, Just to make sure, I would use double sheets the first time you try the parchment to replace the corn husks. There really wont be any difference in flavor.
Answer: You could use banana leaves or avocado leaves, though I'm not sure those would be easier to come by. If you can't get a hold of any of those I would try wrapping them in parchment.
Comment: You can also get grape leaves in a jar.  Bonus: They're edible.


How to plan in a budget for those less frequent but mid-range expensive buys?

Question: Like bicycle or new laptop or something like that. Not very expensive but quite expensive in comparison with day-to-day goods.
Comment: In the days before credit card ubiquity, store layaway plans were *de rigueur*.  Now, as the others have mentioned, do it yourself, though layaway plans seem to be making a slight come-back.
Answer: I use a "sinking" fund.  If you want to buy a $1000 bicycle, you put $100 per month into a savings account.   10 months from now, you can buy your $1000 bicycle.
If you get a $500 windfall, you can either put it in the sinking fund and buy the item earlier.  If you lose some income, you can put $50 per month in the fund.
Answer: You would simply plan for misc. expenses in your budget, and allocate a small amount to this every time you do your budget, eventually building up a pool of money that you can then use whenever you have to make a purchase such as that.
Answer: Personally I solve this by saving enough liquid capital (aka checking and savings) to cover pretty much everything for six months. But this is a bad habit.
A better approach is to use budget tracking software to make virtual savings accounts and place payments every paycheck into them, in step with your budget. The biggest challenge you'll likely face is the initial implementation; if you're saving up for a semi-annual car insurance premium and you've got two months left, that's gonna make things difficult. In the best case scenario you already have a savings account, which you reapportion among your various lumpy expenses.
This does mean you need to plan when it is you will actually buy that shiny new Macbook Pro, and stick to it for a number of months. Much more difficult than buying on credit. Especially since these retailers hate dealing in cash.
Answer: We have what we call "unallocated savings" that go into a fund for this purpose. We'll also take advantage of "6 months no interest" or similar financing promotions, and direct this savings towards the payments.


How to automate polygon reduction using python?

Question: I have several models(more than 1000) in FBX format and I want to decrease their polygon count. I'm using decimate modifier. Since there are so many models and the task is not too complicated, I was wondering if it was possible to do this with python scripting. I looked around the internet but all the scripting tutorials I found were doing scripting inside the blender. But what I want is a script which scans all the models in a folder and outputs their low poly version.
Comment: You can import and export and scan directories for certain files in Blender scripting so this kind of batch converter is entirely possible and quite straight forward to make. But are you sure a simple Decimate modifier will serve you well for all the >1000 models with one setting? Decimate modifier butchers mesh geometry and the raw end result is generally not considered a production ready 3D model.
Comment: @kheetor I'll be using LOD for my models. So, when the user gets near them, the high poly count version will be used. And if some models are not good enough, I'll do them manually. Anyway, If I'm unable to automate the process, I'll eventually have to do manually but if automation could be done, it would be great.
Could you please provide links for import, export and applying decimate modifier scripting!
Comment: You can find Blender API documentation here to get started: https://docs.blender.org/api/2.79/info_quickstart.html The general idea for your script could be make list of the files in given path and iterate through the files. If it's a .fbx file, use fbx importer on it. Then find all the mesh objects, add and apply decimate modifier, select mesh objects and use fbx exporter. Restoring the startup file between fbx files could be fast way to flush data from previous imports but at least delete the mesh and object data and armatures, materials and textures if you import any.
Answer: I'd recommend using instant-meshes with it's batch mode. You could write a python script like this one to do all the files in your folder:
<code>import subprocess
import os

models_folder = 'C:/folder'
models = sorted(os.listdir(models_folder))

output_folder = 'C:/output_folder'

instant_meshes_path = 'C:/Instant_Meshes.exe'

for file in models:
    # Desired number of faces for the model
    faces = 2500

    subprocess.call([
        instant_meshes_path,
        '--faces', str(faces),
        os.path.join(models_folder, file),
        os.path.join(output_folder, file)
    ])
</code>
Comment: I got the following error:

File "C:\Users\x\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\x\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\x\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Also, instant-meshes was unable to load FBX files.
Comment: It's a FileNotFoundError. You have to edit the example script and put in the correct folder paths. Use forward slashes ('/') because back slashes are an escape character in python.


Broken off fuse in case

Question: Tried to remove a 50A fuse in my 2002 Toyota Sienna, but the fuse is broken in the box. I tried wiggling it using the fuse puller but it didn't help. Now the insides are showing and I can't remove the broken fuse. How do I get it out?
Answer: In a word: pliers. Seriously, if the fuse is already trashed, grab it with a pair of needle nose pliers however you can get ahold of it and wiggle it out. It may self destruct further in the process, but you should be able to get it down to where it comes out.
Answer: If it's one of those large square-ish type fuses with the clear window on top for something like the alternator, it's probably screwed in at the bottom (out of sight). Check out this video (albeit for a Camry) for an idea of what's entailed. It'll be frustrating but totally doable if you take your time.
https://www.youtube.com/watch?v=AutPk47lY9A
If I'm off base, can you post a picture or two of what you're looking at?

Broken off fuse in case


Why is climate change triggering faster rotation?

Question: On July the 29th 2022, the Earth finished its rotation about 1.5 milliseconds earlier than the entire 24 hours. Scientists link this to climate change, saying that a possible reason could be due to the melting of polar glaciers.
I do not know for sure what dictates this would happen, but what came to my mind first was the law of conservation of angular momentum. If glaciers melt, then the water gets spread out across the oceans, so the mass located away from the rotation axis increases. This means that there is an increase in the moment of inertia.
But doesn't this mean there should be a decrease in the rotational speed?
I wonder whether there is some larger physical phenomenon at play, something with greater influence on the rotational speed.
Comment: Did you try to do a back-of-an-envelope-calculation?
Comment: See: https://earthscience.stackexchange.com/q/20498/ (You can look ES.SE for related posts on this topic)
Comment: There are many periodic variations in day length over periods ranging from a few days to years and day length can vary by over 1ms over the course of a year. See https://en.wikipedia.org/wiki/Day_length_fluctuations for more details.
Comment: For example, if the water on Antarctica (which is on land, and several thousand meters above sea level) goes into the ocean, that moves water closer to the earth, possibly decreasing the moment of inertia.  Even though sea level rises, it's not by thousands of meters.  However, this water may move many thousands of miles away from the axis of rotation because it's already near the pole.  So I don't know which is right.
Answer: Glaciers are water that is frozen and high up in the mountains. If you thaw that ice and the water flows back to sea-level, then it would seem that mass in the water would get closer to the rotation axis; the moment of inertia of the Earth would decrease and the angular speed increase.
However, it is not such a simple calculation because ice is also melting at the poles, the sea level can rise more at the equator and in addition, the density of water is temperature dependent, the weight of water can deform the crust and the rotation axis of the Earth is also shifting in response to the distribution of water (e.g., Deng et al. 2021).
Answer: There are lots of factors besides glaciers that affect the Earth's rotation. Given the sharpness of the change, it seems unlikely to be glaciers which are notorious for moving very slowly. A more likely culprit would be the circulation patterns of air and water currents.
The wind and the ocean currents generally circulate around the Earth in a particular direction, which constitutes a component of the Earth's angular momentum. If the circulation suddenly changes in strength or direction, then the Earth rotation changes in the opposite direction to compensate. Such changes can occur in a matter of days, weeks, or months. For example, the quasi-biennial oscillation (QBO) is a circulating wind in the stratosphere that reverses direction roughly every two years. Trade winds reversing direction in the Pacific ocean are associated with El Nino. And the circulation of winds in the polar regions is known to periodically reverse. When the wind in the Arctic blows one way, the floating ice rams up against the north coast of Siberia. When it blows the other way, it is pushed southwards out of the Greenland gap and melts.
The length of day seems to have started shifting in around 2015/2016 when there was a big El Nino and a sharp jump in global mean temperature. I should think there have been some associated changes in wind and ocean circulation patterns, affecting how heat is distributed around the globe.
Comment: I meant the one in 2016. And yes, there are lots of other things besides climate change it might be.
Comment: Re *Given the sharpness of the change*, are you writing about the sharp change in July, or the not so sharp change that apparently started in 2016? The sharp change in July happens every year. That's a combination of annual atmospheric changes, annual oceanic changes, and even snowmelt in the northern hemisphere and subsequent transfer of water toward the equator. The not quite so sharp change that apparently started in 2016, the correct answer is who knows. It might be climate change, but it might be a lot of other things as well.
Answer: For simplicity we'll take a homogenous sphere and round some numbers. The moment of inertia for such a sphere is
$$i(r)=\frac{2 M r^2}{5}$$
and its angular momentum
$$J(r,\omega)=i(r) \omega$$
If we round the mass of the earth to
$$ M=6 \rm E 24 \ kg$$
the old radius to
$$r_1=6378000 \ \rm m$$
the old angular velocity to
$$\omega_1=\frac{2 \pi}{86400 \ \rm s}$$
and the new angular velocity to
$$\omega_2=\frac{2 \pi}{(86400-15/10000) \ \rm s}$$
we need to use the conservation of angular momentum to solve for the new radius via
$$J(r_1,\omega_1)=J(r_2,\omega_2)$$
and get
$$r_2=r_1 \sqrt{\omega_1/\omega_2}$$
In order for the earth to rotate faster by the given amount of 1.5 ms per 24 hours we need
$$r_1-r_2=5.5 \ \rm cm$$
so the inhomogenous weight shifts correspond to a homogenous radius decrease of 5.5 cm, which is less than one part per 100 million.
Comment: While an instructive calculation, it's worth pointing out that not only does Earth have an average density that is about 5.5 times higher than that of a melting glacier, its density actually increases towards the solid core where it is about 13 times higher.
Answer: Another possible contributing factor is the recent drought in many mid-latitude areas of the world, which would reduce the amount of water in dams, lakes, and aquifers.  If these are, on average, farther from Earth's rotation axis than the ocean average, that would speed up Earth's rotation.


Using Macrium Reflect on other PCs

Question: Can Macrium Reflect be used on all other PCs beside Mac computers?
Comment: Macrium Reflect is for Windows Only, no MAC version of that software. The MR boot CD may work on a MAC though, never tried it.
Answer: Firstly, disclaimer: I'm a developer for Macrium, so I have a slight (!) advantage answering this question.
The Reflect product itself can be installed on the operating systems described in CGA's answer both in 32 and 64-bit editions. However, recovery can be run from our rescue CDs on any system that supports MBR or UEFI booting - that is, most systems there are :) Windows systems can then be recovered from these images.
Whilst Reflect cannot be run on general purpose Linux systems, one of our Rescue CD formats is Linux-based, and we can image ext4 partitions from Windows (and therefore recover them from a recovery disk, or from Windows).
Contrary to the name of our company, Reflect does not run on Mac OS/OS X platforms at this time - Apple has already produced Time Machine which can perform full system backups for Mac platforms.
Answer: According to their site it works on the following operating systems:
XP, Vista, Windows 7, Server 2003 and Server 2008. 32 and native 64 Bit.

Using Macrium Reflect on other PCs