Is the retarded propagator exactly the Green's function?

Question: I am trying to prove that, for the real scalar field $\phi(x)$, the retarded propagator, which is defined as
$$
D_{R}(x-y)=\theta(x^0-y^0)\langle 0 |[\phi(x),\phi(y)]|0\rangle
$$
is the Green's function for the Klein-Gordon operator; that is the function $G_R(x-y)$ such that
$$
(\partial_{\mu}\partial^{\mu}-m^2)G_F(x-y)=i\delta^{(4)}(x-y).
$$
Here the metric is $\eta_{\mu\nu}=\text{diag}(-,+,+,+)$. I am proceeding as follows:
$$
(\partial_{\mu}\partial^{\mu}-m^2)D_{R}(x-y)=(\partial_{\mu}\partial^{\mu}\theta(x^0-y^0))\langle 0 |[\phi(x),\phi(y)]|0\rangle+\theta(x^0-y^0)[(\partial_{\mu}\partial^{\mu}-m^2)\langle 0 |[\phi(x),\phi(y)]|0\rangle]+2\partial_{\mu}\theta(x^0-y^0)\partial^{\mu}\langle 0 |[\phi(x),\phi(y)]|0\rangle.
$$
The first term is zero because we get
$$
\partial_{\mu}\partial^{\mu}\theta(x^0-y^0))\langle 0 |[\phi(x),\phi(y)]|0\rangle=-\partial_{0}(\delta(x^0-y^0))\langle0 |[\phi(\vec{x},x^0),\phi(\vec{y},x^0)]|0\rangle=0.
$$
The second term is also zero because it satisfies KG's equation. For the last term we can write
$$
2\partial_{\mu}\theta(x^0-y^0)\partial^{\mu}\langle 0 |[\phi(x),\phi(y)]|0\rangle=-2\delta(x^0-y^0)\langle 0 |[\pi(\vec{x},x^0),\phi(\vec{y},x^0)]|0\rangle=2i\delta(x^0-y^0)\delta^{(3)}(\vec{x}-\vec{y})=2i\delta^{(4)}(x-y).
$$
From this I see that $G_R(x-y)=\frac{D_{R}(x-y)}{2}$. There is a factor of two which makes me think I'm forgetting something, either this or Green's function isn't exactly the propagator but only proportional to it. I think this is relevant because the same thing happens for Feynman propagator and Feynman Green's function, which are linked to scattering amplitudes trough the LSZ formula.
Answer: If ${\scr D}$ is some differential operator, a Green's function is a bidistribution $G(x,y)$ with the property that it solves the equation $${\scr D}_xG(x,y)=\delta(x,y)\tag{1}.$$
That is a definition. Now the thing is that to uniquely define $G(x,y)$ one must prescribe extra conditions. In particular, when ${\scr D}=\Box-m^2$ is the Klein-Gordon operator, the standard $i\varepsilon$ prescription is one such condition when solving (1) which has the property that the obtained solution is the time-ordered two-point function $\langle 0|T\{\phi(x)\phi(y)\}|0\rangle$ in free theory. That would be the Feynman propagator. The retarded/advanced propagators follow from other conditions added to (1).
Some authors may define $G(x,y)$ by including some numeric factor to the RHS of (1), but then one is changing the definition, and one must be consistent the whole way through.
So the short answer is that the retarded propagator is one possible Green's function, as is the Feynman propagator. They are all solutions to (1) which differ by some subsidiary condition which picks one out of the space of inverses of ${\mathscr{D}}$.
Answer: Retarded propagator is a Green's function, but a Green's function is not necessarily a propagator. There are two reasons why a green's function might not be a retarded propagator:

Boundary conditions in time, which allow introducing retarded, advanced, time-ordered and anti-time-ordered Green's functions (one could also add lesser, greater and Keldysh functions, but only three of the all named are independent).
Propagator is usually a one-particle Green's function, whereas we may deal also with many-particle Green's functions.


SQL Server create/update database script

Question: In MS SQL Server 2005, how can I create a script consisting off all the objects in the database (tables, stored procedures, views)? I want to use the script to create the database using SMO or to update its objects (alter, drop) if they already exist. I know about the scripting feature in SQL Server Management Studio, I am however not familiar with the configuration options.
Answer: If versioning your database schema is what you're getting to, try Wizardby. Although it does not directly support neither views nor sprocs, it supports running native SQL scripts as part of an upgrade/downgrade process.
Answer: I use Easy Sql Tools. The deploy version is free. You can generate scripts from schemas, data, indexes, almost everything.
http://www.easysqltools.com
Answer: There's a great tool SQL Compare that will actually compare two databases and create a change script for you. It's a great tool for staging purposes. There's also SQL Data Compare tool that will also compare lookup tables and act accordingly.
The downside is, they're not free. :(


Can Transformers detect each other even in their alt-modes?

Question: In the Transformers film, Ratchet and Bumblebee noticed that the F22 was not a friendly and instead, was Starscream. Can all Transformers detect other Transformers even if they are in their alt-modes?
Comment: I don't believe they can, like when they were searching for Jetfire.  They walked right up on him and it wasn't until they saw the symbol they realized he was a Decepticon at one time.. Optimus changed from his blue truck, to the old beat up one to get away from Lockdown.
Comment: That could be explained by the fact that he was in a sort of "hibernate" mode... But other than that...
Comment: In Transformers Generation 1 in the episode "Red Alert" the Autobots find a police car they think is an Autobot named Red Alert, and they were talking to it and shaking it until a policeman told them off, and they realised it was a normal car. Posting as a comment because it's not from the live action movies.
Answer: As far as we know, no. Although if they're observant they may notice details, like Decepticon badges other non-Earth details or things out of place, such as "TO PUNISH AND ENSLAVE" instead of "TO PROTECT AND SERVE" on the side of the police vehicle.
In Dark of the Moon we see that the N.E.S.T. base has energon detectors installed, to alert them of incoming Transformers, especially Decepticons. This helps illustrate that the Autobots being present, on their own, was not enough of a warning. It's not clear evidence, but it's just another piece of the world that adds up to alt mode being effective camouflage to other Cybertronians.


Abbreviation of "In contrast"

Question: What word can I use as an abbreviation of the phrase "in contrast" or "on the contrary" or "directly opposite"?
Comment: Good question.  I don't think there is one, at least not in common use.  Is there a reason you feel it's necessary, or is it just idle curiosity?
Comment: Can you show how you want to use "in contrast", could you give an example sentence.
Comment: Literally an abbreviation? Is an abbreviation a word?
Answer: A contrast is a comparison, the sharp one. I don't know an abbreviation for "in contrast to" but "compare (imperative)" is usually abbreviated to cf. [Latin confer (compare)].
Answer: I have used "cfx" for "contrast". "Compare" is abbrev. cf. and since "contrast" is a comparison, I used that abbrev., plus the x as a graphic of opposing ideas.

Abbreviation of "In contrast"


Last moment a layer in Geoserver was viewed

Question: My company publishes >1,000 layers using several geoservers. We are publishing them on several different websites.
Because there are so many layers, it is impossible for us to know which layer is being used and which one is not.
Therefore, I was wondering whether it is possible to view the last time a layer in Geoserver was requested. Is there any option to know this?
Answer: The best possible solution for you is to check the logs for your webserver.
In our case, we are passing all our requests through Apache, which is functioning as a reverse proxy. We regularly look at Apache's Access Logs and see which of our services are most used, and act accordingly.
If your Geoserver is hosted in Tomcat, or Jetty, you can enable the access log in those webservers directly, and use those Access Logs. Unfortunetly I don't have much admin experience on these two webserver, so I would not be able to tell you how to enable logging.


Dynamic or Fixed height for Modal window

Question: Need your help to clarify one query related to the modal. My question is whether the modal height should be dynamic or fixed? Dynamic I refer to is that the modal height varies based on the amount of content & fixed modal will always have a fixed height regardless of the amount of content. For fixed modal, there will be an internal scrollbar to scroll the content. Sample images attached (first image represent the dynamic & the other 2 fixed).
Which approach is the correct one as per the UX principles & widely used one?
Thanks in advance!
Answer: I ran a usability test in the past for a similar design and I can confidently recommend the fixed height and a scroll bar once the number of items overflows the height of the modal. So number 2.


The process cannot access the file because it is being used by another process

Question: I have a tif files from a specific directory, I have a function to read the all the tif files and converted it to text, after the conversion I move it to a folder named "Completed" once it was successfully converted, and move it Failed folder once it was failed to convert. the Problem is the when I used the Move method of System.IO.File it was raised an error saying that

"The process cannot access the file because it is being used by another process"

What is the problem, I closed the file , I dispose it , but still the error occurs?
Comment: I wonder what your code looks like.
Comment: Did you load this into an Image?  If so did you Dispose of that?
Comment: actually I closed it and dispose it also
Answer: Be sure you close the file, as well as anything associated with it during the processing.
(since you chose not to show us code, we don't really know what got created during the processing.)
Look for things like MemoryStreams, MemoryMapped Files, Images backed by files, File handles stored in a container or IEnumerable, etc.
You have the right idea making sure you explicitly <code>.Close()</code> known references, and Dispose of objects, but something is still holding the file.
Comment: I closed the file when the process was done, before moving it the specific directory
Answer: I had a problem like this and the issue was that I wasn't able to delete the original file if I created it using the "FromFile" method of the Image class.  Instead, I created it using the "FromStream" method (making sure to Close and Dispose of it at the end).
I modified my code to work like method #3 here: http://dotnetguts.blogspot.com/2009/07/process-cannot-access-file-because-it.html
Answer: Make sure your conversion process has completely finished before moving.  Sometimes it looks like a process is done when it really isn't.
Answer: Make sure you close StreamReader, StreamWriter and any other processes that are operating the file before you perform a different operation with it.
e.g. If you are reading with StreamReader and need to write to he file close StreamReader and then start StreamWriter.
Alternatively you could use Filestream and I have heard that in the .NET Framework 4.0 they have introduced asynchronous file operations.


What is a Managed Module (compared to an Assembly)?

Question: What is Managed Module in .NET and how is it different from Assemblies? Is a PE file (eg. test.dll) a managed module or an assembly? How does assembly/managed module correspond to physical files on disk?
Answer: A Managed module is generally understood to refer to a module that only contains IL code, with no direct machine code.
A module is housed in a normal PE file.
An assembly is a set of 1 or more modules, with one designated as the 'head' (will look up the exact term[1]). A module on its own isnt individually much use though - the assembly is the atomic unit.
For example, you could have an multui-module assembly with 2 DLLs and an EXE. Multi module assemblies are quite rare though.
The Don Box book Esssential .NET, the Richter CLR via C# gives good coverage of the topic. For complete details, the Serge Lidin .NET 2.0 IL Assembler book and the CLI standard are more complete.
[1] According to http://www.programmersheaven.com/2/FAQ-DOTNET-DOTNET-Assembly-Explained

An assembly can be a single file or it may consist of the multiple files. In case of multi-file, there is one master module containing the manifest while other assemblies exist as non-manifest modules

To answer the actual questions:-

What is Managed Module in .NET and how is it different from Assemblies?

It is a subset - a DLL can be a master module with no child modules -- and thus be an assembly too

Is a PE file (eg. test.dll) a managed module or an assembly?

Definitely a module. If it also has a manifest and no child modules, it's also an assembly

How does assembly/managed module correspond to physical files on disk?
  Each module is a file. (Tools like ILMerge can merge modules if you're interested)
Answer: A module contains IL and many of them are linked together to create an assembly, which is usually housed in a PE like a .exe or a .dll.
A PE can contain native (non managed) code as well.
This is a good intro to the concepts.
Answer:
Managed modules are the compiled IL
  versions of the source code. The
  extension of the file that is built
  when making a module from source files
  is .netmodule.
Assemblies are either DLLs or .exe
  files containing managed modules,
  resources, and metadata.


Why do satellites have capacitance?

Question: In some comments on this forum I read that satellites have capacitance of some nF or pF,
What is this about? How can I calculate it roughly?
Comment: *Everything* has capacitance. When you tap the screen of your phone, it detects your finger because you have capacitance.
Comment: Can you post a link to such a comment (or its question)?
Comment: Consider it a metallic sphere of a given diameter. This is now a standard electrostatics calculation - put some charge on it, it has to be at some potential relative to ground then. Calculation of the capacitance follows directly from Q/V.
Answer: Why do satellites have capacitance?
Capacitance is some ratio of charge to potential difference, with a constant in front.
Whenever some charge is added to something, be it a person, a cow, or a bit of metal in space, it's electrostatic potential changes. Capacitance is simply the ratio that tells us; *for a given charge added, how does much does the electrostatic potential change?
Our spacecraft could be once capacitance relative to one thing, and at the same time a different capacitance to another.
For a parallel plate capacitor we have:
$$C = \frac{Q}{V} = \frac{\varepsilon A}{d}$$
with $A$ the area of each plate and $d$ the separation between them.
For an isolated conducting spherical cow shell we use the same definition. For two spherical shells
$$C = \frac{Q}{V} = \frac{4 \pi \varepsilon_0}{\frac{1}{R_1}-\frac{1}{R_2}}$$
and for a single isolated sphere of radius $R$ just set the larger radius $R_2$ to infinity and get
$$C = \frac{Q}{V} = \frac{4 \pi \varepsilon_0} R$$
With vacuum permitivity $\varepsilon = 8.854 \times 10^{-12} $ F/m a one meter diameter sphere will then have a capacitance of about 0.2 nF. If your spacecraft is not a spherical cow and instead has some pointy bits and corners then the charge will accumulate at the points and corners, the electric field will be higher and capacitance could be orders of magnitude higher.
However:

For any realistic shape, you need a computer model, or you need to build a mock-up and test it.

If in low-enough Earth obit, one needs to think about capacitance with respect to the very low density plasma of the ionosphere, rather than to infinity.

These are why a spacecraft don't actually measure their own charge. They instead measure their potential.

How do spacecraft measure their own charge?
Comment: A spherical cow *in a vacuum*, as it canonically should be.  +1.

Why do satellites have capacitance?


Is my SATB harmonisation correct in this example?

Question: I am so paranoid about SATB harmonisation, because there are so many rules, and I feel overwhelmed. I literally feel like I have a hundred hidden mistakes in this question.
Comment: Appreciate if you could change the orientation of the image.
Comment: Did you 1) play the melody on an instrument before attempting the harmonisation 2) play your harmonisation after you had written it and agree that it was what you wanted to write? If so, all power to you
Answer:
A minor is a problematic choice for your realization, for the reasons you've discovered. Were A minor the intended key, and unless this is a relatively advanced exercise, I would expect all of the given Gs to be G#s. Minor V is unusual in a beginning exercise, as is the prominent use of III chords.

The most important factor in answering your question is whether or not the key signatures are given, or whether part of the exercise is determining the key.

My feeling (with an assist from @MattL) is that the strongest realization would be in G major, ending on a half cadence (D major -- the V chord of G major). Nearly all of the melody notes are part of the G major triad, with the non-triad-tones (A) in weak rhythmic positions -- clearly passing tones.

If you're supposed to use the given key signature, then I would realize this exercise in C major, ending on a deceptive cadence (A minor). That's because of the G naturals. Were the excerpt to be in A minor, I would expect G#s (unless this is an advanced exercise where minor V is expected). However, one would still need a G# in the second-to-last chord, risking a cross-relation with the G natural at the beginning of the measure.
Comment: It looks very much like G is the intended key.
Comment: @MattL. Agreed. I've revised to reflect that. Thanks for prompting me to rethink the post.
Comment: I don't disagree that seeing this melody as a-minor is _unusual_ for SATB – but IMO it's actually quite pretty. Folky. By comparison, in G-major it's more of a silly fanfare.
Answer: Is this really presented with no key signature?
That is the most confusing part about it. The melody so obviously is in G major (key signature of one sharp) but this has a key signature of zero sharps/flats.
The reason the key signature matters isn't a nit-picky gripe, it has bearing on the strategy for harmonizing, which should be done with chords that make sense within the key!
You should already have some harmonization procedure, but here are a few strategies you can consider. Ideally you want to understand the harmonic implications of the tones of the melody within the key and first fill in a bass that supports those harmonies.
The tune...

Try a "reduction" to get the main harmonic events...

...that can be fleshed out a bit with some of the other strong tones which are also from the outlined triad which we will consider the tonic...

...notice above how ^5 and ^2 are first recognized in terms of their harmonic/tonal role within the key, this is important. For example, consider ^3, the B4. In some harmonization methods you will be told you can harmonize it with triads I, iii, or vi. That's true, but in tonal music tonic/dominant harmony is the primary focus. In that regard ^3 is a member of the tonic chord. Similarly ^2 could be part of a ii triad, but in terms of tonic/dominant it is a member of V.
Look for melodic/voice leading formulas. This is probably only going to come from experience. I noticed some "voice exchanges." That's when the root and third of a chord "exchange" or alternate in a part. An common harmonization of an exchange is just the reversal of the move in the harmonizing part...

...that give a nearly complete bass. Fill in the inner voices...

...that may be a boring harmonization, but the original tunes only outlines a tonic chord. You could move around some of the tones of the inner voices to give them a bit more interest, but I don't think it will matter much. You could harmonize it some other way than tonic/dominant, but I think the point of the assignment is use basic harmony.
The important thing is to understand the tonality of the original melody and first add a good bass. Adding the bass alone should make the harmony clear. It will be only two parts, but the implied chords should be clear. Filling in the inner voices is then fairly straight forward.
Comment: Yes, this melody really feels like it's in G, and ends on the V chord. I'm curious why the key signature doesn't show F#. Of course it could be just the modulated section of a larger piece, but that doesn't seem like a typical thing to expect in a harmony exercise.


Maintaining relationships between data stored in Azure SQL and Table Storage

Question: Working on a project in which the high volume data will be moved from SQL Server (running on an Azure VM) to Azure Table Storage for scaling and cheaper storage reasons. There are several foreign-keys within the data that is being moved to Table Storage, which are GUIDs (Primary-key) in SQL tables. Obviously, there is no means to ensure referential integrity, as transactions do not span different Azure storage types. I would like to know if anyone has had any success with this storage design. Are there any transaction management solutions that allow transactions to be created that span SQL Server and Azure Table Storage? What are the implications of having queries that read from both databases (SQL and Table Storage)?
Answer: If you're trying to perform a transaction that spans both SQL Server and Azure Tables, your best bet will be using the eventually consistent transaction pattern.
In a nutshell, you will put your updates into a queue message, then have a worker process (whether it be a WebJob, Worker Role, something running on your VM) dequeue the message with peeklock, make sure that all steps within the transaction are executed, then call complete on the message.
If you're looking to perform a transaction on just an Azure Table, you can do so with batch updates as long as your entities live within the same partition.


Any way to change the location of Time Machine local backups (./MobileBackups) to another drive?

Question: I am running an SSD boot drive and a HDD drive on my Macbook Pro 5,5 and I obviously cannot have Time Machine filling up my SSD. I was wondering if there was anyway to have time machine create local backups of the users on my SSD, but store it on my HDD and be able to use the typical features of time machine local backups, because otherwise it would be unnecessary. If this question has been asked, I would appreciate a link, because I searched and could not find anything. Otherwise, thank you very much any help you can offer.
Comment: I was wondering whether you managed to move the local Time Machine backups as described in my answer and comment below.  If that's the case I'd appreciate if you could mark your question as answered.  Thanks!
Comment: I just logged on and noticed this. Really sorry it took me so long to mark it as answered. Thanks for the great walkthrough!
Comment: No problem, thanks for your feedback, I'm glad I could help!
Answer: I couldn't find any way of modifying the path /.MobileBackups, but you can create a folder on your HDD and then symlink it to /.MobileBackups:

Open Applications>Utilities>Terminal.
Now you will have to type several commands. Press return after every command for it to execute. When asked, type your password.
The snapshots folder has complex permissions. The simplest way to preserve them is to copy the existing folder to the new location on your HDD:
sudo rsync -ahvHE /.MobileBackups /Volumes/HDD/
(replace /Volumes/HDD with the path to your HDD.)
rsync options are:

-a: archive mode (recursive; copy symlinks as symlinks; preserve permissions, times, owner, group, device files, sockets and fifos)
-h: output result in human-readable format
-v: verbose, that is, show what the command is doing
-H: preserve hardlinks
-E: copy extended attributes like resource forks and ACLs

Disable local snapshots (this will delete /.MobileBackups and its contents):
sudo tmutil disablelocal
Create symlink:
sudo ln -s /Volumes/HDD/.MobileBackups /.MobileBackups
(replace /Volumes/HDD with the path to your HDD.)
Enable local snapshots:
sudo tmutil enablelocal
Create a local snapshot:
sudo tmutil snapshot
If you see a new snapshot dated "now":
ls -l /Volumes/HDD/.MobileBackups/Computer/
(...)
drwxr-xr-x@ 3 root  wheel  102 Jan 28 09:05 2013-01-28-090534

you're done!

If something went wrong or is not working as expected, revert to the original configuration:

Disable local snapshots:
sudo tmutil disablelocal
This will delete the symlink /.MobileBackups. Should that not be the case, delete it with:
sudo rm /.MobileBackups
Enable local snapshots:
sudo tmutil enablelocal
Delete alternative snapshot folder on your HDD:
sudo rm -rf /Volumes/HDD/.MobileBackups
(rm -rf is a dangerous command that won't ask for confirmation before deleting the folder. Make sure the path is correct!)
Comment: Jaume- this was extremely helpful. On OSX 10.8.2, this allows me to write the time machine local snapshots, but for some reason I cannot read the contents of the folders in time machine. I'm sure it is some sort of permissions issue, but I can't figure it out. Any ideas? If I copy the folder off the second drive, and change permissions for access, the backups are there and complete. If I enter time machine, it has folders corrsponding to the dates the snapshots were made, but cannot find any contents. I do notice that the permissions are a bit different on the drive i rsynced to- it is not roo
Comment: Thanks! That looks great and well-written. I have a small problem that when I disable the local backup, the ./MobileBackup disk image is unmounted and rsync throws an error: `building file list ... rsync: link_stat "/.MobileBackups" failed: No such file or directory (2)
done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]`

Thanks for your help so far, it would be great to get this working, so how did you get rsync to work? Thanks again.
Comment: I overlooked that `tmutil disable` immediately wipes out `/.MobileBackups`, that's why `rsync` complains and exits with an error, sorry for that. I've edited my answer, please try it out (don't forget to enable snapshots with `sudo tmutil enable` first).
Comment: I'm glad it was helpful. As for your question: if you mean the backups are in `/.MobileBackups` but you don't see them when you enter Time Machine it could be a permission issue. `/.MobileBackups` is not meant to be accessed directly, and its internal structure, including permissions, is undocumented. You may peek inside (use `sudo ls /.MobileBackups/Computer/`) or even copy files out of it, but don't change permissions. I'd recommend that you recreate `/.MobileBackups` from scratch as explained in my answer and test whether it works. If that's the case, it was a permissions issue.
Answer: If you are running OSX 10.8 or higher, something happens when you disable local snapshots such that the existing snapshots are no longer accessible via TM.  To resolve this problem, use sudo -s to log in as the root user and execute the following code to modify Jaume's excellent tutorial:
cd /
tmutil disablelocal
sleep 300

rm -rf /Volumes/HDD/.MobileBackups/

tmutil enablelocal
sleep 60
tmutil snapshot
tmutil snapshot

rsync -ahvHE /.MobileBackups /Volumes/HDD/
rm -rf .MobileBackups
ln -s /Volumes/HDD/.MobileBackups /.MobileBackups

tmutil snapshot
tmutil snapshot

That seems to work so far.
Comment: I want to use caution with the rm - depending on the number of intervals, you need to let the mobile backups software clean up things. Theoretically, the rm is harmless, but I don't like to have race conditions to delete files when I can help it. I added sleep commands to let the subsystem stabilize after turning it off and on again.
Answer: I know this is a someway old question/answer, but I'm re-doing this right now in Yosemite and I added a little fancy detail to this configuration: since I'm on Yosemite I've been forced to apply Benjamin's "root instead of sudo" way, it's currently working as expected, but I didn't like having an icon for the snapshot volume, something that you shouldn't need to see and access while doing normal stuff as a user, so I choose to hide the snapshot volume icon using the SetFile command (that, afaik, is installed via xcode)
using paths from previous examples, it would be:
SetFile -a V /Volumes/HDD/

and pouf, the volume icon is gone: local snapshots are totally invisible again, as usual, but still mounted (you can browse and even open directories via terminal, as with any other invisible directory in your filesystem)
I even made a little shellscript (not tested, because i already did it manually, so PAY ATTENTION BEFORE RUNNING IT, since it needs to be run as root as Benjamin explained in his comment/reply )
Final note, just fyi: for what i can see now, the snapshot volume can normally be encrypted
Thanks for your work, here is the bash script, clearly based on your replies:
#!/bin/sh

# description:
# move /.MobileBackups to a different volume, to avoid wearing your SSD
# this script must me run as root, not via sudo.
# based on http://apple.stackexchange.com/questions/80183/any-way-to-change-the-location-of-time-machine-local-backups-mobilebackups-t

################################################################################

# safety measure to avoid kids running this script with no clue and blaming me.
# comment it
echo "always check what you run before running it" && exit

# syntax/help
if [ -z "${1}" ] ; then
    echo "\nusage:\t`basename ${0}` /Volumes/SnapshotVolume\n"
    echo "*** Please note that this script MUST be run as root, not via sudo ***"
    echo "*** just run \"sudo su\", insert your password and THEN run this script ***"
    echo
    exit
fi

# checks that this script is run being root, not via sudo
homeDir=`echo ~`
if [ "${homeDir}" != "/var/root"  ] ; then
    echo
    echo "*** Please note that this script MUST be run as root, not via sudo ***"
    echo "*** just run \"sudo su\", insert your password and THEN run this script ***"
    echo
    exit
fi

# get dest volume path
snapVolume="${1}"

# create a "Backups" directory inside the snapshot volume root directory
# please note that this is a safety measure: if the snapshot volume is not
# excluded from time machine backups, you'll find an already existing directory
# at /Volumes/SnapshotVolume/.MobileBackups (each volume has his own directory)
# so, to avoid any mess, I prefer to make a Backups directory and put the actual
# .MobileBackups inside it, at a non volume-root level
mkdir ${snapVolume}/Backups

# duplicate the existing .MobileBackups to the destination path
rsync -ahvHE /.MobileBackups ${snapVolume}/Backups/

# this double command will remove the existing /.MobileBackups directory and,
# if and only if the rm command exits with no errors, symlink the new directory
# cloned in the 2nd hard drive to the main drive /.MobileBackups path
rm -rf /.MobileBackups && ln -s ${snapVolume}/Backups/.MobileBackups /.MobileBackups

# makes the snapshot volume invisible in finder
SetFile -a V ${snapVolume}

# a final test, just because..
tmutil snapshot


How to debug memory leaks in Windows Store apps?

Question: So I have a .NET Windows Store app that is leaking memory. What can I do about it? The profiler tools I used for desktop apps from jetBrains or Red-Gate/ANTS don't support Metro Apps (or do they now?)
Answer: For the simplest approach - skip to the bottom to read about the description of doing that with Visual Studio 2013.

Now there might be some new tools - perhaps something in the updated Visual Studio and I would love to find about these, but I tried WinDbg before with some success. Here are my old notes on how to do that:
<code>1. Create dump file from process manager
2. Run WinDbg (X64)
3. File/Open Crash Dump… (Crtl+D)
4. Run following:

lm
.load C:\windows\Microsoft.NET\Framework64\v4.0.30319\sos.dll
.sympath SRV*c:\localsymbols*http://msdl.microsoft.com/download/symbols
.symfix
.reload
!dumpheap -stat
</code>
Note that if your process if x86, especially if you are running on a x64 version of Windows - you will need to use an x86 version of the debugger (WinDbg ships both versions) to save the dump. SOS, which is a managed memory debugging extension for WinDbg does not support debugging x64 bit dumps of x86 bit processes. You will then also need to update the sos path respectively, so it looks like this:
<code>.load C:\windows\Microsoft.NET\Framework\v4.0.30319\sos.dll
</code>
Possibly not all of these commands are necessary, but this is what worked for me.
Now you can find the type of the object that seems to exist in too many instances
<code>!DumpHeap -type TypeName
</code>
where type name is just the name of the type - no fully qualified namespace necessary.
Now you can check what keeps this object in memory:
<code>!GCRoot Object_Address
</code>

Live debugging didn't work for me since the app seems to get suspended when you attach a debugger. I think I saw an option somewhere to make the app stay in memory, but I forgot where, but for memory profiling - looking at a static dump file might be enough.

You can download WinDbg as part of Windows SDK or as a standalone download of "Debugging Tools for Windows" from here.
To create a dump file - go to Task Manager, right click a proces and select "Create dump file".

Some more links:
http://blogs.microsoft.co.il/blogs/sasha/archive/2012/10/15/diagnosing-memory-leaks-in-managed-windows-store-apps.aspx
http://blogs.msdn.com/b/delay/archive/2009/03/11/where-s-your-leak-at-using-windbg-sos-and-gcroot-to-diagnose-a-net-memory-leak.aspx
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f3a3faa3-f1b3-4348-944c-43f11c339423
http://msdn.microsoft.com/en-us/library/bb190764.aspx
http://blogs.msdn.com/b/dougste/archive/2009/02/18/failed-to-load-data-access-dll-0x80004005-or-what-is-mscordacwks-dll.aspx

*EDIT
According to .NET Memory Allocation Profiling with Visual Studio 2012 by Stephen Toub - PerfView tool supports analyzing leaks in .NET Windows Store apps. Check an article and video walkthrough with Vance Morrison here.

*EDIT 2
Visual Studio 2013 Preview adds a new option to analyze managed memory heaps from dump files. To do it - simply pause your app in the Visual Studio debugger, save your current dump through Debug/Save Dump As, then resume execution and use your app until your suspected leak happens and do another dump. Then go to File/Open/File and open the second dump file. To the right of the Dump Summary in the "Actions" panel you'll see a "Debug Managed Memory" action. Select that and then in "Select Baseline" select your first dump file. You will see a list of objects on the managed heap, grouped by type, with count diffs. Note that you would typically first look at the objects with low, non-zero count differences to track a single leak source. You can drill into the list of objects and see what keeps them in memory by expanding the tree in the Reference Graph view.
Comment: People should note that the "Debug Managed Memory" option is only available in Visual Studio 2013 Ultimate and the dump is created from a .NET 4.5 process. More info here: http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/20/using-visual-studio-2013-to-diagnose-net-memory-issues-in-production.aspx
Comment: More fresher links: http://blogs.microsoft.co.il/blogs/sasha/archive/2012/10/15/diagnosing-memory-leaks-in-managed-windows-store-apps.aspx
Comment: Also it seems like etl (Event Trace Log) files that you can produce using the wpr (Windows Performance Recorder) command and read with wpa (Windows Performance Analyzer) can be helpful in finding leaks, though I haven't played with it yet. Check these links that might contain some helpful information http://www.idigitalhouse.com/Blog/?p=155 http://blogs.msdn.com/b/ntdebugging/archive/2012/11/30/troubleshooting-pool-leaks-part-7-windows-performance-toolkit.aspx
Answer: Telerik JustTrace supports Windows Store Apps: http://www.telerik.com/products/memory-performance-profiler/justtrace-features.aspx
Comment: They tweeted me saying it only supports tracing the managed side of things, but that should be enough for many people.
Comment: Thanks! I'll have to try that!
Comment: The question was tagged .net, so I forgot to mention that it won't work (in the latest version) with WinJS. I wouldn't be surprised to see it at some point.
Comment: You must disclose your affiliation in your answers. http://stackoverflow.com/help/promotion


Yucca Elephantipes Problems

Question: I have had this plant for 2-3 years now and recently (about 2 months ago) I started noticing some problems on the leaves such as dry spots, bumps and brown near the edges and base. What can I do about this? I water the plant about once every 5-8 days, it gets plenty of light (as you can see from the pics). I have never fertilized the plant and I also dust it off about every 2 weeks.
Comment: Brown tips is usually a sign of too much water. Try to water it when the top layer of soil feels dry (finger deep). Some fertilizer might also be a good idea, especially during the spring/summer periods.
Answer: I think your yucca plant looks fine, for a houseplant. If you have such a plant for 2-3 years in your home, it will look more or less like yours.
I cannot see exactly what you mean with the bumps and brown spots. The brown at the base (stem) is normal, it is because the stem under it is brown. You can tear off some of the lower leaves (pull down at the stem), the plant will look better then (because the lower leaves droop/hang very much). But best time to do this is spring though, just before growing season starts (now it is a bit late in growing season and it is coming to an end soon).
You say that you never fertilize it, well that might be one cause of a bit yellowing leaves. I give my Yuccas some liquid fertilizer (Pokon) every 2-3- weeks during the spring and summer. Furthermore, the plant will be happy when you repot it every 2-3 years, in a slightly larger container with fresh potting soil. Also you water it quite often, it would be better to water it every two weeks or so, and wait until the upper part of the soil is dry (half finger deep). Brown tips of the leaves are often a sign of too much water (but you have no picture of that).
Comment: Ok, I see. By the spots and bumps I meant whats happening on the last picture. those small yellow spots are elevated, is that normal?
Comment: Those spots look like scar tissue from mechanical damage. Maybe by dusting it off, is it on the new or old leaves?
Comment: Those are on some relativily old leaves, at the middle of the plant. I can assure you its not mechanical damage.

Yucca Elephantipes Problems


Air bubbles in sausage

Question: Are air bubbles/pockets/loose casing in raw sausages okay food safety-wise? I don't know if it's just because they didn't fill them as full or if they formed from gases/bacteria. They are five days before the best before date Merguez sausages. Thanks!
Answer: It is most likely just a void.  It is hard to pack a casing 100%.  There will be voids.
Could it be (toxic) bacterial gas? Maybe but not likely.
Comment: @coteyr Any bacteria in the air pocket may be killed off yes, but the toxins they leave behind can not be cooked off.
Comment: True, if your meat is old enough to have toxins then best to throw it out. Usually though this is only really a problem, if the meat is stored at room temperature or  stored (in the fridge) for a really long time. Standard meet rules apply.  Once thawed cook it, don't let it set in the fridge raw for more then a day or two.
Comment: Remember your going to cook them. Cooking not only changes the flavor of the meat but kills off almost all harmful bacteria. Air pockets, will get cooked to, and will usually "pop", but even if they don't any bacteria in the air pocket will be killed off.
Comment: As far as I know, bacterial toxins are not usually gaseous. There are spores etc. that can be carried in gas, but they can also be carried in (e.g.) sausage.
Answer: To avoid it, you'd need to pack them in a way that makes them more like hot dogs than sausages. Hot dogs are a smooth emulsion of (usually) reclaimed meat, fat and spices. Sausages are mince that's been somewhat loosely packed and cooked (usually smoked) in a casing along with herbs, fat and spices.
With synthetic casings, you can pump a bit more pressure resulting in a denser sausage with less air, but there's still going to be some. However, the hallmark of a great quality sausage is a natural casing, with little nooks of air, fat, spices, etc.
What you have sounds like quality sausage in a natural casing, and you should positively consume it when it's fresh (ideally within days of buying it!). But there's nothing wrong with leaving them out in the back of the fridge to age a little bit (really helps bring out the flavor of fennel / anise) prior to cooking them up, and they will be a little loose and crumbly.
If you pick up on even a slight acrid taste or smell, don't use them. Otherwise, you're fine.
Comment: @ChrisH Yeah that doesn't quite read well and as intended, fixed.
Comment: * Sausages are cooked mince* -- they're not cooked when they're packed into the casings
Comment: As far as I'm aware, air in sausage is always a fault, even in 'great quality sausage'. In smoked sausage it's not too bad, but can lead to a 'crumbly' product. In fresh sausage, it's annoying because when cooking, 'windows' of air can dry out and crack more easily. In dry-cured sausage, it's especially bad because when aging the oxygen can turn the fat rancid and bad mold/bacteria can grow in the void. Commercial stuffers include vacuum pumps to remove trapped air in order to improve quality and consistency.
Comment: @NickT In dry-cure it's absolutely dangerous. I rather like the crumbly nature of certain kinds of bangers, for instance. I think for brands consistency is paramount because of so many varying tastes. I wouldn't call it a fault in _most_ cases unless it was excessive, but that's just me.
Answer: The casing on a fresh sausage needs to be left somewhat loose because the casing will contract when it's cooked. If it were stuffed as tightly as possible, it would be almost certain to split open in the frying pan. Even for a sausage that will be poached first (boudin blanc, e.g.), which causes the casing to shrink much more gently, you must account for that shrinking.
Air bubbles are simply a natural consequence, as Tim Post says, of the size of the grind. You notice that tennis balls in their can also have "air bubbles" around them. If there are a lot of bubbles, it's a sign of perhaps not-quite-painstaking manufacture: usually the bubbles are pierced after the links are formed. This is again to prevent splitting: the air will expand when it's heated and that can rupture the casing.
The pockets are not a danger sign by any means, though. The only worrisome hypothetical I can think of would be that they appear to inflate on their own while the sausage is in cold storage: that means something alive is producing gas. (My guess would be that'd just be harmless yeast, but) When in doubt, throw it out.

Air bubbles in sausage


iPhone sdk- Save Last Selected Date in KALViewController

Question: I have used KALViewcontroller API to display calendar in my iPhone app. I want to save the last selected date and display it as 'highlighted' when the calendar appears again.
Currently it shows Today's date.
in KALViewController.m a function -(void)showAndSelectToday is responsible to show today's date and highlight today's tile.

[[self calendarView] selectTodayIfVisible];

//where *calendarView* is
- (KalView*)calendarView
{
    checkDateConf = TRUE;
    checkDate = FALSE;
    return (KalView*)self.view;
}

In KalView.m

[gridView selectTodayIfVisible];

//Where gridView is KalGridView gridView;
In KALGridView.m
selectTodayIfVisible is declared

- (void)selectTodayIfVisible
{
  KalTileView *todayTile = [frontMonthView todaysTileIfVisible];
  if (todayTile)
    self.selectedTile = todayTile;
}

Please guide me how I will highlight selected date.
Answer: TO detect which date is selected, I've done this way:
in KalViewController look for didSelectDate (delegate Method) and add Notification post.
#pragma mark KalViewDelegate protocol

    - (void)didSelectDate:(KalDate *)date
    {
  //NSLog(@"DID select DATE:%@",date);
  self.selectedDate = [date NSDate];
  [[NSNotificationCenter defaultCenter] postNotificationName:@"DATA_SELECTED" object:[NSString stringWithFormat:@"%@",date]];
  NSDate *from = [[date NSDate] cc_dateByMovingToBeginningOfDay];
  NSDate *to = [[date NSDate] cc_dateByMovingToEndOfDay];
  [self clearTable];
  [dataSource loadItemsFromDate:from toDate:to];
  [tableView reloadData];
  [tableView flashScrollIndicators];
}

Then in your view Controller that use Kal receive this post just like:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userSelectDate:) name:@"DATA_SELECTED" object:nil];

and the method called is:
-(void)userSelectDate:(NSNotification*)notification{
    NSLog(@"date selected:%@",[notification object]);
}


Identify direct permissions in a farm?

Question: Is there an easy method in a SharePoint 2013 Online or on-premise instance to quickly identify all sites and libraries with direct permissions? I'm trying to enforce groups wherever I can but site owners continue to add permissions directly. Hoping to find a way I can monitor this to help curb the behaviour.
Comment: Are you sure they're not using the Sharing functionality? In order to monitor inheritance, you'd have to enumerate each object in the farm. That is computationally expensive.
Comment: Yes, most definitely. But I think it's worthwhile at least initially to identify issues?
Comment: If they use Share, they will be adding individual permissions on a Document, List/Library, or Site. In my opinion, you're attempting to fight a futile battle as long as you leave Share on.
Comment: Ah - sorry. Not referring to Share, just got what you mean. I'm referring to when people in other business units are added directly to site permissions by site owners..
Answer: SharePoint comes with Auditing feature, which helps in identifying all such activities. You need to configure auditing in your environment. If you had already configured Audit for site collection you can follow follow the below steps.

Click on gear icon, and select Site Settings from the drop down menu.
Now under site collection administrator section, find Audit Log Reports. Click on it, it will open a page.
Now under Security and Site Settings Report select Security Settings.
Follow the on screen instruction to fill the location of report. Hit Ok and you are done.

The report will be available in destination library you selected. The report will contain information regarding, permission on site and specific list and lib. Also it will show the data like who added/deleted/modified permission and when.
To configure audit logs follow below steps:

Click on gear icon and select Site Settings.
Under site collection administrator section find Site collection audit settings. Click on it will open a page.
In setting page, configure log trimming (if you want) this will remove past log data specified in numbers. Under List, Library and Site check the Editing users and permissions. This will start logging permission data.

Follow the URL to learn more on Auditing. https://support.office.com/en-us/article/configure-audit-settings-for-a-site-collection-a9920c97-38c0-44f2-8bcb-4cf1e2ae22d2
This is a good way to check Site collection wise.
If you are looking for entire farm, then you night need to consider writing some PowerShell code in order to get the data from all site collection/web applications.
Comment: Are there any examples of any such powershell out there?
Comment: Hi, I found a solution on technet forum. `Get-SPWeb YOURURL | Get-SPUserEffectivePermissions $user | Export-Csv -NoTypeInformation
-Path c:\perms.csv`. Currently i am not having SP Farm environment, otherwise i would have included that solution as well.
Comment: Also there is a similar question here https://sharepoint.stackexchange.com/questions/144110/powershell-get-permission-on-spsite-spweb-and-all-list

Identify direct permissions in a farm?


Are Traits good or bad?

Question: This is an open-ended question, but I would like to solicit some opinions from the SO community on Traits; do you think Traits in Squeak/Pharo are a good thing, or should you stay away from them and use composition and delegation instead? I ask because while I know how to use them (thanks to the Pharo book), I am not really sure how acceptable it is to use them or where it is OK to use them and where it isn't.
Answer: I do not like traits because they introduce strong dependencies into code. These dependencies can be obvious (a class that imports a trait, a trait that expects methods), but also very subtle (a trait that shadows super methods/instance variables). Furthermore there is no adequate tool support for traits.
In my experience delegation gives a much better and more reusable design in a dynamically typed object-oriented language like Smalltalk.
Answer: Things have their pros and cons. Lukas rightly mentions many of the cons:

Introduce strong dependencies into code.
no adequate tool support.

While the second may go away some day, the first will not.
The purpose of traits is to prevent code duplication that occurs, when two classes that don't share a superclass other than Object, share an instance method. Now, sometimes delegation can fix that, but oftentimes it cannot. So, the pro of traits is:

Reduced code duplication.

My verdict here is that the disadvantages overweigh. I think that, today and forever, code duplication is bound to occur. And when delegation won't do, I can even imagine that code duplication isn't all that harmful, as it often precedes the divergent evolution of the copied code snippets.
I think, the best thing to do, as of today, is to keep automated track of code duplication, and always monitor when one end changes while the other doesn't. I'm currently writing a tool that'll keep track of such links, even across repositories. I'll report on it in my blog when it's ready.

Are Traits good or bad?


Getting an "operation not supported" error when trying to RUN something while building a docker image

Question: I'm trying to build a docker image with the following command:
docker build -f conf/Dockerfile -t my_app_name .

The Dockerfile starts with:
FROM ubuntu:14.04

COPY conf/pubkey pubkey
RUN echo 'deb http://downloads.skewed.de/apt/trusty trusty universe' >> /etc/apt/sources.list \
  && apt-key add pubkey \
  && rm pubkey

And it returns INFO[0000] operation not supported.
Regardless of what I put after RUN (even RUN echo 1 fails)
I tried running a shell in the intermediate docker image (docker run a7bb092… -it /bin/sh) but this just throws FATA[0000] Error response from daemon: Cannot start container a7bb092…: operation not supported
How can I fix this?
Answer: Well, turns out that if your machine had a kernel update but you didn't restart yet then docker freaks out. Restarting the machine fixed that. Oops.
Answer: This can happen if you do not have CONFIG_VETH selected in your kernel or don't have lxc and cgroup.
$ zcat /proc/config.gz | grep VETH
CONFIG_VETH=m

https://github.com/docker/docker/issues/7246


Understanding Kaon Mixing

Question: While studying Neutral-Kaon mixing, I learnt that the way we observe them is through their decays to Pions. But the states that decay are not the particles/antiparticles themselves but their mixture. $$ \left|K_{L}\right>=\dfrac{1}{\sqrt2}(\left|K^{0}\right>+\left|\bar{K^{0}}\right>) $$  $$  \left|K_{S}\right>=\dfrac{1}{\sqrt2}(\left|K^{0}\right>-\left|\bar{K^{0}}\right>)$$ Here, $\left|K_{L}\right>$ goes to two pions while$\left|K_{S}\right>$ decays to three pion system. The thing I don't understand is that in nature what exists in $\left|K^{0}\right>$ and $\left|\bar{K_{0}}\right>$; how do they sometimes combine to give a CP violating state and sometimes CP preserving?
Comment: I would like to add a question to this. How do we relate masses of $\left|K^{0}\right>$ and $\left|\bar{K^{0}}\right>$ to that of $\left|K_{L}\right>$and$\left|K_{S}\right>$?
Answer: Depending on the way you look at them, there are several kind of kaons:

$K^0$ and $\overline{K^0}$ are the kaons produced by strong interaction. They have a definite isospin and strangeness quantum numbers made respectively of $d\bar{s}$ and $\bar{d}s$. However they can oscillate meaning that they transform spontaneously in each other: $K^0 \leftrightarrow \overline{K^0}$ through a box diagram involving the weak interaction. Clearly, that means that $K^0$ or $\overline{K^0}$ cannot have a definite lifetime (since they transform continuously).
$K_L$ and $K_S$ are the kaon having a definite lifetime, the ones propagating and observed in the detectors.
$K_1$ and $K_2$ are the linear combinations of $K^0$ and $\overline{K^0}$ that are CP eigentates: $K_1 = \frac{1}{\sqrt{2}}(K^0 - \overline{K^0})$ and $K_2 = \frac{1}{\sqrt{2}}(K^0 + \overline{K^0})$. Kaons decay into 2 pions states or 3 pions states. It turns out that the CP quantum numbers are such that: $CP(2\pi) = CP(K_1)$ and $CP(3\pi)=CP(K_2)$.

So far so good. Now, experimentally when we create kaons via the strong interaction and detect them long time after their creation we know that what is detected are actually $K_L$, the only surviving kaons having a lifetime long enough to survive. If CP was conserved, you would expect to observe only:
$$ K_L = K_2 \to 3\pi$$
The equality $K_L=K_2$ results from phase space considerations: the phase space in the $2\pi$ states is much larger than in $3\pi$, so we expect $K_1$ to have a much smaller lifetime than $K_2$, thus the identification $K_L=K_2$. However, in 0.2% of the case we do observe $K_L \to 2\pi$. So what can you conclude?

either, there is a direct CP violation: $K_L$ is really a $K_2$ CP eigenstate but CP is violated in the decay process itself allowing $K_2 \to 2\pi$,
or there is an indirect CP violation: $K_L$ is not a pure $K_2$ but a mixture of $K_1$ and $K_2$:
$$ K_L = \frac{1}{\sqrt{1+\epsilon^2}}(K_2+\epsilon K_1)$$
$\epsilon$ characterizing the amount of indirect CP violation. It turns out that both violations exist! In the kaon system the latter dominated (about 600 times larger than the former). But in other systems, like neutral B meson, direct CP violation is pretty common.
Comment: Thank you for your answer but this literature in their in books. I guess I didn't mention my problem clearly. Can you explain how $ K_{L}$and $K_{S}$ exist in nature. Is their any other way to detect one of these without looking at decay products?
Comment: yes, the lifetime of both kaons is long enough to reach the hadronic calorimeters. The $K_{s,L}$ then interact with the nucleon creating an hadronic shower. But you can't determine if this was a $K_S$ or a $K_L$. In addition, since they react via strong interaction it means that the $K_{S,L}$ are projected on $K^0$ or $\overline{K^0}$ by the detection...
Comment: Now, this is confusing. Answer a binary question. Which two are the physical states out of $\left|K^{0,\bar{0}}\right>$ and $\left|K_{L,S}\right>$?
Comment: both are physical states… If by physical state you mean state that propagate (having a definite lifetime), it is $K_{S,L}$. If by physical state, you mean the one that can be physically detected (or created) $K^0$ is the answer. As usual with QM, both exists, just a matter of the way they are observed.
Comment: Thank you. I will look into some papers regarding how these two sets of states are detected.

Understanding Kaon Mixing


Print Primary and Secondary Menu Links separately

Question: I have a main menu with primary, secondary and tertiary links. The primary links will be positioned top right of the page. I want the sub menus (secondary/tertiary links) to print in a separate wrapper that will span the width of the browser. I cannot use absolute position because I need the sub menu to push down the content below it when I hover over the primary links. How can I do this with templates?
Answer: Check out the theme_menu_link and theme_menu_tree hooks.  You can add them to a custom theme, and they give you full access to the links as they are built.
Take a look at the following line in theme_menu_link:
if ($element['#below']) {
  $sub_menu = drupal_render($element['#below']);
}

If you add a test to check if the link being tested is top tier than you can change the $element['#below'] to suit your needs. checking for top tier is as simple as
$element['#original_link']['plid'] == 0

The parent link id of top tier elements is 0, so this works out.
Then, if it is top tier and has links below it, add a theme wrapper that will allow you do what you want it to.  For example:
if ($element['#below']) {
  if ($element['#original_link']['plid'] == 0){
    $element['#below']['#theme_wrappers'][] = 'my_custom_theme_wrapper';
  }
  $sub_menu = drupal_render($element['#below']);
}

I am seeing the original theme wrapper is menu_tree__main_menu.  If you want to completely replace it use you should unset that one, then set a new one as mentioned above.
If you want some pointers on theme wrappers check this post.
Comment: This looks like substantially the right approach, I gave an answer to a similar question with a few more details here: http://drupal.stackexchange.com/questions/145383/how-do-i-render-sub-menus/145525#145525
Comment: Thanks for the feedback. I asked a similar question about showing secondary and tertiary menus of an active parent link to the right. Would the same answer apply? Question is here: https://drupal.stackexchange.com/questions/146218/secondary-tertiary-links-next-to-parent-links
Comment: It would be similar. As @Robin mentions using menu block is probably the way to go. Then, once the block is output on the page, you can use the hooks I mentioned above to change the themeing of the menu block being output. You can access those blocks by checking `if(isset($element['#bid']['module']) && $element['#bid']['module'] == 'menu_block')`, then if you need a specific menu block check `$element['#bid']['delta'] == [block delta here]`.  I will add an answer to the other post to demonstrate adding a toggle to the sidebar menus only.
Comment: After taking another look at the other question it looks like @Robin answered it as asked.  If you have more specific theme questions that dont fit under either of these two questions can you add another question? That way we don't lose the answers to these two questions by changing up the question after the answers have already been given. Thanks!
Answer: I think you should create a menu block for the 1st and one for the 2+ level of main menu which you can format with css separately.
Comment: This will not work. The 2+ level links don't display at all. And I need to have the different level links still related to each other in some way so that when hovering over parent links the secondary wrapper opens and pushes down the content below it.

I am looking for a solution using templates.


Interface inheritance: what do you think of this:

Question: When reviewing our codebase, I found an inheritance structure that resembles the following pattern:
interface IBase
{
    void Method1();
    void Method2();
}

interface IInterface2 : IBase
{
    void Method3();
}

class Class1 : IInterface2
{
    ...
}

class Class2 : IInterface2
{
    ...
}

class Class3 : IInterface2
{
    ...
}

In Class2, Method1 throws NotImplementedException.
Questions:

What do you think in general about inheriting interfaces?
Does the relationship between IBase and Class2 violate the Liskov Substitution Principle?
Comment: Perhape the IInterfaces should be extending/implementing IBase...
Comment: ...and for the edited version, perhaps you could lose Class1 and Class3, seeing as they are identical to Class2.
Answer: Well, first of all, I'm generally against implementing an interface by throwing NotImplementedException exceptions. It is basically like saying "Well, this class can also function as a calculator, err, almost".
But in some cases it really is the only way to do something "the right way", so I'm not 100% against it.
Just something to be aware of.
An interface is a contract, by implementing the interface you say that you abide by the contract. If you then start negating parts of the contract, it sounds to me as the contract, or the implementation of it, was poorly thought out.

Edit: After seing Greg Beech's answer: If an interface specifically says that implementations should throw these exceptions, then it's part of the contract, then I agree that the class is fully allowed to do it.

As for the substitution principle, it states that:

Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T.

In this context, it violates the principle just as much as overriding a method from a base class does, if you change what the method does in the descendant type.
The principle is more detailed on the wikipedia page, like the following points (parenthesis and emphasis on my comments):

Preconditions cannot be strengthened in a subclass. (A precondition could be that "the class is ready for a call to this method at this point")
Postconditions cannot be weakened in a subclass. (A postcondition could be that after calling the method, something is true about the state of the class)

Since you have not shown the full contract of your interfaces, only the declarative part that the compiler can check, it is impossible to know wether the principle holds for your implementation of not.
For instance, if your Method2 has the following conditions attached to it:

Can be called at all times
Modifies the state of the object to be ready for the next event in a chain of events

Then throwing a NotImplementedException violates the principles.
However, if the contract also states that:

For classes that doesn't support chains of events, this method should throw NotImplementedException or NotSupportedException

Then it probably does not.
Answer: So, I'm assuming the question you're asking is:

If a derived type throws a
  NotImplementedException for a method
  where a base type does not, does this
  violate the Liskov subsitution
  principle.

I'd say that depends on whether the interface documentation says that a method may throw this exception to fulfill its contract. If so then it does not violate the principle, otherwise it does.
The classic example of thisin the .NET framework is the Stream class which has a bunch of operations such as Read, Write and Seek yet there is no requirement for a stream to support all of these operations, and are documented as being allowed to throw NotSupportedException.
Comment: Just to clarify, the methods `Read`, `Write`, `Seek` you mention are **`abstract`** members of a class, and therefore they are comparable to interface methods (that are in a sense also abstract).
Answer: Assuming I understand what you mean, then I think the answer is yes, inheriting interfaces is fine, and no, it does not violate the Liskov Substitution Principle.
The way to think about interfaces is as a "behaves like a" operator. It describes a set of behaviours which the class promises to obey, expressed by methods etc. So there is no problem having an  IBehavesLikeACat interface inheriting from an IEatsMice interface: if it behaves like a cat then it clearly eats mice. So a Cat would implement both, a ferret only IEatsMice.
Answer: First of all, inheritance in interfaces is OK, it applies in the same way as it does for class inheritance and is a very powerful tool.
Interfaces describe behavior, let's say an interface defines what a class "can do" so if you implement an interface you are declaring you can do what that interface specifies. For example:
interface ISubmergible
{
  void Submerge();
}

So is obvious, if the class implements the interface then it can submerge. Some interfaces nonetheless imply other interfaces, for example, imagine this interface
interface IRunner
{
  void Run();
}

That defines an interface that indicates that the class implementing it can run... nonetheless, in the context of our program is understood that, if something can run it can obviously walk, so you want to make sure that is fulfill:
interface IWalker
{
  void Walk();
}

interface IRunner : IWalker
{
  void Run();
}

Finally, about the whole NotImplementedException thing... I'm amazed with some of the suggestions. A NotImplementedException should never, ever, be raised by an interface method of a class. If you implement an interface your are explicitly accepting the contract that interface establishes, if you raise a NotImplementedException you are basically saying "ok, I lied, I told you I supported the interface but I really don't".
Interfaces are meant to avoid having to worry about what the class implements and what doesn't. If you take that away they are useless. Much more important, your fellows will expect such behavior, even if you understand what you're doing the rest of your team won't and even you, 6 months from now won't understand the logic beneath it. So class2 violates common sense and interface purpose. Class2 does not implement the IBase so don't claim it does.
Comment: If some implementations of an interface will be able to do something and some won't, and many clients would want to take advantage of the ability when it exists but could work around its absence, I would suggest that it's often better to include the method in the interface but requiring that clients either ask about its availability before using it or be prepared for it to fail, than to put the methods into a different interface and require that clients wanting to use the method must first cast to that interface.  To my mind, the widespread existence of client code that receives...
Comment: ...a reference to `Interface1`, tests whether it implements `Interface2`, and if so casts to that type so it can use `Interface2.someMethod()` is a sign that `someMethod()` should have been an "optional" part of `Interface1`.  To my mind, the ISP indicates that if some clients will be able to support `method1()` but not `method2()` there should be a way for a class to promise to support `method1` without promising `method2()`, but that doesn't imply they should be in separate types.  Indeed, run-time feature queries could make practical a finer separation of promises than types alone.
Answer: Throwing NotSupportedException is OK: this is the exception to throw when some interface functionality is not implemented by design.
It's less clear for NotImplementedException: this is normally used for code which is not yet implemented, but will be.  For example, stubs for interface implementations generated by Visual Studio 2008 contain the code "throw new NotImplementedException()".
See Brad Abram's blog for a discussion of this.
Answer: Inheritance in interfaces is used several places in the .Net framework. So while not everything in there there is perfect I suppose this is seen as ok. Look at the IEnumerable interface for example.
As to throwing NotImplementedExceptions I would say it depends on how you use them in your code. You can for example define an interface with several methods where some are optional. In that case you should check if the method was available and only use it if it was.


Unauthorized tow

Question: Followed by vehicle, who was acting suspicous.  Turned right on highway access road and the vehicle following me turned right across 3 lanes of traffic to follow me. Vehicle behind me hit their lights and with fake police today, like there are, I raced home (which was 3 blocks away.)  I figured if it was not the police, I could get home before them and they would not know where I lived.  If it truly was the police, they knew where I lived and would come to my house.  I pulled into my driveway and waited in the car.  The police did show up and approached me asking why I ran from them.  I told them just what I said above.  The sheriff then said, well you were following all traffic rules until you took off.  The sheriffs then ordered me out of the car, asked if there were any drugs in the car, and then proceeded to search the car.  When my roommate heard the sheriff yelling out front and saw the lights, she opened the front door and the sheriff told her to not come out of the house and to shut the door.  I was arrested for "evading arrest" and after the police car that I had been put in left my house, the sheriffs had my car towed.  CAN THEY DO THAT?
Comment: Sure they can, you should have immediately pulled over and called 911 if you wanted to verify the identity of the officers. Evading is evading, and they can tow your car if they suspect or have reasonable suspicion that you are hiding something.
Comment: I don't know that you're wrong, but I'd love to see some authority saying that they're allowed to tow a car from the owner's driveway in these circumstances, rather than just searching it.
Comment: @bdb484 It is possible that when they did the initial search they came upon a locked glovebox, backpack, purse, etc. that was not authorized by the individual. In this case they would seize the car and apply for a search warrant. Either that or the cursory search led them to believe there was more evidence that would be uncovered by a thorough search better conducted in a police garage.
Comment: Well, I guess we can always change/invent facts to make anything legal. But based on the facts the OP provided, is there any authority for a tow like this?
Comment: Please indicate the jurisdiction this  refers to. It soiunds like the US, was it? such laws vary by country.
Comment: If you were following all traffic rules until you pulled away from the car with lights, why did the police turn on their lights to pull you over?  Do you have any idea?  That may be relevant to your question.
Comment: If you "raced home" so that "they would not know where you lived", I suspect you were speeding so yet another broken law.
Comment: I don't see how the traffic offenses affect the answer. The officer obviously had probable cause for a stop; the question is whether the Fourth Amendment permits the tow.
Comment: If the officer had probable cause to suspect contraband, that justifies the tow. The traffic offense, standing alone, does not. The arrest justifies a search, but may not justify the tow.
Comment: Such laws and related court decisions vary by country and particular state. You didn't mention either, which makes it impossible to research or answer the question.
Answer: Assuming, pending information about the jurisdiction, that this happened in the US, the answer is it depends. As described in Justia's Vehicular Searches article and Wikipedia's Motor vehicle exception article, Under US law police can search a motor vehicle without a warrant if they have probable cause. This doctrine was first stated by the US Supreme Court in Carroll v. United States 267 U.S. 132 (1925) and later modified or repeated in Husty v. United States, 282 U.S. 694 (1931); Scher v. United States, 305 U.S. 251 (1938); Brinegar v. United States, 338 U.S. 160 (1949). All of these cases involved contraband, but in Chambers v. Maroney, 399 U.S. 42 (1970), the Court broadened the rule to evidentiary searches. See also Coolidge v. New Hampshire, 403 U.S. 443, 458–64 (1971)
In Preston v. United States, 376 U.S. 364 (1964) the Court ruled that the search must be reasonably contemporaneous with the stop, so that it was not permissible to remove the vehicle to the station house for a warrant-less search at the convenience of the police.
Subsequent cases have widened the scope of the exception, although the probable cause requirement has remained, and stops must have at least "articulable and reasonable suspicion". In the case of an ordinary traffic stop, the police may conduct a Terry-type search, based on "articulable suspicion". However, if the police arrest the driver, that is grounds to search the car under Atwater v. City of Lago Vista, 532 U.S. 318 (2001) and New York v. Belton, 453 U.S. 454 (1981)
Under Michigan v. Thomas, 458 U.S.(and Chambers v. Maroney, 399 U.S. 42 (1970); Texas v. White, 423 U.S. 67 (1975); United States v. Ross, 456 U.S. 798, 807 note 9 (1982).)  police may remove the car for a search elsewhere if they have probable cause to believe that there is contraband (such as alcohol, drugs, or weapons) in the car.
Thus the arrest justified a search, as described in the question. It might not have justified the tow if there was not probable cause to suspect contraband. But that depends on the detailed facts, and judging those is beyond the scope of this site.
In Collins vs Virginia (2018) the Court ruled that a warrant-less search of a car parked on the owner's property and within the curtilage was not justified. (The "curtilage" is the area near the house which gets additional Fourth Amendment protection, almost as if it were inside the house). However, in that case no arrest was made at the time of the search, and the search was based on an officer recalling the car having been used to elude arrest some two months previously, not just a few minutes before, so that case may not apply in the situation described above.
If there was no probable cause, any evidence found might be subject to suppression, and a suit for damages under sec 1983 might be brought against the officers and the police force, but that would depend on the specific facts, and would in practice require a lawyer skilled in such matters.

Unauthorized tow


What kind of philosophical questions on topic?

Question: What are the guide lines for philosophical questions to be on topic on this site?
Comment: Should this be added to the FAQ?
Answer: A simple rule for philosophical questions would be along the lines of: "How does (this philosophy) shape current techniques, strategies, practices, or symbolism in this art/lineage?" which is emphatically not the same as an out and out philosophical question.
So, you might ask, "How does Buddhism shape this particular style?" which is not the same as "Would throwing a knee at an opponent at this point be a form of attachment and contrary to the teachings of Buddha?"  The former is something you can easily point to the philosophy's own records along with historical records to reference, the latter is effectively a religious/philosophical debate.
If we want to nail this down tight, we probably should look back through every chi/ki-based question that gets shut down as poor vs. good questions and think about what the dividing line is in terms of both "evidence you can point to" and "questions we'd like to have on this site" as an excellent parallel.


How does equal moments of inertia of a rigid body affect mass-distribution $\rho(x)$?

Question: If the principal moments of inertia of a rigid body are all equal, i.e., $$I_1 = I_2 = I_3,$$ does that imply that the mass-distribution $\rho(x)$ in the rigid body is spherically symmetric?
Comment: Short answer no.
Comment: Possible duplicate of [Infer the shape of a solid given the moments of inertia](http://physics.stackexchange.com/q/270412).
Answer: No. The inertia tensor of any uniform density Platonic solid about its center is a constant times the identity matrix, the same form as that of a uniform density sphere about its center. Only the sphere has a spherically symmetric mass distribution.
Comment: A cube is a case and point of this.
Comment: @ZeroTheHero -- That's exactly what the initial version of my answer said. However, a cube is just one of the five regular 3D solids (the Platonic solids), all of which have a non-spherical mass distribution and all of which have the same moment of inertia about any axis passing through the center of mass.
Comment: Upon reading the question I immediately thought about the cube since this example was fresh in my memory.  I actually had not realized that all uniform Platonic solids had this property.  Thanks for your (more general) answer.
Answer: I think that you mean by $\rho(x)$ the mass density and that you by $x$ mean the vector $x$, so $\rho(x)$ is the mass density at $x$. Only in the case of a sphere which has the same principle moments of inertia, $\rho(x)$ is spherically symmetric. If $\rho(x)$ has whatever kind of relation to $r$, the magnitude of the vector $x$ (say $\rho(x)=r^2$), $\rho(x)$ is spherically symmetric.
Now consider the same sphere which maximum r to fit in a cube. If this cube has the same principle moments of inertia, the parts of the cube that stick out of the sphere have to have the same mass. If we assume that in those pieces of mass that stick out $\rho(x)$ has the same kind of relation to $r$ ($r\gt R$, where $R$ is the radius of the sphere) as inside the sphere, it is clear that $\rho(x)$ for those pieces of mass sticking out the sphere isn't spherically symmetric, which means that for a cube with equal principal moments of inertia, $\rho(x)$ isn't sherically symmetric (while it is for the sphere that is contained in the cube).
Comment: It is not clear what point you are making. That the mass distribution for a cube is not spherically symmetric? Isn't that rather obvious?


Finland plans to give every citizen 800 euros a month and scrap benefits. Will it become successful?

Question: Finland plans to give every citizen 800 euros a month and scrap benefits. Will it become successful?
http://www.independent.co.uk/news/world/europe/finland-plans-to-give-every-citizen-800-euros-a-month-and-scrap-benefits-a6762226.html
Comment: I think at the moment there is no study on the effect of a (substantial) basic income. However, from a microeconomic perspective it sounds like a great idea, since it will remove a lot of incentive distortion for low-income earners.
Comment: As the answer of Arthur Tarasov points out, it is very unclear what you mean by successful. Please edit your question to clarify this.
Comment: @HRSE There are studies, see this question and its answers. http://economics.stackexchange.com/questions/4444/the-case-for-basic-income-in-developed-and-underdeveloped-countries
Comment: Very interesting, I did not know about the Namibian BIG project. However, it seems this is not quite comparable, since the funds were obtained externally and not raised through a tax in that same region.
Comment: As well as the question linked by densep, this one also has some relevant material: http://economics.stackexchange.com/questions/1893/is-a-universal-basic-income-possible-in-the-united-states
Answer:
It will be successful in increasing economic growth. Removing benefits and giving everyone a fixed sum of money per month will disincentivize voluntary unemployment, remove moral hazard from benefit schemes, and encourage poor people to seek ways out of poverty. Also there should be less pressure on public infrastructure, including healthcare.
It will be successful in reducing the number of migrants seeking refuge in Finland.
It will NOT be successful in making life easier for the most poor and unfortunate.

From economic perspective, it should certainly be successful. It is hard to judge it from ethical point of view though.
Comment: How do you get to these conclusions? Why is there an effect on migration, why is there no positive welfare effect on the poor? These seem completely arbitrary claims!
Comment: @kbelder The refugees can get over 2000 Euros per month in some richer EU countries. A fixed sum of 800 Euros per month would be a reduction.
Comment: There is also no consensus on economic growth alleviating poverty(if it is not a pro-poor growth).
Comment: I agree with 1 and 3, but I'd like to hear your reasoning on 2.  As a note, I think this plan helps the productive poor, but hurts the unproductive poor... which is economically sound but (as you say) some may question the ethics of it.


How do I manually install vmware tools?

Question: I installed UBUNTU with Vmware Player on my Windows 7 system. For some reason Vmware Player cannot get the Vmware Tools files from internet, possibly a connection problem due to firewall limitations. I want to get the Vmware Tools files in compressed format if there is any, and then manually install it. Two questions:
1- Is there a link where i can download Vmware Tools files?
2- How do i install it manually? I'm using Vmware Player on a Windows 7 system. And if i download it, which folder should i unzip the contents? As you know, UBUNTU runs on a virtual disk, and to copy files on this disk i guess i have to use Vmware Tools. But i don't have it already.
Please help!
Comment: This is not about programming. Try http://superuser.com/
Answer: Here are three steps I used to install the VMWare Tools.  I got the steps from Ubuntu help.
install kernel headers so modules will work
needed this on a 10.04 guest running in a Fusion 3 host
apt-get install linux-headers-virtual
install kernel modules
apt-get install --no-install-recommends open-vm-dkms
EITHER: install tools for an xorg install
apt-get install open-vm-tools
OR: a headless install
apt-get install --no-install-recommends open-vm-tools

How do I manually install vmware tools?


why are my visual studio .obj files are massive in size compared to the output .exe?

Question: As a background, I am a developer of an opensource project, a c++ library called openframeworks, that is a wrapper for different libraries, like opengl, quicktime, freeImage, etc.  In the next release, we've added a c++ library called POCO, which is similar to boost in some ways in that it's an alternative for java foundation library type functionality.
I've just noticed, that in this latest release where I've added the POCO library as a statically linked library, the .obj files that are produced during the act of compilation are really massive - for example, several .obj files for really small .cpp files are 2mb each.  The overall compiled .obj files are about 12mb or so.  On the flip side, the exes that are produced are small - 300k to 1mb.
In comparison, the same library compiled in code::blocks produces .obj files that are roughly the same size at the exe - they are all fairly small.
Is there something happening with linking, and the .obj process in visual studio that I don't understand?  for example, is it doing some kind of smart prelinking, or other thing, that's adding to the .obj size?  I've experimented a bit with settings, such as incremental linking, etc, and not seen any changes.
thanks in advance for any ideas to try or insights !
-zach

note: thanks much! I just tried, dumpbin, which says "anonymous object" and doesn't return info about the object.  this might be the reason why....

note 2, after checking out the above link, removing LTCG (link time code generation - /GL) the .obj files are much smaller and dumpbin understands them.  thanks again !!
Answer: I am not a Visual Studio expert by any stretch of imagination, having hardly used it,  but I believe Visual Studio employs link-time optimizations, which can make the resulting code run faster, but can cost a lot of space in the libraries. Also, it may be (I don't know the internals) that debugging information isn't stripped until the actual linking phase.
I'm sure someone's going to come with a better/more detailed answer anyway.
Answer: Possibly the difference is debug information.
The compiler outputs the debug information into the .obj, but the linker does not put that data into the .exe or .dll.  It is either discarded or put into a .pdb.
In any case use the Visual Studio DUMPBIN utility on the .obj files to see what's in them.
Answer: Object files need to contain sufficient information for linking. In C++, this is name-based. Two object files refer to the same object (data/function/class) if they use the same name. This implies that all object files must contain names for all objects that might be referenced by other object files. The executable however will need the names visible from outside the library. In case of a DLL, this means only the names exported. The saving is twofold: there are less names, and those names are present only once in the DLL.
Modern C++ libraries will use namespaces. These namespaces mean that object names become longer, as they include the names of the encapsulating namespaces too.
Answer: The compiled library obj files will be huge because they must contain all of the functions, classes and template that your end users might eventually use.
Executables which link to your library will be smaller because they will include only the compiled code that they require to run. This will usually be a tiny subset of the library.
Comment: thanks - to clarify the obj files and exe are for the same project - ie, I am not compiling a lib and then compiling an exe from that lib.  I am compiling several c++ files into an exe, and the obj files that MSVC produces are huge in comparison to the resulting exe.


Ubuntu Networking Interface Name Help

Question: If I do an ifconfig I can see I have two interfaces, eth0 and eth1. However if I try and look at the network interfaces from the GUI, by clicking on the drop down menu on the top right of the screen, I can see wired connection 1 and wired connection 2. How do I know which one relates to which eth0 or 1? It's very confusing.
Answer: If you click "Connection Information" in Network Manager, you will see it.
And generally speaking, you either configure network using Network Manager or using CLI and configuration files. It is not supposed to use both.
If you change some settings for an interface in /etc/network/interfaces, Network Manager will stop managing that interface.
Comment: Ah this may be the reason for one of my interfaces not working properly in my machine. I changed a file using nano and now I don't see it in the Network Manager. Pilot6 you are very competent on Ubuntu it seems. Can you give me a couple of links to read about this topic please? Bare in mind that I am super good at networking (it's my speciality) so it's only understanding networking within Ubuntu that I am stuck with and not the actual fundamentals of networking itself.
Comment: @johnsmith You can just use internet search and you will find a lot of links to guides.
Comment: Ok I will do more research and come back if I get stuck. Thanks,

Ubuntu Networking Interface Name Help


S7 Edge - Boots into Odin Mode when trying to system update

Question: I have a rooted Verizon S7 Edge on 7.0 and whenever I try to do a system update, it reboots into Odin mode and does nothing. FRP lock is off and OEM unlock is enabled.
Answer: Rooted phone firmware cannot be updated as one does with unrooted device. Usually, you would need to unrooted, flash stock recovery and update or flash stock with Odin and then update followed by rooting.
There is an alternate way mentioned in this XDA post GUIDE -Easy way to update a rooted phone without losing data using FlashFire, which lets you retain your custom recovery and update using Flash Fire. In this process, apart from reducing steps your data and settings are intact
Comment: I  have no idea if your carrier imposes additional restrictions


SpringAOP, load-time-weaver, strange behavior

Question: in this moment i am facing one problem and really dont know what i am doing wrong. I am coding logging for my webservice using Spring framework and AOP in @AspectJ style. I got two bundles - background and frontend. In background bundle I have LogAspect, which look like this:
@Aspect
public class LogAspect {
    @Pointcut("@annotation(logMethod)")
    public void logMethodAnnotated(LogMethod logMethod){}

    @Before("logMethodAnnotated(logMethod)")
    public void beforeLogMethodAnnotated(JoinPoint jp){
        //actions
    }

    @After("logMethodAnnotated(logMethod)")
    public void afterLogMethodAnnotated(JoinPoint jp){
        //actions
    }
}

and META-INF/spring/background-osgi.xml:
<context:annotation-config />
<context:component-scan base-package="simon.background"/>

<context:load-time-weaver />

and also META-INF/aop.xml:
<!DOCTYPE aspectj PUBLIC
        "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>

    <weaver>

        <include within="simon.background.*"/>
        <include within="simon.frontend.controller.*"/>

    </weaver>

    <aspects>

        <aspect name="simon.background.log.LogAspect"/>

    </aspects>

  </aspectj>

In frontend bundle I've just put into aplicationContext.xml <context:load-time-weaver aspectj-weaving="on" />. But the code is acting very strange. I found out, that there is some problem, when I put into my advice methods JoinPoint as argument. (I mean, when I got advice methods without arguments, so there were no JoinPoin in method header, everything has been working fine and advices has been running before and after @LogMethod (my annotation, which I use to say, that i want to log this method) annotated methods). But now it is working like this:
- when I start server and so that the bundles are deployed for the first time, then the advices are run just for methods, they are @LogMethod annotated and belongs to background bundle, but not for annotated methods in frontend.controller.
- and in addition, when I have done some changes in one of my controllers, saved it and deployed just frontend bundle, then when I run @LogMethod annotated method, I got this error:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "simon.background.log.LogAspect.afterLogMethodAnnotated(Lorg/aspectj/lang/JoinPoint;)V" the class loader (instance of com/springsource/kernel/userregion/internal/equinox/KernelBundleClassLoader) of the current class, simon/frontend/controller/HuhController, and the class loader (instance of com/springsource/kernel/userregion/internal/equinox/KernelBundleClassLoader) for resolved class, simon/background/log/LogAspect, have different Class objects for the type /aspectj/lang/JoinPoint;)V used in the signature
Any ideas what is going on and how can i fix it, so my program will be able to run advices correctly?
One additional note, it could maybe help: When I run this in Debug mode with advices without JoinPoint argument, I realized, that both advices were running twice for one method.
Answer: On running twice, could it be because you are using both  and
 at the same time? Difference between <context:annotation-config> vs <context:component-scan>
Answer: Your pointcut has been triggered twice because your expression only constraints annotation type. When a method is called, call() and execution() are both match this expression so.
You can use @annotation(xxx) && execution(* *(..)) on your point cut to restrict the condition on execution only.


How is magnetization of a solid obtained from electron density in a DFT framework?

Question: What's the theory behind these kind of calculation? What are keywords and concepts I have to search for?
Answer: The main keyword you are looking for is the spin-polarized DFT. Other keywords that might help you are the spin-density matrix, the Hubbard model (DFT+U), the Stoner Model, von Barth-Hedin spin-polarized Kohn-Sham equation, etc.
A very good introductory resource on this topic is Ch1: Density-functional Theory of Magnetism by Gustav Bihlmayer in Handbook of Magnetism and Advanced Magnetic Materials (vol1): Fundamentals and Theory. Below I will try to summarize briefly.
The magnetization density can be written as:
$$ \mathbf{m(r)} = -\mu_{B} \sum_{\alpha, \beta}^{} \langle \Psi|\langle\psi_{\beta}^{\dagger}\mathbf{\sigma}_{\alpha\beta}\psi_{\alpha}|\Psi\rangle = -\mu_{B}\, \mathbf{s(r)} $$ where $\psi_{\alpha}$ is the field operator for an electron with spin $\alpha$ and $\sigma$ is the Pauli matrices. Notice that the magnetization density is a product of the negative of the Bohr magneton and spin density.
The key point is that the density matrix can be decomposed into two parts: a scalar particle density, and a vectorial spin density. Similarly,  the potential matrix can be decomposed into a scalar potential and magnetic field, i.e.,
$$ \underline{n}(\mathbf{r})=\frac{1}{2}\left( n(\mathbf{r})\underline{I} \, + \, \mathbf{\underline{\sigma}}\cdot\mathbf{s(r)} \right)$$
$$ \underline{v}(\mathbf{r}) = v(\mathbf{r})\underline{\mathbf{I}} \, + \, \mu_B\,\underline{\mathbf{\sigma}}\cdot \mathbf{B(r)}$$
Then instead of using the non-spin-polarized Hohenberg-Kohn version of DFT, if we use these spin-polarized matrices, we will get a spin-polarized Kohn-Sham equation (derived by von Barth and Hedin, paper).
This type of DFT is called spin-polarized DFT. Using this, you can obtain the magnetization of solids. Different DFT codes have different ways to enable spin-polarized DFT. For example, in Quantum ESPRESSO, one needs to set nspin=2 in the &SYSTEM namelist for colinear magnetic materials. There are other advanced options too such as noncolinear magnetic materials. You can find some of the examples by searching in this SE with keywords such as "Quantum ESPRESSO LDA+U".


HDRi and sun lamp vs Nishita sky texture

Question: I would like to know is there any benefit to use Sky texture node / Nishita with a bg backdrop compared to a HDRi and binding sun lamp. Also if you use Sky texture is there any benefit to add Sun lapmp with exact same position... Bit confusing, but I have feeling that you get cleaner results with sky texture and backdrop...
Comment: I guess Nishita (and others) is just a procedural HDRI. As for the sun it will create parallel light rays, it won't be the case for a simple white circle on a procedural or HDRI background.
Comment: An answer comparing performance of Sky Texture vs Hi-Res HDRI would be nice :)
Answer: The Nishita model is described in the paper Simulating the Colors of Sky.  The Blender Nishita Sky model is based on an updated version of the original model, but is very similar.
The difference between a sky model such as Nishita and the use of an HDRI is that the sky model attempts to deal with the way the atmosphere filters the light.  In a sky model, if you position the sun closer to the horizon, the light will be redder, than if you position it near its zenith.
Additionally, sky models attempt to account for the effect of clouds.
If you use an HDRi and a sun lamp, you would need volumetric lighting and cloud models to accomplish the same effect.  You would also have to model any clouds that you wanted to appear on the horizon.


1995 VW Eurovan OBD I to OBD II adapter

Question: My 1995 Eurovan has a check engine light coming on. I have a standard OBD II reader but this vehicle requires a OBD I reader. I see they sell OBD I to OBD II adapters online but I have read that with these VW's I won't be able to pull codes even with the adapter. Can anyone tell me if the adapter will give me the ability to read the code it is throwing?
Comment: try your local auto store, they should be able to read the codes for you (usually for free)
Answer: Usually on OBD 1 cars you can jump a pin and read the codes via a blinking light of some sort, refer to your van manual to find what pins to jump(with a paper clip) and then depending on the blinks the manual should have code read outs from that
Comment: The Bentley says - "Blink Method" - do not use, I have searched hi and low and cannot find instructions on what two wires to bridge?

1995 VW Eurovan OBD I to OBD II adapter


Word encompassing the words "above" and "below"?

Question: The word "sideways" can encompass "left side" and "right side".
Is there a word to encompass "above" and "below"?
Comment: For what it's worth I don't think Sideways actually covers the provided use case.
"The phone was on my left side" becomes "The phone was on my sideways". Beside is probably a better fit.

In a case where sideways was the correct word, Vertically would probably fit for the above/below variant.
Comment: It's not my specialist subject, but you might find some relevant terminology in texts that reference [***X Y Z planes***](https://www.google.com/search?tbm=bks&q=%22x+y+z+planes%22) (but I don't even know which letters correspond to ***left/right, front/back***, and ***top/bottom*** in that convention).
Comment: What @Jontia said. Fish and birds routinely relocate *vertically*, but humans only normally move *laterally* (sideways), so we don't really have much need for such a term.
Comment: @FumbleFingers: there's a group of 5 rectangles; one of the rectangles is in the center (let's call it  "pivot") and the other rectangles attach to one of its edges. That means there is an "rectangle above", a "rectangle below", a "rectangle left" and a "rectangle right". The left and the right rectangles can be called "sideways rectangles"; how can the above and below rectangles be called in a single word?
Comment: I agree with @Jontia that "sideways" doesn't necessarily cover your situation anyway. Why not **7** "cubes", rather than 5 "rectangles", in which case you'd also be looking for some word meaning *movement backward/forward, as opposed to left/right*? After all, real people are 3-dimensional, and it's often pretty much arbitrary which direction we call "forward" and which we call "leftward", for example.
Comment: @FumbleFingers: we're coding a layout algorithm and we would like a word replacing the "AboveAndBelowRectangles"
Comment: FumbleFingers - Good idea. This could be something like *x-axis neighbours* and *y-axis neighbours*.
Comment: Sometimes, `beyond` might fit?
Answer: I agree with the other comments, that I am not sure "sideways" serves the purpose you would like.
But if you are not trying to exclude to the left or right, I would say "the surrounding area" or "the surroundings", as this would encompass anything in the vicinity of the object of interest.
Otherwise, I do not know of a word specifically for above or below, but not to the side, unless you want to be more technical and say "along the vertical axis of" or something of that sort which is less concise though than saying above or below.
Answer: To fit your algorithm, I would say that 'vertical rectangles' would fit your needs best, as Jontia suggested. If that doesn't work, you could use FumbleFingers' suggestion and term the groups 'X Rectangles' and 'Y/Z Rectangles' (either would be correct in a 2D space). If you need them in opposing groups of two, that would definitely work.
If neither of these options work, let me know why. I might be able to edit in a better suggestion.
Answer: Building on  FumbleFingers'comment and answered's answer I suggest:
x-axis-neighbours (horizontal)
y-axis-neighbours (vertical)