How does a phonon cause two electrons to attract each other and form a cooper pair?

Question: We know that like charges repel each other. But my professor claimed that two electrons can attract each other as well. What he said was that due to screening an electron travelling at some speed won't repel another electron, but that they will, in some cases, attract each other due to weak phonon exchange. What does that mean? What is phonon exchange? Do two electrons really attract each other?
Answer: Just as two oppositely pointed bar magnets (magnetic dipoles) attract, two electrons embedded within cancelling positive atomic charges can form transient electrical dipoles that attract. The catch is that to create such dipoles, there must be some form of "wobble" in the way that negative and positive charges are around the electrons.
A Cooper pair is a quantum version of just such a wobble-initiated dipole attraction. The effect that creates the wobbles is a quantized version of ordinary sound, also called a phonon. The synchronized way in which the charges wobble at each end of the Cooper pair is described in quantum terms as a "phonon exchange." Like two bar magnets rotating end over end in exact synchronization, this coordinated wobble dance enables the dipoles formed by the electrons to stay attached indefinitely.
Balancing all of this is the fact that these are conduction electrons, meaning they are part of "gas" of electrons that moves relatively freely within the neutralizing positive charge of the metal. If any pair of electrons gets too close to each other within such a gas, the neutralizing charges of the atomic lattice cannot move with them, and you start to develop a local negative charge in that region.
That charge buildup keeps the electrons in Cooper pairs from getting too close to each other, despite the attraction created by their phonon-coordinated charge wobble. This repulsion effect keeps the electrons in a Cooper pair surprisingly far from each, in the order of hundreds of atomic diameters apart. It is also why Cooper pairs are so delicate, since a mere dipole bond over those distances doesn't have much oomph. It can easily be broken by random vibrations (heat) that upsets the wobble dance.
The real magic in all of this, however, stems from a quantum effect that has no classical physics analogy of which I am aware. The two electrons -- or to be more precise, the two quasiparticle dipole pairs they form -- have half-integer spins, which makes them into mutually repulsive fermions. Once bonded, these half spins cancel each other, giving the overall Cooper pair spin of zero. Whole-integer spin makes Cooper pairs into a composite bosons, and such bosons can join together in a fully coordinated fashion that is quite impossible for fermions. All of the most remarkable properties of superconductors stem from that last seemingly minor point in the overall formation of Cooper pairs.
Addendum: @Danu pointed out this excellent illustration by Dr Ronald Griessen at Vrije Universiteit. It shows how rapid motion electron motion through an atomic lattice creates a lagging charge displacement, and thus a charge dipole. (Dr Griessen has some excellent online physics notes at that site, BTW.)
Picture the box on the right as a (not to scale!) snapshot of a phonon-synchronized oscillation going on continuously between two electron sites, and you will have a pretty solid classical-analogy lock on how exchanging phonons (or in classical analogy, vibrating synchronously) can bind two electrons together:
Comment: This description gives somewhat a false message that the 2 electrons are coupled together in the real space, but from my understanding it is the wavefunction of the 2 electrons that is coupled rather than the physical coupling of the 2 electrons. The 2 electrons of the Cooper pair can be spatially separated as well.
Answer: From the Wiki article Cooper pair:

In condensed matter physics, a Cooper pair or BCS pair is two
  electrons (or other fermions) that are bound together at low
  temperatures in a certain manner first described in 1956 by American
  physicist Leon Cooper. Cooper showed that an arbitrarily small
  attraction between electrons in a metal can cause a paired state of
  electrons to have a lower energy than the Fermi energy, which implies
  that the pair is bound. In conventional superconductors, this
  attraction is due to the electron–phonon interaction. The Cooper pair
  state is responsible for superconductivity, as described in the BCS
  theory developed by John Bardeen, Leon Cooper, and John Schrieffer for
  which they shared the 1972 Nobel Prize.
Although Cooper pairing is a quantum effect, the reason for the
  pairing can be seen from a simplified classical explanation. An
  electron in a metal normally behaves as a free particle. The electron
  is repelled from other electrons due to their negative charge, but it
  also attracts the positive ions that make up the rigid lattice of the
  metal. This attraction distorts the ion lattice, moving the ions
  slightly toward the electron, increasing the positive charge density
  of the lattice in the vicinity. This positive charge can attract other
  electrons. At long distances this attraction between electrons due to
  the displaced ions can overcome the electrons' repulsion due to their
  negative charge, and cause them to pair up. The rigorous quantum
  mechanical explanation shows that the effect is due to electron–phonon
  interactions.
Comment: I feel like this answer is a little too much of a case of link-only... Could you perhaps expand a little?
Comment: @A4KASH, I think it may be the case that you're failing to distinguish between the case of "not distorting the lattice **at all**" and the case of "minutely distorting the lattice".  The next sentence after the quote of the article I provide is:  *The energy of the pairing interaction is quite weak, of the order of 10−3eV, and thermal energy can easily break the pairs. So only at low temperatures are a significant number of the electrons in a metal in Cooper pairs.*
Comment: @AlfredCentauri The most important point of the Alfred Centauri's answer is obviously that the second paragraph of the Wikipedia description is a *simplified classical explanation* of the Cooper pairing. The Cooper pairing is better explained (to my mind) as an instability of the Fermi sea caused by electron-phonon coupling, as the first paragraph of his quotation tells you. You need a quantum mechanical treatment to understand the Cooper pairing. By the way, neither a phonon nor an electron is a classical object :-)
Comment: I have been reading this article since few hours and something is making me confused. I dont know how can an electron distort the lattice site even though the positive ion has much greater charge than a single electron?
Comment: @Danu, I understand your concern, however, my interests are elsewhere for now.  I will consider expanding a little in time.
Comment: @Danu (to echo my comments in chat) Whoa, hold on. This is **not** what we mean by "link-only." There's a substantial blockquote that prevents it from being link-only. As a matter of fact, assuming the quoted passage answers the question, I see nothing wrong with this answer.
Comment: @DavidZ cool, good to know :) I personally don't really feel strongly about it, but it's good to have evertything crystal clear. Alfred, sorry for any possible inconveniences (and please, don't take it personally ;) )


Micronaut is slow for the first request after startup, after that its not

Question: I have a doubt regarding micronaut with kotlin, I created a simple api with two routes, one is for hello world and another one is for returning the received query params, when I hit any request to the web service for the first time after startup it takes around 100-200ms, but any requests after the first one takes around 10 ms. Also, request for any invalid endpoints too behaves the same, first invalid endpoint will have a spike in response time but the successive requests for unique invalid endpoints won't take long time. I have already searched it on the internet, but couldn't find useful reference. Your help would be highly appreciated :)
Video link
<code>// micronaut controller
package com.example.controller

import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpResponse
import io.micronaut.http.MediaType
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
import io.micronaut.http.annotation.Produces

@Controller("/api")
class HelloController {

    @Get
    @Produces(MediaType.TEXT_PLAIN)
    fun hello() = "Hello world"

    @Get("/params")
    fun getHttpParams(request: HttpRequest<*>): HttpResponse<*> {
        val params = request.parameters.asMap()
        return HttpResponse.ok(params)
    }

}
</code>
I built it using gradle shadowJar task and ran using the below command.
<code>./gradlew optimizedJitJarAll
java -jar myapp-0.1-all-optimized.jar
</code>

first request after server startup to any route takes 200ms after that every route takes around 10 ms, same with 404 routes
I can confirm, no caching is involved here. I tested it with browser developer tools and rest api clients, every result is the same.
Answer: This is probably because of either JIT compilation, classloading and initialization, and other JVM warmup-related things such as internal optimizations and adjustments, which particularly happen during the first few requests.
These things improve performance for subsequent requests but can cause performance issues at first.
There's a general way to solve this, using something called Crac.


Detecting if an IDataReader contains a certain field before iteration

Question: So I'm using an IDataReader to hydrate some business objects, but I don't know at runtime exactly what fields will be in the reader.  Any fields that aren't in the reader would be left null on the resulting object.  How do you test if a reader contains a specific field without just wrapping it in a try/catch?
Answer: This should do the trick:
    Public Shared Function ReaderContainsColumn(ByVal reader As IDataReader, ByVal name As String) As Boolean
        For i As Integer = 0 To reader.FieldCount - 1
            If reader.GetName(i).Equals(name, StringComparison.CurrentCultureIgnoreCase) Then Return True
        Next
        Return False
    End Function

or (in C#)
public static bool ReaderContainsColumn(IDataReader reader, string name)
{
    for (int i = 0; i < reader.FieldCount; i++) {
        if (reader.GetName(i).Equals(name, StringComparison.CurrentCultureIgnoreCase)) return true;
    }
    return false;
}

:o)
Answer: You can also use IDataReader.GetSchemaTable to get a list of all the columns in the reader.
http://support.microsoft.com/kb/310107
Comment: Not sure why people are voting you down - this is the neatest solution
Comment: Yes it does. The first item in each row from reader.GetSchemaTable().Rows are the column names. i.e. reader.GetSchemaTable().Rows[0][0] gives me the first column name.
Comment: Not sure if this is the nicest. Contrast `reader.GetSchemaTable().Rows.Cast().Select(x => (string)x["ColumnName"]).Contains(colName, StringComparer.OrdinalIgnoreCase)` **with** `Enumerable.Range(0, reader.FieldCount).Select(reader.GetName).Contains(colName, StringComparer.OrdinalIgnoreCase)`. The FieldCount approach is not only cleaner, but many times faster.
Comment: The GetSchemaTable doesn't list the columns of the returned data structure.
Comment: Last time I tried such it gave me the schema_info like columns.  I'll have to try it again though since it's been a while.
Comment: Agree with Jim, easily the nicest solution
Answer: Enumerable.Range(0, reader.FieldCount).Any(i => reader.GetName(i) == "ColumnName")

Answer: The best solution I've used is doing it like this:
DataTable dataTable = new DataTable();
dataTable.Load(reader);
foreach (var item in dataTable.Rows)
{
    bool columnExists = item.Table.Columns.Contains("ColumnName");
}

Trying to access it through reader["ColumnName"] and checking for null or DBNull will throw an exception.
Answer: While I disagree with this approach (I think when accessing data, you should know the shape before hand), I understand that there are exceptions.
You could always load up a datatable with the reader and then iterate through it.  You can then check to see if the column exists. This will be less performant, but you won't need try/catch blocks (so maybe it is more performant for your needs).
Answer: You can't just test reader["field"] for null or DBNull because a IndexOutOfRangeException is thrown if the column isn't in the reader.
The code I use in my mapping layer for creating domain objects and the stored procedures that use the mapping layer might have different column names is below; you could modify it to not throw an exception if the column isn't found and return default(t) or null.
I understand this isn't the most elegant or optimal solution (and really, if you can avoid it then you should), however, legacy stored procedures or Sql queries might warrant a work-around.
    ///
    /// Grabs the value from a specific datareader for a list of column names.
    ///
    /// <typeparam name="T">Type of the value.</typeparam>
    /// <param name="reader">Reader to grab data off of.</param>
    /// <param name="columnNames">Column names that should be interrogated.</param>
    /// <returns>Value from the first correct column name or an exception if none of the columns exist.</returns>
    public static T GetColumnValue<T>(IDataReader reader, params string[] columnNames)
    {
        bool foundValue = false;
        T value = default(T);
        IndexOutOfRangeException lastException = null;

        foreach (string columnName in columnNames)
        {
            try
            {
                int ordinal = reader.GetOrdinal(columnName);
                value = (T)reader.GetValue(ordinal);
                foundValue = true;
            }
            catch (IndexOutOfRangeException ex)
            {
                lastException = ex;
            }
        }

        if (!foundValue)
        {
            string message = string.Format("Column(s) {0} could not be not found.",
                string.Join(", ", columnNames));

            throw new IndexOutOfRangeException(message, lastException);
        }

        return value;
    }

Comment: That will perform poorly


Benefits of JPMS/Project Jigsaw for Small Applications / Libraries

Question: I understand the benefits of the Java Platform Module System (JPMS) for large applications, but is there any reason to make a small library or application into a (single) module? If so, are Modular Jar Files the best means of accomplishing this, or is the normal approach preferred?
Going forward, will there be performance implications for modularized v. classpath programs?
Answer: Immediate performance implications include the following:

Modularized applications can opt to use jlink so that the distributable runtime is reduced in size: it only uses the modules you require. So if you don't need Swing, Corba, etc, it does not reside on disk. (more info here).
Modularized applications use the module graph for classloading; the algorithm for this is much faster than the linear search of classpath (more info here).

This is by no means a guarantee that your app will be faster, but the above is undeniably attractive.
Longer term, consider this:

Though experimental in JDK 9, there is an AOT compiler that (for Linux x64) will compile the java.base module to native code. This is likely the path forward for future Java releases. Surely this will improve startup time in the future. (again, more info here)
Comment: Also in JDK 9 [compact strings](http://openjdk.java.net/jeps/254) were introduced. Henceforth by default Java will use 1 byte per char for Latin characters. It does`t have connections with jigsaw project but might reduce your heap size and overall performance.
Comment: jlink can also be used by non-modularized applications, so this is not a benefit. Class loading speed gains are only relevant for the large JRE classes, so this is not a benefit either.
Answer:
If so, are Modular Jar Files the best means of accomplishing this, or is the normal approach preferred?

I'm not sure what you you mean by "the normal approach" - modular JARs are the "normal approach" to create artifacts that the module system will create a module for.

[I]s there any reason to make a small library or application into a (single) module?

Yes, a few:

Developers creating a modular application or using a modular library benefit from reliable configuration, where they can only launch their application if all dependencies are present - this is a benefit no matter how large the application/library is.
As a library designer you can hide internals. While strong encapsulation is only effective if your modular JAR is put onto the module path, the module descriptor still documents your intent in code, and allows you to more unscrupulously change your code. Application developers benefit as well because they can no longer accidentally depend on unsupported implementation details.
Even in small applications and libraries, services might be used to decouple different aspects of functionality and make code more easily extensible.
Only "real" modules (as opposed to automatic modules) can be included in a runtime image by jlink. Not providing a modular JAR robs your users of a library of that possibility.

Also note that you never know which small application or library might turn into something bigger. :)

Going forward, will there be performance implications for modularized v. classpath programs?

While building the module graph and verifying modules costs time, the module system should make it up with an improved class loading strategy: It records for every package which module exports it and loads types from that package directly from that module instead of having to scan the entire class path. either way, I don't think this should be a deciding factor.
Answer: Found this link informative
http://www.javaworld.com/article/2878952/java-platform/modularity-in-java-9.html

Aren't JAR files modular enough?
JAR files and the deployment environment in which they operate greatly
  improve on the many legacy deployment conventions otherwise available.
  But JAR files have no intrinsic uniqueness, apart from a rarely used
  version number, which is hidden in a .jar manifest. The JAR file and
  the optional manifest are not used as modularity conventions within
  the Java runtime environment. So the package names of classes in the
  file and their participation in a classpath are the only parts of the
  JAR structure that lend modularity to the runtime environment.
In short, JARs are a good attempt at modularization, but they don't
  fulfill all the requirements for a truly modular environment.
  Frameworks and platforms like Spring and OSGi use patterns and
  enhancements to the JAR specification to provide environments for
  building very capable and modular systems. Over time, however, even
  these tools will succumb to a very unfortunate side-effect of the JAR
  specification JAR hell!
Classpath/JAR hell
When the Java runtime environment allows for arbitrarily complex JAR
  loading mechanisms, developers know they are in classpath hell or JAR
  hell. A number of configurations can lead to this condition.
First, consider a situation where a Java application developer
  provides an updated version of the application and has packaged it in
  a JAR file with the exact same name as the old version. The Java
  runtime environment provides no validation facilities for determining
  the correct JAR file. The runtime environment will simply load classes
  from the JAR file that it finds first or that satisfies one of many
  classpath rules. This leads to unexpected behavior at best.
Another instance of JAR hell arises where two or more applications or
  processes depend on different versions of a third-party library. Using
  standard class-loading facilities, only one version of the third-party
  library will be available at runtime, leading to errors in at least
  one application or process.
A full-featured and efficient Java module system should facilitate
  separation of code into distinct, easily understood, and loosely
  coupled modules. Dependencies should be clearly specified and strictly
  enforced. Facilities should be available that allow modules to be
  upgraded without having a negative effect on other modules. A modular
  runtime environment should enable configurations that are specific to
  a particular domain or vertical market, thus reducing the startup time
  and system footprint of the environment.
Modularity solutions for Java
Along with the modularity features mentioned so far, recent efforts
  add a few more. The following features are intended to optimize
  performance and enable extending the runtime environment:
Segmented source code:
  Source code separated into distinct, cached segments, each of which
  contains a specific type of compiled code. The goals of which include
  skipping non-method code during garbage sweeps, incremental builds,
  and better memory management.
Build-time enforcements:  Language constructs to enforce namespaces,
  versioning, dependencies, and others.
Deployment facilities: Support
  for deploying scaled runtime environments according to specific needs,
  such as those of a mobile device environment


Complex profiles in maven

Question: I've been looking at profiles in maven for selecting different sets of dependencies. This is fine when you want to build say a debug build differently from a release build. My problem is that I want to do a fair bit more than this. For my application (Mobile Java app where J2ME is just one target among many) there may be a large number of possible combinations of variations on a build.
Using some made-up command line syntax to illustrate what I'd like to see, I'd imagine typing in something like
<code>mvn -Pmidp,debug,local-resources
</code>
What Maven does in this case is to build three different builds. What I want to do is use those three (Or more, or less) switches to affect just one build. So I'd get a MIDP-targetting debug build with 'local resources' (Whatever that might mean to me - I'm sure you can imagine better examples).
The only way I can think of doing this would be to have lots and lots of profiles which becomes quite problematic. In my example, I'd have
<code>-Pmidp-debug-localresources
-Pmidp-release-localresources
-Pmidp-debug-remoteresources
-Pmidp-release-remoteresources
...
</code>
Each with its own frustratingly similar set of dependencies and build tag.
I'm not sure I've explained my problem well enough, but I can re-write the question to clarify it if comments are left.
UPDATE:
The question isn't actually valid since I'd made a false assumption about the way maven works.
<code>-Pmidp,debug,local-resources
</code>
does not do 3 builds. It in fact enables those 3 profiles on one build, which was ironically what I was looking for in the first place.
Answer: The Maven way is to create a lot of artifacts with less complexity.  I'd say your best bet is to abstract the common parts of each build into a separate artifact, then create a project for each build that defines the build specific parts.  This will leave you with a lot of projects, but each will be much simpler.
Comment: I have that, but it's the selection of a specific part within a superpart that has me stumped, particularly when I want to choose between a large set of possible small parts, each doing some small thing, and each possibly a variant of another.

Complex profiles in maven


Where does $\sum_{i=1}^k x_i(n-x_i)$ attain the absolute maximum value?

Question: Given a multivariable function $\sum_{i=1}^k x_i(n-x_i)$ for $k\geq 3$ where $0\leq x_i \leq n$ and $x_1+\cdots+x_k=n$, what is the absolute maximum value and where is it attained?
Answer: Take $f(x)=\Sigma_{i=1}^{k}x_i(n-x_i)$. Considering $\Sigma_{i=1}^{k}x_i=n$ we can rewrite $f(x)$ as follows:
$$f(x)=\Sigma_{i=1}^{k}nx_i-\Sigma_{i=1}^{k}x^2_i=n^2-\Sigma_{i=1}^{k}x^2_i$$
Then maximizing $f(x)$ is equivalent to minimizing $\Sigma_{i=1}^{k}x^2_i$. Also by AM-GM we have:
$${{\Sigma_{i=1}^{k}x^2_i}\over{n}}\ge(x^2_1...x^2_n)^{1\over n}$$
with equality iff $x^2_1=...=x^2_n$ and since $x_i\ge0$ we can deduce $x_1=...=x_n$ which by substitution gives us $x_1=...=x_n={n\over k}$ and results $max \ f(x)=n^2(1-{1\over{k^2}})$
Comment: I'd use [QM-AM inequality](https://math.stackexchange.com/questions/1129300/arithmetic-mean-quadratic-mean-proof) to justify $x_i=x_j$. Also, the maximum is $n^2(1-1/k)$.
Answer: Here are two solutions using approaches that also works for some similar problems.
Approach 1:
First, note that $f(x_1,\dots, x_k) = \sum_{i=1}^k x_i(n-x_i)$ is a continuous function on a closed, bounded domain and therefore has an absolute maximum $M$. Suppose $f(a_1,\dots,a_n)=M$. We will show that the $a_i$ must be equal, because the value of $f$ increases if two unequal $x_i$ values are replaced by their average. (This replacement maintains the constraints on the range of the $x_i$ and their sum.)
If two of the $a_i$ values are $a$ and $b$, respectively, with $a\neq b$, the value of $f$ after each of these two values is replaced with their average, $\frac{a+b}2$, is $M-a(n-a)-b(n-b)+2\frac{a+b}2(n-\frac{a+b}2)=M+a^2+b^2-\frac{(a+b)^2}2=M+\frac{(a-b)^2}2>M$.
Thus $f$ attains its maximum $M$ when $x_1=x_2=\cdots=x_k$, or where each $x_i$ equals $\frac{n}k$.
Approach 2:
Again, assume that $f(a_1,\dots,a_k)=M$, where $M$ is the maximum. Note that $\frac{\partial f}{\partial x_i}=n-2x_i$. The directional derivative of $f$ in the $\vec{e_i}-\vec{e_j}$ direction (a direction that maintains the constraint on the sum of the $x_i$) is then $2x_j-2x_i$. This is not zero if $x_i\neq x_j$, so the maximum value of $f$ cannot occur if the $x_i$ are not all the same.

Added later: Another version of Approach 2, appealing to the idea behind the method of Lagrange multipliers as motivation. Maybe this helps a little to understand why what I first wrote is enough.
Your goal is to maximize $f(\vec x)=\sum_{i=1}^k x_i(n-x_i)$ subject to the constraint $g(\vec x)=0$, where $g(\vec x)=x_1+\cdots+x_k-n$.
This is from Wikipedia, with minor edits:

The method of Lagrange multipliers relies on the intuition that at a
  maximum, $f(x_1,\dots, x_k)$ cannot be increasing in the direction of any
  neighboring point where $g(x_1,\dots, x_k) = 0$. If it were, we could walk along $g(x_1,\dots, x_k) = 0$
  to get higher, meaning that the starting point wasn't actually the
  maximum.

This intuition leads to the fact that at any local maximum of $f$, the gradients of $f$ and $g$ are parallel. Specifically, $\vec\nabla f=\lambda\vec\nabla g$ for some number $\lambda$.
I want to show that this relationship between the gradients does not hold at a point $\vec x$ with $x_i\neq x_j$ for some $i\neq j$. I can do so by showing that there is a direction $\vec v$ in which the directional derivative of $g$ at $\vec x$ (that is, $D_{\,\vec v} g(\vec x)=(\vec\nabla g)(\vec x)\cdot \vec v$) is zero, while $D_{\,\vec v} f(\vec x)=(\vec\nabla f)(\vec x)\cdot \vec v$ is not zero. (A non-zero value can't be a multiple of zero.)
It's easy to see that the directional derivative of $g$ in direction $\vec{e_i}-\vec{e_j}$ at $\vec x$ is zero at any $\vec x$, but if any two coordinates $x_i$ of $\vec x$ are different, the directional derivative of $f$ in the same direction at $\vec x$ is non-zero. [For completeness, it's probably worth mentioning something about the boundaries, by noting that when $x_i$ or $x_j$ is $0$ or $n$, the direction in which $f$ increases keeps the coordinates of $\vec x$ between $0$ and $n$.]
Comment: Have you used the extreme value theorem for multivariable in the approach 2? I am not clear with the approach 2, so can you give me more details?
Comment: I'm not sure I know exactly what you want to know, but I added a second version of "Approach 2." Maybe that will help.
Comment: It helps a lot! Thank you


Push-forward of Levi-Civita connection.

Question: Let $(M,g)$ and $(N,h)$ be two complete Riemannian manifolds and $f:M\rightarrow N$ be a differmorphism. If $\nabla$ is the Levi-civita connection of $M$ then is it true that the push-forward of $\nabla$ $f_*\nabla$ is the Levi-civita connection of $N$? If this statement true then is it possible that $F\circ \gamma$ is a geodesic in $N$ with connection $F_*\nabla$ where $\gamma$ is a geodesic in $M$?
Comment: if $f$ is an isometry then certainly yes, but for a general $f$ the answer is no (there may be $f$'s which are not isometries and still preserve the connection, but a general $f$ will not)
Answer: No, you can generate many different connections $f_* \nabla$ by choosing different $f$, while the Levi-Civita connection is unique. The $f$ that this does hold for are known as affine transformations, which include isometries but in some cases other maps too - consider $\mathbb R^n$, where dilation and shear mappings preserve the connection but not the metric.
In the case that $f$ is affine, then yes, it sends geodesics to geodesics.

Push-forward of Levi-Civita connection.


Shortest time to meet

Question: Three runners are located at the corners of an equilateral triangle, 100 meter a side. They run to a point inside the triangle and their goal is to do it as fast as possible. If they run at the same speed the natural point is the middle of the triangle. The challenge is to devise the meeting point if their speeds are 3, 4, and 5 meters per second respectively.
Comment: I presume the puzzle is to find the point so that they all arrive there at the same time?
Comment: To get the shortest time you can show that they need to arrive at the same time.
Answer: I'm not sure what exactly you want but here you go:
Suppose the equilateral triangle is $\triangle ABC$.  Suppose further that the 5 m/s runner starts at $A$, the 4 m/s runner starts at $B$, and the 3 m/s runner starts at $C$.  Then the point where the runners need to meet is the unique point $P$ satisfying:

$AP = \dfrac{500}{\sqrt{25+12\sqrt{3}}}$
$BP = \dfrac{400}{\sqrt{25+12\sqrt{3}}}$
$CP = \dfrac{300}{\sqrt{25+12\sqrt{3}}}$

We can draw circles centered at $A$, $B$, $C$ with the above radii to verify that they are concurrent:

This also shows that this is a perfectly constructable, well-defined point.  Your question does not specify to what degree we must define this point, so I'll leave it like this.

I will now prove that the above distances are the desired.
We are essentially solving for $x$ in the following diagram:

Rotate the entire diagram 60 degrees clockwise around $B$:

Because we rotated 60 degrees, $\angle PBP' = 60^\circ$.  But then $\triangle PBP'$ is equilateral, so $PP' = 4x$.

We conclude that $\angle P'PC$ must be right, so $\angle BPC = 90+60 = 150^\circ$.  By the Law of Cosines on $\triangle BPC$:
$$100^2 = 16x^2 + 9x^2 + 12\sqrt{3}x^2$$
Solving gives $\boxed{x = \dfrac{100}{\sqrt{25+12\sqrt{3}}}}$, as desired.
Comment: This is a solution but I am looking for a more elegant one without the need of higher level of knowledge in trigonometry - basic Euclidian approach.
Comment: But this WAS a very basic Euclidean approach.  I don't use any "advanced" trigonometry until the very end with the Law of Cosines.  How exactly do you want us to define this point?  Multiple correct answers were given, I don't really think you should just expect us to guess the method you're thinking of because simplicity is subjective.
Comment: You use trig - Law of Cosine. There is a way to prove this with basic diagrams.
Comment: @Moti Prove what?
Comment: To show a way/proof where the ratio can be any - a, b, c. Your approach using trig extension to the general case will be way too complicated.
Comment: @Moti actually it won't be since angle addition formulas exist...  besides, you still haven't told me exactly what you want.  You want a short way to derive the lengths?
Comment: A proof that supports a claim of such based on basic geometry - Euclidian. Does not take advantage of the unique case of 3, 4, 5.
Comment: You still need to tell me WHAT claim you want proved!  You're not being specific here.  Do you want a compass-and-straightedge construction of the point and then a "basic" proof?  Do you want a "basic" proof of the lengths I derived?
Comment: Besides, it's unfair that you're setting such arbitrary restrictions such as needing "basic geometry" which is completely subjective.  For example, Law of Cosines can be proven using "basic geometry" and therefore be reduced to "basic geometry".  If you want a "basic geometry" solution, you should have specified in your question.  Both mine and Bass's solutions are perfectly valid.  You can't expect us to guess what solution you're thinking of.
Comment: As you note there are more than one solution. Which is the right one? Is the first one? Simplicity and the fact that a solution may be made by an elementary school student is of value. If I could accept every solution I would have done it happily - the site allow you to accept ONLY 1. That is why I will wait for the "BEST" solution. Let us call it - compass-and-straightedge construction
Answer: Now that you've specified that you want a geometric construction...
The basic idea here is that we'll flip the problem.  Instead of directly constructing the point inside the triangle, we'll consider the following alternate problem:
Given three concentric circles of radii 3, 4, and 5. construct an equilateral triangle, each of whose vertices lie on a different one of these circles.
If we construct such a triangle $\triangle DEF$, then the center of the circles $O$ would be a point 3, 4, and 5 units from $D$, $E$, and $F$, in some order.  This is the point we want, and then we simply need to transfer the point over to the original triangle by mapping the two triangles using a dilation, a rotation, and a translation.
So here's our three circles.  Choose an arbitrary point $A$ on the outermost circle.

Now here's the clever idea of the day.  Suppose our desired equilateral triangle is $\triangle ABC$, with $A$ on the outermost circle, $B$ on the second circle, and $C$ on the innermost circle.  Then the point $C$ is what you get when you rotate $B$ 60 degrees around $A$.  It follows that if I rotate the entire second circle around $A$, it will intersect the innermost circle at $C$.  But that means I'm done!
We rotate the second circle 60 degrees counter-clockwise about $A$:

Mark the intersection point with the innermost circle:

Then constructing the last point is easy:

The observant reader will note that depending on what direction I choose to rotate the circle, or which intersection point I mark, there could be other equilateral triangles that satisfy the conditions.  From some brief thought, I believe there are 4 in total, two of which work because $O$ is inside the triangle, whereas the other two do not because $O$ would lie outside said triangle for those constructions.
Anyways, we have our magic point inside a dummy triangle, so transfer it over and you're done.
Comment: Very nice. I can see that it is "equilateral":) Not the way I had in mind - actually more elegant than mine. I hope you see the value in delaying my "award"! The only thing missing is, how the 60 degrees rotation translates it with a different way the rotating by 70? Why ABC is 60?
Comment: It seems that you do not see the difference between a construction and a proof. You need to have a set of statements that result mathematically the conclusion that BAC = 60. When you get have the proof I will accept the solution.
Comment: @Moti I'm going to restate the proof I've been giving you:  Suppose the equilateral triangle $\triangle ABC$ exists on those three circles satisfying our conditions.  Then since $B$ rotated 60 degrees around $A$ will give $C$, rotating the set of possible points for $B$ (the middle circle) 60 degrees around $A$ will necessarily intersect the set of possible points for $C$ (the inner circle) exactly at $C$.  Thus $A$ and $C$ are two correct vertices of an equilateral triangle satisfying our conditions, and the proof that $B$ is constructed correctly is trivial from the two green circles.
Comment: I believe that I understand your claims. You should start your proof by stating that BAC by definition is 60. Than you continue by stating that you rotate all the structure by 60 -  showing the rotated triangle ,may be with the two circles demonstrating that the order of creating the intersection is important.
Answer: Well, maybe there's a more puzzleriffic solution to this, but here's my go with a compass and a straightedge, because why not. :-)
I'm not going to bother with spoiler tags, since this answer is kind of long, and just seeing a couple of the first images in not going to spoil anything for anyone. Also, this method feels a bit.. forceful, there's probably a neater way to do all this. But anyway.
Because naming things is hard, I chose A as the runner with speed 4, B's speed is 5, and C's speed is 3.
We'll want to find the points which the runners would reach at the same time. We'll do that by plotting such loci (Oo, Latin!) pairwise, and then finding the intersection(s) of those plots.
Let's start by drawing a circle with radius 4 around A, and another with radius 5 around B. As long as those circles intersect, the actual units don't matter. I tried to pick something that gives a halfway readable diagram. Let's name the points where those circles intersect D and E. If the runners A and B would choose either of those points, they would obviously arrive at the same time.
Next, we choose one of those points (E), and consider the angle $\angle$AEB:

We want one more point whose distance is at the desired ratio of "4 from A, 5 from B". We could do that by choosing another length unit, and drawing two more circles at A and B, but instead of that, we can also bisect the angle $\angle$AEB to find point I, and then use the angle bisector theorem to show that point I splits the segment AB at the desired proportions: line EI will bisect the angle $\angle$AEB if and only if the ratio $\frac{\mid\text{AI}\mid}{\mid\text{BI}\mid}$ is equal to to the ratio $\frac{\mid\text{AE}\mid}{\mid\text{BE}\mid}$, which is, by our construction, $\frac{4}{5}$.

Now we have three points, E, I and D, all located so that their distance from A is 4/5 of their distance from B. Thus we can construct (using perpendicular bisectors of EI and ID, not shown) a circle through those points. This is called a Circle of Apollonius, and by its construction, we know that all points on this circle share the property that their distance from A is 4/5 of their distance from B. In other words, all points that runners A and B would reach at the same time lie exactly on the circle $\circ$EID.

Then we can just repeat the procedure for B and C with circle size ratio 5:3, and we'll find the second Apollonian circle through J, O and K:

And now we can see that the two Apollonian circles intersect twice, at P and Q. P is inside the triangle, so that's going to be our spot:

Since we want to be thorough, let's add the third Apollonian circle for A and C (at ratio 4:3) to confirm that it too passes through P (and Q).
This should be trivially true, since P (or for that matter, Q) is on both of the earlier Apollonian circles, meaning that runners A and B would reach it simultaneously, and also that runners B and C would reach it simultaneously. The third Apollonian circle plots all the the points that runners A and C would reach simultaneously, so by the transitivity of "simultaneity", P (and Q) should obviously be on the third circle, too.

How nice, it all worked out as expected! So there we have it, the runners should meet at P.
(If they chose to meet at Q instead, they would all arrive at the same time there, too. However, that would take a lot longer.)
All images plotted with the excellent GeoGebra tool, and screenshotted from there.
Comment: So complicated - will take me some time to digest...
Comment: There is way simpler way without the need to know about Circle of Apollonius (is it easy to prove it? - did not try)
Comment: @Moti, yeah, that's often the problem with using just a compass and straightedge; it would be a lot easier to find point I by saying "starting at A, go $44.44..$ metres towards B", but it's kind of the whole point of the exercise to show that it can be done without using such superfluous tools as a tape measure :-)
Comment: You did not need to do it that way - you can use different circles -) I can email you the elegant solution with basic geometry tools.
Comment: @Moti no need, we'll see if someone else can come up with it, and if they don't, you can post it as a self-answer after a couple of days.
Comment: No need for Apollonius - basic Euclidian.
Answer: There is a little dilemma with this question;

since there are two targets A would like to go, to which direction should A move to meet with B and C? and visa versa.?

which forces you assume something like;

They know their own speed and decide where to meet which will be shortest distance to meet for sure since they move straight all the time.

or

they have to check others' location at any time they move and move towards between two distance which will be some other kind of hard geometry question in my opinion.

So I will go for the first one first,
This is a question to find a point inside a triangle where

the distance from A (5), B (4) and C (3) will be 5x, 4x and 3x respectively.

or

so it becomes a pure geometry question but the answer is

 about 15 seconds.

For the second case the answer will be something like:

but geometrically a better way to show and proof is needed. It takes maybe a little more than first one but the shortest will be for sure the first one.
Comment: It is not a tracking problem - they know the speed and task and can coordinate between them.
Answer: This is a solution, but it assumes that we have time to do some coordination with the runners before running towards the critical point.

 Label the vertices A, B, and C. Get the 4m/s runner to run towards (and beyond) point B from point A, and the 3m/s runner to run away from the 4m/s runner (or away from point A) from point B (it may help to first use a straightedge to mark a line for the runners to follow). Mark the point that they meet. Now do the same thing again, except this time the 3m/s runner should run towards the 4m/s runner. You should now have two points. It should be fairly easy to draw a circle that has those points as it's diameter (you might want to find the midpoint first, then it's easy to mark the circle with a compass).
 Now repeat this whole process with the 3m/s runner starting from point B, and the 5x runner from point C, this time, the 3m/s runner always running towards the 5x. The point of intersection of the two circles that are marked that lies inside the equilateral triangle should be the correct point for all the runners to run towards. (each runner starts from the same point that they started from in all of the trial runs)
 Here is a diagram, showing how each part is constructed:

note that:

 this solution also uses the circle of Apollonius, but more directly

Is this to be considered a satisfactory answer?
Comment: No need for Apollonius - basic Euclidian.

Shortest time to meet


Why does Cycles render Weird even w very low subsurface scattering?

Question: The cycles renders completely different from Eevee even with a very low subsurface scattering of 0.06. Or is 0.06 too high for plants? If i set it to zero it's fine but should it not have some value?
Comment: The value is in units, and can be translated to meters, so 0.06 is 6 cm. If your subsurface radius is around 1 m, it means the light will scatter under the skin of your objects for roughly 6 cm (This isn't how it works under the hood but I think it's close to what actually happens). So if your stem is less than 6 cm wide, light has a chance of completely traversing it without being reflected back. Hence the fruit jelly look. So either you lower the subsurface radius vector or you have to use a very low subsurface value
Comment: You have a procedural texture directly connected to a normal socket. You can't expect any type of coherent results with a setup like that
Comment: Cycles and Eevee us very different approaches. Cycles simulates light while Eevee is more of an approximation.
This looks like render noise to me, so I'd say it probably is too much SS. Also I don't think the stem of the plant would have much SS to begin with.
Comment: I second @DuarteFarrajotaRamos opinion, try removing the Normal input on your Principled shader, bet money that will fix it.
Comment: @Gorgious hey you are right! my plant does start growing from 6cm until it's huge 12m tall full fledged tree. so i probably need to animate the subsurface scattering value from 0 to a certain bigger value.
Answer: That is because subsurface scattering is greatly dependent on the actual scale of the object, bigger objects will require higher values to have the same amount of SSS while small objects need smaller values. You also need to have a bump node between the procedural texture and the normal channel.


Solution package for a specific webapplication

Question: I have created a solution package using the makecab tool that contains a feature and a DLL which will be installed on the GAC. Its getting deployed globally however I want to deploy it for specific webapplication, what is the change required.
Answer: I think there are a couple of ways to force a solution to install to a specific web app.
One way is to have the DLL deployed to the bin directory instead of to the GAC. Beware though, that all API calls will need to be cleared through Code Access Security policies written and placed in your manifest.xml.
Another is to include SafeControls which reference your DLL within the manifest.xml. This means that a web.config will have to be written to, making deployment require a web application to be specified.
Comment: thanks, +1! And just for clarity, I'd like to add: There is no such setting in your manifest.xml, which can change deployment type for your wsp. This deployment type is selected automatically, based on manifest.xml contents. If your manifest.xml does not contain any webapplication-scoped elements, such as SafeControls, it will be deployed globally. Here is a good article about this: http://trentacular.com/2009/06/sharepoint-differences-between-global-and-web-application-targeted-solution-deployment
Comment: Yep, that's what I was getting at, though should've mentioned it - the contents of the manifest will dictate whether or not the wsp will be globally deployed or targeted to a specific web app.
Answer: Here are scripts to deploy to specific site collections on a web application.
http://globaldeploymentmoss2007.blogspot.ca/


I got promoted then the person I was replacing changed their mind and I got put back in my regular position

Question: I got promoted with a raise. The person I was replacing had put in their two week notice but then decided not to leave and I was put back in my regular position with less of an raise. I'm real salty about this. Is this fair?
Comment: Please add a country tag, there are huge differences between the "wild west" of labor laws that some US states are, and for example complicated labor laws of Europe.
Comment: If you add your country tag to this question, you can get more accurate answers.
Comment: Why do you care of that's fair or not? Isn't a better questions "what are my options on how to deal with this and what are the pros and cons of each option"?
Comment: Did you start in the new position?  Did you formally start performing those new duties?
Comment: (1) If he changes his mind again and actually leaves, do you get the promotion again? (2) Can you make his life so miserable that he will change his mind again and actually leave?
Answer: Is it fair?
No.
But that's not really the question you want to ask, though, is it? You want to know is it legal and what recourse you have.
I've done a bit of reading (not a lawyer) and the answer seems to be quite interesting.
First question: Did you sign a new contract stating your new position and new pay rate? If the answer is 'Yes' - this will make things much easier - simply decline to sign a new contract with your old job title and reduced salary.
I'm betting though, you didn't sign a new contract. Hopefully you do have the agreed amount in writing in Email.
Next question: Have you worked a day in your new position and at the new, higher rate? If yes - then this is a demotion - we'll get to that in a mo.
Looking through the info on this - the short answer is 'It's not illegal' - but the longer answer appears to be more interesting: Most countries have a concept of good faith negotiating and rescinding a pay rise without an adequate reason suggests that this could fall foul of this. The same is true if this is a Demotion.
Several sites list the 'valid' reasons for doing this are:

Underperforming
Business struggles/hardship
Disciplinary reasons
restructuring/reorg.

From the business point of view - they may have a good case to make that a position was being vacated and that the higher rate is tied to said position, but once that position was no longer being vacated, the promotion and increase was no longer justified.
However, I think you would have a good counter-argument pointing out that if the company feels that you have the skills and experience to handle that role, then you have the skills and experience to command the higher salary. Furthermore, that position is now a flight-risk and having you trained up and able to float between roles has advantages to the company.
All-in-All, seeing Payrises and promotions get revoked is, IMO a bit scummy. I would be wary of my continued employment with a company that acted in this manner. They may not feel they have done anything wrong - afterall, business needs changed and there was no deception on their part, but at the same time - I believe they should honor it, even if it means they have two people in a role that traditionally has one.
I would be tarting up my Resume and having a talk to all the local recruiters to see what is out there.
Comment: *"if the company feels that you have the skills and experience to handle that role, then you have the skills and experience to command the higher salary."* - surely the company would shoot back that: they believe the OP will quickly grow into the role and are prepared to give a chance when there is a vacancy, but they aren't willing to pay the full salary to someone who isn't presently occupying the role which attracts that salary? There may be several who the company thinks could get into the role - they're not going to pay several potentials all the full salary.
Comment: @Steve - there may be several, but the fact OP was picked suggests strongly that they were the best choice
Comment: "...command the higher salary" only if there is an available position to match the salary, though
Comment: @njzk2 - As I said in my answer, the business can make that case, but the employee can also say 'This is what you think my time is worth, and so this is what I want to be paid' and have a pretty good argument to make. Afterall, if they had the skills and experience for the Role at their current company *they have the skills and experience for the role at other companies*
Comment: They are saying this is what your time is worth if you are fulfilling that role, if you are fulfilling a lesser role, your time is worth a lesser amount.
Comment: @cdkMoose - see, I take a different view - My time is worth what my time is worth.  Regardless of what the company happens to have me doing. If they want to pay me less because of 'a lesser role' then I will take my time elsewhere
Comment: To you, yes, but that doesn't mean the employer has to value you that way depending on the role you are in.  You are certainly free to take your talents elsewhere.  And they are free to pay you according to the role you are filling.
Answer:
Is this fair?

No, it is not fair.
Sorry this happens to you.
An important question is whether there is a binding employment contract between you and your employer, and how feasible or legal it is for the employer to change the contract against your will. This highly depends on the labor law of your country. Therefore, you may also want to consult a labor law attorney in your city for more info if necessary.

Employment contract aside, generally speaking, your employer's action seems not illegal (in some countries at least) because it is not a form discrimination based on race, gender, age, religion, disability status, etc...
Comment: If an employment contract was formed, unilaterally changing it is illegal in any jurisdiction, regardless of whether some form of discrimination is involved.
Comment: @quarague That depends, in The Netherlands, some things can be changed unilaterally, but that definitely does not cover things like remuneration (i.e. salary, benefits).
Comment: (note that in many jurisdiction, even verbal agreements are binding contracts, even if a bit difficult to enforce)
Answer: Talk to your union about whether this is within your contract.  It probably is.
That said, if they do not give you what they promised in some other way and you feel deceived or worse, then you will probably stay unhappy about it the rest of the time you work for them.
I would suggest mentioning to your boss very clearly that this is very important to you and see what the response is.   If they don't care because it is just business, I would also suggest that you find a better employer.
Answer: Fairness is not really the question here. The question is in what form you were promoted and given a raise.
If that is all in writing then in most jurisdiction your employer can't simply retract that but rather needs to form a new contract with you at the lower salary and position. The employer needs your signature for that but how much pressure they can put on you heavily depends on the jurisdiction.
If on the other hand the raise and promotion where just verbal offers then your employer is behaving in a not-nice, untrustworthy way but didn't do anything illegal. You can then choose whether you want to put up with this kind of behavior or whether you want to look for a new employer who treats their employees more fairly.
Comment: Yes but against that, they mention that the incumbent's notice was 2 weeks, and they withdrew the resignation during that 2 weeks. It sounds to me like the most likely approach the employer took was to ask the OP "will you replace John now he's leaving?". The OP said "Yes", but in the event John didn't leave, so the arrangement has collapsed, and the OP counted their chicken before it hatched. I have a somewhat jaundiced view of employers, but without more, I struggle to see how the employer gained from this charade.
Comment: *"your employer is behaving in a not-nice, untrustworthy way"* - that's a bit of a harsh characterisation here. The employer believed a staff member was leaving and promised a promotion to an internal replacement. The incumbent staff member has withdrawn their resignation during their 2-week notice period, so there is no longer a position to fill. They've nevertheless granted a lesser raise to the would-be replacement who is now let down. It doesn't sound like a classic case of employer malevolence to me.
Comment: @Steve The first sentence of OP is *I got promoted with a raise*. Note that this doesn't sound like a promise of something that may happen in the future but like something that already did happen. Then the employer tried to undo that. That sounds like a classic case of a malevolent employer to me.
Comment: @Steve The "lesser raise" is simply a feel good move by the company to gloss over the fact that they pulled a major dick move on the OP.  It is not unheard of for people to  rescind notices, so the OPs company should not have been promising things that they couldn't deliver.  At the very least they should have waited until the other person had actually left.  And saying the OP was counting chickens has a smell of victim blaming, as the company *promoted* them, not them chasing a promotion with the idea that they, and only they deserved this promotion.
Comment: @PeterM, we don't know what they promised, but I doubt it was promised in terms that would have caused the OP think, if the departing member of staff didn't actually depart, that they would still receive that role. The employer is not very well going to wait until the other person leaves before even discussing who is to take over, are they? You're assuming the OP had some kind of contract and it has been rescinded. With resignation given *and withdrawn* all in less than two weeks, I doubt anything got beyond the verbal stage: a promise (in earnest) to promote the OP into the vacated role.
Comment: @Steve If the company didn't feel culpable for their actions, why did they proffer up a "lesser raise"?  They are not under any compulsion to provide anything additional to the OP.  IMHO doing so is indicative as to how firm the negotiations were, and how they know that they screwed up.  And no, I am not assuming any sort of physical contract.
Comment: @PeterM, they may feel the turnout is unfortunate and unexpected enough, and the OPs confusion and resentment reasonable enough, to offer a financial consolation prize, rather than aggravate the feelings of a valuable employee by stonewalling completely and risk dealing with yet another resignation when one has just been solved. I'm not sure that rationale is the same as accepting culpability.


Count a consecutive streak of values in Google Sheets, if the values aren't all the same?

Question: So, I have a Google Sheet with various readership/writing stats, and I'm using one column to log how many words I'm writing every  day. I'd like to use that column to calculate writing streaks, i.e., have a cell that records the most cells in a row that have any value in them (days in which I wrote any amount of words) before being interrupted by a blank cell (day in which I didn't write). I've seen formulas for counting streaks of the same consecutive value, and formulas for counting non-empty cells, but for the life of me I can't figure out how to put them together in a formula that doesn't result in an error.
Comment: It would be best if you could share a copy of your spreadsheet.
Answer: Use this max(len(split())) pattern:
=arrayformula(
  if(
    len(join("", A2:A)),
    max( len( split(
      concatenate( left(isblank(A2:A)) ),
      "T"
    ) ) ),
    "no streak"
  )
)

The formula assumes that the number of words figures are in column A2:A.


How Do I Use a Saved Pose at a New xyz Location?

Question: I've created a number of poses for my rigged character. These poses were created while he was at the center of the grid in the 3D viewer. When I apply a pose anywhere else, it places him back at that location. How can I use the poses I've created at any other locations than where they were created?
Answer: In most cases, your Armature object should be the root of object hierarchy. So that means it should not be parented to anything.
Also the armature object should be without any transforms - always with origin in the center.
Instead the rig should have a Root or Master bone to transform the whole rig in pose-mode. You want to make rig positioning in the scene with this bone.
This prevents numerous problems with scene management, linking, and most importantly keeps things clean for animators - they have all the key-frames under the pose. And not some under object and some under pose.
When you do not want to store the root transform of your rig inside a pose library - delete that bone from the Action which is used to store the poses - or just delete the keyframes from the poses you don't want to store the root transform in:

Should be named PoseLib by default and you will find it in Action Editor.
Answer: Make your Armature a child from an object, In that way, the poses are always relative to the parent-object.
To do this, first select all your children, in your case select the armature. With all children selected, finally select your parent-object (In your case a simple Empty-object or similar). Press Ctrl + P to parent all selected objects (children) to the last selected object (parent).
Note: Because the armature is now a child-object, always reset the transform of the parent-object, if you add or modify an animation, otherwise the results are not clean.
Tip: If you're using it in the BGE use a rectangular or capsule as the parent in the dimensions of the character. Set 'Physics Type' to Dynamic, Rigid Body, Character or what ever is best for your purpose and more importantly set to invisible.
I hope I could help.


Source for a Chatat offering on behalf of deceased father and alive son

Question: I think this is a gemara, but I'm not sure where. I heard that you can still bring a chatat that had been separated already on behalf of a father and son who both did the same sin, but then the father dies and the son is still allowed to bring the Korban.
Comment: Nazir 4:7?  It includes a chatat but not for a sin
Comment: Keritot 6:7 is relevant
Answer: The Gemarah in Temurah (16a) brings from R'Shimon a Halacha L'moshe Mi-Sinai that there are 5 types of Korbon Chatos that are left to die, and not brought up on the mizbeach. One of the 5 is a Chatos that the owner has died.
The Gemorah in Zevachim (5a) brings down a case of a lady who is required to bring a korban Olah and a korban Chatos (she is required to bring these because she gave birth) and she then died. The Gemorah writes that her inheritors can bring her korban Olah, but not her Korban Chatos.
Comment: thanks! I guess I misheard. Is there any scenario except the korbanot hatzibur, Kohel gadol, or beit din, when a Chatat can be brought by 2 or more people?


Are you allowed to extract buried Shemos?

Question: I understand that the burying of Sheimos, in a sense, is similar to burying a dead body. I assume that in the same way that you cannot dig up a dead body except for some unusual situations, you cannot dig out Sheimos. Is that true, or are there specific situations where you would be allowed to do this? If so, please cite 1 or 2 examples.
Comment: Isn't the whole principle of burying Shemot, at least in revealed Torah, so that they shouldn't come to be disgraced? If so, I can't see the problem in exhuming them.
Comment: [Ginzei Hakodesh by Rabbi Yechezkel Feinhandler](http://www.israelbookshoppublications.com/store/pc/Ginzei-Hakodesh-12p716.htm)
Answer: In the new Masores Moshe volume 2 page 270 it quotes this exact question which was posed to Rav Moshe Feinstein. He was asked if one can exhume seforim from a grave which only seforim are buried. Rav Moshe allowed one to do so and his reasoning was that only the dead have an inyun on not being disgraced and prohibition of pleasure from them.
Answer: From the Sefer Ginzei Kodesh perek 15:10:24(referenced by chiddushei Torah) writes that a big hole where one buries shemos from time to time one does not need to cover it with earth until they are finished(or its full). However, one has to protect the shemos from rain and wind (I guess a tarp would suffice). The reason is so the shemos won't come to degradation,but it seems one can extract shemos as long as the shemos dosen't get ruined because of it.
Even things which need a kli (Sta"m) it seems one can extract it as long as the buried items don't get ruined. It seems the purpose of the kli is to keep it from being degraded or decay faster.
*This is my extrapolation from reading the sefer,unfortunately I could not find anywhere in the sefer where he addresses this issue explicitly ,but from the other halachos in the sefer it seems that if it won't be degraded it should be fine to extracthe shemos in a respectable manner.Of course ask a Rav for Halacha lmaase.
Comment: It's also important to note that one can store shemos in a special designated place where it won't get ruined besides for the ground. Take the Cairo Genizah as an example


Anonymity with tor

Question: Question : If you have the gmail app on your phone (samsung) and you not signed out of the app, if you then use a VPN then access tor, does Google have your search history of tor and is your tor searches still anonymous?
Answer: Google will have your search history if you're using Google to search: with or without signing in. If you're using not Chrome and not Google to search over Tor - it depends on Google application suite integration/wiretapping in your particular mobile device model implementation - it can have it if it's wiretapping deeply
Comment: for many Samsung devices Lineage OS is available - it's an open-source Android build, and you can have it without Google app suite. If you need GMail - use a third party IMAP/SMTP client for it
Comment: Much appreciated and will give it a try

Anonymity with tor


Cannot remove InfoPath form form central admin

Question: I have an Admin Approved InfoPath form deployed as a feature on SharePoint 2010 farm. After deployment i can see the form in Manage Form Templates and i activated to a site collection. I wanted to make changes to the form and tried to upload the new form to the CA. I cannot remove/update the form even after deactivating the feature. When I try to upload the updated form it says Form with the same identity urn:schemas-microsoft-com:office:infopath:formname is already deployed on this farm.. If I try to upload the form with upgrade option(replace if existing) it says -The following form template cannot be upgraded because it is not currently uploaded on this farm: urn:schemas-microsoft-com:office:infopath:formnameIf i try to remove it says -This form template was deployed as part of the  feature.  This form template should be removed only by uninstalling that feature.
Answer: Go To -> Site settings ->Site collection Administrators ->Site Collection Features, in the list you will see a feature that maps to the name of the XSN file.
Click on the Deactivate button and in the query string the feature GUID is shown, copy it and don't deactivate the solution.
Then run an STSADM command:
<code>stsadm -o uninstallfeature –id <the feature GUID you got from the query string> –force
</code>
Check the reference.
Comment: Thanks for the response. I had been through this article earlier and it did not work for me.


Pheasant hunting and manual transmission driving

Question: I am looking for a book that I read when I was very young, probably early elementary school in the 90s. I recall it had something to do with pheasant hunting. I think there was an emergency, or the adult got lost, and a young boy mustered the courage to figure out how to drive a manual transmission through the woods. It narrated the manual transmission learning attempt in detail, so the reader listens to him worry about having it in 1st gear too long and burning up the engine, so he'd better be brave and get it into second gear (and so on).
Just trying to figure out what the rest of the story was about because I remember it fondly.
Answer: That's Roald Dahl's Danny, the Champion of the World.

The plot centres on Danny, a young English boy, and his father, William. They live in a Gypsy caravan, fix cars for a living in their mechanic shop and partake in poaching pheasants.

He's nine years old, and has to drive a car to find his father in the woods, so that would fit with the plot. As the book is set in England, it would certainly be a manual transmission car. It was published in 1975 and is a well-known classic, so you reading it at school in the 90s makes sense.
Here's an excerpt kindly found online by @Pete; you can read the relevant section on ESL-Bits.

I looked again at the clock. He had left the caravan at six, which meant he had been gone over eight hours!  It took me two seconds to decide what I should do.  Very quickly I stripped off my pyjamas and put on my shirt and my jeans. Perhaps the keepers had shot him up so badly he couldn't walk. I pulled my sweater over my head. It was neither navy-blue nor black. It was a sort of pale brown. It would have to do. Perhaps he was lying in the wood bleeding to death.
...
At that point a wild and marvellous idea came to me. Why shouldn't I go in the Baby Austin? I really did know how to drive. My father had always allowed me to move the cars around when they came in for repair. He let me drive them into the workshop and back them out again afterwards. And sometimes I drove one of them slowly around the pumps in first gear. I loved doing it. And I would get there much much quicker if I went by car. This was an emergency. If he was wounded and bleeding badly, then every minute counted.
...
The motor was beginning to rattle and shake. I was still in first gear. It was vital to change up into second otherwise the engine would get too hot. I knew how the change was done but I had never actually tried doing it. Around the filling-station I had always stayed in first gear. Well, here goes. I eased my foot off the accelerator. I pressed the clutch down and held it there. I found the gear-lever and pulled it straight back, from first into second. I released the clutch and pressed on the accelerator. The little car leaped forward as though it had been stung. We were in second gear...
...
I began to worry about the motor. I knew very well it would be certain to overheat if I drove for long in either first or second gear. I was in second. I must now change up into third. I took a deep breath and grasped the gear-lever again. Foot off the accelerator. Clutch in. Gear-lever up and across and up again. Clutch out. I had done it!
Comment: @NotEntirelySerious. He also wrote the screenplay for *Chitty-Chitty-Bang-Bang*, based on the novel by Ian Fleming. (Yes, the James Bond Ian Fleming.)
Comment: A truly excellent YA story teller! If you enjoy that book, try some of his others as well. He wrote "Charlie and the Chocolate Factory", the basis for the movie "Willy Wonka" as well as "The Witches" and "James and the Giant Peach".
Comment: I love his books. Matilda, and George's Marvelous Medicine were huge favorites of mine. I never realized that this book was one of his, too, and was always searching for more obscure authors. I'm super impressed, I figured I would never be able to find it off so little information.


macchanger working then stopping

Question: When I run the following code:
sudo ifconfig xxxx down
sudo macchanger -r xxxx
sudo ifconfig xxxx up

I do see a change in the mac address when doing the command ifconfig. However after a certain amount of time passes, I use ifconfig again and I notice that the mac address goes back to the permanent one.
THINGS I DON'T UNDERSTAND:
Is macchanger a program constantly running in the background spoofing the mac address until a certain event happens? What might that event be? I assume that restarting the computer is one type event, but is my previous case of it being reverted after a certain amount of time normal? How do I know how long it will run?
QUESTION: Could someone explain to me how macchanger works and especially how long macchanger is running (if I need to modify something to have it run indefinitely, etc)?
Answer: I tested macchanger some time ago, and it lost its configuration after a WiFi disconnect. If you are using this for your wireless card, you might try a newer version of wpa_supplicant, which does now implement this function. ( mac_addr=1 in wpa_supplicant.conf will activate it)

macchanger working then stopping


Reasonable to assume mobile application trademark protection will allow for robust competition?

Question: The USPTO 009 International Class category for trademarks, which covers "recorded and downloadable media, computer software", is where every mobile application seeking trademark protection will at the least register. I hope the USPTO realizes how giant this sector already is and how much more it will grow and allow for robust competition. There are literally millions of apps in circulation with millions more to come. Conversely, there are definitely not millions of chemical companies, for example. Is this a safe assumption given the history of how it treated other similar sectors? For example, if a personal finance app can successfully claim a trademark on "pineapple" (in IC-009), is it safe to assume the USPTO would allow a children's game app to claim the same trademark in IC-009 also?
Answer: As an example - There are currently 7 live and 23 total "Pineapple" listings in international class 9 so I wouldn't worry too much.
The first is for insurance applications and the second is for education regarding food and drink. The third is for travel magazines.
Comment: So you are suggesting that the nature of two competing marks (both registering for the same wordmark) both being downloadable mobile applications doesn't really matter because what matters is their userbase overlap? And this is because a mobile app named X will not be confused with another mobile app named X (both in the same app store on the same platform) so long as their userbases don't have significant overlap (i.e. people house hunting versus people on a dating app).
Comment: I'm not an expert on trademark law. But important issues include likelihood of confusion among consumers.
Answer:
For example, if a personal finance app can successfully claim a
trademark on "pineapple" (in IC-009), is it safe to assume the USPTO
would allow a children's game app to claim the same trademark in
IC-009 also?

One word, straight word only trademarks are rare. There might be two trademarks in the same class that contain the word pineapple, but generally speaking, that protection would only be in conjunction with other words or with stylized scripts or a logo, not simply the word standing alone (unless the trademarks all belonged to the same registrant).
You would need to examine each of the trademarks in the class containing that word and determine:
(1) Are they on the principal registry (which provides full presumptive protection) and
(2) What precisely is the protected trademark.
A trademark of "pineapple grove" in blue cursive writing on the supplemental register, is not the same as "pineapple" without any associated words or appearance, in the principal register.
If there are trademarks in the same class with overlapping words or elements, the question is whether they are confusingly similar or identical. If so, and if the earlier one hasn't expired, and if both seek to be on the principal register, the later applicant should be rejected by the USPTO, and could probably be challenged by the prior applicant.
Comment: I understand all that but my question is about the app space. If a restaurant claimed the wordmark "XYZ" then I fully understand why other restaurants wouldn't be able to claim XYZ also. However, a paint store can claim XYZ because it doesn't compete with the restaurant and there is very little likelihood of confusion. But both this restaurant and this paint store can have iPhone apps. And there would now be two apps called XYZ which means both the restaurant and the paint store could then claim XYZ in IC-009 (downloadable software). How would this be rectified?
Comment: IC-009 does not work in the app space if registrants can claim wordmarks just for being downloadable software because virtually every company in the world is producing their own software in some capacity. The only reasonable conclusion I can think of is that the USPTO must account for the subcategory of the software, or am I wrong?
Comment: @acidgate Your intuition is mostly wrong. And running out of wordmarks is a genuine concern in many IC categories. Reasonable or not, for the most part, that analysis is not a subcategory type analysis. You can definitely have direct conflict with one mark in one class and another identical mark in another class. But within a class, confusingly similar is your only guide and when in doubt you should assume that exact duplication within a class is not allowed. Basically a mark would often cover a whole line of varied apps of different types within a class (think Microsoft/Apple). Not a science.
Comment: So in your estimation, a restaurant named XYZ with a mobile app could not claim IC-009 on XYZ if a paint store named XYZ with a mobile app already claimed XYZ in IC-009 because these apps cannot be broken down into subcategories since they are both downloadable software?
Comment: @acidgate It is analyzed on a case by case fact specific basis, but basically yes. If PeachCo has an "IPeach" mark in Category IC-009 for "downloadable software" with  a mark which is the word "iPeach" for an app associated with  restaurant coupons, and a paint company markets an "iPeach" app for paint coupons when PeachCo has never had apps for, the PeachCo infringement suit against the paint company's infringing app would still  likely win if PeachCo's mark description is broad enough and it was first to file, at a time when the infringer was not using the mark at all.


Django - Reordering admin categories

Question: I am hoping there is a way to do this without having to build and entire custom admin template.
I currently have the following:

Auth
-Groups
-Users

Book Content
-Book A
-Book B
-Book C
-etc.

The issue is that my models.py and views.py files are going to get way too large as there will be hundreds of Books, each with custom content. There are also multiple coders, so I would rather not have a coder need to wait for the views.py to be checked in if they are working on Book C when a different coder is working on Book B.
I played around with making each Book an App so that I can keep the models.py and views.py separated, but then I get:

Auth
-Groups
-Users

Book A
-Book A

Book B
-Book B

Book C
-Book C

I would like to go back to the original interface for the admin area, but keep each Book as a separate App. Is there a way in the admin.py to define an App is part of a different App? Or group App A, B, C together?
Answer: try http://django-admin-tools.readthedocs.org/en/latest/index.html

Django - Reordering admin categories


two DC-DC converters to get split rail

Question: I'm trying to design a circuit to power my DIY analog synthesizer.
My requirements are:

9V DC input voltage (from a common 9V wall adapter)
+/-15V output voltage
able to supply about 500mA on +15V and about 400mA on -15V

I selected this DC-DC converter series PDQE15-D as best candidate for the task.
My idea is to use two of PDQE15-Q24-S15-D, one for +15V and one for -15V.
Main specs are:

9~36 input voltage
15V isolated output, max 1000mA output current
±10% output voltage trimming
100mVp-p output ripple noise

since those DC-DC converters usually all have high ripple noise, and since my analog synthesizer wouldn't tolerate that (rail voltages are often directly used as frequency reference for the VCOs and other, so noise on the rails would result in frequency instability, for example), I thought about using a linear regulator after the DC-DC converter, that should reject enough ripple noise.
so the idea was to adjust the DC-DC output to ~16V and then use a LDO like the LM2940 to get a clean +15V output. The same will be done to get the -15V output, using another identical DC-DC converter and a LDO like the LM2990
I considered using the dual output +/-15V DC-DC converter of the same series, but the dual output variant can't be trimmed. So the next higher voltage available in the series would be +/-24V, but regulating that to +/-15V would result in too much heat wasted.
I choose the 15W series because even thought I only need 500mA for each rail, I guess the 15W DC-DC converter would not be stressed to its limit.
so far what I drawn is this:

C9/L1/C10 are took from the EMC RECOMMENDED CIRCUIT on the datasheet, but I don't know if I got that part right
the ON/OFF mechanical switch is simply removing the power from the converters, I'm not using the CTRL pins.
should I worry about start up times?
to get -16V, I simply wired the output of the second DC-DC converter in the opposite direction of how it is supposed to be wired.
C7 and C8 are again took from the EMC RECOMMENDED CIRCUIT, but I'm not sure if C8 should be there or on the +VO pin.

side note: you can see an additional +9V output connector (J3), that one is needed to supply a 7805 regulator on a daughter board, D1 and D2 are probably not needed
what are your thoughts?
I don't expect this to be an ideal solution, I guess a better solution would be to design a custom DC-DC instead of using an off the shelf DC-DC, but that goes beyond my capabilities
Answer: Calculate the maximum current at the 9V jack. At, say 35 or 40W it will likely be more than most wall plug adapters can support, more of a brick.
You need to decide on a grounding strategy which will depend on what is going to be connected to this device and how much it can tolerate common mode noise from mains frequency to the several hundred kHz switching frequency of the DC-DC converters and harmonics to many times that. Whatever source of 9V you are planning on using may have other contributions, as well as potentially supplying an earth lead. That's way outside the scope of this answer and might be too complex a question for this venue, however a well crafted question would probably result in some tips.
Add reverse-biased rectifier diodes across each linear regulator output to deal with potential short or overload conditions, so neither regulator can see (much) reverse voltage on its output. The diodes should be able to withstand the short-circuit current of the DC-DC converters.

two DC-DC converters to get split rail


SQL Analysis Services - SSAS

Question: Do you know what the best practices would be regarding SSAS and having real-time reports.
I am not sure if we should be pulling data off our live database or using SSIS to move data periodically to a Data warehouse database before re-processing the cube.
Any advice on what the best approach is would be greatly appreciated.
Comment: Depends on many things. How busy is your live database, how much data is there, what sort of reports are you running? What platform are you on? If you could add more detail, that'd help people help you :)
Answer: The most significant balancing act to consider is whether your need for real-time reporting outweighs the performance hit that both your OLAP and OLTP systems will take from using your OLTP data source directly as fact and dimension tables, and then bouncing ROLAP/HOLAP queries off of them. If the tables are all quite small, and the server isn't under heavy load already, then the penalty is probably negligible. If SSAS queries are going to kick off 500MB+ reads, then that's a problem.
And unless you're doing some kind of high-frequency trading, you probably don't need to have your SSAS database that up to date. It seems like SSAS is more useful for big-picture kind of summaries, and if the past few hours of data aren't included yet, it's not going to make a big difference to those running the reports (ask around to be sure, obviously).
We load our data warehouses and process the cubes each night, and that's typically plenty. We also have a few simple reports built against OLTP tables for viewing more targeted, up-to-the-minute data (stuff that's really more OLTP than OLAP in nature).
Answer: Operational vs. analytic reports
Ad-hoc reporting against an operational system is a bad idea, so the answer depends on what your real-time requirements are.

In most cases the actual realtime requirement is for a handful of operational reports.  These are usually not aggregate or statistical in nature, and tend to be exception reports, status reports or to-do lists.  They should not typically hit large amounts of data, but rather select certain records that match the criteria of the report.Operational reports are almost always tied to a specific process and never analytic in nature.  Usually, analytic reports can be run off a periodic load and do not need up-to date data.  There are a few exceptions to this such as market data feeds, but these are exceptional cases.In this case you should do a periodic load to a data mart, data extract or data warehouse system for the analytic reports and build the operational reports as bespoke, tuned reports.  Run them of a replicated database instance if possible to reduce transient load on the operational system database.
Some applications do need real-time or near-realtime (low latency) data to be loaded into an analytic system.  A couple of examples of this type of requirement are market data analytic systems or accounts reporting systems.  In the former case the system is used by traders to run statistical analytics on the data and in the latter case there is typically a requirement for the accountants to be able to prepare and enter a journal and then report on it immediately.These are really operational reports in disguise, and tend to have their SLA tied to the source system.  One thing these systems have in common is that they tend to have a relatively straightforward model for the underlying data.
You can front certain operational databases with a ROLAP toolthat queries the underlying schema.  It is rarely a good idea to do this with an operational system database as they tend not to lend themselves to efficient aggregate queries.I have done this on one occasion with an accounts system and a report model - in theory a cube could have also been used.  Oracle also supplies a discoverer based ad-hoc reporting tool for Oracle Financials that works similarly.  However the native data model of an accounting system is actually quite close to a snowflake schema so you can sort of get away with this.  However the reports tend to be quite slow and they still bog down the system if it gets loaded.
If you really want ad-hoc analytics on a low-latency source you could build a low-latency ETL process that populates a data mart.  This sort of thing is more fiddly and complicated than a traditional ETL process, so you don't want to do this for applications where there is no genuine requirement.  You can put a cube with a leading ROLAP partition on this and store the historical data as MOLAP.  I have been involved in building a system that works like this.

Low-latency analytic systems
Depending on your data source you can use a changed-data capture mechanism or polling mechanism to identify new transactions.  This process can then trickle the data into the data mart.  If you want really low latency and control the source database you can implement triggers that push out transactions to the data mart, although this option may place siginifcant load on your system.
Leading ROLAP partition on a cube
A low-latency cube can be done with a hybrid architecture.  Leading data (e.g. for the current open accounting period) can be queried through a ROLAP partition, which will issue queries against the underlying data.  Closed or historical data is managed through MOLAP partitions that have aggregations.  This gives you near-realtime data without having to issue database queries on large data volumes and the performance benefits of aggregations on the historical data.
This has a few caveats.  Pure ROLAP dimensions substantially restrict the features that can be used on the measure groups (e.g. no aggregations except SUM or COUNT).  If you expect incremental updates to dimensional data you are better off with MOLAP dimensions and an incremental update process triggered off from the job that updates the underlying dimension table.  This is quite efficient if you process the dimension incrementally.
Testing this type of system is somewhat fiddly, as you have to make sure your changed data capture or incremental load mechanism is working correctly.  You will probably need to create a test harness that can post transactions into the system in order to run unit tests.
Answer: If you are using SSAS in MOLAP storage mode, then you have to process the cube to refresh reports that use the cube as a data source.  Whether you use your "live" database or a "non-live" version generated via ETL processes, you must process the cube to bring the cube up to date.  If you are using SSAS for the advantages of high performance aggregations, then you will have to accept some degree of data latency.
On the other end of storage modes for SSAS is ROLAP.  ROLAP does not require processing a cube since it doesn't actually generate a cube data store.  Instead, all it does is spawn SQL queries against the source system database anytime you run a MDX query.  This means that it is going directly against your underlying database.  So if you have a "live" database, you can get current data from it without processing a cube if your storage mode is ROLAP.  My own presonal experience is the underlying queries are generally horrific.  For instance, if I wanted to query a fact and a few attributes of a dimension, the MDX would spawn a SELECT DISTINCT * FROM Dimimension.Table JOIN Fact.Table ON Key.Column = Key2.Column2.  This basically made ROLAP useless for me since it performed worse than any alternatives.
In the middle you have HOLAP storage mode.  This is basically MOLAP for some dimensions and facts tables and ROLAP for others.  So you have to process part of your cube and the other part is live data from the database.  To me, this was not a viable solution since it still suffered the same performance issues as ROLAP and added some latency like MOLAP.
If you really want to query your live data without forcing users to learn SQL, you could create a report data model in BIDS, deploy it to your Reporting Services server, and then use it as a data source.  The data model is a metadata later that is almost identical to the model in SSAS -- it just doesn't allow you to generate a precached cube from it.  This could be a reasonable alternative to SSAS.  However, report data models only work with SSAS -- they do not work with Excel.  If your users want a high-speed data source for Excel that does not require writing SQL, then your only viable solution is MOLAP SSAS.  If your users want "live" data and don't need Excel as a starting point, then go with SSRS and a report data model.
If you are using Cognos, Business Objects, Microstrategy, or some other BI solution, then please note they all have data model metadata layers similar to the report data model and they can also query the "live" source systems with generated SQL statements.
A word of advice: don't program a reporting solution against a production database unless you are building the reports into the underlying production application's interface.  Even then, you probably still want to offload report queries to some replicated data source instead of the production OLTP system.  You don't want someone's query about past sales to block an actual new sale.  If you are building a reporting system for internal users only, then take the time to load the data into another server either via replication, log shipping, mirroring, backup/restore, etc., and then load the data into a data warehouse via SSIS or some other ETL solution.  You really don't want a report to be the reason for a production system outage or latency issue.
Comment: +1: "A word of advice: don't program a reporting solution against a production database unless you are building the reports into the underlying production application's interface." Thanks!!

SQL Analysis Services - SSAS