If Thor does not hold Mjolnir, but he is worthy, does he possess the power of Thor?

Question: If you are not Thor, but are worthy and hold his hammer, Mjolnir, then you shall wield the power of Thor.
But if you are Thor, and are worthy, but do not hold Mjolnir, then do you still possess the power of Thor?
Comment: This is a Thor thubject.
Answer: Of course. Unless Thor is currently unable to reach Mjolnir, or he decides to lend Mjolnir to someone else, he will still retain the power of Thor, because he IS Thor. More importantly, the power is additive, adding itself to the powers of the person using it, making them even MORE powerful.

This is a complex topic because the power of Thor came in a variety of flavors depending on when you meet the God of Thunder:

Thor has a number of superhuman abilities which take place no matter whether he uses Mjolnir or not. His strength is greater than the average Asgardian due to his relationship with his mother, the Earth Goddess, Jord/Gaia. His strength is effectively limitless but has been measured as at least 100+ tons.
His Asgardian tissues are three times as dense as a normal Human. He is more durable and resilient than a normal human due to his enhanced molecular density. He is, especially when wearing enchanted Asgardian armor, resistant to normal Human weapons.
While Thor was growing up, he did not have Mjolnir. He simply had his great strength and was a capable warrior of Asgard. His hundreds of years of experience in combat are part and parcel to his fighting abilities and he is more than a capable combatant even without Mjolnir.

In Thor's youth he was strong and tough and fought against the enemies of Asgard with sword and shield. Later when Odin wanted Thor to take on more responsibility, he gave him the warhammer, Mjolnir. In the Marvel universe, Mjolnir was a gift that Odin reserved the right to revoke its capabilities to Thor as HE saw fit.

When Thor was deemed arrogant and unworthy, Odin took Mjolnir and the physical capabilities of Thor away from him and merged him with a mortal doctor, Doctor Donald Blake. This was part of an enchantment he cast upon Thor. By being the partially lame, Dr. Blake, Odin hoped Thor would learn humility and to love Midgard as a place to be protected.
When Doctor Blake found Mjolnir disguised as a staff, he would strike it upon the ground and become the Mighty Thor. The power of Thor was literally bound up with the hammer making an ordinary mortal, Thor. But Thor was not always aware of his complete heritage. The hammer also had a limitation that if Thor did not make contact with the hammer for 60 seconds, he would revert back to Donald Blake.

Thus the nature of the writing upon the hammer which implied that the power of Thor was completely held within the hammer. But technically, the power of Thor is two-fold. One part was an enchantment which released Thor's abilities to THOR who was depowered by Odin as a part of a punishment.
The Power of Thor is partially the ability to manipulate the energies, magic and capabilities of Mjolnir. But if Thor is lending the hammer to someone else (Superman for example) Thor doesn't lose his powers, or become enfeebled as he might have done once upon a time when Mjolnir had an enchantment where if Thor did not come into contact with the hammer in 60 seconds, it reverted back to a staff.
The second power of Thor is the ability to command Mjolnir such as Jane Foster does when she uses the Mjolnir in her guise as Thor. Since she is using the hammer at the moment, she is stronger, faster, more capable than she ever would be as a Human, so she is experiencing the Power of Thor as more than just a command of the hammer, but as an improvement of her physical abilities giving her a degree of superhuman strength, speed and resilience.

Thor Odinson, who currently isn't wielding Mjolnir, is no longer under a limiting enchantment, so he is able to retain his incredible strength, resilience and durability that is his as a son of Odin and Jord. He makes use of a mighty axe, Jarnbjorn and has a nigh-invulnerable metallic arm made of Uru.
There have been more than one instance where Thor is unable to reach his hammer, needed the help of another hero (Steve Rogers, as the Captain) who was able to partake of the power of Thor, particularly superhuman strength, while NOT taking away any of Thor's abilities from him during this temporary transfer of power.
As shown in this image of the Captain (Steve Rogers) using Mjolnir, he is using it because Thor is under duress. They are battling Grog and the Demons of Death. Thor is unable to summon Mjolnir to him. The Captain decides he should try and return Mjolnir to Thor, but knows normally no one can lift it. But he decides he has to try. [From Thor #390, 1988]

In this moment of extreme crisis, the Captain "levels up" in the worthiness quotient because Thor is unable to help himself and only with help will he be able to fight his way free. Steve Rogers IS worthy, but it is because in this instance he sacrifices himself as a warrior should, does he become warrior enough, and worthy enough, to wield Mjolnir and its power for even a moment. He does the right thing immediately after that and throws Mjolnir to its rightful owner.
For the record, Steve Rogers will wield the power of Thor during the 'Fear Itself' saga, but again Thor is "in extremis" and the Captain is wielding the hammer in order to bring the battle to the enemy and return the hammer to Thor. In both cases, Thor is temporarily incapacitated.
See Also:
Prior to the spell cast on Mjolnir, did Thor control lightning on his own?
Comment: Because Superman wasn't already ridiculously overpowered...
Comment: The earth goddess Earth. Those Norsemen/Greeks sure were inventive with their namings…
Answer: The current answer is from a comics perspective but this is tagged with the MCU tag and as of Thor: Ragnarok we have an explicit answer for this. In short yes you will still have the power of Thor. We see this a few times in the film, first when Thor and Hulk are fighting on Sakaar. But the best moment is probably the final fight montage on the Rainbow Bridge. It is worth noting that at this moment in time Mjolnir is destroyed.

And of course Odin even states as such that Mjolnir was only there to help Thor focus his powers.

Odin: Are you Thor, God of Hammers?  That hammer helped you control your power, focus it. But it was never the source of your strength.
Thor: Ragnarok
Comment: was just coming to see if that awesome line delivered by an awesome actor was cited
Answer: The Answer is: Of Course, YES
Thor, as the god of thunder, isn't dependent on his mighty hammer - Mjölnir. Thor has bunch of powers duo to Mjölnir, but he can still control weather, manipulate lightning and etc. Jason Aaron's Unworthy Thor run showed Thor can still do it. In his fellow times, when he didn't have mjolnir, he was still able to use his godly powers. For further information, you can read "The Unworthy Thor" comic. I know he is Unworthy there; but I don't think that'd make a difference.
Comment: A few things 1) the question is about the MCU (see the tags) not the canon as a whole. 2) You should [edit] in some evidence to back this up. 3) _"I know he is Unworthy there; but I don't think that'd make a difference."_ - the question specifically states if he is worthy so it makes some difference in regards to what is being asked here.


Why is my selfie flipped?

Question: I take a picture, facing front, and I get a reduplication of the reality in front of my with the right and left sides equivalent between earth and digital. However, once I step over to take a selfie picture reality gets reversed on the digital end, right to left and left to right. Why?
Comment: The theory is that it's like looking in a mirror, less confusing if you're using it as such. I've no official citation for that, so just as a comment.
Answer: While taking the selfie, the displayed image is mirrored so you can line things up easier. This is demonstrated in the first image.
After the photo is taken, the image is unmirrored and displayed naturally. This is demonstrated in the second image.
Answer: I'm a little confused by what you mean by reality getting reversed. It may help if you provide pictures.
Possible scenarios:
You may be changing the orientation of your device causing your camera to assume which way is up and down.
Or
You may have a orientation lock on your device as a whole, that is affecting the camera
Or
You might just be seeing your self from the view/ direction that your camera sees you.
Answer: In actual your selfie isn't fliped by Apple, in fact Apple is probably one of the very few Makers who keeps it the way it should be. But, even still if you want to change the selfie mirroring, then there are plenty of apps on AppStore as well. I am providing link for one of them . Mirror Selfie App
Comment: Welcome to Ask Different.  Please see [answer] for tips on providing good answers and avoiding downvotes.  Your answer doesn't add any additional info and just restates what other answers already provided.
Comment: @fsb yes I understand that's why I added a link for him as a part of solution to the problem he is facing. I hope this one qualifies as a good answer than previous attempt of myself.

Why is my selfie flipped?


How to batch fix background artifacts using actions?

Question: I have almost 700 small images of glyphs which are anti-aliased black on white backgrounds.  All the files have excess whitespace and I wanted to use the trim function in Photoshop to batch resize all the images using an action.  However, it turns out there are some non-perfectly white pixels throughout all the files causing very inconsistent trimming.  By using the paintbucket tool with a tolerance of 1 I am able to manually fix the backgrounds but I don't want to do that 700 times.  Is there a way to clean up these backgrounds using an action in batch processing?
Comment: Couldnt you use levels to blew the whites out to then trim?
Comment: Yes, that is solving a lot of them.
Answer: Create an action with the following steps.

Levels: Boost the white point enough to handle most, if not all, of
the images.
Select Pixels: From the Channels panel, Ctrl+click to select the active
pixels in the black channel. Or, if in RBG, select the active pixels
in R, then Shift+select the active pixels in G as well as B.
Selection: Invert the selection so that the marquee is around the
black. (Invert the marquee SELECTION, not the actual pixels)
Selection: Expand the selection by a few pixels to create a safe
zone. This helps round shapes to not have flattened sides at the boundary.
Crop: Crop to the expanded selection. This will ensure that the glyph is
centered with an even white space around the glyph.
Comment: This seems to get me a lot of the way there but the last step isn't behaving the way I expect.  It doesn't seem to crop all the way down to the selection.  Here is an example.  For some reason it's not cropping off the white space on the right.  I don't see how to embed this.  https://i.imgur.com/U3ZsM5U.jpg
Comment: The crop step isn't going to work unless all of the "white" area is completely white. Be sure to adjust the levels so that there are no pixels with gray or color in the white area. A good way to do this would be to find a darker example from among your source images.
Comment: Alternatively, you could add a pair of steps just before the Crop step as follows:
4.1 Selection: Contract the selection by 10 pixels.
4.2 Selection: Expand the selection by 10 pixels.
This will have the effect of deselecting any areas that are 10 pixels or smaller, leaving only larger selection, then the expansion will set the marquee back to the full size (hopefully without the scattered darker pixels.) It shouldn't matter if the end marquee doesn't conform exactly to the shape you are cropping, because the crop function only looks at top, bottom, and side extremes of the selection.
Comment: Well, I never could get this to work properly.  In the example I used I had already changed the white level to 220 which was working with a trim.  What worked in the end was changing to gray scale, adjusting white level, and then just trimming.  I followed that with a canvas bump to get a margin.  That worked for all images.


Nonlinearity of the J-K Flip Flop

Question: In Encryption Schemes for Computer Confidentiality, Pless describes how to use the J-K flip flop as a nonlinear combiner for linear feedback shift registers.
This generator was broken because the J-K flip flops are not correlation immune but my question concerns the basic nonlinearity of the J-K function itself: how do you measure its nonlinearity? For instance we know that Boolean functions with maximum nonlinearity are the bent functions, which have the farthest distance to all affine functions. Then we have the linear functions like XOR, so where would the J-K flip flop fit into this spectrum?
Answer: There's no way to reduce the J-K flip-flop to a boolean function, much less a 2-input boolean function. The J-K flip-flop is a 3-input block with a clock input in addition to inputs $J$ and $K$. Its output(s) is/are not a boolean function of these inputs, because past output(s) matters to future output(s).
If we want to model a J-K flip-flop using boolean functions, we can do this in several ways, including two identical 3-input functions $Q(I,B,C)=(I\cdot B\cdot C)|\bar B$, where $I$ is $J$ for one function and $K$ for the other, $B$ is the output of the other function, and $C$ is the clock, as per this schematic:

Knowing the initial state $Q$, and the inputs $J$, $K$, $C$, this allows predicting future $Q$, except for some inputs where $C$ changes near-simultaneously with either $J$ or $K$.

The article considers a J-K flip-flop with single output, sharing its clock input (made implicit) with the sources feeding its other two explicit inputs $J$ and $K$. The model given is:

a gated D latch with single output (as used for individual bits in a Linear Feedback Shift Register);
and a (boolean) feedback function, which 3 inputs are $J$, $K$, and the output.

The state (noted $R_n$ in the article) of the output $Q$ of the J-K flip-flop at a certain clock period $n$ is
$$R_{n+1}=((J\oplus \bar K)\cdot R_n)\oplus J$$
(as can be deduced from any proper model of the J-K flip-flop, including the above model as two boolean functions). And thus, in a modern exposition, anything using the J-K flip-flop in this clock configuration can be readily expressed in the framework of Non-Linear Feedback Shift Registers.

In the shared clock configuration of the article, the J-K flip-flop's feedback function given above is a 3-input, 1-output boolean function $F(J,K,R)=((J\oplus \bar K)\cdot R)\oplus J$, where the additional input $R$ is the previous output. The truth table for $F$ can be condensed from the normal $2^3$ entries to
$$\begin{align*}
J&K&F\\
0&0&R&\text{ unchanged}\\
0&1&0&\text{ clear}\\
1&0&1&\text{ set}\\
1&1&\bar R&\text{ toggle}\\
\end{align*}$$
This function $F$ is balanced (that is, half of the $2^3$ outputs are 1), and $F(J,K,R)\oplus R$ is also balanced. $F$ is non-linear w.r.t. each of its inputs (that is, the XOR of the output with any input is not a function of the other inputs).
$F$ is not correlation-immune: the output is biased towards $J$, and towards $\bar K$. This indeed allows an attack in the context of combining LFSRs, but replacing $F$ with any 3-input boolean function can't improve this; enumerating the 256 such functions, we would find some issue with the output (ordered from worst to least):

severely biased (that's why we want $F$ balanced);
severely correlated to the previous output (that's why we want $F(J,K,R)\oplus R$ balanced);
equal within polarity and a clock delay to one of the two inputs, which (being a LFSR) is efficiently predictable using the Berlekampf-Massey algorithm;
equal within polarity and a clock delay to the XOR of the two inputs, which is efficiently predictable by the same method, because the XOR of the outputs of any two LFSRs is identical to the output of another LFSR of size at most equal to the sum of the sizes of the two LFSRs;
just as correlated with the inputs as in the J-K flipflop case.

Note: I'm not familiar with the definition of bent and semi-bent functions, and won't attempt to classify where $F$ belongs, but that should be trivial from the definition of bent and semi-bent, whatever that is.
Note: The J-K flip-flop seems to be one of the simplest two-inputs combiner with memory worth consideration in the framework studied by Frederik Armknecht and Matthias Krause in Algebraic Attacks on Combiners with Memory (Crypto 2003).
Comment: @DW , Yes I am aware of how hard it is, but I like the challenge. But now that I am retired, its either design something new or watch "Gilligan's Island" re-runs. Oh, and by the way, if I were you, I wouldn't bet against me ;-)
Comment: OK < thanks for the info, this is interesting. According to some papers I've read bent functions have to have an even number of variables, so according to your analysis, the flip flop can't have the same nonlinearity as the bent functions. I will wait for more answers here, hopefully someone will enlighten us.
Comment: So let me ask this question: if the J-K flip flop was correlation-immune, it could be considered a strong cryptographic combining function?
Comment: @WilliamHird, I think you might have a misconception.   It sounds like you want to design a secure stream cipher, and your approach is to try to find a function that in isolation has some combinatorial properties.  This has two problems: (1) to design a secure stream cipher, you need to look holistically at the entire design; you can't just pick out one component/function used in the stream cipher and say that "since it has properties X,Y,Z, the cipher is secure"; (2) designing secure ciphers is very hard, and you're unlikely to do better than existing state-of-the-art schemes.
Comment: @grieu, Nice work, answer accepted. You are the "hardest working man in cryptography !
Comment: @DW: I'm curious about your comment that "I'm unlikely to do better than existing state-of-the-art schemes: what do you think you know about me that would lead you to make such a broad statement? Seems rather presumptuous on your part, no? Hello?

Nonlinearity of the J-K Flip Flop


Where can I find a python GDAL 1.8.0 package?

Question: I have python 2.7.4 installed on my RHEL 5 machine along with gdal-devel-1.8.0 and gdal-1.8.0. I tried to install the GDAL 1.9.1 package available on python's page (https://pypi.python.org/pypi/GDAL/1.9.1) but got errors that are related to trying to install v1.9.1 when my gdal libraries are 1.8.0 (see Error installing GDAL 1.9.0 python package). I can't find any other versions of python GDAL bindings. Can anyone help me please?
Comment: Is there a `gdal-python` package available as well? that's how its usually installed.
Answer: Have a look here: http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries.  This gives you links to GDAL binaries for all sorts of operating systems and the first item is for ELGIS, supposedly including RHEL.  Also see here.
I mostly use Windows and get my binaries from the excellent gisinternals link further down the page, so I can't vouch for the binaries, but since the links are from osgeo, I'd expect them to be good.
Comment: Thanks but I have the GDAL libraries/binaries installed for ELGIS already (v1.8.0 available at that website). The problem is that the only python package (bindings) I can find are for version 1.9.1 and apparently they are not backward compatible. I need python bindings for 1.8.0.


How to reset to default permissions on El Capitan

Question: During development and debugging I have changed permissions of various files and folders using chown and chmod on my local system (I didnt maintain the list of changes). Now that I have fixed the issue, i fear of security consequences.
Any way I could restore the default permissions and/or find vulnerabilities in terms of network security or other potential loop holes that might create due to my changes.
Answer: For system installed packages you can run the following command in Terminal.app to find permissions that differ from the default:

sudo /usr/libexec/repair_packages --verify --standard-pkgs /

If you want to just apply those permissions to your system as a whole, run the following command:

sudo /usr/libexec/repair_packages --repair --verify --standard-pkgs /

Or you could individually fix the permissions that you have changed yourself using chmod/chown.
For everything else, you need to have used either a package manager that can verify permissions, or have a backup you can use for comparing permissions before and after the event.
For others: Please note that the repair_packages command no longer exists in Sierra and newer macOS versions, as they now automatically handle repairing permissions. If you have manually messed up permissions so much that they cannot be fixed automatically, I would recommend restoring permissions from a Time Machine backup or similar.
Comment: @Geekarist You're running a too new version of macOS. If you're on Sierra or later, it won't be there.
Comment: good point, I should have included that in my answer too. However, that will only verify, to fix you'd need `sudo /usr/libexec/repair_packages --repair --standard-pkgs /`
Comment: Yes, I'm aware that it only shows the changes. This was intentional as the user did manually change some permissions, so I assumed he would be able to tell afterwards which of the changes were due to his own actions, and which were already changed before he did his thing. But I'll include it in the answer!
Comment: The command returns an error:

`sudo: /usr/libexec/repair_packages: command not found`
Answer: It depends on your OS.
Yosemite

Use Disk Utility to reset System permissions.
Reset Home folder permissions & ACLs using OnyX  - Maintenance tab/permissions, tick the box at the top then Execute.
For belt & braces, apply [or-reapply if already up to date] 10.10.5 using the 10.10.5 combo update, not the delta from App Store

El Capitan

Reset Home folder permissions & ACLs
This has become more complex since El Capitan because of System Integrity Protection, but is still possible by booting to Recovery Mode...

At boot, hold  Cmd ⌘   R  at the chimes
At the recovery screen, open Terminal from the Utilities menu.
Type in resetpassword and hit Return\Enter. A Reset Password window opens.
Select your username from the drop-down menu labeled Select the user account (NOT System Administrator/root).
Click the Reset button at the bottom of the window in the Reset home folder permissions and ACLs section.
Quit the Password Utility and go back to the main recovery screen.
On your keyboard, press  Cmd ⌘   Q   and restart your computer (or Select   > Restart from the menu bar). It's very important that you don't hold down the power button to exit the recovery session, or the ACL reset won't be performed.

For belt & braces, apply [or-reapply if already up to date] 10.11.5 using the 10.11.5 combo update, not the delta from App Store
Comment: This answer is not correct, as this will only fix permissions on the user's home folder. As the question is related to security, networking, etc. - it is vital to check the permissions on systems folders as well. In addition, the question specified El Capitan, so the answer for Yosemite cannot be used there.
Comment: @jksoegaard I didn't spot that el cap was tagged - tbh, mentioning it in the tag only is not the accepted AD method, it should also be in the question body. However - re-applying the combo update will fix system perms, which makes the answer actually correct ... & more complete than verifying system perms only.
Comment: No, it actually doesn't. Applying the combo update will only fix permissions for the stuff included in the combo update. All other installed packages (i.e. optional packages, packages from third parties, etc.) would not have their file permissions fixed with the combo update. With the repair_packages command I wrote about, any changed permissions would be shown for files coming from a package install.
Answer: I accidentally changed the ACLs permissions on my home folder and had the same problem on my MacBook Pro running macOS Sierra version 10.12.2
Follow the step below to changed the folders No Access permissions and revert back to Allow access:
Restart with the Command and S keys held down, and run the following commands:
mount -uw /
chown root /
chmod 1775 /
exit

After the last command "exit" your system should restart on its own and everything should appear the same as the time before you changed the Home folder permissions.


OS X Server Mavericks stuck on "Preparing Services"

Question: I am trying to install OS X Server app version 3 on Mavericks system. I tried everything, including manually deleting all server app files and making clean install, but nothing works. Whenever I start the installation process, it sticks on "Preparing services". The app keeps respond, but no HDD activity is visible at all. Does somebody encountered the same problem?
Comment: What does the log say? (/Library/Logs/ServerSetup.log)
Answer: Try resetting Server.app permissions:
<code>sudo chown -R root:wheel /Applications/Server.app
sudo chmod -R g+rx,o+rx /Applications/Server.app
</code>
This has been discussed on this Apple Support Communities thread:

https://discussions.apple.com/message/24122772#24122772
Comment: I already tried this, but it didn't help. Will try again.
Answer: As I am advising you, which you have done already after removing server.app setting. Have you re-download the same app from Apple site? after all this- have you  restart your configuration? If no then it might be the reason else yes then you can take a help by visiting here-
Read More: https://support.apple.com/en-in/HT200271


Why does my dishwasher back up my sink?

Question: My dishwasher backs up my sink when the water is expelled during the washing. Eventually the water drains and I can use my sink no problem. What can I do to prevent my sink from filling up?
Comment: Has this always happened (since the dishwasher was installed), or has it just started?
Answer: It sounds like you have a fairly typical dishwasher set-up whereby it drains into your garbage disposer. If the dishwasher is expelling a larger volume of water than can be drained through the garbage disposer and its drain plumbing, that sounds like you have a blockage.
If you have a two-bowl sink and the bowl with the garbage disposer is the only one that drains slowly, then the blockage is either in the garbage disposer or in the drain pipe that connects the garbage disposer to the drain for the other bowl. This is fairly common and happens when people use their garbage disposer for its intended purpose, and large food chunks or slices get caught in there. You can usually access this pipe fairly easily and clear the blockage. Then you can stop using your garbage disposer and instead compose all the junk you were throwing down the drain. :)
If, on the other hand, the bowl without a garbage disposer also drains slowly when you run the water, then the blockage is downstream of the sink and you may need to call a plumber, or else use a snake yourself to try to clear the blockage.
Comment: Sometimes running the garbage disposal (which it's not actually clear if @Mike Cohen has, as he does not mention one) as the dishwasher empties can help clear things out. With most kitchen sinks, suspect a grease clog...

Why does my dishwasher back up my sink?


Erdos distance problem n=12

Question: The recent paper On the Erdos distinct distance problem in the plane
Authors: Larry Guth, Nets Hawk Katz prodded me to get a non-trivial example.  Here is what I cannot find:  an example of 12 distinct points in the plane with only 5 different distances between points.  The regular 12-polygon has 6 different lengths but I cannot do better. http://oeis.org/A186704 implies that there is one>
Answer: Here goes my poor explanation:
Take a regular hexagonal lattice with distance 1 between nearest neighbors, and choose a 15-point equilateral triangle in this lattice (15 is a triangular number). Remove the 3 vertices of the triangle. You'll be left with 12 points and 5 distinct distances.
Edit: Just checked the OEIS reference, and it's available on Google Books. The picture you want is on page 200.
Answer: If I may supplement Logan Maingi's apposite answer with a snapshot of the page to which he refers:

(I couldn't resist including the surrounding conjecture.)
Comment: Coming to this very late, but this suggests an interesting secondary conjecture: that a maximal set of points for $k$ distinct distances can always be realized as a subset of the triangular grid. Given the form of the conjecture I presume this has to be wrong, but is a specific $k$ known for which this isn't true?
Comment: Thanks! I tried to no avail to embed the image, but I'm still rather bad with TeX and couldn't get it to work.
Answer: Thought it might be nice to show the set placed on the hexagonal lattice.

Here's a Desmos link if you wish to play around with such point configurations.

Erdos distance problem n=12


Counter-Attack Houserule

Question: I'm thinking of making a house rule for Pathfinder which lets you counter attack when your opponent rolls a natural 1 to attack. First, is there already a counter attack system in Pathfinder? If not, how will my house rule impact the balance of the game?
Comment: I think I'd resent that as a player; if having just got an extra attack and facing a BBEG then not making it as I'd be as likely to get hit as the BBEG was to getting a hit on me.
Comment: At higher level, especially for monks with flurry (4+ attacks) this could get potentially very nasty for the players. I'd not be keen for this 5%+ chance every roll that the enemies get to beat me up.
Comment: You should check out http://rpg.stackexchange.com/questions/2/is-a-fumble-on-a-natural-1-an-official-rule/12650#12650, which is a similar question for D&D3.5, but the answers there apply to Pathfinder as well, and there are several interesting suggestions for house-rules.
Comment: @Rob you could not make the lower attacks if you weren't likely to hit.
Comment: One important consideration is that characters who are good at melee would provoke more counterattacks than characters who aren't - which is to say, if a twentieth-level fighter was having a punch-up with a first-level commoner, the fighter would provoke twice as many counterattacks as the less-skilled combatant. In other words, being better at combat makes you more likely to leave exploitable openings in your defenses; This may be seen as a bit weird.
Answer: There is no "counter attack" system in Pathfinder as such.  First off attacks are presumed to be happening at the same time, and swords, maces, and fists are expected to be flying all the time.  The closest thing in Pathfinder is the Attack of Opportunity which models how attacking a character when they have effectively left themselves open, by casting a spell, running past, or some other mechanism.
Let's look at what your suggesting as an attack of opportunity.  If you only have it occur on a natural 1, it will happen 5% of the time to all characters regardless of skill.  Obviously it benefits characters in melee more as an opportunity to damage and causes a problem as they are taking more damage.  It's not going to effect casters or ranged characters much since they aren't making attacks in melee often.  It also benefits melee characters who have Combat Reflexes (can make more than one Attack of Opportunity) as they would be able to take advantage of it more often.  It may also discourage a character from making all their attacks if they have multiple attacks.  If you have 3 attacks, and the lowest only has a 10% chance to hit, but also involves a 5% chance of a counterattack you might not take that chance.
In short you will increase the lethality of melee combat slightly across the board, and improve the attractiveness of Combat Reflexes, while slightly decreasing the attractiveness of multiple attacks.  It probably wouldn't be game breaking, but it would certainly affect play.
It would also affect the flow of play.  Your combats will be interrupted more often with players making out of turn actions more often 5% of the turn for every attack made.
Comment: That's what I'm saying, in the off-chance that my concentration check is low then this would be just another way to destroy my caster. One's plenty, they tend to be squishy.
Comment: @LitheOhm How many times would he be casting a ranged attack spell within another creature's reach?  I wouldn't expect that to effect him, now his melee touch spells are another matter...
Comment: +1. I know my caster would hate this rule because his ranged touch spells still require an attack roll, and even if you make the check to cast defensively you can still be screwed.
Comment: When the big baddie in my face isn't the thing I need to kill next. Flesh golem in my face but nimblewright keeping the fighter from saving my ass, guess who's getting a scorching ray?
Comment: @LitheOhm true, but you already had some risk there of failing the combat casting check.  This is only an incremental change in a very narrow situation.
Comment: The last paragraph is important. Seems that a brawl with 7 entities (perhaps 3 PC and 4 NPC) would have a fumble-counter-attack happening about once every 3 turns.
Answer: One way to include this as an idea, would be to draw on the Parry class skill that was included in the Neverwinter Nights games.
It was a Dex based skill available to the non-arcane casters(except bards so only sorcerer and wizard didn't get it as a class skill). The check used a fluid DC

The difficulty class is the modified attack roll of the incoming blow.
  A successful parry means that the attack does not damage the parrying
  character. A character may only parry a number of attacks per round
  equal to the number of attacks per round available to the character

In addition, if a Parry exceeded the attack by more than 10 points, then it allowed a counter-attack. Each successive counter-attack took a cumulative -5 penalty to the roll(along the lines of the penalties to BAB for multiple attacks). Wearing armor applies the check penalty as per normal for Dex skills.
Answer: The big issue with just making it a natural 1 is that this makes it more frequent than critical hits, which become a problem when the players make so many more rolls than the enemies.
One thing you could do, though, is invert the threat/confirm system: a natural 1 on an attack roll creates an "opening threat," and the player must make a second "confirmation" roll with the same modifiers. If that roll also misses, then the player has provoked an attack of opportunity from the target. The target must still obey the usual AoO rules when countering -for example, they must be able to actually reach the attacker- or else the counter is negated.
This should keep things relatively balanced versus critical hits. It gives some advantage to reach, range, and higher BABs: the former two reduce the amount of foes that can counterattack you, and the latter reduces the number of times you leave yourself open in this way. Then again, that could be considered a touch of realism.

Counter-Attack Houserule


Espérance vs espoir?

Question: I see that both of these seem to translate to the noun hope. What is the difference between them, if any? It seems that one gives espérance but has espoir.
Answer: Espoir seems to be more focused, and more tangible. Espérance refers more to a state of mind, more like optimism. Espoir is widely used in French, as opposed to espérance which is a not-so-used word.
ex. J'espère (j'ai l'espoir) que le repas sera bon (I hope the meal will be good). vs Il est plein d'espérance (he is full of hope)
Comment: I would add that espérance applies in religious or spiritual contexts.
Answer: while "espoir" (https://fr.wiktionary.org/wiki/espoir) -which is the  "Déverbal" of "espérer"- is a neutral,abstract,down-to-earth and everyday life word,"espérance"(https://fr.wiktionary.org/wiki/esp%C3%A9rance) is formal and more focused on the action by itself...
In deed,"espérance" can be split into the stem that comes from "espérer" plus the sufix "-ance" which gives all the nuance to that word :the sufix "-ance" indicates an action or the result of an action (https://fr.wiktionary.org/wiki/-ance).
"espérance" is widely used in theological literacy and mathematics :

l'espérance mathématique d'une variable aléatoire réelle est, intuitivement, la valeur que l'on s'attend à trouver, en moyenne, si l'on répète un grand nombre de fois la même expérience aléatoire

(https://fr.wikipedia.org/wiki/Esp%C3%A9rance_math%C3%A9matique)
Finally,i dare say that "espérance"" is for situations in which we are sure about the result while "espoir" has a nuance of great uncertainty.
Answer: Espoir est horizontal, espérance est vertical. Espoir is horizontal (concrete, grounded, material...), while espérance is vertical (spiritual, inspirational, greater...)
Answer: Correct usage is L'espérance de vie and not L'espoir de vie that could help clarify usage for both. That's how I came to this anyway, always thought the correct term was "espoir de vie"
Comment: *L'espérance de vie* (futur) est d'environ quatre-vingt ans, avec *l'espoir d'une vie* (matérielle) meilleure grâce aux progrès de la médecine

Espérance vs espoir?


drupal webform sliding radio button

Question: I m trying to build a form that has questions with radio button answers when someone clicks on a radio button the next question comes up and it should have a next and prev button is there any php code i need to put in? or will it be just jquery as i m very new to php and javascript
Answer: You may use Webform module and read this.
The full documentation is at http://drupal.org/documentation/modules/webform.
You can achieve the conditional field with Webform Conditional.

This modules enhances the existing Conditional Rules of the Webform
  Module. It adds the ability to make components dependent on select
  components(i.e. listboxes, radio buttons, and checkboxes) that appear
  on the same page.

Here's a youtube video Screencast demo.

Webform already has support for conditional fields on multi-page
  forms. For example Field C on Page 2 can be dependent on Field A on
  Page 1. This module adds the ability to have conditional fields on the
  same page. This module adds the ability to have Field B on page 1 be
  dependent on Field A also on Page 1.

Check the version of the Webform module; you may have it already.
Comment: i have done that but what i want is when someone clicks on a radio button the next question slide out instead of clicking next page button.
Answer: You can have a look at https://drupal.org/project/webform_ajax_page it renders all pages at once and uses AJAX to go to the next page, you might be able to add a sliding effect by hooking into the javascript
Answer: The conditional field module will let you set conditions for a field to appear or not.
For example if the question is do you have a cat? Then fields like:
Siamese
Stray
Kitten
And if you click on the radio button dog:
German Shepperd
Bulldog
Pitbll
Ect...
http://drupal.org/node/1704126 does this

drupal webform sliding radio button


"Long have we waited for this day "Long we have waited for this day."

Question: Which one is correct? Normally its subject verb and this is not a question but I still think the first option is correct and possibly even better.Why?
Comment: Either is possible.
Comment: This is not everyday English. What is the context? If you can bring your question into scope, someone may be able to provide a more considered answer.
Comment: "Long have we waited for this day." Anything with for I guess. Or an adverb "Long have we waited, now its time."
Comment: You need to edit your question. You know the rules.
Answer: English has a strong preference to put the verb second in declarative sentences (the second element, not necessarily the second word). This means that if something other than the subject precedes the verb, there is a tendency to invert the verb and the subject:

Long have I waited for this day.
Never had he seen such a thing before.
On no account should you approach him.

Sentences like these are rather literary: in normal speech you would not start with the adverb, eg "I have waited a long time for this day".
Note: all this does not apply when the element at the start is a linking item, such as "and", "otherwise", "or else".

Otherwise you can wait.

It also doesn't apply when the item is not in the same breath group (usually set off with a comma in writing):

In any event, that's my answer.


What kind of canoes were used in 19th century Yucatán?

Question: I'm specifically curious about seagoing canoes along the coast of the Yucatán Peninsula in the mid-1800's. Were they still typically of the dugout variety, or had they evolved to canvas on a wood frame or some other construction? What size would they typically be? Were they fitted with outriggers?
Comment: Could you tell us anything about the people that were using these watercraft?
Comment: @AaronBrick Mayan, specifically, although I have trouble believing that the craft used by native versus colonial people as late as the mid-19th century would be all that different.
Answer: It seems the dugout variety canoe mentioned in the question was likely to be the variety encountered still in the mid-19th century. An ethnology titled THE MAYA INDIANS OF SOUTHERN YUCATAN AND NORTHERN BRITISH HONDURAS by Thomas W. F. Gann, published in 1916 has a section concerning boat building:

The Indians living in the neighborhood of lakes and rivers possess
  dories or canoes which vary in size from tiny craft 5 to 6 feet long
  by 16 to 18 inches beam, capable of holding only a single individual,
  to large craft 25 feet or more in length, large enough to hold a dozen
  people. All their canoes are constructed by the simple process of
  hollowing out large logs, the more durable ones being made from cedar,
  the lighter ones from wild cotton (yaxche).

We can assume that if this was the process observed in 1916, it was likely also in use in the mid 1800s.
I have not found direct reference to 19th century use of dugouts at sea, but we do know they were used at sea at a much earlier time. A Wikipedia article on Mayan Maritime trade discusses an early sighting:

As of yet, there have been no discoveries of an intact ancient Maya
  canoe, however artistic representations from prehistory as well as
  descriptions from Christopher Columbus' son, Ferdinand, provide rich
  details about what these vessels were like. Ferdinand tells of an
  encounter with a Maya Canoe in the Bay of Honduras near the Bay
  Islands during Columbus' fourth voyage in 1506. Bartolomé de las Casas
  describes the encounter:
"There arrived a canoe full of Indians, as long as a galley and eight
  feet wide. It was loaded with merchandise from the west, almost
  certainly from the land of Yucatan, for that was near there [the Bay
  Islands], a matter of thirty leagues or a little more. There was in
  the middle of the canoe a shelter [toldo] of palm matting, which they
  call petates in New Spain. Inside and under this were their women and
  children, possessions, and merchandise, so that neither rain nor sea
  water could wet anything. . . There were in the canoe up to
  twenty-five men."[9]

Since an earlier question by this OP indicate research into this time and location as a setting, it might be worth noting that during this time frame (mid 1800s) the indigenous Mayan peoples of the Yucatan peninsula were embroiled in a civil war of their own, the Caste War of Yucatán.
Comment: I have been working the Caste War into the story.
Answer: I'd like to offer another interpretation: the Mayans may not have been using oceangoing canoes at all by the 19th century. Smaller dugouts for inland waterways did continue to exist.
Larger vessels are more stable in the ocean, and the historical record of the contact period repeatedly mentions substantial Mayan coasting vessels; see J. Eric S. Thompson for the stories and details. However, Norman Hammond found no later evidence at all of large Mayan canoes. Specifically, according to Erik Vance,

... of the thousands of boats that once littered the coasts, all that has survived is a single canoe preserved in peat soil that dissolved almost as soon as it touched the air and a couple of paddles discovered in Belize.

Also note that the maritime port at Vista Alegre was abandoned 500 years ago.
Comment: Interesting. Is there mention of what these coasting vessels were?
Comment: Yes, I just added a source to provide more details on what is known.
Comment: Thanks. It makes a lot of sense that by 1867 coastal Mayans would be using more modern craft than a dugout canoe.


Reattach images to media library items after optimization?

Question: I was able to download all the legacy image files in my media library via an ASP.net script (https://gist.github.com/DaveGoosem/6289015), in order to optimize them.  I've finished doing this and now want to re-upload/attach them to the media items and replace the old ones.  Wondering if there is an easy way to do this either via .Net or via a Powershell script?  There are hundreds, so I'm not keen on replacing them manually within the content editor!
Comment: You are probably better off using SPE Remoting to download, run optimizer, and upload rather than mix it up with the page.
Comment: What tool you used to optimize images?
Answer: This can certainly be performed using Sitecore PowerShell Extensions. Read more about setting up SPE Remoting here.
Example: The following gets an item and uploads through SPE Remoting.
$session = New-ScriptSession -Username "sitecore\admin" -Password "b" -ConnectionUri "https://remotesitecore"
$localFilePath = "C:\temp"
$filename = "kitten.jpg"
$filenameWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($filename)
Get-Item -Path "$($localFilePath)\$($filename)" | Send-RemoteItem -Session $session -RootPath Media -Destination "Images/"

If you wish to update using a GUID then the command changes slightly like this:
... | Send-RemoteItem -Session $session -RootPath Media -Destination "{GUID}"

Check out the modules directory for more samples here.
Comment: So, the problem is that our media library has many folders so I can't just dump them all into a single directory.  You think it would be difficult to look for the originating item by the filename and then re-attach it to the appropriate item in the correct folder?
Comment: Not at all. I've updated the example to show how to update with the item ID.
Comment: Interesting.  So that will grab the filename from the local folder, match that to an item based on the attachment, and then upload that file and replace the attachment with the new version?  Or are you assuming that the local store's file name has the GUID in it?  They do not, they are regular descriptive filenames...
Comment: You can either use the filename or GUID to replace the blob for an existing item. If for example you downloaded the item and maintained a csv of IDs then the GUID would help. Perhaps sticking with the filename and match on that is your best option here.
Comment: Ok, well, I've found I think another way to do this - using the [Media Conversion Tool module](https://marketplace.sitecore.net/en/Modules/Media_Conversion_Tool.aspx) to convert items to using the file system, then optimizing the items in place.  After that we may or may not reconvert them back to db blobs.  This will require doing the optimization process again, but that seems a much easier lift than working through the powershell scripting syntax which I'm pretty unfamiliar with in order to work properly...
Comment: You can also use SPE to convert the db items to file items. I look forward to hearing that the Media Conversion Tool helped solve the problem. Good luck!
Answer: I would recommend implementing optimisation inside the script. So for each image, you get media stream and optimise it in memory and then reattach to the same item.
For this, you can use Dianoga (lossless optimisation) or any other tool like ImageMagick, jpegtran, jpegoptim.
For example for Dianoga additional code can looks like this:
foreach (var image in images)
{
    var mediaItem = (MediaItem)image;
    var media = MediaManager.GetMedia(mediaItem);
    var stream = media.GetStream();

    // OPTIMISE
    var dianogaOptimizer = new Dianoga.MediaOptimizer();
    var optimizedOutputStream = dianogaOptimizer.Process(stream, new MediaOptions { });
    if (optimizedOutputStream?.Stream != null)
    {
        // REATTACH
        media.SetStream(optimizedOutputStream.Stream, media.Extension);
    }
}

For the future, you can consider optimising images during upload to Sitecore as I described it here: How to resize and compress images with Dianoga during upload to sitecore media library


Is it safe to set "Access Control Allow Origin" header's value to the "Origin" header's value which is implicitly set by the browser?

Question: I was testing a website and noticed that changing the "Origin" Header's value of a request with an intercepting proxy application results in the web application sending a response with "Access Control Allow Origin" set to the same changed value. I read that the Origin header is protected by the browser and cannot be changed.
I want to know if there can be any potential risk associated with this scenario.
Comment: @Shurmajee He hasn't mentioned it. I am just saying that this is the behaviour you would expect from one.
Comment: This is exactly how you would expect a public API to behave. If the API is supposed to be public this is by design, if not it might be a vulnerability.
Comment: @Anders Where has the OP mentioned that it is a public API?
Answer: If the server simply mirrors the Origin provided by the client into the Access-Control-Allow-Origin header of the response without further checks then it essentially allows any third party to access the resource cross-origin, i.e. it would be a security issue if cross-origin access should be restricted.
But, if this mirroring is only done after additional checks, for example only if the client is authorized, then this is less of a problem. Although there might also be cases where it can be a problem also in this case.
In summary: if this is a problem or not depends on information which are not provided in the question.
Answer: The vulnerability that you have noticed is called CORS mis-configuration. There is a good blog post by PortSwigger (Guys behind Burp suite) which talks about the same topic.
Before we go ahead and try to answer this question, I think a few dots need to be connected.
The Basics
The same-origin policy (SOP) is a browser-level security control that dictates how a document or script belonging to one origin can interact with a resource from some other origin. Basically, SOP prevents scripts running under one origin from reading data from another origin. There may be cases where an app needs to allow other origins for resource access. This is achieved by using Cross Origin Resource Sharing. There can be potential security issues due to CORS mis-configurations.
The Problem
Now, We understand that CORS can be used to allow cross origin data access in a controlled manner using Access-Control headers. However there is a problem. The
Access-Control-Allow-Origin header works fine if you need to trust only one third party domain with data access. However, there may be cases where a white-list of domains need to be provided cross domain access. This is where the problem lies. None of the browsers support specifying multiple origins in the Access-Control header. You can not even cover sub-domains using wildcards e.g.

Access-Control-Allow-Origin: abc.com xyz.com (NOT SUPPORTED)
Access-Control-Allow-Origin: *.example.com (NOT SUPPORTED)

This has forced many developers to use the origin header value form the HTTP request and dynamically generate the Access-Control-Allow-Origin header to provide required access. Basically the Origin header value sent in the request is reflected back in the Access-Control-Allow-Origin reponse header (For a detailed explanation, refer to the blog post above)
This behavior violates one of the basic principles of security:
All data coming from the client should be treated as untrusted until validated.

The Vulnerability
This behavior basically defeats the purpose of Same-Origin-Policy. As the Access-Control-Allow-Origin header can be controlled by the client, Any malicious domain can now request data from the target web application and read the response. The only condition being that the targeted user should have the target site and the malicious site opened in the same browser at the same time along with an authenticated session with the target site. This provides unlimited access to the malicious site allowing it to perform all kinds of user actions and capture user data.
This is a tricky vulnerability to fix and unless the browsers start providing better support to the CORS white-listing options, We need to programmatically  validate the requesting domain before allowing cross origin access.
Comment: I think you are misunderstanding the issue, or I am misunderstanding your answer. You say that data from the client can not be trusted. That is correct. But we can trust the browser to enforce the SOP. Using the origin header to determine if access should be allowed or not is totally fine, it is exactly what the spec recommends you to do. You seem to suggest that there is some fundamental flaw in CORS itself, but there is not.
Comment: @Anders I do not intend to mean that CORS is flawed :) . The behavior mentioned by the OP indicates that the application takes the Origin header from the request and puts the value in the Access-Control response header i.e. the user supplied value is reflected back in the HTTP response. This is where I mention that the Origin value from the HTTP request should not be blindly trusted and used in the Access-Control header. I have tried to clarify the same in my recent edit.
Comment: Ah, I understand better now. I don't think spoofed origin headers are a problem, but I do agree that you need to be careful to implement the whitelisting correctly.
Comment: @Anders I think I need to clarify a little more. I am not talking about origin header spoofing here. Its just malicious sites sending sending cross domain requests. Imagine a CSRF attack where you can read data from the target domain because of a CORS misconfiguration.


Wavelength of light

Question: how do you calculate the wavelength of light? For chemsitry lab, we calibrated the scale reading of Hg, for example, to be 4.91 cm which is violet and the given wavelength says 436.  For Hg, it says scale reading of 5.51 cm for green and wavelength of 546. But for overhead fluorescent, I took the scale reading of 4.93 for violet but don't know how to calculated the wavelength. Any help with steps shown would be great!
Comment: Close wave-lengths would look the same color. I would guess the point of your lab was to use known Hg spectrum calibrate the scale and then use th calibration to determine the wave-length of the line sin the "overhead fluorescent". At least this is exactly what my students were doing today in the lab :)
Answer: Well, the equipment appears to be giving you the wavelength; however, the scale seems to be skewed (off-calibration) so you have to correct for it.
The scale readings you give appear to be off a few orders of magnitude; the wavelengths you list as "given wavelengths" are in nanometers. Wavelengths of 4-5 centimeters as your measurements suggest would place the emission spectra in the "ELF" radio frequency range at the extreme low end of detectable electromagnetic spectra, and well out of the range of visible light. So, just for the sake of argument, let's say you interpreted the measurements incorrectly, and these numbers should be in the hundreds and represent nanometers of wavelength (or, as written, they represent tenths of a micrometer).
Given that assumption, the numbers are still off a bit, indicating the instrument is slightly out of calibration. If the instrument itself isn't adjustable to correct the values,  "calibrating" it boils down to a percentage error calculation that is then applied to further readings: (experimental-theoretical)/theoretical * 100%. For your violet wavelength, you got 491nm but expected 436. That is (491-436)/436 * 100% = 12.6% error. The green wavelength reading was 551 when you expected 546; those two are much closer (0.915% error), which indicates that the equipment you're using has some chromatic aberration. That's understandable in an instrument designed to "fracture" light into a prismatic spectrum; other light-sensing equipment, like cameras, generally try to minimize it so all the wavelengths emanating from one point on the subject pass through the lens to expose one point on the film or photocell. But I digress.
Your violet spectral line reading off of an ordinary fluorescent lamp is 493nm. Given the percentage error measures on this end of the scale, this reading is about 12.6% too high; so, we divide by 112.6% to get the actual measured wavelength of 437.8. That measurement, against the known emission spectra of mercury vapor, has a percentage error of only (437.8-436)/436 * 100% = 0.42%, which for a measurement made with classroom lab equipment and other less-than-ideal conditions is pretty darn close.

Wavelength of light


How Salable Quantity Works and how we can manage?

Question: On the Category page, a product shows "Add to Cart" button and after clicking on it it redirect on product detail page with "Out of stock" message.
As checked and found that this product has 2 qty and stock is "In stock" while "Salable Qty" is 0 due to which it shows "out of stock" on detail page.
First Question:- Why qty is showing 2 and "Salable Qty" 0,how can we manage "Salable Qty".
Second Question:- when i modify the product qty to 20 then "Salable Qty" becomes 18 and when modify to 100 it becomes 98 means it always minus two why?
Please find attachment.
Answer: On the Category page, a product shows "Add to Cart" button and after clicking on it it redirect on product detail page with "Out of stock" message.
As checked and found that this product has 2 qty and stock is "In stock" while "Salable Qty" is 0 due to which it shows "out of stock" on detail page.
Answer: On the Category page, a product shows "Add to Cart" button and after clicking on it it redirect on product detail page with "Out of stock" message.
As checked and found that this product has 2 qty and stock is "In stock" while "Salable Qty" is 0 due to which it shows "out of stock" on detail page.


given a set of $n$ points in $d$-dimensional space and the basis vectors of some subspace, how to find all the points on that space?

Question: given a set $A$ of $n$ points with integer coordinates in $\mathbb{R}^d$, and $k<d$ basis vectors of a subspace $K$ of $\mathbb{R}^d$, is there an efficient algorithm that returns all points from $A$ that lie on $K$?
specifically, can I, given the answer for some subspace $K$, use it to find an answer for another subspace $K'$, the basis of which contains the basis of $K$ that I was given before, without looking at all of $A$?
Comment: I only know the very straightforward way of checking for each point if it belongs in that space or not (via Gaussian elimination for example). I thought (maybe wrongly so) that the second question is related to the first in a sense that an answer to it contains the answer for the first (although perhaps I should have then formulated it otherwise). an explanation is definitely due to the second question: given an output for some $K$, a basis $b$ for $K$ and basis $b'$ for some $K'$ that contains $b$, can I solve the said problem in less than $O(n)$ time?
Comment: As of the problem being research-level or not, I couldn't figure where else I should ask, so I tried here. Thanks for the comment!
Comment: I'm focusing on such a case where $k<=n$ and $n>>d$. Thanks for the help!
Answer: One straightforward approach is to first compute a $d \times k-d$ matrix $M$ such that $Mx=0$ iff $x \in K$.  Then you can determine which points from $A$ lie on $K$ by computing $Mx$ for each $x \in A$.  The running time for that will be $O(d^3 + k(d-k)n)$ or so, i.e., $O(d^3 + d^2 n)$.  Since the input has size $dn$, any solution has to take $\Omega(dn)$ time.  Thus this solution is at most a $d$ times factor slower than the best possible.
You mention in the comments that you are interested in the case $k,d \ll n$.  This might suggest counting the running time as a function of $n$, i.e., focus primarily on the dependence on $n$, and largely ignore the dependence on $k,d$.  As a function of $n$ (treating $k,d$ as constants), the solution above runs in $O(n)$ time.


Why is it not possible to prevent sudden unemployment of thousands of people?

Question: Why is it not possible to prevent sudden unemployment of thousands of people?
Often one can observe, for example in news, that suddenly from one day to the other thousands of people of a company get unemployed. Why is it not possible to prevent this or why do companies not downsize slowly instead of above stated? Of course those companies should know this earlier and they could downsize slowly, but they don't. Why?
I would really appreciate any solutions and ideas
Comment: You can, at least to some degree, boil this down to asymmetric information. The most perceptive employees jump ship with a severance before a company implodes. Those employees who lack information and/or foresight go down with the ship. If all employees had perfect information, this would be less of an issue.
Comment: When asking any economic question, always set a context. The question just too broad to be answered.
Answer: This question boils down to asking why business cycles exist and change employment in shocks.
One possibility is that employment is sticky or not worth changing constantly. A firm cannot constantly calculate and evaluate worker productivity and general profitability without a, perhaps rather expensive, cost, especially if the firm is very large. Constantly hiring and firing to try and have "optimal" employment for a firm is also bad for morale.
And perhaps more to the point, the alternative to firing people in large swathes is lowering wages, which is even worse for worker morale and sometimes not really legal (e.g. salaries are fixed for a year). So if there is a recession for example, a firm will generally choose to keep wages up, and then when it can't afford such a scenario anymore, it will create large layoffs.
Further Reading: The cost of firing changes the dynamics of how people are fired as well. See this article about France and Spain's different changes in employment with respect to the Great Recession. It is possible to prevent large drops in unemployment. Whether it is efficient is another question. My answer only briefly touches on the theory, and there is plenty of literature related to the points I've made that you can look for.
Answer: Your question asks "why" but does not provide a perspective.  Who is it that you believe should be attempting to prevent sudden unemployment?
It sort of sounds like you think CEOs might want to let people go slowly.  Generally speaking, I don't see why they would want that.  I believe an environment in which there is a constant threat of job loss would be worse for morale and productivity than one in which very occasionally there are larger cuts to a certain part of the business.  Also, the reasons for cutting the workforce don't tend to trickle in over time.  For example, when a certain production line stops making money, it's not like firing one or two people will change that.  You kind of have to shut the whole thing down.  CEOs could achieve slower workforce reductions if they desired it, but it would be bad for their companies and lose money.
There may be government officials or other third parties who might prefer slower layoffs, but they don't have power over hiring and firing decisions, so they aren't relevant.
I will also ask you to think of why you believe slow downsizing would be better than fast.  It seems clear to me that fast downsizing is better for firms.  Are you certain that slow downsizing is better for the economy, or for the workers?  You would have to show this before others could provide additional reasons why it makes sense for large layoffs to occur.


What is the relationship between force and momentum in collisions?

Question: I know that $ \Sigma F = \Delta mv/\Delta t$. But if we had a marble that moves in a straight line at a constant velocity and colloids with another marble. Because of the law of conservation of momentum, the second marble now had the velocity of the first marble. But what is the force that the first marble applied one the second marble? The collision is almost instantaneous. Wouldn't that make the force in $ \Sigma F = \Delta mv/\Delta t $ insanely large because $ \Delta t $ is so small?
Comment: This simply shows that the collision *isn't* instantaneous. Try (if you have the time) filming such a collision with a high-speed camera and looking at it in slow-motion. A) It should be cool and (more importantly) B) You'll see that the collision isn't instantaneous - it's simply very brief.
Answer: In this type of collision where you have what amounts to a very quick change in velocity, the force is called an impulse force and it is best to think of the equation a little differently.  For example, instead of:
$$
\sum F = \frac{\Delta mv}{\Delta t}
$$
Think of $\int F \mathrm{d}t$ being equal to the change in momentum, that is:
$$
\Delta mv = \int F\,\mathrm{d}t \qquad\text{impulse force}
$$
The change in momentum itself is equal to this integral where the actual functional form of F may not be known at all.
Comment: plus the impact forces (impulse forces) which act on a very small time-frame are usualy ignored in calculating inital-final momentums etc... If one would take into account such impulse forces. 1. They are unknown, 2. diificult to put into analytic form. In any case in the integral inital-final conditions, they smooth out
Comment: Mathematically, nothing new was added.  But, looking at the problem a little differently, mathematically rearranging things, often simplifies the problem of understanding.  I think the OP problem was dealing with infinite or very large force but actually the change is momentum is due to the combination of force over time as I showed by the integral above.
Answer: The force can be surprisingly large, but $\Delta t$ is not zero, and the force is not infinite.
Make some estimates:  the duration of the collision is so short that our eyes and brain cannot perceive it.  Make an estimate for an upper limit for the duration.  (There's no right answer, but a lot of wrong answers.  For example, I would think that a duration of 0.1 s would be perceivable, and "wrong".  My upper limit should be smaller.)
From this you can get a lower limit on the force.
You can improve your estimate for $\Delta t$.  You know the speed of the marble.  You can make a guess at the size of the deformation of the ball that occurs during the collision.  It's certainly less than one tenth of the radius.  Probably less that 1/100 ... (Make your own estimate.)  From there calculate a $\Delta t$.
Try this:  make a crude model of the force generated when two satellites collided in 2009.  The relative speed of the collision is known.  The masses and sizes can be found or estimated.  Calculate the duration of the collision and the force generated.  (They did not collide head-on, so divide by 2 to crudely account for this.  :)  They also disintegrated.  So there the analysis will have flaws.  But it's an interesting exercise as long as you keep in mind that it is unrealistic.   )
Answer: As stated in other answers, $\Delta t$, although small than times you're used to perceiving, is not 0.  Because the marbles do not deform very much, the collision does not appear to take much time.  However, in the grand scheme of things, the change in momentum for each marble during the collision is also small. Although answers vary, a quick google search suggests that mass of 10-20 grams might be reasonable.  That means that even if the marble is traveling at highway speeds when it hits the other marble,$\approx 30m/s$, which seems very unlikely, the total momentum of the marble is less than $1 kgm/s$.  So even for small time intervals (under the upper-limits that garyp suggests in his answer), I can convince myself that the force will certainly be on an order of magnitude of 100N-1000 N, which may seem like lots, but not more than the weight of a typical human being.
If you don't find the back-of-the-envelope calculations convincing, you could always try looking at collisions with other types of balls.  Although the collision will not be perfectly elastic, ping pong balls, tennis balls, or base balls should still all separate after the collision as well, and the deformation, and time in contact, might be just enough that you can convince yourself that all collisions take place over a non-zero interval of time.
Answer: (make comment as an answer)
As mentioned in the comment here, the impact forces that are active during the time-frame of the actual impact are
1) unknown
2) difficult to put in analytic form
That is why results like the conservation of momentum theorem are used. One can do estimations or approximations of these impact forces but would have to use more information by employing other equipment (like high-speed cameras and detectors, high-sensitivity heat detectors etc).
Answer: If you assume linear force displacement relationship (small displacements) with stiffness $k$ then $F(t) = k\, x(t)$ where $x(t)$ is the separation of the two objects. Also initially the impact speed is $V = \dot{x}(0)$.
The impact time is characterized by the natural frequency of the system $$\omega = \sqrt{\frac{k}{m}}$$ where $m = \left( \frac{1}{m_1} + \frac{1}{m_2} \right)^{-1} $ is the reduced mass of the system. If we assume a elastic harmonic response to the impact with displacement $x(t) = X \sin (\omega t)$ lasting from $t=0\ldots \frac{\pi}{\omega}$ then the contact force is $$F(t) = m \omega^2 x(t) =m \omega^2 X \sin(\omega t)$$.
From the conservation of impact momentum $J=(\epsilon +1) m V$ (see this post for more details on the treatment of collisions) with $\epsilon$ the coefficient of restitution. In addition, the impulse is defined as $J=\int _0^\frac{\pi}{\omega} F(t) \,{\rm d} t = 2 X m \omega $. So the displacement amplitude is estimated at $$X = \frac{(\epsilon+1) V}{2 \omega} $$ with peak force $$F_{max} = F(t=\frac{\pi}{2\omega}) = m \omega^2 X = \omega \frac{(\epsilon+1) m V}{2}$$
This can be stated as the fraction of the peak force to impact momentum
$$\boxed{ \dfrac{F_{max}}{m V} = \omega \dfrac{(\epsilon+1)}{2} } $$
For a purely elastic impact $\epsilon=1$ then $$F_{max} = V \sqrt{k m}$$
Appendix
According to Hertzian contact theory two identical spheres or radius $r$, and of the same material with elastic modulus $E$ and Poisson ratio $\nu$ the force displacement relation ship is
$$ F^2 =r \frac{2}{9} \left( \frac{E}{1-\nu} \right)^2 \delta^3 $$
which is used to estimate the stiffness $k = \frac{F}{\delta}$ of the contact at the impact time.


How do I use a pattern to unlock the phone screen?

Question: Is there a way to set up my lock screen so that I can draw a pattern to unlock the phone? That way, only I can unlock it again. At the moment, my phone automatically locks the screen, but you just slide to unlock it. Because of that, any one can unlock my phone, which is not ideal.
Answer: From the home screen hit the menu button, then choose Settings > Location & Security and from there you should have an option to set up a patter or pin based screenlock.  The pattern lock will give you the option to create your own pattern on the 3x3 grid:

If you want to be able to draw a completely random pattern, Cyanogenmod 6.2 has the option to draw any invisible Gesture to unlock the screen.
Comment: @Jay: Which is a large part of the reason we strongly encourage people to ask for solutions ("How do I...?") and not ask for apps ("Is there an app that...?")
Comment: Thank you very much. All along it was within android itself. I wasted a lot of time looking for an app that would do this. Once again, thansk : )


Is this type of currency index a thing already?

Question: I was considering making some sort of free index data set that would basically attempt to estimate changes in the value of a currency against all other currencies. So I came to thinking if I took daily volume, and daily changes, summed dollar volume for all currencies except the one for the given index, then divided a given currency's estimated volume in dollars lets say for example is CHF, this gives us percent of daily volume, then we would multiply by the percent of daily volume by the change of the currency for the index, for example lets say we are calculating the USD index, we then multiply the price change for USDCHF by the percent of daily volume. Then continue for every currency against the dollar in order to calculate how much the index should move. Is this a thing or should I make it one?
Comment: As everyone has already mentioned, data on volume is hard to know, but I wanted to share that CLS is now offering **FX databases with trade volume** on **Quandl** See: https://www.quandl.com/vendors/cls. Volume is covered in terms of both the number of trades and the total value in USD. CLS operates the world's largest multicurrency cash settlement service. The databases cover 33 currency pairs aggregated hourly, daily and monthly and by trade instrument (swap, spot, outright forward). You can check out the databases at https://www.quandl.com/vendors/cls [Full Disclosure: I work for Quandl]
Answer: It is not a thing.  The basic problem is that volume of currency traded is unknown.  FX traded almost exclusively over the counter without centralised clearing or reporting.  There are no daily volume statistics.
The thing that is most commonly done for FX indexes is trade weighting.  Changes in a currency's value are measured against the value of a basket of other currencies, where each currency in the basket is weighted according to its share of the import/export trade.  Probably the weighting would be adjusted annually, or in line with how often the government accounting office publishes import/export statistics.
Comment: I understand already the OTC aspect of FX, but what I was meaning is to sample from a single estimate source, probably from year to year, and as new estimate data arrives on volume, weights would be adjusted for all new data.
Answer: re: fx volume
majority of fx volume is "unknown", but so is much else in markets. there are ways of estimating volume to feed your models - just don't get overly reliant on it IMO.
check out CME T&S and a few spot venues. google Lee/Ready and Tick Rule to get ideas on how to create your own estimation models based on available/accessible data for FX.
Answer: An index has to have a purpose. For example, the FTSE100 tracks the performance of the 100 largest capitalised companies on the LSE; it's purpose is to give the expected return of a fund of those largest companies. It is, therefore, replicable; if I wanted to get the same performance as the FTSE100, I just buy the right proportions of shares as the index contains, and keep rebalancing vs the changing portfolio and weightings.
So for a currency index, the question has to be: What is it for? If you want to know how well USD is performing, then performing against what? If I was a US investor in a collection of European companies, where I want my USD initial capital to track the movement of the currencies of those companies, then I would want a basket containing that proportion of currencies. If I was a Swiss investor with a need to maintain a fund of CNY for my imports, then I would want that in the basket.
Ultimately, I think an index which just tracks 'volume' (as measured by whom?) isn't particularly useful. Currency movements are less about how much has moved, and more about the economies and inflationary environments of the countries that issue them.
Consider the recent Brexit move. If I were a US investor into the UK, then obviously GBPUSD is going to be a large component in the risks I'm looking at. But for exporting companies, a drop in GBPUSD is helpful, as it cuts labour, rent and other local costs at a stroke. But that UK capitalisation is also reduced. So then perhaps I care more about the long term interest rates available in the UK, and the market's view on its future. So I might want a basket of Gilts, German bonds and Treasuries, each with their own currency dependencies, to reflect my interest or my risk.
Comment: well the objective is mostly to gauge the actual change in value of a currency, as the exchange rate change of USDJPY is also dependent on the change of the Yen's value. Ultimately I think trade data as mentioned is possibly a better route for weighting, how volume could also be a factor applied to the index.
Comment: @FreepromTech so what do you mean by the actual change in value of a currency? Compared to what? Nothing is absolute in Finance, so that is the change in value of an amount of JPY in terms of USD? Or as an indicator of the asset value of a country? Ultimately the question is what you are trying to measure. The exchange rate itself is already capturing effects from changes to investment rates to inflation to perceived differences in risk in interbank markets. So, what is the purpose of this actual value you're trying to measure?
Comment: I mostly am making this out of boredom and curiosity, I saw the weights on the dollar index, and the FXCM dollar index, but was interested in a currency index with more pairs as well as a less arbitrary seeming weighting. I did manage to find a trade weighted index which satisfied my curiosity measuring the dollars change in value. It has 25 currencies which is enough for me.


Should I buy a PVC or aluminum roller?

Question: I'm currently trying to choose between the CycleOps PVC roller and the CycleOps Aluminum roller. How big of a difference is there between them? I don't really care about riding the roller outdoors, so that difference is moot for me.
Comment: Both of the URLs lead to 404 pages. Might be a good idea to update the links...even though it's been five years...there is alway someone searching for pro tips about rollers.
Answer:
How big of a difference is there
  between them?

The difference is this big...

http://www.flickr.com/photos/bobmarley753/249120602/
Seriously though, after some research and asking friends, many who have aluminum rollers prefer them over PVC rollers
The unasked question:

Which one would you buy?

Neither!
Some of my friends have rollers that are cylindrical like the two you have linked to. When asked about their rollers, their biggest complaint is how often they end up riding off the side of their rollers. One even has gotten in trouble with his wife after riding off the edge of his rollers leaving burn marks on the floor. oops! With cylindrical rollers, more concentration is needed to stay on, which can be a good thing if that is something you are looking to improve in your form and concentration.
If I were to buy another set of rollers, I would most definitely purchase another set of parabolic rollers.

I love my parabolic rollers! They were really easy to learn on and I have yet to ride off the edge of them. Not having to worry as much about riding off the edge is really big for me as it allows me to ride longer, feel more comfortable shifting my hands to shift and readjust, and allows me to watch an occasional movie or two while riding. : ) If you are looking at getting a set of rollers, I would highly suggest adding parabolic rollers to your consideration list.
Google search for parabolic rollers to get you rolling ...chuckle
My thoughts about having ridden on plastic rollers:

Never had my rollers statically shock me.
Haven't seen any major wear on the rollers that makes me worried that they won't last for years on end.
Love how quite the rollers are especially compared to my CycleOps Fluid 2 Bike Trainer.
Never needed to use them outside.
Has been a very smooth ride for me and much smoother than my fluid trainer.
Resistance? I love that my rollers have a variable resistance module so I can change the resistance depending on what kind of workout I am going for.
Comment: You bet! Glad I could help.
Comment: Awesome! Hope you enjoy them as much as I do.
Comment: @Mike, how high does the resistance go? Is it good enough for strength training?
Comment: @Mark, I've been riding them for a few weeks on the lowest resistance setting and haven't moved up the resistance yet so I don't know. My guess is that the resistance doesn't go as high as stationary trainers can go.
Answer: Aluminum is more durable, but highly used PVC rollers have been seen to hit the decade mark so it's not really a big difference maker.
The other difference would be that PVC rollers charge up static electricity and it can be annoying to get zapped every time you ride your rollers. Now it's up to you to see if that's worth an extra 90$. It's most likely possible to ground the rollers to avoid the shocks and save some money.
(The main difference is that PVC rollers can't really be used outside, but it doesn't matter here.)
Answer: In addition to what has already been said, aluminum rollers tend to be smoother, easier rolling, and quieter.  In a nutshell, they're far more pleasant to ride on.  Try both, and you'll notice the difference right away.
Answer: A major consideration would be the weight of the rollers themselves. Heavier rollers are easier to ride because they have more inertia and are therefore less sensitive to the small changes in wheel speed related that occur over the course of a pedal stroke.

Should I buy a PVC or aluminum roller?


Was "All for you" by Imagine Dragons ever released?

Question: The movie Transformers: Age of Extinction (which, as a side note, is very bad) features two songs by Imagine Dragons: "Battle Cry" and "All for you". The first one was released on the OST and as a single. I can't seem to find the second one. Not on any soundtrack release or single/album by the band. Is it really not obtainable? (Other than bad quality YouTube videos).
Answer: The song "All For You" was a surprise inclusion over the opening scenes of Transformers 4.  It was scheduled to be released on CD as part of the soundtrack, but the entire soundtrack got scrapped over licensing rights.  As of right now, the only way to obtain it is to rip the audio yourself from the DVD/Blu-Ray.  It's not commercially available in any format.
Comment: Here's an unofficial source for you: http://transformernews.blogspot.com/2014/06/imagine-dragons-all-for-you-other.html
Comment: The license thing sounds like a legit explanation for the situation. Do you have a source?
Comment: Nothing that I can quote.  ;o)  But I'm sure if you google *"All For You" soundtrack release* you'll find a couple of unofficial sources.
Comment: Can't seem to find anything on reporting that the release was scrapped. Only some unofficial announcements of a CD that is nowhere to be seen for sale. Considering this I'll take you word for it ;-)


R,S Configuration of asymmetric carbon atom when group priority 3 and 4 are not on wedge bond?

Question: I am not blessed with the gift of spatial awareness. I understand how to determine the configuration when a group with priority 4 is on the hashed wedge or when the group with priority 4 is on the bold wedge and priority 3 is on the hashed wedge. However are there any rules I can follow for situations as shown in the image? The numbers show the priority.
Comment: A piece of chewing gum and four matchsticks can be a decent replacement for insufficient spatial awareness. Also, welcome to Chem.SE.
Answer: To do this, Put the lowest priority group as far away from you as possible.
In the 1 example, if I look at 4 from between 1 and 2 it would be farthest away from me. And i will see that the 3 group is on top, 2 on my left and 1 on my right.
And now if i move from highest priority group to lowest (1-2-3) it would be in clockwise sense. So the configuration is R.
2nd and 3rd example has S and R configuration respectively.
Comment: Highest priority to lowest is 1-2-3.


Marcus Aurelius' Meditations

Question: My question is short. Are there any contradicting things in Meditations of Marcus Aurelius? Contradictions in between his quotes or quotes and real life.
Answer: Welcome, Igor
I divide the discussion between Philosophy, then Practice.
Philosophy
A number of philosophical, Stoic themes emerge in the Meditations:
The unity of the universe

When Marcus talks of 'unity' without further qualifcation he usually refers
   to the unity of the universe. He urges himself to meditate often on "the
   concatenation of all things in the universe and their relationship with one
   another". epistundesis, 'concatenation', is a strong word for the mutual union
   and interdependence of all things and this necessary connection of antecedents
   and consequents is explained rather cryptically by Marcus as due to the movement of stress, the sympathy that pervades all things and the unity of all
   substance. Marcus argues that the tendency to union increases as one advances
   to higher orders. There is more uniting activity among irrational creatures,
   with their swarms and flocks, than exists among inanimate objects, such as
   minerals and plants. Rational creatures form political communities, friendships,
   households, assemblies and so on. He asserts that progress along the natural
   scale was able to produce unity even among things which are quite separate,
   such as the stars, which move in concert.-' But Marcus revels most in strong
   affirmations of his belief in the unity of the cosmos:

"All things are interwoven and the common bond is sacred.... For there
     is one universe consisting of all and one God immanent in all, one substance
     and one law - the reason common to all intelligent creatures - and one
     truth, if indeed the ideal of creatures who share the same origin and the
     same reason is one."

This belief is so well established that Marcus can speak of 'cosmos' as
   simply the name for the single but all-embracing unity in which all things that
   come to pass exist simultaneously." He exhorts himself to think constantly of
   the universe as a single living creature, comprising a single substance and a
   single soul." Men are united by nature, but they can sever themselves from
   "the unity which is in harmony with nature". For man, who is born as a part
   of the whole, cuts himself off by not associating his will with what happens or
   by some unsocial act. (G. R. Stanton, 'Marcus Aurelius, Emperor and Philosopher',  Historia: Zeitschrift für Alte Geschichte, Bd. 18, H. 5 (Dec., 1969), pp. 570-587: 576.)

The nature of the universe

Knowledge of this universe in which all things are bound together is important to Marcus and he frequently discusses its nature. He states that "the
   mind of the universe is social", implying that men as rational creatures have
   an essential ability to create koinonoa, the fellowship of society." A definite
   attitude to one's fellow man should result from this conclusion. Although our
   kinsmen and neighbours are ignorant of what is in harmony with their nature,
   we who do know should treat them in a kind and just fashion, in accordance
   with the natural law of fellowship.
Marcus' central idea about the working of the universe is change. The universe
   is continually preserved in its prime by change. Change is inevitable. What
   men call loss or death is nothing but change. Men should not fear change
   since nothing is more familiar to universal nature. Two principles which
   Marcus stresses as basic are: (i) "I am a part of the whole controlled by nature";
   (ii) "I am intimately connected in some way with other parts of the same
   kind". With this in mind man should not be displeased with anything allotted
   to him by the whole, for what is beneficial to the whole cannot harm the part.
   The welfare of the whole and the part are completely bound up together.
   Linked with this concept of acceptance of whatever is assigned to man from
   the whole is the popular idea, for Marcus, of harmony with universal nature.
   Every man's interest is served by what is in harmony with his own constitution and nature; and man's nature is rational and social.' Hence to care for all  men is in harmony with man's nature. Marcus stresses repeatedly that no one
   can prevent man living in harmony with nature. He states his personal
   determination to walk in the way that is in harmony with nature.

...

Marcus also recommends acceptance of one's destiny. Just as a
   doctor prescribes cures, so universal nature prescribes for men whatever befalls
   in the way of sickness or loss, as being beneficial to the whole. A rational
   being welcomes all that is assigned by universal nature, because he is a part of
   that whole. Marcus' overall view of man's relation to universal nature has
   these twin principles at its centre: first no one can prevent you living in harmony with nature; secondly, that nothing can happen to you which is not in
   harmony with universal nature." The most specific that Marcus becomes in
   explaining these principles occurs when he gives examples of acts of impiety
   against that venerable goddess, universal nature: injustice (because rational
   creatures are created to benefit one another); lying (because it distorts the know-
   ledge of the real nature of the things that exist); seeking pleasure and avoiding
   pain (because in either case a man must often blame the gods for a supposed
   unfair dispensation to good and bad, and blaming the gods is already established as sinful)." (Stanton: 577-8.)

Cosmopolitan ideas

Marcus clearly thinks of himself as a citizen of the universe: "My city and
   fatherland as Antoninus is Rome, but as a man, the universe." Moreover he  gives a detailed defence of his concept of the universe as a state.

...

"If mind is common to us all, then so is reason, by virtue of which we are
   rational beings. If that reason is common which prompts us to do or not to
   do thiilgs, then law also is common. If that is so, we are citizens. If so,
   we share in an organised community. But the universe is the only organised
   community in which the whole race of mankind can be said to share. Thus
   the universe is as it were a state."
Then the argument proceeds to justify the premises:

"This common state is the source of our mind and reason and sense of
     law. For the mind, like the earthy and watery and spiritual and fiery
     parts in us, must have come from somewhere.""
     It seems likely that Marcus would also conclude that the universe is a state
     by means of the well established principle, in his thought, of koinonia, for it
     is a fellowship of men who are rational and social beings. Hence their community is in fact a universal state. The brotherhood of mankind is a unity
     based on the common possession of mind. Marcus says as much:
"When you are discontented with something, you have forgotten ...
     how strong is the kinship of man with all mankind, for it is a community
     (or fellowship) based not on blood or seed, but on mind." (Stanton: 578-9.)

Practice
In light of the above, how does he act as emperor ?
Wars

The reign of the emperor-philosopher was marked by continual wars on the
   northern and eastern frontiers of the empire. In 162, a year after his accession,
   Marcus sent his colleague Lucius Verus to the Parthian War and troops were
   taken from the northern frontier to bolster the armies in the east. From 166
   on tribes living beyond the Upper Rhine and the Danube, especially the
   Quadi and Marcomanni, broke through the weakened line of defence and even  invaded northern Italy. Marcus' response to the initial threat took the form
   of a frenzied round of foreign religious ceremonies and a march north led by
   both emperors. Italy and Illyricum were soon secured (A.D. 167) but Marcus
   spent most of the rest of his life fighting from his base in Pannonia and was
   still engaged in war with the Germanic tribes at the time of his death. (Stanton: 580-1.)

Stoicism and continual wars make an odd conjunction.
Persecutions

Judging from Eusebius' general notes of alarm about ... the time around the seventeenth year of Marcus Aurelius' rule [GT: c. 166-8], and judging also from his general grouping of
   particular anti-Christian movements and individual martyrdoms,
   one can with reason conclude that during this Emperor's rule
   there were at least two very distinct waves of persecution resulting in a large but indefinite number of martyrdoms. One is
   justified in ascribing the great majority of persecutions and particular martyrdoms to the hatred and violence of the non-Christian
   population, especially in Asia and even in Lugdunum. Christians,
   even more than the Jews, were, traditionally, targets of violence
   and pogroms in the Greek provinces, especially in the East. The
   singling out of these two periods of Marcus Aurelius' term and
   the specially alarming tone of the Christian historian and the
   obvious and extraordinarily violent character of these two waves
   of persecution, however, need much more than the usual explanation - the general popular hatred. (Paul Keresztes, 'Marcus Aurelius a Persecutor?', The Harvard Theological Review, Vol. 61, No. 3 (Jul., 1968), pp. 321-341: 327.)

Whatever the explanation, if Marcus did not intitiate the persecutions he also appears to have done little to stop them. This is perhaps not entirely what one might have expected from the supposedly great practioner of Stoicism.

Marcus Aurelius' Meditations


What are the two common sense ideas that seem to conflict and thus give rise to the free will problem?

Question: What is free will? How does that relate to human?
Comment: This may too broad for a brief answer. To help provide context are you reading something that makes you think of this question? Why should there be only two common sense ideas? Regardless, welcome to Philosophy!
Answer: I'm going to answer, but i agree you need to do more work on the question.
lower animals such as cockroaches are driven almost exclusively by immediate reaction to stimulus. That is.. if the see something their hardwired brain tells tem is a predator, they flee.
Cockroaches cannot really learn to identify new threats. Their mental processes are a simple product of evolution.
They can however 'decide' which direction to go in. But again this choice is likely to be automatic in some way.
When there are no immediate stimuli, a cockroach will do nothing.
humans have infinitely extended cognition. That is to say... humans can react to stimulii from years gone by.
This manifests as 'free will'.
Humans can seem to make decisions and act.. without stimulii.
Intelligence as we know it seems to be based on this infinitely extended cognition.
The 'big problem' is whether this constant thought and ability to make arbitrary decisions means that our free will is somehow etherial.. and not directly linked to the physical brain.
Many believe we're just like cockroaches, but kid ourselves into imagining 'free will'.
It's compelling, but counter intuitive.
Answer: I agree that the question needs some development.  But I have an answer that might fit what you're asking.
The free will problem is generally seen as a conflict between the assumptions of determinism and agent causation.  Determinism is the idea that the world is governed by a set of physical laws that completely fix the history of the universe.  Specifically, all of our actions are determined by the state of our bodies — including our brains — which is determined by our environment and the prior state of our bodies, and so on, all the way back to the Big Bang.
Agent causation is the idea that beings like us are capable of initiating actions that are causally independent of our prior history; we can act as "uncaused causes."  This means that some of our actions are not determined by the state of our bodies, and so on, all the way back to the Big Bang.  So agent causation is incompatible with determinism.
Much of the free will debate in academic philosophy assumes determinism, and then considers whether there are other ways of thinking about "free will" that are more compatible with determinism.
However, from my perspective as an empiricist philosopher of science, both determinism and agent causation are metaphysical postulates, and I am suspicious of both ideas.  Determinism comes from the medieval Christian idea of God as a divine lawmaker.  The idea that physics provides a comprehensive description of the world has been promoted for hundreds of years, but has always fallen short.  Research on human behavior often finds important connections to physiology and biochemistry; but we have nothing close to a set of deterministic laws of human behavior, much less an understanding of how human behavior might be reduced to fundamental physics.  Even in physics, we have very few accurate, deterministic models of complex physical systems.  Given the very limited success of determinism as an approach to scientific inquiry, from an empiricist perspective there doesn't seem to be any reason to conclude that the world is deterministic.  For more on this perspective, I recommend Angela Potochnik's Idealization and the Aims of Science.
On the other hand, research in social science, psychology, neuroscience, and so on, has identified many things that influence our behavior.  These causal influences fall short of determining our behavior.  But they also seem to undermine the idea of agent causation.  Some neuroscientists have argued that their research shows that we "don't have free will."  But they often say that their research shows that our actions are "completely determined."  From my empiricist perspective, the first point seems correct, but the second goes well beyond what their research actually shows.