Are there any differences between living in a meditation centre vs a monastery?

Question: With all due appreciation for all positive interventions and with apologies for a seemingly dilettantish question, does anyone have any insight on the differences as well as on the commonalities of living long-term inside a meditation center compared to a monastery?
Answer:
"Traditionally they didn't have such things as meditation retreats. You went to monasteries. And in monasteries, there was time to meditate, but there were also other duties in the course of the day. There was work to be done. You had to interact with the other people in the monastery to at least some extent. And in the course of that work and those interactions, you learned a lot about the Dhamma: the Dhamma of generosity, the Dhamma of virtue, the Dhamma of patience, equanimity, goodwill—all these other virtues that are an essential part of training the mind.

The idea of creating meditation retreats came basically in the late 19th or early 20th century, the same time when the assembly line was invented, breaking jobs down into little tiny parts that you do repetitively. This approach to physical work was efficient and effective, so it became the model for a lot of meditation retreats and for the methods taught on those retreats. You take one method and you just apply it again and again and again. But a lot gets left out in that approach. It's like exercising only one muscle in your body, so that the muscle gets strengthened all out of proportion to the rest of your body. And that can't be healthy.

It's better to think of meditation as a training for the whole mind, as exercise for the whole mind. You have to train the whole mind in all the virtues of maturity and heedfulness. In other words, you need to develop the ability to anticipate dangers, particularly dangers in your own behavior, and to figure out what you can do to prevent them."

~ Thanissaro Bhikkhu "Working at Home" https://www.dhammatalks.org/books/Meditations5/Section0017.html
Answer: This question is very general because there is obviously no uniform characteristics of a meditation centre. My general impression is:

Living in a meditation centre would generally involve living with uptight overly serious laypeople and having to rigidly conform with the meditation schedule. The place would probably be pedantic about what foods to eat & possibly have communist fantasies. If you have work duties, you probably have to deal with meditation newbies having nervous breakdowns & other forms of worldly neurosis. If you want to avoid work duties & just meditate, a meditation centre is good for intensive meditation however it will generally cost you money.

Living in a monastery means you join in activities with the monks and experience the interactions between monks & laypeople, including offerings of food & ceremonies. One will come to understand Buddhist culture better. While having to join in work, chanting & ceremonial routines, you will probably have more free time for personal activities & meditation. Living in a monastery will generally not cost you money. In a monastery, there are no arguments and no social management crisis responsibilities for the layperson.
Comment: My experience with the first point is near spot on, except maybe the communist fantasies.
Answer: Simple answer is that a monastery is a centre for people who have gone forth into a mendicant life of homelessness, who then live in a community of like minded people (ordained sangha) For what I would assume is communal benefit.
A meditation centre is essentially the same, but either is including, specifically only, or also revolves around laity.
Personally I have lived in a meditation centre in a specific tradition as a lay person, where the day to day life and communal living was focused upon Buddhist ideals, rather than the normal idle society ideals.


What is the asymptotic covariance matrix?

Question: Is it true that the asymptotic covariance matrix is equal to the covariance matrix of parameter estimates? If not, what is it? And what is the difference between the covariance matrix and the asymptotic covariance matrix in that case?
Thanks in advance!
Comment: The asymptotic covariance matrix is an approximation to the covariance matrix of the sampling distribution of parameter estimates that gets better as the number of samples on which the parameter estimates are based increases.
Answer: Given an iid sample $(X_1,\ldots,X_N)$ from a parametric distribution with density $f_\theta(\cdot)$, $\theta$ being the unknown parameter, an estimator $\hat{\theta}(X_1,\ldots,X_N)$ has a distribution with mean $\mu_n(\theta)$ and variance-covariance matrix $\Sigma_n(\theta)$. So $\Sigma_n(\theta)$ is the variance-covariance matrix of $\hat{\theta}(X_1,\ldots,X_N)$ in the sense that
$$\mathbb{E}_\theta\left[ \left\{\hat{\theta}(X_1,\ldots,X_N)-\mu_n(\theta)\right\} \left\{\hat{\theta}(X_1,\ldots,X_N)-\mu_n(\theta)\right\}^{\text{T}} \right] = \Sigma_n(\theta)\,.$$
Now, if $\hat{\theta}(X_1,\ldots,X_N)$ is a convergent estimator and if there exists a limiting distribution for $\hat{\theta}(X_1,\ldots,X_N)$, it means there exists a sequence $(\phi_n)$ increasing to $+\infty$, e.g., $\phi_n=\sqrt{n}$, such that
$$\phi_n\left\{\hat{\theta}(X_1,\ldots,X_N)-\mu_n(\theta)\right\}\stackrel{\text{dist}}{\longrightarrow} G_\theta$$ where $G_\theta$ denotes a distribution indexed by $\theta$ and the limiting distribution of the l.h.s. This limiting distribution has a variance $\Xi_\theta$ that is called the asymptotic variance.
Comment: Why do you say "e.g. $\phi_n=\sqrt n$"? Shouldn't it **always** be $\sqrt n$?
Comment: There are estimators that converge faster or more slowly than $\sqrt{n}$ as e.g. [the Uniform one](https://stats.stackexchange.com/a/96689/7224).


Lightning Community Does Not Support pubsub for Lightning Web Components?

Question: Has anyone successfully used the pubsub module from lwc-recipes to enable inter-component communication in a Lightning Community?  The registerListener function in the pubsub module throws an error because the pageRef property is undefined.  Or is pubsub designed for Lightning Experience only?
Answer: The pub-sub module checks for page references when firing events, so that the event is scoped and only in the current page.
In Communities, we actually now support lightning-navigation as of Spring '19: http://releasenotes.docs.salesforce.com/en-us/spring19/release-notes/rn_networks_navigationchanges.htm
However, there are some limitations, currently CurrentPageReference in LWC is not supported like: <code>@wire(CurrentPageReference)currentPageReference;</code>, which is why you are getting undefined page references. We are currently working on supporting it, so it should be out soon!
For a temporary solution, you can just remove all the pageRef checking in pubsub :). Here's a quick example: https://gist.github.com/kmesic/262887799fb70be94707cb0b87936e7b
Also, we are soon going to be releasing a LWC sample that will work in Communities by default! This should help clear up any confusion when using LWC in Communities.
Comment: Thank you so much, Kenan!  That's great news.
Comment: @kenan, is this being supported natively now.
Answer: Pub - Sub model uses Page reference and lightning-navigation and as lightning - navigation is supported only in Lightning Experience and Mobile App, the pub - sub module currently won't work in communities.
Src : https://github.com/trailheadapps/lwc-recipes/issues/86
Comment: Adding to this, even the aura version doesn't support community context so it's unlikely the LWC would too.


Being 100% sure whether or not there are any encrypted files on the system just by accessing grub during boot

Question: Is there a way to know whether there are ANY encrypted files or directories on an Ubuntu 14 machine running in VirtualBox?
The password for the account is lost, therefore I would reset it by booting in recovery mode and changing the password with 'passwd username'.
But since I wouldn't be able to access encrypted files afterwards (passphrase of which I wouldn't know as well), I want to be 100% sure whether there is ANY encrypted content in this system. If so, I wouldn't change the password because the data is very important.
To find out FOR SURE whether there are encrypted files, is it enough to run: 'ls -A /home' and see if there is .ecryptfs? I would guess not, but then: Do you know other ways to find out?
Thank you so much in advance!!
Answer: No, you cannot be 100% sure. The user could have an encrypted folder (encfs for example).
If possible, you can create a new user and copy the files. Then check if everything is there in the newly created user. If you ever find out the password or have to go back, the data will be still sitting there.
Comment: Hey, thanks a lot for your answer.
Is there a way to find the possibly encrypted folder then?
I think you cannot copy encrypted files just like that, can you?
Comment: That's a completely different question.


Pressing questions about the annihilation of a particle & an antiparticle

Question:
A charged particle (e.g. proton) meeting with its own charged antiparticle (e.g., antiproton) annihilates and energy is given off in the form of radiation. Do we have any clue why this happens?
Does a neutral particle (e.g. neutron, neutrino etc) meeting with its neutral antiparticle (e.g. antineutron, antineutrino) also annihilate and produce radiation? If not, why?
What does a proton meeting with an antineutron do? Since the system has a net nonzero charge, this upon contact cannot annihilate to radiation.
Comment: I've answered some of your questions here: https://physics.stackexchange.com/a/451337/123208
Comment: @PM2Ring Thanks for the answer. I did give a look at it. But I was looking for a more field-theory kind of explanation as given by yu-v.
Comment: No worries. As I said in that answer, the cross-section for neutrino + antineutrino annihilation is *really* tiny, since they annihilate to Z bosons, which have a huge mass. The Z boson has a half-life of around $10^{-25}$ seconds, and it can decay into all sorts of things, as explained here: https://en.wikipedia.org/wiki/W_and_Z_bosons#Z_bosons_2
Comment: note that your 3rd bullet point gives insight into the 1st two: "because they can"...if no conservation laws are violated.
Answer: They annihilate because in the Lagrangian that describes their behavior there is a term $\propto -i e A \Psi \bar{\Psi}$ where $\Psi$ is the matter field, $\bar{\Psi}$ its conjugate, which describes the anti-matter field, and $A$ the gauge field, for example photons in quantum electrodynamics. This means that there is a term which allows for a particle and an anti-particle to "come in" and a photon to "come out". In reality, two massive (anti/)matter particles cannot annihilate to a single massless gauge particle as you cannot place this process on the mass-energy shell, and two massive (anti/)matter particles will annihilate to at least two massless gauge particles.
If you consider neutrons as elementary particles, that is - you write a field theory that contains them as fundamental excitations, and only consider the electromagentic field as a gauge field, then neutrons will not annihilate as they do not couple to it. If, however, you consider them as composite particles composed of quarcks, then anti-neutron can annihilate with a neutron, via the coupling to the color gauge field (the strong interaction). Then, of course, the neutron is no longer a neutral particle, as its individual quark components will have charge under the strong interaction.
Comment: If we have a case where a neutral elementary fermion and its antiparticle meet, wouldn't they annihilate? For example, a neutrino and an antineutrino?
Comment: neutrinos have a charge under the weak interaction (what's called the "weak isospin")
Comment: Sure. But to couple to photons, they need to have the electric charge. Since neutrinos are electrically neutral, the meeting of a neutrino-antineutrino pair does not annihilation to photons. Is it wrong?
Comment: @mithusengupta123 You can get some photons eventually (plus other stuff), from neutrino + antineutrino annihilation, after the Z boson(s) have decayed. But you're correct that simple annihilation to photons doesn't happen. If it did, we'd get low energy (visible) photons from the antineutrinos of beta minus decay annihilating with solar & cosmic neutrinos, but the probability of that happening is ridiculously tiny.
Comment: they cannot annihilate to photons directly. only through some more complex higher-order process
Comment: Sure, Z bosons *have* to be involved. I didn't mean to imply with the last sentence in my previous comment that the annihilation can occur without Z bosons. I was mainly just saying we have empirical evidence that such low energy annihilations are almost impossible.
Comment: well, neutrons do have a magnetic moment.
Answer: The concept of annihilation in particle physics depends  on quantum mechanics, special relativity and the quantum numbers axiomatically assigned to the particles in the standard model of particle physics, in addition  to energy conservation.
Special relativity assures that all particles have intrinsic energy, and are described by four vectors . The antiparticles have the same mass as the particles, and when they meet their quantum numbers add up to zero ( that is what annihilation means) and depending on their kinetic energy there is a high probability that new particle antiparticle pairs will come out, in addition to photons, i.e.electromagnetic radiation.
Particle meeting an antiparticle is a quantum mechanical interaction and there are calculable probabilities of the output.  Depending on the energy carried by the input pair, they might scatter off, might create more particles remaining themselves intact, or annihilate into a multitude of different particle-antiparticle pairs .
A good example is electron positron scattering. For low energy either they are elastically scattered or the quantum numbers (+1 lepton nunber for electron-1 for positron) add to zero and two photons ( for momentum conservation in the center of mass) come out. For high energy in the incoming particles, as at LEP a large number of particles can come out, as long as the quantum numbers add up to zero. The standard model was checked and validated by the data coming from LEP.
When a proton meets and antineutron, one has to conserve charge, the other quantum numbers add up to zero. The possible output particles  must have charges summing up to +1. As protons and neutrons are composed of triplets of quarks , the particle antiparticle pairs will have a probability to rearrange so that the total charge is +1. An antiup with a down quark make a pi+, and the rest a pi0 , if there is more energy a lot more pairs.
The important thing to retain is that it is quantum numbers that annihilate and the"radiation" depending on probabilities of scattering and the energies involved can be a lot more particle pairs.


Pop-ups in Chrome

Question: Hi I'm using Chrome in a MBP and anytime that I click anywhere on the page I`m browsing, a pop-up opens and I cannot stop it. I have already tried with configuration of Chrome but it's useless.
Answer: Go to http://www.adwaremedic.com and download and install the Adware Medic software to remove the adware. It will search for the specific adware that usually gets installed from questionable websites, i.e. a website to stream a movie.
Once ran, the program will show you the file locations of the documents it is removing.
Otherwise, go to preferences- extensions in Google Chrome and remove anything you did not install. However, this will not remove any launchagents or launchdaemons or frameworks installed by the initial installation of the adware.

Pop-ups in Chrome


Placing a Player on IR in the NFL

Question: What is the purpose of placing a player on Injured Reserve in the NFL?  My understanding was that you could hold an injured player out of a game and dress someone else in their place regardless of whether or not the injured player was on IR.  Unless that understanding is incorrect, it seems as though it would be just as easy to continue listing the injured player as "out" for the upcoming week.
Answer: The reason for IR is to free up space on the team's 53-man roster if a player has an injury that makes him unable to play for the rest of the season.
Once a player is assigned to IR, that player's roster spot is now available on the teams roster. This roster spot is used to bring another player in to fill his space. If that player was just sat out, he would still count against the roster and the team would have no room to make an addition to fill his spot.
Once a player is put on IR, he cannot be activated again for the remainder of the season (Exception).
The point of sitting a player out is if that player has an injury that will only sideline him for 1-3 weeks or simply not the whole season. The player could also be put on the Injured Reserve/Designated To Return list.
Comment: That makes sense.  I wasn't sure if a player who didn't "dress" for a game still counted as part of the 52-man roster.  Thanks!
Comment: @jackel414 You're welcome! Glad I could clarify.
Comment: And just to add--the 53-man roster, on gameday, includes 46 "active" players (who are dressed and can play in the game) and 7 inactives, who cannot--these are the ones with, as Zack explained, short-term injuries, as well as those who maybe the team wants to keep on the roster but doesn't plan on using them (maybe because of matchups, gameplanning, etc.) in this particular game.

Placing a Player on IR in the NFL


How do I tell what syntax file is being used?

Question: Vim is syntax highlighting my file in a funny way, and I want to know what syntax file is responsible for this behaviour. How do I find out what syntax files vim has loaded?
Answer: The syntax for the current buffer can be queried via
:setlocal syntax?

It usually (but not necessarily) corresponds to the buffer's filetype (:setlocal filetype?).
For a deeper look,
:syntax list

shows all syntax definitions (some syntaxes (can) include other language's syntaxes, e.g. java has html for the JavaDoc comment markup).
Comment: This is what I came looking for based on the title of OP's question. OP of course clarifies in the description he's looking for the actual syntax file, but I appreciate you leaving this here since it's one of the first answers in search engines.
Answer: To find out which files Vim has actually loaded, execute
:scriptnames

Comment: Generally, only the last one listed is "active", and even it may not be if you've turned syntax highlighting off. To see the syntax currently in effect, execute `:echo b:current_syntax`. To see the syntax items currently in effect, do as Ingo suggested and execute `:syntax list`. The latter may help if syntax items from more than one syntax file are in effect, as Ingo noted.
Comment: You may have two syntax files loaded that have the same name.  For example, vim ships with syntax highlighting for ColdFusion, (`/usr/share/vim/vim81/syntax/cf.vim` for me).  I installed a custom cf.vim because the standard one is dated.  `:scriptnames` shows both files.  The default is lower on the script list; however, the former is being used.  If you look at `/usr/share/vim/vim81/syntax/cf.vim`, there's a guard `if exists("b:current_syntax") finish endif`.  So, in my case, the `scriptnames` was helpful, but I had to dig a bit deeper.
Comment: On Mac OS X I modified the `/usr/share/vim/vim73/filetype.vim`. After using the above command I realized it was using MacVim's version at `~/Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim`. If you have MacVim installed, make sure you modify the correct file.
Comment: That's useful. Now, here is something I'm not sure about: if a syntax file shows up in this list, is it guaranteed that the syntax file is "active"? I can see quite a few syntax files here.
Answer: You can view what filetype(s) are currently used and by
:verbose set ft ?

The plugin handling the filetype is most likely located at
:e $VIMRUNTIME\ftplugin

Answer: I guess you would like to know exactly which highlighting color scheme(syntax) is currently being used for the file opened, here is what I do:
as @garyjohn mentioned
:scriptnames

But this will show you a complete list of settings currently loaded.
  1: /usr/share/vim/vimrc
  2: ~/.vimrc
  3: /usr/share/vim/vim81/syntax/syntax.vim
  4: /usr/share/vim/vim81/syntax/synload.vim
  5: /usr/share/vim/vim81/syntax/syncolor.vim
  6: /usr/share/vim/vim81/filetype.vim
  7: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
  8: /usr/share/vim/vim81/plugin/gzip.vim
  9: /usr/share/vim/vim81/plugin/logiPat.vim
 10: /usr/share/vim/vim81/plugin/manpager.vim
 11: /usr/share/vim/vim81/plugin/matchparen.vim
 12: /usr/share/vim/vim81/plugin/netrwPlugin.vim
 13: /usr/share/vim/vim81/plugin/rrhelper.vim
 14: /usr/share/vim/vim81/plugin/spellfile.vim
 15: /usr/share/vim/vim81/plugin/tarPlugin.vim
 16: /usr/share/vim/vim81/plugin/tohtml.vim
 17: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 18: /usr/share/vim/vim81/plugin/zipPlugin.vim
 19: ~/.vim/syntax/applescript.vim

Then which exactly is the one doing coloring? => the last one always the decision maker(e.g.):
~/.vim/syntax/applescript.vim
In my case, I want to test last downloaded syntax of applescript.vim if working.
On the other side, please be reminded that vim syntax is filetype/extension-based, so check exactly the file definition at /usr/share/vim/vim81/filetype.vim, there you can easily find out AppleScript has its unique extension defined as .scpt (as standard) .
Hope this helps also.


How to setup remote desktop?

Question: I have 2 Ubuntu 14.04 machines running the default Ubuntu desktop, I only have a monitor for one so I'm trying to setup remote desktop on the machine without a monitor. How can I setup the non-monitor computer to accept VNC connections from my computer with a monitor?
**I tried X11 forwarding over terminal, didn't work. Don't care about X11 forwarding as long as i can access the other with built in remote desktop client.
***Also if possible how can I do remote desktop with 2 Xubuntu machines?
Answer: You might try using the suggestion here: How to make VNC Server work with ubuntu-desktop without xfce to see if that does what you need.

How to setup remote desktop?


$T_1$ version of Engelking theorem?

Question: Theorem 6.1.23 in Engelking's Topology book says that in a compact space $X$ each quasi-component is connected.  Quasi-component means the intersection of all closed-and-open subsets of $X$ containing a given point. The proof uses normality of $X$, so $X$ must be Hausdorff.  But what if $X$ is only $T_1$ compact?  Is it still true that each quasi-component is connected?
Answer: The answer is no. Let $X$ be any totally disconnected infinite compact Hausdorff space, e.g. various projective limits of finite discret spaces. Take a point $a$ in $X$ and consider the analogue of the line of double origins: take two copies of $X$ and glue all the pairs of identified points except $a$ and its copy $a'$. Let $Y$ be the resulting quotient space. Then it is easy to see that $Y$ is quasi compact and satisfies $T1$ while the quasi component of $a$ (or $a'$) is the two point set $\{a, a'\} $ equipped with discret topology.
Comment: Personally, I think the real reason for this theorem to hold is that a compact Hausdorff space has a unique uniform structure which is compatible with its topology. See e.g., section 4 of chapter 2 of Bourbaki's general topology. And $T1$ uniform space is automatically Hausdorff (completely regular even).
Comment: And I'm not sure we should call it the Engelking theorem.

$T_1$ version of Engelking theorem?


Django: Using Faker to fill multiple tables

Question: I am trying to populate my Django project with some test data.  I have 3 tables, Person, Address, Employment.  Both Address and Employment have a Person FK.  My script is creating my person but when it gets to Address it fails at Address.person
models
class Person(models.Model):
    first_name = models.CharField(max_length=200)
    middle_name = models.CharField(max_length=200)
    last_name = models.CharField(max_length=200)

class Address(models.Model):
    person = models.ForeignKey(Person, on_delete=models.CASCADE)
    address = models.CharField(max_length=200, blank=True, null=True)

class Employment(models.Model):
    person = models.ForeignKey(Person, on_delete=models.CASCADE)
    employer = models.CharField(max_length=200)

My script
def populate(n=5):
    for entry in range(n):
        person = Person.objects.get_or_create(
            first_name = fakegen.first_name(),
            middle_name = fakegen.first_name(),
            last_name = fakegen.last_name(),

    FakeAddress(person)
    FakeEmployment(person)

def FakeAddress(person):
    address = Address.objects.get_or_create(
        person = person,
        address = fakegen.street_address(),
TypeError: Field 'id' expected a number but got <Person: Michael Baker>.

I've tried to pass the Person to the address function and I get TypeError: Field 'id' expected a number but got <Person: Michael Baker>.  Next I tried passing the Person's ID instead of the person and I get ValueError: Cannot assign "93": "Address.person" must be a "Person" instance.
Answer: get_or_create returns a tuple. Since I only need to first item in the tuple I changed
 person = Person.objects.get_or_create(
            first_name = fakegen.first_name(),
            middle_name = fakegen.first_name(),
            last_name = fakegen.last_name(),

to
        person, _created = Person.objects.get_or_create(
            first_name=fakegen.first_name(),
            middle_name=fakegen.first_name(),
            last_name=fakegen.last_name(),


In GNOME 3, how does one assign keyboard shortcuts for applications besides the default applications?

Question: In GNOME 3, there's a facility to assign keyboard shortcuts for applications like your default browser, default email client, default terminal etc. How do I do this for other applications?
Answer: As far as I know, there is no GUI application allowing that for gnome 3. If you have Gnome 2, you can still use the settings application from menu.
The easiest ways for me is to edit settings through gconf-editor:

specify your command in
/apps/metacity/keybinding_commands/command_X
specify your keyboard shortcut in
    /apps/metacity/global_keybindings/run_command_X

The name of keyboard you can find using xev. X stands for number from 1 up to 12.
Comment: In Gnome 3, `System Settings > Keyboard > Shortcuts > Custom Shortcuts`; afaik, it has always been there.
Answer: To assign hotkeys without limitations like '12 user defined hotkeys' try xbindkeys
Answer: As said in a comment that should be an answer by don_cristi:

In Gnome 3, System Settings > Keyboard > Shortcuts > Custom Shortcuts;
  afaik, it has always been there.
Comment: In GNOME 3.30, it's Settings > Devices > Keyboard -> Keyboard Shortcuts, and then scroll down to the bottom and click the + button to add a custom shortcut.
Comment: It does not allow some keystroke (ex: Shift+enter)
Answer: In GNOME 3 press Meta and start typing shortcuts. Alternatively go to Settings -> Devices -> Keyboard.
Then at the bottom press +.


Question about probability tree stabilization

Question: The following question references Project Euler Problem 499, which can be found here. Here is the problem in a nutshell: a gambler starts with s dollars, and he can gamble in a that costs m dollars to play. Once he starts to play, he pays the m dollars to the dealer, and he gets a 1 dollar pot. He then flips a fair coin. If the coin lands on heads, his pot is doubled, and he plays again. If the coin lands on tails, the gambler takes the entirety of the pot, and he has to pay the m dollar starting fee again to the dealer to get his pot back. What is the probability he never runs out of money for m = 2 dollars and s = 2 dollars?
My strategy was to create a python script with a branching probability tree that would tell me all possible outcomes on a certain branch down the line (for example, all possibilities after 25 coin tosses). Here is the script, though the code is secondary; the important thing for me is the mathematical, statistical theory behind it.
def play_game(initial_funds, price_to_play, iterations):
    prob_tree = {}
    for iteration in range(1, iterations + 1):
        prob_tree[iteration] = []
        # first number always represents money in hand, second represents money in pot.
    prob_tree[1].append([initial_funds - price_to_play, 1])
    for iteration in range(2, iterations + 1):
        # for each possible outcome listed in the line above in the probability tree
        for possibility in prob_tree[iteration - 1]:
        # if there isn't any money in the pot AND not enough current funds, just repeat it twice in the next line for counting purposes.
            if possibility[0] < price_to_play and possibility[1] == 0:
                prob_tree[iteration].append(possibility)
                prob_tree[iteration].append(possibility)
                # maybe add the current possibility combo twice to the current iteration.
        # if there is money in pot, append a heads and tails possibility to the current row
            elif possibility[0] < price_to_play and possibility[1] > 0:
                case2_old_pot = possibility[1]
                case2_win_new_pot = possibility[1] * 2
                case2_lose_new_pot = 0
                case2_player_funds = possibility[0]
                # if successful, the money in the pot will double, and the player's money will remain constant
                prob_tree[iteration].append([case2_player_funds, case2_win_new_pot])
                # if not successful, the money in the pot will be added into the player's money, and the pot will return to 0
                prob_tree[iteration].append([case2_player_funds + case2_old_pot, case2_lose_new_pot])
        # if there is no money in the pot but there is sufficient money in the player's pocket to play again1
            elif possibility[0] >= price_to_play and possibility[1] == 0:
                # first, the money in the player's pocket goes down by the amount price_to_play, and the pot amount goes up to one.
                case3_funds_after_buyin = possibility[0] - price_to_play
                case3_pot_after_buyin = 1
                case3_pot_if_successful = 2
                case3_pot_if_unsuccessful = 0
                case3_funds_if_successful = case3_funds_after_buyin
                case3_funds_if_unsuccessful = case3_funds_after_buyin + case3_pot_after_buyin
                # then, either the player gets back the pot and it goes to 0
                prob_tree[iteration].append([case3_funds_if_unsuccessful, case3_pot_if_unsuccessful])
                prob_tree[iteration].append([case3_funds_if_successful, case3_pot_if_successful])
    counter = 0
    for outcome in prob_tree[iterations]:
        if outcome[0] < price_to_play and outcome[1] == 0:
            counter += 1
    print float(counter)/(2**iterations)

play_game(2, 2, 25)

I figured as the number of layers on the tree grew larger, the answer would be increasingly accurate. When testing this theory, I was surprised to see that the failure rate for a 2 pound cost and a 2 pound initial amount was stabilizing around 35.4%, instead of the expected 25.2% that the problem gives me.
Some possible reasons for this could be that I am assuming that all non-failures at a given line will go on forever, but I don't know how to account for this without adding another branch and thus repeating the problem. Any insights would be greatly appreciated.
Answer: The $25.2\%$ given in the problem is the success rate, not the failure rate, which should be $74.8\%$.
Your code contains a bug in case $2$: The comment correctly says "if there is money in pot", but the code incorrectly requires possibility[0] < price_to_play.


How to Load config from ~/.aws/config

Question: change log says
Load config from ~/.aws/config if AWS_SDK_LOAD_CONFIG is set.
Couldn't find any examples or documentation regarding how to load the config. Any help!
Comment: If you set `AWS_SDK_LOAD_CONFIG` to a truthy value, the SDK will automatically load the `~/.aws/config` file in the same way the AWS CLI would. What kind of example are you looking for?
Comment: In nodejs i can set the env variable to truthy value with           process.env.AWS_SDK_LOAD_CONFIG = true; How can I retrieve the region value in the config ? Mind sharing some code ?
Answer: There is a little bit of magic in how aws-sdk loads the config
either set the env variable
export AWS_SDK_LOAD_CONFIG="true"

or before loading the aws-sdk set
process.env.AWS_SDK_LOAD_CONFIG = true;

Then load the aws module;
var AWS = require('aws-sdk');

You can access the region directly by
AWS.config.region

Answer: The answer of sreenivas is correct. It also seems to be the only way to do this without writing a custom function.
I've traced it back in the source code and the the way it loads ~/.aws/config is similar to this pseudocode:
if process.env.AWS_SDK_LOAD_CONFIG:
  return load('~/.aws/credentials').overwrite('~/.aws/config')
else:
  return load('~/.aws/credentials')

This also means you can set the environment variable after require('aws-sdk'), as long as you do it before new SharedIniFileCredentials({..}) or credentials.refresh(). Beware that credentials.get() will not work until the sessiontoken has expired.
Answer: There is documentation for this:

HERE: Loading Node Credentials Shared
HERE: Loading Node Credentials JSON File
HERE: Getting Started NodeJS

I would recommend installing the awscli tool to set this up and then run aws configure in your terminal. By default, anything you're running on your local host will assume the credentials listed in your config file unless specified to assume a different profile.
Example from the first link:
AWS.config.credentials = new AWS.SharedIniFileCredentials( { profile: 'work-account' } );

If you are using the CLI to run your script:
AWS_PROFILE=work-account node script.js

If you are using just the CLI tool and not JavaScript:
aws s3 ls --profile work-account

Update:
config and credentials are made and referenced at the same time. When you run aws configure it makes two files. The credentials file containing AccessKey and SecretKey - and the config file containing the response type and region. It is NOT necessary to explicitly define or reference the config file.
Comment: Am looking for 'config' not 'credentials'.
Comment: They are made at the same time. When you run `aws configure` it makes two files. The `credentials` file containing AccessKey and SecretKey - and the `config` file containing the response type and region. It is NOT necessary to explicitly define or reference the `config` file

How to Load config from ~/.aws/config


Software to handle large Excel .xls files

Question: Some users receive XLS files from other offices for analysis, but these files are extremely large and the performance of Excel is low.  I know the best solution could be transfer this information to a DB manager but this is not practical right now.   Is there software designed to handle a large number of records in Excel? I am using Windows 7 with a PC (AMD APU A6 7400 K a 3.50 GHz
Ram 4GB DDR3)
Comment: Its often helpful to set Calculation to Manual, working on file locally - not on a network drive, and sometimes setting up conditional formats (fill colours) will help analysis and can be used with filters.
Comment: Only XLS or mainly XLSX? The old XLS format is quite proprietary.
Answer: Python + Pandas can import from Excel and can handle manipulation of very large data sets.
Both are free and cross platform.


GDAL ReadAsArray NoneType error when importing string of file directory?

Question: I am trying to write a python app to ask for file directory input via tkinter. I am not sure what is going wrong but it returns an error:
data_array = file.ReadAsArray()
AttributeError: 'NoneType' object has no attribute 'ReadAsArray'
The process is as follows:
Both the file_browser and convert_file functions get called with a button in tkinter

I use tkinter and the .filedialog.askopenfilename function to get user selected file directory name.
The selected file directory name is assigned to variable "assigned_file_directory".
This variable is used as the file path for gdal.open so it can be read as an array via the GDAL .ReadAsArray function.
The file directory string isnt recognized by GDAL and gives NoneType error.

from osgeo import gdal
from tkinter import filedialog

current_opened_file = "D:/Random Stuff/image.tif"
assigned_file_directory = ""

def file_browser():
    select_file_name = filedialog.askopenfilename(initialdir = "/", title = "Select a File",)

    if (select_file_name):
        current_opened_file = select_file_name
        current_selected_file.configure(text = "Current Selected File: " + current_opened_file)
        split_function = select_file_name.split("/")
        split_file_name = (split_function[0] + "//" + split_function[1] + "//" + split_function[2])
        assigned_file_directory = '"' + select_file_name + '"'
        print(assigned_file_directory)

def convert_file():

    #assigning the file path for the tif image
    #file_path = current_opened_file
    file_path = assigned_file_directory

    #opening the tif file and assigning it
    file = gdal.Open(file_path)

    #the assigned file is converted into an array
    data_array = file.ReadAsArray()

    #creating the figure dimensions
    mlab.figure(size = (1025, 1025))

    mlab.surf(data_array, warp_scale = 0.01, colormap = "cool")

    mlab.show()

I originally just had the current_opened_file variable change to whatever file was loaded via tkinter as well as I previously left the file directory name as it was. However, I read that GDAL doesn't like single "/" characters and decided to deconstruct the file directory name and manually redo it. I also tested whether quotation marks would make a difference and it did not.
Additionally, the original file loaded will run perfectly fine, however, if I choose to browse for the same file and load it, GDAL gives me the same NoneType error. This makes me believe that my code is correct but perhaps there is an issue with GDAL reading the string directory name.
Comment: I would compare the "current_opened_file" that works and the "assigned_file_directory" that does not work. They can't be equal.
Answer: I figured out the answer to anyone in the future with the same issue.
Turns out I needed to assign the current_opened_file as a global variable like so:
if (select_file_name):
    global current_opened_file
    current_opened_file = select_file_name
    current_selected_file.configure(text = "Current Selected File: " +
    current_opened_file)

This changes the variable so it can be assigned new values outside of the function.


How to replace the threshold in a center-hinged exterior porch door?

Question: I have a center-hinged porch door leading out onto my deck. Viewed from the inside, the right panel of the porch door swings inward, and the left panel is fixed. The wood below the aluminum threshold has mostly rotted away, and I would like to remove the threshold and reflash and replace it. I've seen several videos of people replacing thresholds on single or double doors where the door panels are hinged to the side jambs, but not on a door like this where the panels are hinged to the center mullpost, which goes through the threshold. Is it possible to cleanly replace the threshold on a door like this, without replacing the entire door unit?
Answer: Especially this time of year, it is probably more wise to to repair the rotted wood in place.

Scrape away the rotted door sill material,
apply wood hardener to what's left (be careful not to get that stuff on any exposed surfaces, and keep it off of your hands somehow),
use an epoxy based wood filler to create a new sill edge,
apply your flashing,
sneak a bead of sealant between the new flashing and the threshold, and
caulk the joint between the new sill edge and the ground.

If you install metal flashing, be sure that there's some path for water to diffuse out of the sill so that it can evaporate.
Comment: I have to admit that wood hardener and epoxy, while inelegant, do an adequate job and require less futzing about than trying to actually replace the wood. One thing to be aware of: different epoxy putties cure at different speeds, and a hot day can cause some to cure before you can really get them in place. I've had the best luck with the ones that come as a tube of doughy putty, two parts concentric with each other, that you kneed to mix;.the one I used cured slowly, but started out thick enough to apply and shape. Do paint afterwards to protect what's left of the wood.


impose restrictions on buffer size

Question: Is there any way I can impose a size constraint on a character buffer such that no kind of operation on the buffer would lead to an out-of-bounds access?
Answer: In short: No
C does not perform any runtime checks, unless you do them by hand.
You could use your own functions, macros and per-buffer book-keeping to guard against invalid accesses. However, you would have to use this interface everywhere, which means that you would lose direct access to that buffer.
You would also see an impact on performance due to the extra condition checks. You might be able to avoid some of that by using direct access on code branches that are proven to not cause out-of bounds accesses.
EDIT:
There is also the rather major question of "what should the code do once an invalid access is detected". Should your program output an error and exit, as if it encountered an exception in other languages? Should it ignore the error? Should it attempt to fix it?
The C way to deal with this issue is to look-before-you-leap and ensure that each code branch/part is safe beforehand, rather than check each access.
Answer: This may help: http://duma.sourceforge.net/ in your quest.
Answer: The short answer: No.
The long answer:
To ensure even something as silly as buffer[ULLONG_MAX] does not go out of bounds, you need to declare your buffer with a bound bigger than the biggest integer number representable on the system. This is obviously not possible, aside from the amount of memory that such a buffer would need.
The practical solution is that you manually keep track of the size of your buffer and any untrusted indexing into the buffer is verified against the buffer size.
Answer: See our Memory Safety Checker, which used as a debugging aid, instruments your C code to determine if you make any errors with arrays or buffers.  This finds problems that valgrind cannot.

impose restrictions on buffer size


How to Place the Right Seams for UV Unwrapping

Question: Where can I read how UV Maps should look and how to know where to place the seams? Here I have a very simple model I'd like you to suggest where the seams should be placed and why. I have attached a picture of my test model and attached the Blend file.
Blend file
Answer: In my opinion you should try to place the seams in that way, so the UV islands in UV/Image Editor are even distributed and have a proper scale that reflects the scale of the model's elements. It is often the matter of experimenting. You should think of it as it was a real model. Try to imagine how you may cut it open with scissors and spread on a flat surface.

The example below shows how the different unwrap of the same object results in less uniform Uv islands distribution, which is less beneficial.

Here is the .blend with the seams placed: http://www.pasteall.org/blend/33446
Answer: You could read here for uv mapping, how and where with examples http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Mapping/UV/Unwrapping
The link will help you understand the information need on mapping types, unwrapping and marking seams.
I personally would recommend seaming near the middle.
Comment: Sorry I just placed it down from him asking "where can I read"
Comment: When writing questions or answers it is recommended that the said question or answer be sufficient to clearly ask or answer the question without any outside sources, as links to other sites may become obsolete or broken over time.


Can I connect a Digitech Vocalist Live FX to a Boss RC 300 Looper?

Question: I am hoping someone here can help me.  I would like to run my Digitech Vocalist Live FX Processor through my Boss RC-300 Looper.  I am not Tech savvy.  Is it possible to do this and if so how?
Answer: Save for some unusual vintage pedals, you can connect any effect to any other effect, usually simply with a single ¼" patch cable. Vocal processors are a bit of a special case because their connectors are by default XLR, but the Vocalist Live seems to have also a line-out and the RC300 also an XLR input, so you can choose either XLR or ¼" – doesn't really matter.
Now, just because it's possible doesn't mean it's also musically useful. Lots of effect combinations interfere rather badly. But there's no reason to fear that here. For what it's worth, the combination of vocal processor and looper is nowadays quite common; in that light you may well try it.
I personally have a strong dislike for most of what such vocal processors do (pitch "correction" destroys much of the nuances of a good vocal performance, and harmonizers never come close to the intimate resonance between actual multiple human voices), as well as looping in general (which not only makes the musical material predictably repetitive, it also prevents natural tempo development). But that's just my taste, evidently many people disagree about this, and anyway this doesn't really get worse if you connect both together vs either effect on its own.
So, to answer how to do it... well, you connect your mic into the Vocalist as usual, then an XLR cable into the output and that into the looper's input. Alternatively, connect a ¼" cable to the Vocalist's line output and into the looper's input.
Comment: Hi, thank you for your comprehensive answer; very much appreciated!

I agree with you regarding Vocal FX.  I am mostly interested in reverb, sometimes doubling for dynamics, and delay.

Yes, loopers can be repetitive for sure which is one reason why I have a multitrack looper so I can use it to create different parts of a whole piece, and I like to use volume control.  I have recently purchased a Trio plus to give me the capacity to have different bass and drums throughout a piece as well.

Thanks for the ways to connect the Vocalist.  I have just freed up the 2nd input so will try this


Adding rest service to a struts application

Question: I'm trying to add rest services to a struts application using jersey.For this i need to segregate the java code in such a way that it can be commonly accessed by both the struts and rest api.This is done so that the code is shared between both rest and struts,and any change will reflect in both the services.I would like to know , how much of this idea is feasible  and weather this is how usually people design rest services .
Answer: While our presentation layer isn't Struts based (usually it's either Spring Web MVC or JSF), we use Spring 3.0 + Java EE 6, specifically, EJB 3.0 and JPA 2.0 for such situations.
EJB 3.0 stateless session beans work great—they can have declarative (annotation-based) dependency injection and transaction demarcation, or they can manage their transactions, dependencies and resources themselves using whatever traditional mechanism. They seamless integrate with JPA 2.0 and are easy enough to unit test. The main advantage over pure Spring beans is that they can be deployed independently of the Web application (as an EJB JAR).
On the front-facing Web services, we also use Jersey/JAX-RS. Because Jersey/JAX-RS dependency injection is broken (it doesn't use Weld/CDI like the rest of Java EE), we've had to resort to Spring DI to 'wire' up the front-facing REST resource classes with the 'back-end' EJBs. The good thing is this works well enough to inject the EJBs into our MVC controllers and can also be used with JSF managed beans. Alternatively, you can write your REST-ful resources using Spring alone (either way has its own pros/cons, but in general both do the job well).
I know I glossed over the whole thing but I'd be glad to share more details upon request.

EDIT: Some more details, as per request.
You're first stop for learning Jersey/JAX-RS would have to be the Jersey User Guide. There are also several tutorials/examples you can easily find across the 'Net.
While you should be able to package Jersey/JAX-RS resources into the same WAR as your Struts pages, we went with the simpler alternative of deploying them separately.
Now, when deploying to Glassfish 3.1, we hit this bug, also documented here. The bottom line is that @EJB injection didn't work for us as expected.
So, instead, we fell back on to Spring using the jersey-spring contrib module, following this example.
Anyway, the rest of it is standard Java EE 6 / EJB 3.0. We identify and place all common functionality into a 'service' layer which are largely implemented as @Stateless EJBs.
Persistence is handled through JPA @Entitys accessed through a JPA inject EntityManager. Transactions are declaratively demarcated using @TransactionAttribute.
Here's a quick illustration of a typical EJB + JPA service bean:
@Stateless
public class WidgetServiceBean implements WidgetService {

    @PersistenceContext
    private EntityManager em;

    @Override
    public List<Widget> findWidgetByName(String name) {
        return em.createNamedQuery("Widget.findByName", Widget.class)
            .setParam("name", name).getResultList();
    }

    @Override
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public void removeWidgetById(int id) {
        em.find(Widget.class, id).remove();
    }
}

(Obviously not production quality but just shows how 'lean' they can be.)
The service layer and entities are packaged as an EJB JAR which can be deployed separately, and made available to all other modules via global JNDI lookup. Or, they can be deployed within the Struts or JAX-RS WAR and as of Java EE 6 (Glassfish 3.x) they will be found, deployed as part of the module and made available to other components within the same WAR.
Some might argue that it's simpler to just use Spring beans if you're using the Spring container anyway. I would say, probably, but then you also have to use Spring's persistence framework, and Spring's transaction framework. (Spring also provides declarative transactions and persistence.) If you're already heavily invested into Spring then that might be an easier path.
OTOH, EJB 3.0, JPA 2.0 and JTA have also been radically simplified from their predecessors and are part of the Java EE standard so it's an architectural decision with a lot of dimensions.
Comment: Tnx,i would like to know more details about how you have implemented.


How would I find the lengths of the sides of a regular pentagram if given the perimeter of the circle that the pentagram is inscribed to?

Question: For a Turtle program in Python that I am working on, I will need to draw out a star. This star is a regular pentagram, meaning that each of the sides are of equal length. As well, the pentagram is inscribed into a circle with the perimeter of 15.625. However, I don't know the lengths of the sides of the star, and I am not sure how to use the circle's perimeter to get the sides of the star. So, what would the length of the sides of the star be, and what steps would I take to get it?
Comment: Start by drawing a picture. Figure out the angles. Once you have that, simple trigonometric functions will relate the sides with the radius of the circle, and therefore with the circumference (perimeter) of the circle.
Comment: So, what sort of tools are you working with? The easy way here involves drawing lines at certain angles and running until you intersect the circle.
Answer: The chord that is one side of the pentagram subtends an angle of $\frac {4\pi}5$.  If you draw the radii to the endpoints of the chord and a radius that bisects the chord you get two right triangles.  The hypotenuse is the radius of the circle, $\frac {15.625}{2\pi}$.  The angle of the triangle at the center is $\frac {2\pi}5$.  The side opposite the angle at the center, which is half the chord, is $\frac {15.625}{2\pi}\sin \left(\frac {2\pi}5\right).$  The chord is twice this, $\frac {15.625}{\pi}\sin \left(\frac {2\pi}5\right)\approx 4.73.$
Answer: The circumradius $r$ of a regular $\{n/d\}$-gon with unit sides, i.e. a regular polygon with $n$ vertices and being wrapped up $d$ times, equals $$r = \frac 1 {2\ \sin(\pi\frac dn)}$$
Your case would be $n=5$ and $d=2$.
The inradius $\rho$ similarily would be obtained as $$\rho = \frac 1 {2\ \tan(\pi\frac dn)}$$
Cf. https://bendwavy.org/klitzing/dimensions/polygons.htm
--- rk
Answer: Easy, between adjacent vertices  there's 72 degrees. Between any two connected vertices, that makes 144 degrees. $\frac{180-144}{2} =18^{\circ}$ for every line from a vertex,to a line straight to the center(radius of circle). $r = \frac{C}{2pi}$ and $2r\cos18 =\frac{C}{\pi}\cos18$ is the length of the line connecting the vertices.


Controlling draft options from a Makefile

Question: I would like to control class options such as draft and geometry package's showframe from a Makefile.  Is there a way I can parameterise a document using LaTeX itself, or will I need to preprocess the document using sed from the Makefile?
Answer: This is something I use quite often.
In your document you do this:
\providecommand\classopts{}
\expandafter\documentclass\expandafter[\classopts]{article}

The \expandafter shouldn't be necessary, however, I always provide them.
The \providecommand only adds the command if it didn't already exist. So you just need to create the command beforehand and then you can switch between different schemes.
In your makefile you can then do:
draft:
    pdflatex "\def\classopts{draft}\input{document}"
pdf:
    pdflatex document

And then you have two different compilations, one with draft and the other with regular settings.
I typically use it for switching between compiling handouts and the presentation for a beamer presentation.
Comment: @fborchers you can nest as many `\input` as you want (basically), See [here](https://tex.stackexchange.com/questions/301456/what-is-the-maximum-nesting-depth-of-input)
Comment: This works great!  I've used `pdflatex "\def\classopts{,draft}\input{document}"` (note the leading comma) so that I can append options to a list of standard class options such as `a4paper`
Comment: It works nice for me too. It has, however, a drawback: Since you call the main document with `\input{document}` from the command line it is not possible to input (or include) other files from there. This is a nice feature for large documents. The reason why this is not longer possible is that `\input` cannot be nested.
Comment: @fborchers, you might have been thinking of the `\include` command which cannot be nested. https://latex.org/forum/viewtopic.php?t=20341


Do I need to split a 1.5 billion document database into several in a standalone MongoDB?

Question: There will be total 1.5 billion documents in nearly 100 collections in one database. Need I to separate this database into several? Is there a performance limitation for a single database when the quantity of documents going higher?
Comment: In general, database and collection address grouping of data; that is mostly an application functional needs. Having too many databases and collections (thousands) can be an issue as these require additional storage related resources. MongoDB databases, collections and the indexes are stored in individual files, and more files means more resources. Data frequently used by applications is called as "working set" - this needs to be in memory for efficient access. The data access performance depends upon number/size of documents, memory, indexes, kind of query/sort operations, etc.
Comment: @prasad_ Thanks for the answer. So, can I simply summarize that the number of total documents in a database will tinily affect the performance while the number of collections is not too much?
Answer: Not necessary.
It's more like a hardware problem. Especially memory! Not CPU.
So, if you can give that DB server quite much memory, like a few hundred of GB, it will be fine!
Of course, the first question is "how big" is the DB? Especially how big partition of that data is "active". And how fast that DB must serve clients.
Comment: The total size of the DB is about 600GB. There will be 500 documents requested each time, and the time consumption is limited to 3s.
Comment: I'm a little confused about the word "active". If it means that the size of data requested, it nearly 10MB; If it means that the size of collections being writing and reading, the number of collections is 4, totally about 75m documents, the size is about 80GB
Comment: Because mongo tries to keep as many as possible documents (and indexes) in the memory, active data is that data that is used regularly. So, if you could have 100GB memory, then DB will serve clients in milliseconds. With 32GB memory, response time should still be under second.
Comment: @zyeewang Effective capacity planning includes both resource consideration (available RAM, I/O, CPU relative to the working set of commonly used data & indexes) and data modelling (efficiently modelling your data to support common usage). I recommend reading the series [Building with Patterns: A Summary](https://www.mongodb.com/blog/post/building-with-patterns-a-summary) and [A Summary of Schema Design Anti-Patterns and How to Spot Them](https://www.mongodb.com/developer/article/schema-design-anti-pattern-summary/) for some typical approaches.
Comment: As JJussi mentions, total size of data is less important than the working set of actively used data & indexes that should ideally fit in RAM. Swapping data to/from disk is orders of magnitude slower than working with data in RAM. Indexes are compressed on-disk & in-memory; documents are compressed on disk and uncompressed in memory. A 600GB data set could translate to 10s of GBs data working set or could be much larger than 600GB if a significant percentage of total data is routinely loaded into RAM. RAM is also needed for filesystem cache and other processing (eg aggregation).


How to get GA goals by a utm campaign?

Question: Is it possible to see all completed goals on Google Analytics by a particular utm campaign?
Answer: The easiest way is to make a segment of all visits from your campaign, and then refer to your normal goal reports.
You can also see goals from the conversion panel column when looking at an All campigns report (filter to the particular campaign you're interested in. This will either show all goals (but not split out), or you need to specify from the conversion drop-down menu which goal you want to see
Comment: Actually, new segment + filtering by a segment on goals page works pretty well! Thank you!

How to get GA goals by a utm campaign?


Is it unprofessional to delay my start date due to sickness?

Question: I am meant to start my new job on May 2nd, but I got a terrible back injury. I'm in a lot of pain and unable to move around a lot or think clearly. I might need 1 week extra to recover. The company were pretty flexible with the start date.
Comment: Get a doctor's note
Comment: Where in the world are you? In some places, delaying your start date would be stupid, given you can get a doctors note.
Answer: Whether it is unprofessional is irrelevant. In your situation, you don't have a choice other than delaying your start date. If it takes a week for your back to recover, then that's how long it takes.
Mail the company requesting to delay your start date because of your back injury. Then call your manager or HR to discuss the situation. It may also be a good idea to add some buffer, so that if your recovery takes longer than a week, you don't have to delay the start date again. Requesting them to let you join sooner than agreed (if you recover early) would be definitely less embarrassing.
Comment: This is a start up position, they are very flexible about the start date and they are very understanding people. So I am thinking it might be ok.


What is a worker in ruby/rails?

Question: I am coming from the Java world and keep hearing this term 'worker' in the ruby/rails world.  What is it? a thread?
Answer: Depends on the context.
A worker is typically a process that runs outside of your application request cycle. Ruby libraries like resque and delayed_job are typically used to manage worker queues.
On the other hand, if we're talking about web servers the word "worker" is sometimes used interchangeably with threads or processes (ie: nginx or apache "workers").
Comment: @Kamilski81 in web servers and using the solutions outlined here, these would be separate processes. With delayed_job for instance, you can run many different worker processes that can all pop off the next highest priority task from the database.  Due to this architecture many people run an additional monitor process using something like God, or BluePill.  See here for more: https://www.ruby-toolbox.com/categories/server_monitoring
Answer: Often in the 'Rails world' a worker is referring to a priority queue type system that has separate processes popping off tasks to execute outside the application cycle.  One of the most popular of these systems is DelayedJobs. This uses a database migration to add a table to hold the tasks that are to be executed by a worker process.  You can then configure any number of worker processes that will check the DelayedJobs queue table and execute the serialized task.  With DelayedJobs you have not only the ability to set priority of different tasks, but also a timeframe to execute the task, eg. send a particular email 1 hour from now.
Answer: A server running your rails app uses workers to do all of the things an application needs.  It sends email, runs requests, performs calculations etc.  The number of workers you need depends on how much traffic and calculations your web app needs to do.

What is a worker in ruby/rails?


Brahms Hungarian Dances

Question: Wondering are the twenty or so dances  from Brahms Hungarian Dances are they really dances? I was searching on this subject nothing could point me that are dances only to the name. If they're not real dances why were they called as such? Can someone help me  clear up this matter?
Answer: As I understand it, these pieces were composed by Brahms after being inspired by some Hungarian folk tunes and dance tunes. I think it is unlikely that he ever seriously considered whether anyone could actually dance with these pieces as accompaniment, and really that is not important.
You might also like to look at a lot of other classical pieces which have names which might imply that they are "dances", such as minuets, gavottes and sarabandes (e.g. by Bach and many others of that period). They might have been inspired by actual dances, but although the pieces themselves follow the rhythms of various dances, they were never really intended to be danced to.
Comment: Actually, very few of the Hungarian Dances themes are actually Hungarian. Many of the are Gypsy.
Answer: From reading a couple of Brahms' bios, I seem to remember that these Hungarian Dances were the result of someone asking Hannes what type of music he played when the was a pianist in the Die besten kleinen Bordelle in Hamburg (in his younger days.) Brahms would often extemporize for his friends. Someone suggested that he arrange some of these pieces for publication. Brahms did arrange some for piano four hands and some others for orchestra.
The Hungarian Dances do sound a lot like the very popular "Hungarian" or "Verbunklos" bands from Hungary and other places in Central Europe. (The style died out a bit during the 1930s.) There are still a few bands around Austria or Hungary playing this style in clubs and restaurants. There is also a band called the Pressberg Gypsy which was playing this way a few years back (when the original question was asked.)
There are several books on Hungarian music attempting to figure out the difference between "Authentic Hungarian" music and "Gypsy" music. When a style has been in an area for some time, it probably should be called nativized. It's hard to separate parts.

Brahms Hungarian Dances


'will submit' or 'will be submitting'

Question: Which one is appropiate?

I will submit my assignments by tonight
I will be submitting my assignments by tonight.

I want to express that before the end of the day, I will submit my assignments.
Answer: First off, with the preposition by, we would normally mention a specific time or point in time. I will submit my assignments by 10 tonight or by midnight tonight. Or you can say by the end of the day, because that also refers to a specific point in time. (By tonight does not really specify a point in time, unless there is a previously defined specific time that tonight refers to, such as a deadline that everyone knows about.)
As far as which construction to use, either one is fine. The first one has more of a promise meaning. The second one has a more matter of fact meaning. I explain the difference in detail here
Comment: I think, if one wants to emphasize that he will finish the process by this time, one can also say "I will have my assignments submitted by the end of day"
Answer: I will submit my assignment by tonight.
I will be submitting my assignments by tonight.
Both the sentences express the future and are interchangeable, with a slight difference in meaning.
The first sentence formed with will + bare ininitive has the overtures of certainty, and intention and emphasizes the action. On the other hand, the second sentence formed with will be + present participle is merely a statement, which means that the assignments will be submitted in the normal course of events or a routine. It's therefore considered to be usual or not so promising as the first sentence.
Answer: In this case, "I will submit" is the correct usage.
"I will submit" focuses on the fact that there will be an event, where you submit the assignment.  The listener can reasonably assume it will be swift.
"I will be submitting" focuses on the act of you engaging in submission.  There will be a submission, but it concentrates on the time period where the submission is occurring, rather than the fact that it happens.  I would use the phrasing "I will be submitting my assignments by tonight" if the listener knows I intend to submit my assignment in the form of an interpretive dance in the cafeteria drawn out over 3 acts, and I will be intentionally disrupting normal class to do so.
This is more obvious in other verbs.  "I will pray for you" may be as little as "I'll pray for you once, but then I'm going about the rest of my business."  "I will be praying for you implies a longer duration and many prayers. (though some people will say "I will pray for you" and pray many times over a long duration.  Welcome to English.  We're not as consistent as we'd like.)
Answer: 1 will submit
2 will be submitting
In my view , the formula 2 here is not used for stressing the progressive aspect but simply to give the idea "will submit" more weight, simply because the formula "will be submitting" is longer. Whether this emphasis of the submitting act is appropriate or not is another question. I have the feeling "will be submitting" sounds a bit like a cheap rhetoric effect.

'will submit' or 'will be submitting'


Wrap text on title and hyperlink columns

Question: I'm trying to import a list from Sharepoint On-Premise to Sharepoint Online. In the old list, the text was wrapped for both the title and the hyperlink column which gave the list an organized and clean look. After the import to Sharepoint Online, the title and hyperlink column are no longer wrapped and it doesn't seem like I'm able to change it in the column settings. I was trying to use the JSON formatting to fix it but I wasn't able to get it to work. Is there any way to do this?
Pictures below to show the difference:
Old:

New:
Answer: You can force the list to display in the classic view by going to the List settings > Advanced Settings  > List experience and selecting Classic experience:

In the modern lists, you can adjust the width of the column and then save the view. The column width will be then stored in the view and other users will be able to see this change.
In terms of wrapping the hyperlink field's text, I am afraid there is no out-of-the-box way of doing it.
Answer: As we can easily drag the length of the column, automatic line wrapping is canceled by default in SharePoint Online. Agree with Denis, you can use classic experience instead. Also, you can use multiple lines of text column instead of single line of text column and link column(use hyperlink).

You can give your feedback to Microsoft if you don't want to recreate columns via UserVoice. It is a place for customers provide feedback about Microsoft SharePoint products. What's more, if a feedback is high voted there by other customers, it will be promising that Microsoft Product Team will take it into consideration when designing the next version in the future.
Answer: Just use the Formatter to display Title value
<code>{
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "div",
   "txtContent": "@currentField"
}
</code>
Note that the options on Title will disappear. Those are the reasons why you don't get the text wrapping in the first place
Answer: Although text wrap in hyperlink field multiline text field won't work due current limitation, you can use workaround instead of building a brand new SPFX just for the issue.
How
Use other columns (with long text) and use text wrap, or define row height. This way, the multiline column is piggybacked off another non-multiline column. Yet, you can take advantage of its row height adjustment.


2004 Kia Sedona 160000 miles Timing Belt Replacement

Question: I have a 2004 Kia Sedona LX with 160000 miles on it.  I am going to be changing out the Timing Belt.  It will be the Car's second one.  What do you recommend I replace while I am inside?  Water Pump?  Idlers?   Oil Seal?   I didn't want to dig back in later for something I can do now.
Much Thanks
Reid Lantz
Answer: Right off the bat, I would highly recommend visiting some forums dedicated to your make and model. Chances are there's a howto with common gotchas and recommendations specific to you. It seems like every model has its nuances!
Any idler pulleys or tensioners and the water pump are an excellent idea. They're not absolutely necessary as you've probably guessed, but the extra cost and effort are usually worth not having to do it again. That, and if one of them decides to give up the ghost it could cause the belt to hop off or rub until it burns up. In this case if it's an interference engine, you're looking at many thousands of dollars of repairs. If it's not, you're at least stranded.
The serpentine belt and tensioner may be a good idea if it's close to due since that will probably come off as well.
Except for ridiculously hard to access seals like a rear main seal, I wouldn't bother with any oil seals unless you're seeing a leak.


How to see how much storage is used per app on OS X?

Question: I was wondering if there is a way to check how much space is used for each app that's installed on your mac. When you click on the Apple logo left on top, then "About this mac" you can see at the tab "Storage" the total amount of pictures, programs, other, movies and music. But it would be nice if I can check per app how much space the take on my mac. Is this possible?
Answer: If you are not afraid of using Terminal.app, you can run
sudo du -sh /Applications/* /Applications/Utilities/*

to get the size of each application.
Comment: the "-sh" switch is broken down into "s" which gives you summary stats (Display an entry for reach specified file) and "h" which gives you human readable output.  Of course you could look these switches up yourself by reading "man du".
Answer: The full answer is not easily. The short answer is for most apps, you can ignore the settings, preferences and other files stored outside of the Application binary and can open /Applications in Finder and enable calculate all folder sizes:
Open a finder window:

Command + Shift + A - go to applications
Command + 2 - show the list view
Command + J - pull up that folder's view options
Select the Calculate all sizes control

The system will then add up all the storage for each app and you can click on the size column to sort it. A general purpose tool like Daisy Disk or What Size might also help you keep tabs on the files an application might store in /Library since apps like Garage band or Logic Pro can download significant amount of sound loops and instruments - but they usually tell you explicitly before those downloads start.


How to tell if my starter is the problem

Question: I have a 2008 Honda Civic. My battery was replaced last year. Yesterday my wife tried to start the car. All the lights everything turned on except the car would not start. Not even a sound just turn the key and lights, air, radio but no sound from the starter or engine.
Comment: Although you got a new battery recently, I would strongly suggest checking it at an autoparts store. The starter and ignition system tends to draw quite a bit of power.
Answer: Does the car have an alarm system or system which disables the ignition ... usually tied in with a key fob? If so, this is usually tied in with the Body Control Module (BCM), which if bad, could be disabling your starter. Everything else might come on, but you turn the key and nothing. You'd also see a security light on the dash board with this problem.


Inserting shapefile in AutoCAD Workspace?

Question: How can I insert an ArcMap shapefile in AutoCad or how can I save the shapefile so as to put it in Autocad Workspace? Even a tool in ArcMap that exports shapefile in a form which can be inserted in AutoCad or AutoCad Map would do.
Comment: Both ArcMap and ArcCatalog has a command button in their toolbar with red icode named ArcToolBox. Try ArcToolbox/Conversion Tools/To CAD/Export toCad.It converts you shape file into a CAD drawing.
Comment: It was a little helpful but I had to use feature to line first and then export to Cad.
Comment: There is also a tool from ESRI for AutoCAD that imports ArcGIS files without converting. I don't remember the name but you can google that.
Answer: you can use the dxf interchange format for CAD to export your data. This conversion tool is available in ArcMap (Conversion toolbox/to cad/ export to cad, then choose dxf as output format).
from the other side, shapefiles can be imported in AutoCAD MAP 3D using insert > import panel > map import
Comment: Couldn't find "the dxf interchange format for CAD" in Conversion Toolbox.

In which workspace of autodesk exactly? There is no "import panel" option in "insert" menu neither in Autocad nor Autocad Map.
Comment: In the search menu in arcmap type "dwg" or "dxf".  side note... if you are  having trouble with this part:   think about  this before you export gcs data to dwg.  autocad handles coordinates very differently than armap.  Depending on what your doing you may need to scale on the backend.  You can quickly butcher your data if you blindly use autocad or esri tools.


Prove that $a^{\cos(b)^2}-b^{\cos(a)^2}\leq \frac{4}{\pi}(1-\frac{\pi}{2})b+\frac{\pi}{2}-1$ and the reverse inequality .

Question: It'a problem of my own :

Let $a\geq b>0$ such that $a+b=\frac{\pi}{2}$ then we have :
  $$a^{\cos(b)^2}-b^{\cos(a)^2}\leq \frac{4}{\pi}(1-\frac{\pi}{2})b+\frac{\pi}{2}-1$$
  Let $b\geq a>0$ such that $a+b=\frac{\pi}{2}$ then we have :
  $$a^{\cos(b)^2}-b^{\cos(a)^2}\geq \frac{4}{\pi}(1-\frac{\pi}{2})b+\frac{\pi}{2}-1$$

For the first the equality case is when $b=0$ or $b=\frac{\pi}{4}$ for the second when $b=\frac{\pi}{4}$ or $b=\frac{\pi}{2}$
The main remark is : the line $f(x)=\frac{4}{\pi}(1-\frac{\pi}{2})x+\frac{\pi}{2}-1$ is a chord of the curve defines by the function $g(x)=\Big(\frac{\pi}{2}-x\Big)^{\cos^2(x)}-\Big(x\Big)^{\sin^2(x)}$
So my idea was to derivate the function $g(x)$ we obtain :
$$g'(x)= (\frac{\pi}{2} - x)^{\cos^2(x)} \Big(-\frac{\cos^2(x)}{(\frac{\pi}{2} - x)} - 2 \log\Big(\frac{\pi}{2} - x\Big) \sin(x) \cos(x)\Big) - x^{\sin^2(x)} \Big(\frac{\sin^2(x)}{x} + 2 \log(x) \sin(x) \cos(x)\Big)$$
See that $g'(x)<0$ on the interval $[0,\frac{\pi}{2}]$ and apply the mean value theorem but I'm stuck after this.
If you have nice idea it would be cool.
Ps: Is there a symmetry with respect to the line ($f(x)$)?If yes we can cut in two the problem.
Thanks for sharing your time and knowledge .
Answer: put $x=\dfrac{\pi}{4}+a$
$h(a)=(\frac{\pi}{4}-a)^{\frac{1}{4}(\cos{a}-\sin{a})}+(\frac{\pi}{4}+a)^{\frac{1}{4}(\sin{a}+\cos{a})}$
$=i(a)+i(-a)$
$i''(x)$ is increasing  in the area $(-\frac{\pi}{4},0)$ and $i'(0)\geq-1$,  h(x) is the shape like which add two parabola.


Are there any major alternatives to Waterfall and Agile?

Question: I am curious if anyone knows of any methodologies that are significantly different (not a recombination) and I would especially appreciate anyone who brought forward any experience with alternatives.
Answer: Wikipedia lists these as methodologies/development processes:

Agile - based on iterative and incremental development, where requirements and solutions evolve through collaboration between self-organizing, cross-functional teams.
Cleanroom - the focus of the Cleanroom process is on defect prevention, rather than defect removal.
Iterative -  a cyclic software development process developed in response to the weaknesses of the waterfall model. It starts with an initial planning and ends with deployment with the cyclic interactions in between.

RAD -  uses minimal planning in favor of rapid prototyping. The "planning" of software developed using RAD is interleaved with writing the software itself.
RUP - The Rational Unified Process (RUP) is an adaptable iterative software development process framework, intended to be tailored by selecting the elements of the process that are appropriate.
Spiral - combining elements of both design and prototyping-in-stages, in an effort to combine advantages of top-down and bottom-up concepts. This model of development combines the features of the prototyping model and the waterfall model.

Waterfall - sequential through the phases of Conception, Initiation, Analysis, Design, Construction, Testing and Maintenance.

Lean -  a translation of Lean manufacturing and Lean IT principles and practices to the software development domain; everything not adding value to the customer is considered to be waste.
V-Model -  Instead of moving down in a linear way, the process steps are bent upwards after the coding phase, to form the typical V shape. The V-Model demonstrates the relationships between each phase of the development life cycle and its associated phase of testing.

TDD -  relies on the repetition of a very short development cycle: first the developer writes a failing automated test case that defines a desired improvement or new function, then produces code to pass that test and finally refactors the new code to acceptable standards.
Comment: Great list, except for TDD.  That's not a lifecycle but a development practice.
Comment: Thank you for such a clear, succinct answer. I am so old school, I have never heard many of the terms being thrown around on P.SE.
Comment: Spotify Tribe Engineering Model
https://medium.com/scaled-agile-framework/exploring-key-elements-of-spotifys-agile-scaling-model-471d2a23d7ea
Comment: Holacracy used by Adobe Team from what I have heard https://www.digicomp.ch/blog/2016/04/21/holacracy-das-unternehmen-als-lebender-organismus
Answer: Cowboy Coding
Pure unstructured, unmanaged, freeform development. It can be useful for small hobby projects that lack a deadline or even a clear goal, but likely won't work in a corporate setting.
Comment: "likely won't work in a corporate setting". Says you! ;)
Comment: yay! bang-bang!
Comment: +1 Aaa, cool! I do it sometimes, but i did not know how to name this "process" :)
Comment: yeeee-haw padnah!
Comment: In formal mature corporate settings true.  However, in small business there can be quite a bit of, "Just get-r-done" mentality.
Answer: The Spiral Model
The spiral model is a software development process combining elements of both design and prototyping-in-stages, in an effort to combine advantages of top-down and bottom-up concepts. Also known as the spiral lifecycle model (or spiral development), it is a systems development method (SDM) used in information technology (IT). This model of development combines the features of the prototyping model and the waterfall model. The spiral model is intended for large, expensive and complicated projects.
-Wikipedia
Answer: Plan
Sit down with the client (or end user) and design a series of use cases.
Design
Layout the system on paper / whiteboard over a few beers and pizza. Snicker when something looks phallic.
Confirm
Confirm design with client (or end user) and freeze requirements.
Code
Self explanatory.
Comment: "Freeze requirements" is the biggest easier-said-than-done ever.
Answer: This Waterfall argument has been around for awhile and used by the agile thought leaders early on. They too encountered the "reality" of waterfall as a "red alert."
When you start working on a software development project you will quickly discover that the development methodology used will have a major part to play in the speed and quality of the code developed.Since Agile methodology is so widely used it is important that you understand the advantages and disadvantages of agile so you are able to determine whether it is the best fit for your project deliverables.
Agile software development is a conceptual framework for undertaking software engineering projects.Most agile methods attempt to minimize risk by developing software in short timeboxes, called iterations, which typically last one to four weeks. Each iteration is like a miniature software project of its own, and includes all of the tasks necessary to release the mini-increment of new functionality: planning, requirements analysis, design, coding, testing, and documentation.
It's a good process for the company because it include the customer in the development process and make it responsible for the product delivery. In the other side customers are happy because they find theirs self participating in the development of the product.
Demerits for Agile:

Agile is too programmer-centric
leaving it unclear how to balance
work across an organization.
If You Don't Know Where You're Going,
Agile Won't Get You There!
Creation of frameworks without clear
needs.
Overuse of language features
(inappropriately).
No test-first mentality.

Well for an interesting methodology which might work as an alternative for AGILE may be best viewed under these 3 links :
Kanban as Alternative Agile Implementation
Kanban software development
Lean software development on the cloud
Comment: If You Don't Know Where You're Going, Waterfall Won't Get You There!


Include host in buffer name for all files opened with TRAMP

Question: I frequently use TRAMP with emacs to edit files remotely. However, I sometimes have files open from both my production and development server. When I have the same file open on both servers, TRAMP will name the buffers bar</ssh:stable:> and bar</ssh:dev:>. Is there a way I can get this behavior for all buffers, even if they're currently only open from one of the servers? For instance, if I'm visiting /foo/bar on only the development server and /baz/qux on only the production server, I would like the buffers to be named bar</ssh:dev:> and qux</ssh:stable:>, respectively.
Comment: The answer (whatever it will end up being) may entail using the `find-file-hook`, the function `rename-buffer`, and the test described by phils in the related thread, along with my comments underneath his answer -- **Emacs — dired-mode test to determine remote server name / address**:  http://stackoverflow.com/questions/24481381/emacs-dired-mode-test-to-determine-remote-server-name-address
Answer: Okay, the following appears to work exactly the way I want as described above. Just put these in your .emacs:
(defun add-server-postfix ()
  "Add the name of the connection type and server to the buffer name"
  (if (string-match "^/ssh:.*?:" (buffer-file-name (current-buffer)))
      (rename-buffer (concat (buffer-name (current-buffer)) "<" (match-string 0 (buffer-file-name (current-buffer))) ">")) nil))

(add-hook 'find-file-hook 'add-server-postfix)


Is the Logitech C310 webcam compatible?

Question: Does the Logitech C310 webcam work in Ubuntu 11.10? Do we require any drivers to install that webcam on Ubuntu 11.10?
Comment: This question appears to be abandoned, if you are experiencing a similar issue please [ask a new question](http://askubuntu.com/questions/ask) with details pertaining to your problem. If you feel this question is *not* abandoned, please flag the question explaining that. :)
Answer: I have found two previously-asked questions here on Ask Ubuntu that look like they would be relevant to you:

Logitech C310 webcam video problems
Logitech C310 audio problems

The good news is your camera should be expected to work out of the box, more or less. No manual driver installation will be necessary.
That being said, this particular model does seem to have some video and especially audio issues on 11.10.
Answer: My Logitech C310 audio did not work with 11.10 .  Lots of other solutions did not work, including loading some backport module, because I couldn't find it.
What did work is here:
http://www.matthartley.com/audio-problems-with-skype-for-ubuntu/
Basically load pavucontrol, start skype, look at the recording tab, set the audio to the c310.

Is the Logitech C310 webcam compatible?


Node modules is not added in the folder after running yarn hardhat

Question: Even after adding the hardhat packages by yarn multiple times, node modules are not showing in the folder.

What am I doing wrong?
Answer: You should initialize the project before installing the packages.
This should be the order to install hardhat through yarn.
yarn init -y
yarn add --dev hardhat
npx hardhat

If it doesn't work, you can try install using the npm.
npm init -y
npm install --save-dev hardhat
npx hardhat

For more information you can click here.
Tell me if it helps!
Comment: Thank you so much mate, it works now!!


Movie or book about people kept in a type of prison where if their name came up in a lottery, they'd be subject to experiments and/or organ harvesting

Question: Looking for the title of a science fiction movie or book. It involved young people kept in a type of prison and facing a lottery where if their name came up they would face experiments on their body and or organ harvesting. There is also a bit of a love story and a mass escape by the prisoners.
Comment: These are some pretty common science fiction plot, actually; there are multiple works that will fit this description.  You seem unsure whether this was a film or a book, so is this something you have actually seen/read?  Or is it something you have only heard about second hand?  In the latter case, it may be very difficult to pin down the answer unambiguously.
Comment: @Mike Friske - If anyone correctly identifies the movie or book you're looking for, you can mark that answer as [accepted](https://scifi.stackexchange.com/help/accepted-answer) by clicking on the check mark beneath the voting buttons, as per the [tour].
Comment: Sounds exactly like the movie "The Island" starring Ewan McGregor and Scarlet Johannson.
Comment: A planet named Shayol?
Answer: Sounds like the premise for The Island (2005).
From Wikipedia:

The Island is a 2005 American science fiction action thriller film directed and co-produced by Michael Bay. It stars Ewan McGregor, Scarlett Johansson, Djimon Hounsou, Sean Bean, Michael Clarke Duncan and Steve Buscemi.

In 2019, Lincoln Six Echo and Jordan Two Delta live with others in an isolated compound. This dystopian community is governed by a strict set of rules. The residents are told that the outside world has become too contaminated to support life with the exception of a pathogen-free island. Each week, one resident gets to leave the compound and live on the island by way of a lottery.
Lincoln begins having dreams that he knows are not from his own experiences. Dr. Merrick, a scientist who runs the compound, is concerned and places probes in Lincoln's body to monitor his cerebral activity. While secretly visiting an off-limits power facility in the basement where technician James McCord works, Lincoln discovers a live moth in a ventilation shaft, leading him to deduce the outside world is not really contaminated. Lincoln follows the moth to another section, where he discovers the "lottery" is actually a system to selectively remove inhabitants from the compound, where the "winner" is then used for organ harvesting, surrogate motherhood, and other important purposes for each one's wealthy sponsor, of whom they are clones.
Comment: I think loosely based on the book "spares" by Michael Marshall Smith!
Comment: And Parts the Clonus Horror from the 70s. They thought they were going to America.
Comment: Regarding the OP's two points: clones Scarlett Johanssen and the Ewan McGreggor are in love, want to stay together ... and how she knows his little tiks is even a plot point. There's also a memorable scene where a resident wakes up while having organs removed, runs in terror, and is roughly tackled.
Answer: LogicDictates answer is probably closer, but this also sounds similar to the novel and movie 'Never Let me Go'.
Wikipedia:

The story begins with Kathy H., who describes herself as a carer,
talking about looking after organ donors. She has been a carer for
almost twelve years at the time of narration, and she often reminisces
about her time spent at Hailsham, a boarding school in England, where
the teachers are known as guardians. The children are watched closely
and they are often told about the importance of producing art and of
being healthy (smoking is considered a taboo, almost on the level of a
crime, and working in the vegetable garden is compulsory). The
students' art is then displayed in an exhibition, and the best art is
chosen by a woman known to the students as Madame, who keeps their
work in a gallery. Kathy develops a close friendship with two other
students, Ruth and Tommy. Kathy develops a fondness for Tommy, looking
after him when he is bullied and having private talks with him.
However, Tommy and Ruth form a relationship instead.
In an isolated incident, Miss Lucy, one of the guardians, tells the
students that they are clones who were created to donate organs to
others (similar to saviour siblings), and after their donations they
will die young. She implies that if the students are to live decent
lives, then they must know the truth: their lives are already
predetermined. Miss Lucy is removed from the school as a result of her
disclosure, but the students passively accept their fate.
Answer: Sounds like Deadman Wonderland.

Deadman Wonderland is Japan's only privately operated prison, built after the Great Tokyo Earthquake on ground zero. Deadman Wonderland was founded by Rinichirō Hagire and run by Tsunenaga Tamaki. It gathers prisoners from all over Japan and raises money for the revival of the destroyed metropolis. To the public and the tourists that visit daily, Deadman Wonderland is a massive theme park-like facility run by the prison population. Unbeknownst to the general population, most of the prison's attractions involve cruel games of survival where many inmates lose their lives or are maimed for the entertainment of an oblivious public. The prison guards are also granted autonomy over how to punish the prisoners, which often results in bloodshed.

....

Deadmen who are defeated yet survive the game have a part of their anatomy surgically removed for scientific research which is broadcast as part of the Corpse Carnival Post-Game Show. In a cruel twist, the doctor spins a bird-shaped macabre slot machine to determine which part of the loser's body will be removed (with the show being broadcast live to the other prisoners) by the doctor with the parts ranging from the eye (the right one was removed from Senji), vocal cords (which were removed from Nagi), and the kidney, part of the stomach, and hair (which were removed from Minatsuki). Other parts listed on the slot machine are hand, tongue, lip, nose, leg, tooth, nail, heart, lungs, and brain.
Comment: Welcome to SciFi.SE! Can you explain how Deadman Wonderland matches the description provided in the question?


elmah causes application crash

Question: Has anyone else run into an issue where Elmah has caused application crashes?  On one of my site this was definately the case but I had been using it for a long time beforehand and never had this problem.  Now another site that uses it has had application crashes.
Comment: Is it happening on local pc or when deploying on IIS?
Answer: If you're using ELMAH 1.1 or 1.2, verify that you're packaging all of the referenced DLLs needed in order to persist to your data store. Also make sure that you're using the right version of the x64/x86 libraries.
I ran into a similar issue when I was storing my data in SQLite. It was quite a while ago, but it ended up being something about the dlls not being compiled in a compatible way.
My fix ended up being completely upgrading to the newest version of ELMAH (once I did that, my issue went away).
This post may also be relevant...

elmah causes application crash


How often can COSMOS missions be repeated?

Question: How often can the COSMOS missions for high faction standings be repeated?
Answer: Seemingly they cannot - it has been requested to allow them to be repeatable once every six months/one year but I can't find any communication from CCP that states they've implemented this as a change.
Unlike the epic arc missions, once you've done a set of COSMOS missions you will not be able to repeat them. This is further clarified on the EVE wiki:

Most of these missions can only be completed once during your character's lifetime.

and...

Warning: DO NOT FAIL, QUIT, DECLINE OR LET MISSION OFFER EXPIRE. It could lock you out from accessing other Cosmos agents.
Comment: I completed the SOE Arnon missions in August 2010 and then again in June 2012.  So they either were manually reset by CCP at some point or they are repeatable after some period of time.
Comment: SOE != COSMOS. SOE is an epic story arc, which is covered in the line `Unlike the epic arc missions`...