How do I block hackers or bots from accessing newsletter signup

Question: I am receiving large amounts of newsletter subscription signups which are coming in at a rate that is too fast to be real. When I looked up the ips from my online customers, some of the ips are proxy ips and other ips from Russia, Ukraine and France. I disabled newsletter signup and blocked a whole lot of ips, and when I enable it again, I was fine for a day or two and it started up again. Are these hackers or bots? Does anyone know how I could stop this?
Answer: There are a number of techniques you can use to protect your forms from bot spam. E.g you could add a CAPTCHA question, or add a hidden 'honeypot' field and only accept the submission if the field is ommited. These approaches might not be be 100% affective but should help reduce spam.
Answer: For a 1.9 install, i think this is the best solution i have found so far.
https://github.com/magento-hackathon/HoneySpam
It will set a new system to check if there is a bot trying to submit the form and if the bot is filling out the for too fast for a human user.


WSUS not detecting computers

Question: Hi I have followed the online tutorial from Microsoft Technet and successfully installed an configured WSUS 3.0 SP2 on Windows Server 2008 x64. I also set up a new GPO for use with WSUS and set the required policies, however the WSUS service does not detect any computers in the Domain which obviously need updates. Can anyone help please? I have also whitelisted the server ip on port 80 (HTTP) and 443 (HTTPS) through Pfsense firewall. Thanks
Comment: Have you run wuauclt.exe /detectnow on the client ??
Answer: There is a whole bunch of possible issues here:

Is the WSUS actually operating on the defaults ports as you say ? It could be using the alternate config.
The pfSense suggest the WSUS server is in another subnet as the clients. Are you sure the URL used in the policy is actually valid from the clients perspective ?
Is the policy really deployed to the clients ? Check if the registry keys are created on a client computer. GPUPDATE /FORCE is your friend.
On a client run "wuauclt /DetectNow" from a command prompt. Check WindowsUpdate.log (in C:\Windows or c:\Winnt) to see what is happening.
Answer: One small update, sometimes the SUS server isn't detected by just putting the address of the SUS server into the server location in the GPO. You sometimes need to add the default port of the SUS site that's automatically created in IIS. For example, the default port is http:// wsus:8530, so you'll need to put that in there instead of just http:// wsus. I discovered this when my SUS server was Server 2012 and IIS 8. I hope this helps some of you.
For the visually oriented folks, I took some screenshots of what I was talking about here:
http://danblee.com/wsus-not-detecting-clients-and-not-listing-computers/
Answer: If you were templating your servers without running sysprep afterwards you may try to generate new Client ID. Use this PowerShell script for automation.

WSUS not detecting computers


How to enable encryption for CVS?

Question: I want to access CVS when I'm outside the workplace. Is there a way to encrypt the authentication and file transfers that CVS normally does?
Answer: CVS is almost always used remotely over SSH, which encrypts everything. This is the default for modern installations of CVS. You can use SSH's authentication (which can be by RSA or DSA key) for CVS on any modern operating system.
Answer: There are many different ways of doing this.
For regular access you could use SSL VPN (Secure Sockets Layer Virtual Private Network).
For secure file transfers you could use SFTP (Secured File Transfer Protocol).

How to enable encryption for CVS?


Mirroring iPad to Apple TV using local router and using data connection?

Question: I have a iPad 3 or the new iPad and it's 3G. I plan on using this at trade shows so I can mirror what's on my iPad to the TV using Apple TV. We'll be using a local router instead of wi-fi because it's a fortune to purchase internet at shows. My question is once I access an app that requires 3g connection will I lose my connection to Apple TV?
Comment: Can you clear up the question for us, I'm confused - using a router instead of Wifi?  Don't you mean using a local router *for* wifi (that has no internet route)?
Comment: I suspect the intention is: He will be using 3G for internet access, but a non-internet connected WLAN as the network for the Apple TV and iPad.
Comment: Correct using a local router with no internet. Then using 3G for internet access.
Answer: If your cellular network allows you can turn on the "personal hotspot" feature on iPad and connect Apple TV to that network. Then you can AirPlay the content to Apple TV (not mirroring) and at the same time use the cellular 3G network for internet.
Answer: As far as I know the iPad can only have one IP-based connection at a time. That is either local Wifi or 3G. I am not exactly sure if you will loose the AppleTV connection or you won't be able to access the internet, but I sure you won't be able to have both.
You might want to try to bring another iPhone or iPad and use it's Personal Hotspot Feature. You would then connect the AppleTV and your new iPad to this Personal Hotspot Wifi.
Please note that the 3G is usually very crowded at trade shows, because you are not the only one using it ;-)


What happens when base voltage is higher than the collector voltage in a bipolar NPN transistor?

Question: Does the base voltage has to always be (0.7v) in order for a bipolar NPN transistor to work? what happens if the base voltage increases or decreases? I'm really not into the technical stuff I'm just curious about how electrons exactly work in transistors. Like what if the base voltage is more than the collector's one, wouldn't electrons just flow through the base current and completely ignore the collector?
Comment: Welcome. When you have many questions please list them on separate lines so they are easy to see and correlate.
Comment: If you want to completely understand how BJT works, I recommend reading an electronic books. Or at least completely understand diode exponential behavior first.
Answer:
Does the base voltage has to always be (0.7v) in order for a bipolar NPN transistor to work?

No.  But a silicon small-signal BJT transistor usually has a base to emitter voltage of around 0.6 to 0.7V when it's operating.
(Note that you say "base voltage", and I'm changing that to base-emitter voltage -- the voltage of the base vs. some arbitrary point in the circuit is meaningless, and the emitter isn't always grounded.  It's the voltage from the base to the emitter that matters).

What happens if the base voltage increases or decreases?

Roughly, the emitter current of a BJT increases exponentially as the base-emitter voltage increases.  More base-emitter voltage -- regardless of the collector voltage -- means more emitter current.

what if the base voltage is more than the collector's one, wouldn't electrons just flow through the base current and completely ignore the collector?

This is where things get fun.  The way that a BJT is constructed, if there are carriers flowing out of the emitter into the base, and if the collector voltage is right, those carriers mostly fly through the base without contributing to the base current.  In an NPN transistor (which is what you appear to be talking about) the carriers are electrons, so they are attracted to positive voltages.  So if the collector voltage is above the base voltage, electrons from the emitter, in around a 50:1 or 100:1 ratio, fly through the base and into the collector.
That ratio is pretty close to a transistor's "beta", or amplification ratio.
This happens even if the base and collector are at the same voltage (!).  Basically, one way to model a transistor is as the base-emitter diode, which is forward biased in normal operation, and the base-collector diode, which is reverse biased in normal operation, and a magic current source that causes 99% of the emitter current to flow from collector to emitter.
If the collector voltage drops below the base, the transistor will still amplify current -- at this point, the base-collector diode is forward biased, with some current flowing in it, but that action can still be overwhelmed by the "magic current source".  In fact, this is a useful mode of operation, where in a typical 1970's-era transistor like the 2N3904, you can have a current amplification of 10:1 or so when the collector-emitter voltage is 0.2V.  In new "super-beta" transistors you can get useful amplification with this voltage less than 0.05V.
Answer: 0.7V is not an absolute value.  It varies depending on the transistor part number and even across any given lot of "identical" transistors.   It's an approximation.
It's also not a hard-cut-off.   You don't get 0.69999V it's "off", 0.7000001V it's "on".  It's a gradual range across maybe 0.5V-0.8V or so  (again, transistor dependent).
The 0.7 comes from the result of the base being a diode.   You feed it MORE than 0.7V, and the diode 'clamps' the voltage you see there at ~0.7V, just like any normal silicon diode.
BJT transistors are CURRENT controlled devices.  You turn them on/off by controlling the amount of current passed into them, not by the voltage you apply.   (COntrast to MOSFET's which ARE voltage controlled devices)
I know you don't wanna get 'technical', but you also said you wanna understand how they work.  These are technical devices and to understand how they work, you have to understand the technical details.
I'm sure there's plenty YouTube vids showing qualitatively how they work.   Just search a bit.  Keep in mind that any qualitative understanding doesn't put you in a position to design with them.  You really do have to "get it" to apply them successfully. You have to be able to do the math or you'll melt parts and not know why.
Comment: So what happens when you increase the base current/voltage, can there be a way for electrons to flow through the base if the voltage/current of the base is greater than that of the collector?
Comment: The voltage at the base will be higher than the voltage at the collector if the transistor is fully turned on (saturation).      How they work is really way too complicated to just describe in text.    You need diagrams and maybe some animations.   Seriously, look up "How does a BJT transistor work" on YouTube, you'll probably get 100 hits.   MOSFETs, to me, are much simpiler to understand and apply
Comment: I did look up on YouTube and Google before I came here, the only thing that I don't understand is at 5:29 in this YT video https://www.youtube.com/watch?v=7ukDKVHnac4 It explained everything perfectly except when he said "If you increase the base current the collector current will increase proporionally" can you please explain that to me in a way that it makes sense
Comment: It just dosen't seem right that when you increase the base current the collector current will ALSO increase, shouldn't one decrease if the other increased?
Comment: Base current is like a water valve-  You can control the collector current by controlling the base current.   The more base current you drive, the more collector current can flow.   One doesn't fight the other.  FUrther, you have to keep in mind, the collector current flowing is a result of the EXTERNAL CIRCUIT as well as the BJT itself, so you can't analyze it in isolation.
Answer: If the base voltage is higher than the collector voltage, and the base voltage is higher than the emitter voltage, the transistor is in the "saturation mode" of operation. Current will be flowing into the base (or out of base for PNP). This is something you can enter into a search engine for better understanding.
If the base voltage is higher than the collector voltage, and the base voltage is LOWER than the emitter voltage, then the transistor is in the "reverse active" mode of operation. Current will be flowing into the base (or out for PNP). That is also a viable search term.
The base emitter voltage does change depending on base current. It generally goes UP in magnitude with higher current and down with lower current. But the relationship is not linear. A small voltage increase leads to a large current increase.
Also, the base emitter voltage changes with temperature. Generally it goes DOWN in magnitude with higher temp, and UP with lower temp.
0.7V is just a typical number used to help do rough analysis. Some people use 0.6V instead of 0.7. If you need a more accurate number, you can start by using 0.7, then solve for the base current, then use the diode equation to solve for the base voltage, then go back and solve for the base current again. After you do that a few times you will probably get very close to the true base current. Or you can use a simulator.


How do I prune Silver Birch Tree?

Question: We acquired three Birch Trees.Silver,..not weeping...from a Landscaper. One was mostly straight...the other two had mostly 'weeping' branches. I expressed my concern and was told that they would 'grow out of that'. It's been about six years and they are still 'weeping'. One site suggested I prune off about 1/3 of the brances that are headed downward. Repeat next year, etc. I have done that and one of the trees now appears to be mostly one sided! Any thoughts on this?
Thanks
Comment: Welcome! "Any thoughts" is a bit vague as far as questions go - could you please read [ask], then [edit] your post with more details? And a photo or two certainly would help your fellow gardeners to get a better idea of what you are working with.
Comment: I doubt very much the ones with weeping branches will 'grow out of it', no matter how you prune them, they are likely a different variety of Birch than the straight one provided. A photo of the trees might help to identify which varieties you have.
Comment: So:  'Any thoughts' should have been:   Do you have any thoughts on this?
Answer: Birch pruning is trickier than most hardwood species, because the trees have a tendency to bleed massive amounts of sap if pruned in late winter or spring, the way many trees can be safely pruned. This can harm the tree, and can leave them vulnerable to damaging insect infestations. The best time to prune birches is usually in late summer or early fall. This timing both avoids the highest sap flow, and the egg-laying season for the insects that are most damaging to birches.
As for the "weeping branches", this is a feature of silver birch, whose scientific name is Betula pendula, "pendula" referencing the hanging nature of the branches. However, this characteristic varies from individual to individual, and depends both on the genetics of the tree and on the site. It could be that your particularly tree is unusually prone to this growth habit. But it also could have to do with conditions.
Silver birches love light; they are fairly shade-intolerant even compared to other birches. As such their branches will seek light wherever it is available. If there is abundant light reaching lower levels of the tree, already-hanging branches will grow longer. Relative to other birches, silver birch is more likely to have higher-up branches droop or grow longer to reach light lower down, rather than sprouting out of the base.
If they're grown among other trees, these trees will self-prune and you will find few branches reaching the ground, mainly because the lower branches don't get enough light to justify the tree sustaining them.
How to prune? I think the best way to prune most birches is to leave them alone as much as possible, and only remove branches that are too close to something, like a building or a path. If you want the tree to have a single-trunk habit, you can prune off side-branches. But in general, birches sometimes grow with a multi-trunk habit. Silver birch is a lot less prone to such a growth habit (and more likely to grow with a single trunk) than some other birch species (such as gray birch, Betula papyrifera, a native of North America) but it still sometimes grows this way, and if it wants to grow this way, you will have a lot of work cut out for you if you want to change its growth habit. Also, when grown on open, sunny sites, silver birch sometimes likes to branch lower down on the tree. Again, you can sometimes get it to grow in a single-trunk habit by pruning off side branches.
It is always best not to prune off too much at once. If you have selected one of several trunks or branches that you want to make the main trunk, but they are all relatively equal in size, you don't necessarily want to cut off too much in one year. Instead, trim off a portion, maybe a third to a half the growth on the side branches. Then, over the next 1-3 years, continue trimming back the unwanted trunk or branches. This will minimize the stress on the tree, and allow it to invest more growth into the main trunk or branch. Usually, this approach is sufficient to get the tree to adopt a single-trunk habit.
If you pruned off too much in a previous year, you might want to go easy on it this year. Does the tree look stressed, or does it look healthy or vigorous? I would lay off the pruning if it looks visibly stressed, i.e. less healthy or vigorous than the other trees.
Lastly, look at the lighting conditions. It could be that the tree is growing in a more one-sided way because it is more shaded on one side. If that's the case, there's not much you can do about that. Either open up more light for it by pruning away a branch or two from a nearby tree that is shading it, or just accept the asymmetry. If you have a shaded site, to where the birch isn't getting enough light, you might be better off looking for a more shade-tolerant species in the long-run. In the wild, silver birch are usually replaced by more shade-tolerant trees over time.
I'm not sure where you're located so I can't give any specific recommendations, but I always recommend choosing plants native to your local area. (Silver birch is native to a wide range across Europe and north Asia and depending on how you classify birch species, possibly into northwestern North America.)
Comment: I live in Portland, Oregon.  These Birch Trees have total 'light'.  They all started as a 'single trunk' but these two branched off rather soon.  I have been told to just pick a 'leader' and prune off any side branches...sporadically... One of them does not have a 'leader'....I was assured by the Professional that they were all the same 'species'.....I saw a difference within two years.   Last resort, which I dread....start over.   Thanks for all the comments.
Answer: Betula pendula (aka "silver birch") is, to quote the RHS, "an elegant medium-sized deciduous tree with slender drooping twigs." Betula pendula "Youngii" is, again quoting the RHS, "a small deciduous tree forming a dome-shaped crown of arching branches weeping to the ground ... " If you google them you'll see the difference. If you have Betula pendula then my advice would be to let it do its own thing - you won't be able to prune it to look nicer than its natural, graceful form. If you have "Youngii", it wants to be a weeping, dumpy looking tree and nothing you do will be able to prevent that. Also, bear in mind that there are numerous birch species and cultivars.
Comment: Comparing the photos of the two species you mention, I still maintain my original thought that we received 1 Silver Pendula and 2 Youngii (weeping Birch)......With the pruning I have just done............we may end up with a 'Monster' Birch....!    ha

How do I prune Silver Birch Tree?


Country-Specific Answers

Question: A question was UK specific, but I wanted to know if it would be appropriate to ask an identical question but for US universities for a US-Answer.
Comment: It seems to me that only the answer is UK specific, not the question.
Comment: Huh, you are right. Question was not country-specific. Thanks.
Answer: This has been discussed fairly extensively on this site before. The general accepted practice is to use tags to label questions as specific to a given country. (FWIW, I gave a different answer in this question, but that was five years ago when the site was brand new... the times, they are a'changin'.)

Country-Specific Answers


Origin and meaning of "from out of left field"

Question: What is the origin of the phrase from out of left field? My understanding is that the meaning is unexpected, or odd. Is that correct?
Real world examples of the phrase being used badly would be great :)
Comment: Bad usage: The fan burst onto the outfield from across the first baseline and ran at the pitcher who was watching the play unfolding at third. Before he realized what was happening the fan had closed the distance and landed a solid punch to the back of the pitcher's head.   When asked about it later ther pitcher replied, "It was so unexpected and happened so quickly- it's like it came out of left field."
Comment: @jim: I'm not too familiar with baseball, is that bad usage because it's tautological? or because it came out of right field? Also, is that a real example?
Comment: You guessed it- it's because it came out of right field. All persons depicted here are fictional and fabricated solely for your entertainment. Any similarity to any person living or dead is purely coincidental.
Comment: Also for the record, when I wrote that example, your question did not ask for "Real world examples" simply "examples of it being used badly"
Comment: Yes, sorry about that. Should have been clearer anyway. Good example regardless.
Comment: Sounds a little like "The Devil is in the details", which is really a mutated form of the originial "God is in the details", as written by the designer of the Taj Mahal. Most pop culture now only is aware of the Devil, usually mentioned in a wry wink and a nod way, to show that it's hard to get things right. That is much less meaningful than the inverse.
Answer: This phrase comes from baseball. Wikipedia has a thorough description of the etymology:
http://en.wikipedia.org/wiki/Left_fielder#Out_of_left_field
Among other theories listed there: "During this time period, the shape of the outfield in Yankee Stadium roughly approximated an oval,[3] with the "long" portion pointing to left-center. A left-fielder would thus typically be stationed further back from the action than the center or right fielders, as he would have a greater amount of ground to cover. Hence, "out in left field" meant one was furthest from the action taking place at home-plate, and the most likely to draw erroneous, fanciful conclusions about that action."
Comment: As witness the title of the famous _Festschrift_ of humorous and satiric papers on linguistics: [***Studies Out In Left Field**: Defamatory Essays Presented to James D. McCawley on the Occasion of His 33rd or 34th Birthday*](http://benjamins.com/#catalog/books/z.63).
Comment: Wouldn't a right handed batsman hit the ball to the left?
Comment: @mgb, I don't know much about cricket, but as the Wikipedia article mentions, right-handed batters do tend to pull to left field.
Answer: The Concise New Partridge Dictionary of Slang and Unconventional English (2008) says:

left field noun > out of left field unexpected, unforeseen, from nowhere US, 1946
left field adjective different, out of the ordinary. Figurative use of
baseball jargon US, 1967

The American Heritage Dictionary of Idioms (1997) says:

out in left field Also, out of left field. Eccentric, odd; also, mistaken. For example, The composer's use of dissonance in this symphony is way out in left field, or His answer was out of left field; he was totally wrong. This idiom refers to baseball's left field but the precise allusion is disputed. Among the theories proposed is that in some ballparks the left field wall is farther from the batter than the wall in right field. Another is that in early ballparks, left field was often larger than right field and therefore was home to more lost balls and general confusion. [Mid-1900s] Also
see FAR OUT.

See also Safire's Political Dictionary for more discussion.

I found some examples earlier than 1946.
Billboard magazine, 24 Apr 1943, "Religion All Of A Sudden: Groups With Self-Styled Piety Capitalizing on War Nerves by Buys on Indies But Nets Sneer":

NEW YORK. April 17. Latest twist in radio linked with the war is the exceptional number of quasi-clerical groups and individuals who have come out of left field in recent months and are trying to buy, not promote, radio time.

A direct baseball pun is made in Public Utilities Fortnightly, Volume 25, Issue 1, Public Utilities Reports, 1940 (snippet, but date seems correct):

PRESIDENT Roosevelt has started the session off on a strong note of economy. His budget, with expenditures substantially reduced below those of a year ago, places the burden on Congress if it adds materially to proposed appropriations. The President in this message took a more positive stand against unnecessary expenditures than he has since the night in October, 1932, when he made his famous economy speech at Forbes Field in Pittsburgh from a platform erected over the second base. It might be suggested that in this respect January, 1940, marks the first time since then that he has been out of left field.

However, the earliest citation in the Historical Dictionary of American Slang is 1937 in S.F. Chronicle (April 19) 2H:

Lefty Gomez [New York Yankees pitcher noted for his eccentric humor] is "way out in left field without a glove" in baseball jargon.  In other words he is as proficient at whipping over a smart crack as a sizzling strike.
Answer: That "theory" (the Yankee Stadium rationalization) seems not only to be a case of Wikipedia error, but also one of urban myth's supplanting of factual origins.
The mistaken usage, "…out in left field" (and its similarly misinformed pseudo derivative, "…out of left field") can arguably be said, at a fundamental level, to have resulted, apart from any connection to original meaning, solely from the circumstance that the majority of people are right handed—a recapitulation of sorts of the sinister-dexterous versus right-&-left handedness linguistic dichotomy; and, not surprisingly, because the Internet is no less effective propagating and perpetuating error than accuracy. (An unrelated example of how people's natural proclivities can bring about rephrasing of once logical (albeit likewise niche vernacular) sayings would be the transmutation of "You cannot eat your cake and have it, too" (a clearly sensible proposition) into "You cannot have your cake and eat it, too" (a statement fraught with ambiguity... to no recognizable effect).
In times past, when a substantially greater number of Americans--youth and adult alike--played, followed, or otherwise actively and socially participated in the game, the then well known, baseball-derived expression, "…out in right field" (no, not "out of..." but the allusion could still hold, albeit with dubious effect and validity) was (and still is) not in reference to size or distances in a ball park: were that the case, would we not speak of things being "from out of" these "parks' left" or "those parks' right" fields? Or, collectively-speaking, of their being from out in, or out of, an archetypal park's center field…the field which, indeed, would circumscribe the greatest area and subtend the greatest distances in the majority of parks...and "sand" lots?
So, if not the greater space and longer distances of the eastward and northward situated baseball outfields, then what would explain how and why that outfield which is shortest and smallest gives rise (and does so for an erstwhile self-evident reason) to a figure of speech pertaining—rightly or wrongly—to some aberrant or derogatory quality or feature?
To aficionados of baseball lore and novice players of the game (especially those latter who have experienced e being "exiled" to right), that question devolves to a set of observations not always obvious to baseball-non-participants, or even to ball park spectators, namely, that:

Most hitters are right handed and hit right handed (from the 3rd-base side of the plate).
Most batter "connected" pitched balls are hit straight away or "pulled" left-field-ward from the batter's box (along trajectories away from right field).
Accordingly, most successfully-batted pitched balls are pursued, are fielded, drop free, or get by within the relatively greater area (vis-à-vis right field) that is encompassed by left and center fields.
Conversely, a proportionately small number of pitches are struck into and have need to be pursued in right field, as a consequence of which….

Accordingly faster (running), stronger (longer throwing), better sighted (for fly ball catching), more alert (faster-reacting)—in general, the more athletically gifted, healthier, less injury-impaired, and more highly regarded individuals are most apt to be assigned or "chosen up" to the center and left field positions; whereas…
The less demanding (and, on the sand lot, the usually last remaining) right-field "vacancy" is the one most likely to be filled by the "least and last" viable aspirant…(in child and youth contests...the position that goes—not infrequently with some measure of stigma—to the boy deemed least reliable and, therefore, best placed "away from the action"—the position also which, sad to say, occasionally evinces a measure of comparative peer group acceptance. (To what degree any right field "bias" carries over into varsity, the minors, and the majors would be a topic "not without dissention,"   but it is well known that many of the game's most productive, most illustrious players found themselves relegated to right field only after the rigors of playing left and center had worked its toll on their legs and leg joints, leaving hitting prowess as a sole remaining team asset, to be protected and extended in the relative sequester of right field.

Because of the long periods of right fielder idleness between hits to right, a relatively inexperienced right field player can sometimes fall subject to lapses of attention... even so far as to be caught daydreaming, or napping standing (in baseball parlance, to be caught flat footed) when a fly or drive soars over, by, under or sometimes even into a too-late roused, might-have-been "fielder."
Whence a manager's or fellow player's derogation, and a broader populace's aspersion, directed, respectively, toward or with regard to a player, or person, who is found, or deemed likely to be found, in a state of least attention (alertness, awareness, wakefulness,…) when a situation most calls for it; a baseball allusion (and double entendre) in which, be it within the paradigm of baseball or otherwise, and irrespective of any specific location or context, a person, for lack of attention or by taint of wandering mind, is said to be or have been "out in right field." (By double entendre is meant "out" also in the sense of altered consciousness.)
So we have today a frequently used, and almost as frequently miss-used figure of speech (the latter for which we even have highly-paid sport commentators to thank) of which it can be said, that because of a mere physical-genetic "accident" of nature, called handedness, its actual significance has come to escape virtually all who speak it. Would it be fair, then, to say that the …bastardized form, out in, or from out in, left field represents a societal cultural diminishment? In some regards the answer must be yes; but not in all regards, which is to say: that in error virtue (of sorts) can sometimes be found.
So it is that when we most often hear mention of a thing's "coming from" (as opposed to a person's being) "out in right (or left) field" (or, in another baseball allusion, of its being "off the" [outfield] "wall" [and thus harder to "catch"…its meaning], could it not be said that the speaker has, unwittingly or otherwise (nah) made his own inattention, heedlessness, or misunderstanding the object of derision in place of another (in the proverbial outfield, from whence the thing came or bounced)? Is not the equivalent defense, "it came unexpectedly", also an admission that the one to whom it came was caught unawares? Just as if he, not the other, had been "out in right field"?
Comment: Wow. Your sentence lengths are astounding.
Comment: +1 for example of (now rare) long form writing abound with rare words (almost on the verge of "inkhorn-laden writing") :) Though it's a little bit hard to follow because of lenght it's also a nice example of how widely accepted etimologies can be incorrect (there are plenty of other examples, e.g. "black friday"'s most polular etimology is not the right one)
Comment: https://www.lyrics.com/lyric/2744647/Right+Field
Answer: In Chicago Il the old sight of West Side Field bound by Wood.Damen, Taylor, and Polk I believe home of the Cubs in the early 1900's where Cook County Hospital was there was a psychiatric ward "way out in left field" and when a ball was hit really far,  at the time there were no home run fences,the phrase was coined by some ballplayer. There is still a placque ther today on the site.
Answer: Paul Dickson, The Dickson Baseball Dictionary (1989) has a lengthy entry for "out in left field/out of left field":

out in left field/out of left field 1. adj. Odd; out of it. Phrase used for that which is a bit off.
ETY[MOLOGY] How left field got to be the metaphorical location for oddness has been the subject of no end of speculation. Several have suggested that it comes from the remoteness of left field. But right field is just as remote and, at the lower levels of the game at least, more likely to be populated by an odd player. ...
There are two major theories:

That it was an insult heaped on kids who were stupid enough to buy left field seats in Yankee Stadium, which for many years would have put them far away from a right fielder named Babe Ruth. ...

That it was, in fact, a specific reference to the fact that there was a mental hospital, the Neuropsychiatric Institute, in back of left field in the old, 19th-century West Side Park in Chicago. ...

It should be pointed out that there was a phrase used in the 1930s that was "way out in left field without a glove." According to a United Press International dispatch of April 19, 1937, which carried George Kirksey's byline, the phrase was not used to describe a player who is out of it but rather one "as proficient at whipping over a smart crack as a sizzling strike."

Although Dickson includes a "1." before the definition "Odd; out of it," he offers no second definition for the term. This is somewhat surprising because most authorities understand "out in left field" and "out of left field" to have quite different meanings—the former suggesting isolation and the latter unexpectedness. In this answer, I will look at the two expressions separately.

'Out in left field'
The last paragraph in Dickson's entry refers to the same quotation that appears in J.E. Lighter, The Random House Historical Dictionary of American Slang, volume 2 (1997) and is cited in Hugo's answer:

out {or off} in left field, 1. (of persons) eccentric; (hence, broadly) absurd; nonsensical, unreasonable; entirely wrong; far from the mark. Also, as quasi-adv. [First cited occurrence:] 1937 S.F. Chronicle (Apr. 19) (Tamony Coll[ection]): Lefty Gomez {New York Yankees pitcher noted for his eccentric humor} is "way out in left field without a glove" in baseball jargon. In other words he is as proficient at whipping over a mart crack as a sizzling strike. ... 2. distracted; unconscious. [Cited occurrences from 1958 and 1964 omitted.] 3. very far away; (hence) out of touch; in obscurity; in a difficult position; at a disadvantage; at a loss. [Cited occurrences from 1945 and later omitted.]

I am not inclined to take George Kirksey's 1937 interpretation of the meaning of "in left field without a glove" as entirely accurate—in part because the phrase (used figuratively) appears some 30 months earlier in a non-baseball context. From George Durno, "News Behind the News: The National Whirligig," in the Santa Cruz [California] Evening News (October 26, 1934):

Any New Dealer so brash in the interim [before the 1934 midterm elections] as to start announcing new policies or taking controversial action in connection with those existing probably would wind up in left field without a glove. As they all know this, the team undoubtedly will remain intact.

The sense of "in left field without a glove" here means something like "sent to Coventry"—that is, banished to an undesirable place with out the necessary equipment to do the job. Contrary to Dickson's reading of the 1937 quote about Lefty Gomez, the 1934 quote is not meant to describe someone as witty or quick with a riposte; it describes someone who is being punished for disregarding orders—and it is not a great stretch to see that sense of being "out in left field" being extended to refer to a person who frequently behaves eccentrically or unpredictably or without proper discipline. A more recent term for the same sort of eccentricity is "flakey" (of behavior) or "flake" (of the person who acts flakey).
As for Dickson's theories of "out in left field" originating in New York City or Chicago, the chief problem is that the two earliest instances I found are from Cambridge, Massachusetts—and again, they refer only figuratively to baseball. First, from "Surprises at City Council Meeting—Councillors Delaney and Leahy Really Agree—Mr. Sennott Chides Pres. Murphy," in the Cambridge [Massachusetts] Sentinel (January 26, 1929):

Delaney continued, "It might be well right, that there's nothing for Cambridge to get after a lapse of 19 months. Why has Cambridge been so lax? Cambridge has been left out in left field, holding the bag." Councillor Leahy surprised the gathering by supporting Councillor Delaney. He was only too pleased to learn why the city was being "guzzled."

And from "Gossip," again in the Cambridge [Massachusetts] Sentinel (June 20, 1931):

Police Captain Donahue, of the Traffic Squad, has determined to prosecute any motorist caught going to the left of the North Cambridge "islands," or parking their cars in the zones. The City Council is out in left field in this instance. Bravo, Cap! The state is the first law in Massachusetts, and Joe knows that he is first an officer of the Commonwealth, which delegates police powers to cities and towns.

So Cambridge, Massachusetts was using out in left field" in what appears to be the figurative sense that Lighter describes as definition 3 for his entry: "out of touch; in obscurity; in a difficult position; at a disadvantage; at a loss." It is hard to see the relevance of a Chicago sanitarium or New York City's ballpark layout to these instance from 1929 and 1931.
A somewhat more literal sense appears in Jim Kean, "Thru the Eagle's Eye," in the Boston [Massachusetts] Heights (November 24, 1939):

d I are more interested in getting together $2.20 to see Auburn and Temple, than to make reservations for the Cross game. So, comes the Cross game and we are out in left field without a glove. The shoppers have spent their $3.30 for the year and have taken up all the seats.

The "right fielder named Babe Ruth" theory that Dickson cites also suffers from the fact that Ruth actually played almost the same number of games in left field (1,048) as in right field (1,130) over the course of his career. What made the right field seats more desirable at Yankee Stadium, I imagine, is that as a left-handed power hitter, Ruth would tend to hit most of his home runs into the right field stands. But that doesn't seem like much to hang an insulting chant on.

'[From] out of left field'
Lighter has this separate entry for "from {or out of} left field":

from {or out of} left field, 1. as if from nowhere; from out of the blue; (hence) without warning; most unexpectedly. [Earliest cited instances:] 1947 Bowers & Millhauser Web (film): I really solved this one from left field. 1952 The Hunter (CBS-TV): Where are these putouts {murders} {murders} coming from, left field? 1960 Sat[urday] Evening Post (Aug. 13) 76: You see a little wiggle that suddenly comes out of left field. She is absolutely unexpected. ... 2. out {or off} in left field, below. [Earliest cited occurrence:] 1949 KFRC radio (S[an] F[rancisco]) (july 24) (Tamony Coll[ection]: Maybe I was a little dreamy and from left field.

In its etymological discussion of "left field" as a more general phrase, Lighter offers these thoughts:

left field, n. {of baseball origin; semantic development obscure; perh[aps] sug[gested] by the fact that, owing to the distance involved, a putout throw from left field to first base is extremely difficult; ...}

Lighter then cites a lengthy discussion in William Safire, I Stand Corrected: More on Language (1986), which dedicates three pages to discussing a number of other consideration that may have factored into the emergence of the notion that left field is a remote place conducive to oddball behavior. A subsequent book by Safire, Safire's Political Dictionary (2008) distills those theories to two that he seems to view as most probable and satisfactory explanations for the genesis of the term:

Sports fans differ on the reasoning behind the metaphor. Some suggest that left fielder play farther out to get the power balls hit by right-handed players. Others note that in most of the older, asymmetrical ballparks—Yankee Stadium [in the Bronx, New York], Ebbets Field [in Brooklyn, New York], Forbes Field [in Pittsburgh, Pennsylvania] among others—left field was deeper than right field. That gave left-handed batters an advantage because distances to right-field fences were shorter.

These observations make sense in the context the isolation sense of "out in left field" but they do little to justify the unexpectedness sense of "[from] out of left field." There, I think, Lighter's argument that the phrase reflects the difficulty of throwing a runner out at first base on a ball hit to left field left field has some plausibility. The difficulty is compounded by the fact that most baseball teams put their fastest sure-handed starting outfielder in center field (because he has the largest amount of ground to cover), and their strongest-armed outfielder in right field (because it is extremely important strategically to limit the number of base runners who successfully go from first base to third base on a single, and the throw from right field to third base is much longer than the throw from left field to third base. Consequently, many teams put their weakest-armed starting outfielder in left field—and a powerful, accurate throw from left field may come as a surprise.
Another explanation involves not the surprise that the throw from left field produces on spectators, but the uncertainty that a throw from left field may involve from the perspective of the receiving infielder. On a throw from right field to third base (or to second base) the infielder preparing to make the catch is facing both the incoming ball and the advancing runner; but on a throw from left field, the infielder is either standing sideways to the advancing runner (at third base) or facing the other direction entirely (at second base). There is thus a heightened element of uncertainty associated with any throw from left field—especially in the rough-and-tumble days of early baseball when runners were encouraged to knock down fielders on close plays at any base.
There is, however, not much evidence that "out of left field" in the sense of unexpected had much currency in baseball before it began appearing in a figurative sense in contexts outside baseball. The earliest matches (from 1947 and 1952) for "from left field" are figurative, as is the earliest instance that a Google Books search finds for "out of left field." From Hal Webman & Alan Fischler, "The Record Year," in The Billboard (Jun 19, 1948):

The second Petrillo ban hit the biz on New Year's Day. And the costs incurred in pre-ban recording took its toll of some of the less stable smaller companies.  Hit records and hit songs came out of left field throwing somewhat of a damper on the "name" singer cycle and the big publisher ballad market.

The same is true of the earliest matches returned by an Elephind newspaper database search.  From Erskine Johnson, "It's Jane Froman's Voice in Susan Hayward's Throat," in the San Bernardino [California] Sun (July 16, 1951):

"I never thought I'd get out of cops-and-robbers pictures," Scott [Brady] told me at the Beverly Gourmet. "Then this thing came out of left field. I'm playing comedy for the first time. I look at the screen and say is this really me? Is this the guy who smelled in all those other pictures?"

And from Bob Thomas, "Hollywood," in the Santa Cruz [California] Sentinel (November 6, 1952):

Miss Ritter continues to maintain a home in the east, where her husband, advertising man Joseph Moran, and two children live. She commutes here for pictures and remains aloof from the Hollywood hubbub. In fact, it looked a few months ago as though she would chuck the works because of the roles she was getting.
"I was playing too many maids," she commented. "Or at least it seemed as though I was. I was a maid in 'A Letter To Three Wives,' but that gal was right out of left field. Then there was 'All About Eve.' But what most people didn't catch was the line where I told Bette Davis that for 10 years I closed the first act. Anybody who did that in vaudeville was doing all right."

And from Lyn Connelly, "A Peak at the Stars," in the Claude [Texas] News (October 7, 1954):

Georgia Gibbs keeps pulling songs out of left field . . . Her smash, "Seven Lonely Days." was written by Yale students . . . Her popular. "What Does It Mean To Be Lonely?" was written by two Miami Beach lawyers.

An interesting early figurative use of "from left field" appears in an account of a boxing match between Joe Louis and Primo Carnera, where the expression seems to mean "from a long distance." From Henry McLemore, "Louis 'In' on First Blow," in the [Champaign-Urbana, Illinois] Evening Courier (June 26, 1935):

He [Louis] threw a punch. Was it a right or a left? I don't know. It started too swiftly. It landed high on Carnera's cheekbone and the Italian sank to the floor like a shot-through elephant. Out of his head, he was up as the timekeeper tolled "two-uh!" Watching him, bleeding, glassy and rubber-kneed, you wished he'd stay down for good, for you knew what awaited him.
Louis, as cold as ice, met him coming up and nailed him with a left. You could see the blow this time, for he started it from left field. Carnera hit the deck again.

The description suggests a similarity between Louis's punch and an outfielder winding up to throw a baseball into the infield from left field.
And from Charles Freeman, "At the New York Theatres," in the Bronxville [New York] Reporter (March 12, 1953):

I, further, would like to recommend to all would-be writers of comedy that they sit in a few times and observe Mr. [Hugh] Herbert's manner of dialoguing his characters through the premise set down in THE MOON IS BLUE. For here is a craftsman who is a shrewd observer of character, has just the right instinct for the comic line and story twist and wastes no time between jokes which latter, he does not bring in from left field.

Conclusions
U.S. English has a number of idiomatic expressions tied to "left field" (part of the outfield in baseball and softball), including "out in left field," "out of left field," and "from left field." The first of these phrases tends to be used to convey the idea of isolation or uninformedness. The other two more centrally involve the idea of unexpectedness or, in some cases, kookiness or eccentricity.
Why left field, rather than the other two outfield positions (center field and right field), received this idiomatic attention  is a matter of conjecture. None of the theories that I have read seem especially persuasive. Given that right-handed batters tend to hit the ball to left field, and left-handed batters to right field, the association of the expression "[from] out of left field" with unexpectedness must originally have reflected something other than how frequently a ball is thrown in from left field.
One possibility that actually links the "unexpectedness" meaning to the relative frequency with which balls are hit to left field is that the expression arose from batting practice sessions where outfielders chase down the balls that they can't catch on the fly or on the bounce and then throw them back toward the pitcher's mound while the pitcher continues to throw pitches to the batter in the batter's box. Under those circumstances, a pitcher may have delivered several additional pitches before a ball from an earlier pitch comes back in from the outfield. And since the pitcher is focused on (and facing) the batter and on home plate, a ball arriving tardily from the outfield might very well come as surprise, especially if it hits the pitcher or rolls underfoot as he is delivering another pitch. It seems to have come out of nowhere.
But there is no consensus as to the nature of the left-field-specific surprise that gave rise to calling something unexpected "from out of left field"; indeed, there is not even consensus on whether the surprise in question is unexpected from the perspective of a player on the field or of a spectator in the stands or of both.
Answer: Left field in baseball is a very busy place with a lot of hit baseballs going there due to the majority of batters being right handed and tending to pull the ball that direction. So things going into left field are common. A natural contradiction is that things coming out of left field would be very unusual and unexpected. Thus the saying.
PB


What's the Kantian response to the idea of martyrdom?

Question: What's the Kantian response to the idea of martyrdom? Say, for example, that a town is under a curse of misfortune and demise, but one of the shamans casts a spell on a child who's meant to experience the total and concentrated effects of the curse and in turn making the child immortal. Years pass and the child is forgotten as a folklore tale around the village, but one day the child reveals itself to the townsfolk in an attempt for the villagers to unbind him. So, the dilemma appears: is it better to release the child or let him suffer?
Comment: Martyrdom is supposed to be voluntary. Forcing suffering on someone for the benefit of others is against everything Kant's anti-utilitarianism stands for, he was even [against lying to the murderer at the door](https://philosophy.stackexchange.com/q/65696/9148) to save the victim.
Comment: As signaled by conifold, what op refers to is less martyrdom than scapegoating, as described by René Girard (which is yet distinct from the rhetoric/politic tactic of scapegoating). Scapegoating consists in using a person as a mean to relieve social pressure without consideration for their own dignity as a person, which is clearly against Kantian morale.
Comment: I think you can ask about Kant's response to the idea of martydom - does he expressly consider it or can a  response be derived - constructed - from from his texts ? - without including the imagined conditions you describe. Your question can stand alone, unaided by a thought-experiment of the shamanic spell-casting kind or any other. It is btw a thoroughly interesting question.
Answer: In the second Critique, Kant warns his readers about something translated(?) as enthusiasm, which is similar to, but not quite the same as, the kind of "excitement" that goes by said name nowadays. Here is the context:

But if it is asked: "What, then, is really pure morality, by which as a touchstone we must test the moral significance of every action," then I must admit that it is only philosophers that can make the decision of this question doubtful, for to common sense it has been decided long ago, not indeed by abstract general formulae, but by habitual use, like the distinction between the right and left hand.

We will then point out the criterion of pure virtue in an example first, and, imagining that it is set before a boy, of say ten years old, for his judgement, we will see whether he would necessarily judge so of himself without being guided by his teacher. Tell him the history of an honest man whom men want to persuade to join the calumniators of an innocent and powerless person (say Anne Boleyn, accused by Henry VIII of England).
He is offered advantages, great gifts, or high rank; he rejects them. This will excite mere approbation and applause in the mind of the hearer. Now begins the threatening of loss. Amongst these traducers are his best friends, who now renounce his friendship; near kinsfolk, who threaten to disinherit him (he being without fortune); powerful persons, who can persecute and harass him in all places and circumstances; a prince, who threatens him with loss of freedom, yea, loss of life.
Then to fill the measure of suffering, and that he may feel the pain that only the morally good heart can feel very deeply, let us conceive his family threatened with extreme distress and want, entreating him to yield; conceive himself, though upright, yet with feelings not hard or insensible either to compassion or to his own distress; conceive him, I say, at the moment when he wishes that he had never lived to see the day that exposed him to such unutterable anguish, yet remaining true to his uprightness of purpose, without wavering or even doubting; then will my youthful hearer be raised gradually from mere approval to admiration, from that to amazement, and finally to the greatest veneration, and a lively wish that be himself could be such a man (though certainly not in such circumstances).
Yet virtue is here worth so much only because it costs so much, not because it brings any profit. All the admiration, and even the endeavour to resemble this character, rest wholly on the purity of the moral principle, which can only be strikingly shown by removing from the springs of action everything that men may regard as part of happiness. Morality, then, must have the more power over the human heart the more purely it is exhibited. Whence it follows that, if the law of morality and the image of holiness and virtue are to exercise any influence at all on our souls, they can do so only so far as they are laid to heart in their purity as motives, unmixed with any view to prosperity, for it is in suffering that they display themselves most nobly.
Now that whose removal strengthens the effect of a moving force must have been a hindrance, consequently every admixture of motives taken from our own happiness is a hindrance to the influence of the moral law on the heart. I affirm further that even in that admired action, if the motive from which it was done was a high regard for duty, then it is just this respect for the law that has the greatest influence on the mind of the spectator, not any pretension to a supposed inward greatness of mind or noble meritorious sentiments; consequently duty, not merit, must have not only the most definite, but, when it is represented in the true light of its inviolability, the most penetrating, influence on the mind.

It is more necessary than ever to direct attention to this method in our times, when men hope to produce more effect on the mind with soft, tender feelings, or high-flown, puffing-up pretensions, which rather wither the heart than strengthen it, than by a plain and earnest representation of duty, which is more suited to human imperfection and to progress in goodness.

To set before children, as a pattern, actions that are called noble, magnanimous, meritorious, with the notion of captivating them by infusing enthusiasm for such actions, is to defeat our end [emphasis added]. For as they are still so backward in the observance of the commonest duty, and even in the correct estimation of it, this means simply to make them fantastical romancers betimes. But, even with the instructed and experienced part of mankind, this supposed spring has, if not an injurious, at least no genuine, moral effect on the heart, which, however, is what it was desired to produce.

All feelings, especially those that are to produce unwonted exertions, must accomplish their effect at the moment they are at their height and before the calm down; otherwise they effect nothing; for as there was nothing to strengthen the heart, but only to excite it, it naturally returns to its normal moderate tone and, thus, falls back into its previous languor.

Principles must be built on conceptions; on any other basis there can only be paroxysms, which can give the person no moral worth, nay, not even confidence in himself, without which the highest good in man, consciousness of the morality of his mind and character, cannot exist. Now if these conceptions are to become subjectively practical, we must not rest satisfied with admiring the objective law of morality, and esteeming it highly in reference to humanity, but we must consider the conception of it in relation to man as an individual, and then this law appears in a form indeed that is highly deserving of respect, but not so pleasant as if it belonged to the element to which he is naturally accustomed; but on the contrary as often compelling him to quit this element, not without self-denial, and to betake himself to a higher, in which he can only maintain himself with trouble and with unceasing apprehension of a relapse.
In a word, the moral law demands obedience, from duty not from predilection, which cannot and ought not to be presupposed at all.

Let us now see, in an example, whether the conception of an action, as a noble and magnanimous one, has more subjective moving power than if the action is conceived merely as duty in relation to the solemn law of morality. The action by which a man endeavours at the greatest peril of life to rescue people from shipwreck, at last losing his life in the attempt, is reckoned on one side as duty, but on the other and for the most part as a meritorious action, but our esteem for it is much weakened by the notion of duty to himself which seems in this case to be somewhat infringed.

More decisive is the magnanimous sacrifice of life for the safety of one's country; and yet there still remains some scruple whether it is a perfect duty to devote one's self to this purpose spontaneously and unbidden, and the action has not in itself the full force of a pattern and impulse to imitation. But if an indispensable duty be in question, the transgression of which violates the moral law itself, and without regard to the welfare of mankind, and as it were tramples on its holiness (such as are usually called duties to God, because in Him we conceive the ideal of holiness in substance), then we give our most perfect esteem to the pursuit of it at the sacrifice of all that can have any value for the dearest inclinations, and we find our soul strengthened and elevated by such an example, when we convince ourselves by contemplation of it that human nature is capable of so great an elevation above every motive that nature can oppose to it. [edited: added paragraphs]
Kant discusses enthusiasm again in the third Critique (of judgment):

Let me dwell a little on that last point. If the idea of the good is
accompanied by affect [as its effect], this [affect] is called enthusiasm. This mental state seems to be sublime, so much so that it is commonly alleged that nothing great can be accomplished without it. But in fact any affect is blind, either in the selection of its purpose, or, if that were to have been given by reason, in [the manner of] achieving it. For an affect is an agitation of the mind that makes it unable to engage in free deliberation about principles with the aim of determining itself according to them. Hence there is no way it can deserve to be liked by reason. Yet enthusiasm is sublime aesthetically, because it is a straining of our forces by ideas that impart to the mind a momentum whose effects are mightier and more permanent than are those of an impulse produced by presentations of sense.

He also says in that document:

This pure, elevating, merely negative presentation of morality brings with it, on the other hand, no danger of fanaticism, which is a delusion that we can will ourselves to see something beyond all bounds of sensibility, i.e. to dream in accordance with fundamental propositions (or to go mad with Reason); and this is so just because this presentation is merely negative. For the inscrutableness of the Idea of Freedom quite cuts it off from any positive presentation; but the moral law is in itself sufficiently and originally determinant in us, so that it does not permit us to cast a glance at any ground of determination external to itself. If enthusiasm is comparable to madness, fanaticism is comparable to monomania; of which the latter is least of all compatible with the sublime, because in its detail it is ridiculous. In enthusiasm, regarded as an affection, the Imagination is without bridle; in fanaticism, regarded as an inveterate, brooding passion, it is without rule. The first is a transitory accident which sometimes befalls the soundest Understanding; the second is a disease which unsettles it.

In the casuistical section of the Doctrine of Virtue, where Kant discourses on suicide, he notes that we might think there is something valiant about killing oneself, at least so far as it requires a lot of courage to do so. And he asks after instances where sacrificing oneself might be credited to us as virtuous. But in Religion within the Limits of Reason Alone, even with respect to the Crucifixion, he favors a metaphorical gloss according to which that story is an image of our own self-crucifixion, spiritually, in our eternal redemption.
Comment: I don't understand the edit. I do feel like I might've been better off culling the quoted sections of the 2nd Critique, since as it stands, my answer is pretty blob-like, but the edit makes it sounds like *I'm* saying a bunch of things that *Kant* said. As for the blob problem, on the other hand, well, Kant wrote like that anyway, so at worst, I'm just answering the OP per what the OP requested.
Answer:
Christian Martyrdom has unanimously distinguished between "martyrdom"
and "voluntary martyrdom" as separate phenomena, practices and
categories form the second century onward

https://www.jstor.org/stable/23252340
I've not read the article, etc.. Anyway, if the difference can be maintained, then I imagine that we're talking either suicide (boo) or murder (boo). He asks if it is "heroism", but says

I can never be allowed to sacrifice my life intentionally or to kill
myself in fulfilment of a duty to others... a soldier... is merely
risking his life (Vigilantius lecture).
Comment: dunno why I felt the need to reply.
Comment: it's his lecture! I believe @GeoffreyThomas
Comment: Okay, fair enough: it might be useful to indicate that you are not referring to (as might appear) Kant's 'Vigiltantius lecture' but to lecture notes taken by J.F. Vigilantius - and to indicate which translation you are using.
Comment: Kant discusses and disallows suicide in many texts. In the Vigilantius notes, the impermissibility of suicide is taken up in §92 and elsewhere. In §92 the Cambridge translation goes: 'It is permitted to venture one's life against the danger of losing it; yet it can never be allowable for me deliberately to yield up my life, or to kill myself in fulfilment of a duty to others ... when a soldier pits himself against the foeman's steel, he is merely risking his life' : I. Kant, *Lectures on Ethics*, tr. P. Heath, Cambridge: CUP, 2001: 370.
Comment: ok, thanks for the note @GeoffreyThomas
Answer: Well, I don't really believe in witches, wizards, warlocks and the like. So lets take some actual examples of martyrdom, say martyrdom in Christanity.
Far from the early church being persecuted the Romans considered Christians bizarre and their rituals distateful but more or less tolerated them. There was no empire wide policy of persecution.
One of the earliest historical record that we have of a concerted persecution policy was in the French city of Lugdunum in AD 177 during the reign of Marcus Aurelius, the stoic emperor. An account of this persecution is in a letter preserved Eusebius's Ecclesiastical History.
Before the actual outbreak of violence the Christians were prevented from going to the marketplace, the forums and the public baths. They were accused of:

Thyestean banquets and Oedipean intercourse

The Thystean reference is to so-called 'cannabilism' in the Christian ritual of Communion and the 'incest' reference to Agape, neighbourly love. Eventually this moved to violence of property and then of person. 48 Christians were massacred and in the history of the church they became martyrs.
What would Kant make of this? Well, in the opening paragraph to his Religion within the Limits of Reason Alone, he wrote:

So far as morality is based upon the conception of man as a free agent who, just because he is free, binds himself through his reason to unconditioned laws, it stands in need neither of the idea of another Being over him to apprehend his duty ...

And this is true, but what is true of the man who believes in no higher being is just as true for those who do, that is to "apprehend their duty". And this is exactly what those 48 men and women did.
Kant also had a notion of a duty to self. That is to treat oneself as an end and not as a means. Now the martyrdom of these men and women were not sought. They did not seek to die for their faith. Rather they were hounded, rounded up and then made to die for their faith. To suggest that they then sought their martyrdom is to invert the culpability of the action. They had done no wrong by the laws of the city they lived in, nor by Roman laws or even the laws of the gods: the Roman empire was a multi-ethnic and multi-faith empire. The Romans were much too astute as empire-builders to demand conversion to their religion but merely that it was the institutional and civic religion and that one did not insult the gods.
To describe these martyrs as seeking their fate is only to victimise again the victims of this hideous cruelty. The culpability lies squarely on the local French/Roman administration and not on the victims. In fact, the author records the fact that they themselves refused that designation:

Though they had attained such honour, and had borne witness, not just once or twice, but many times - having been brought back to prison from the wild beasts, covered with burns and scars and wounds - yet they did not proclaim themselves martyrs, nor did they suffer us to address them by this name.

That they were called martyrs by the church is to memorialise and honour them. And this is no different in any essential way to the many rituals and memorials to the millions who died defending their country in the first and second world war. None at all.
Another, more contemporary example would be the 'martyrdom' of Palestinian suicide bombers during their long campaign to regain what was stolen from them by a disgraceful British administration and then Israel. These were not 'martyrs' in the sense that this word is usually understood. They died fighting against injustice. They did not seek to die, rather they fought against being dispossesed of their lands, their homes and their nation. They died because, as Kant said, they could "apprehend their duty" as free men and women.


Which two leaders of my Dawn Redwood should I remove?

Question: I need to remove two of the leaders of my Dawn Redwood tree. Which ones? I planted this in October of 2017.
Comment: some say it weakens the tree, should it snow, gusty winds, etc. I believe some say the less dominant leaders will either be absorbed into the bigger trunk or just become less dominant side branches. I pruned 2 of the 3 down to a lower side branch and will let nature tell me which one is the dominant one!
Comment: Why do you need to remove the leaders? (I know nothing about the dawn redwood and ask out of curiosity.)
Comment: 2 schools of thought here.
Answer: The two on the right look the thinnest - remove these. I know it's painful to cut off a sizeable proportion of the young growth, but it will be easier to do that now rather than at some time in the future have your beautiful tree split its trunk because of a weak fork.
Answer: hopefully you have not yet removed the entire leader as it is not strictly necessary to do so and can cause harm to young trees. First, never remove more than 25 percent if the crown of a tree at one time.
The best action in this case is to lop the smaller leader about 1/3rd down, and be sure to cut it 1/4" above some lateral branches. Over time, the leader will grow up, and push the smaller leader into a more lateral position. This is preferable because you maintain a branch, which provides structural integrity, and you don't overly prune your sapling, which causes stress, which in turn invites all kinds of other problems.
It's always easier to take off more the next season than prune too much that will never grow back.
That being said, if you did already remove it, don't stress out about it, but avoid clipping it or pruning it further for quite some time.


Applying a window to a signal

Question: How can I Gaussian or Bartlett window to a signal? On the other hand, is it a good way of smoothing signals? If not what are the differences between smoothing and windowing?
Comment: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
Answer: Windowing is commonly done to reduce spectral leakage in the result of a Discrete Fourier Transform (DFT). There are many other posts here that explain the finer details, but at the high level to apply a window, you use a window that is the same length as the block of time domain data for which you will be computing the DFT. The window is multiplied by the time domain data, which tapers the edges of the selected waveform in such a way that reduce spectral leakage in the frequency domain. Smoothing on the other hand is done by convolving a time domain signal with the impulse response of a low pass filter which serves to remove the high frequency components and thereby "smooth" the time domain result.  Thus windowing is a product in the time domain while smoothing is a convolution. The target function that is multiplied for windowing and convolved for filtering is determined under different considerations (not the same function but can be similar).
For the more technical details of this, please see the following posts:
Filtering sidelobes
Why would one use a Hann or Bartlett window?
Comment: Thank you so much for your answer!
Answer: For regularly sampled data, windowing consists in multiplying a signal $x[n]$ or a portion of it by a window $w[k]$, sample by sample, as illustrated as follows (source NI). The result will be somehow a novel signal defined $x_w[k] = w[k]x[k]$, where the product is often assumed zero when either  $w[k]$ or $x[k]$ is unknown/undefined. Smoothing is generally a weighed combination of several  $x$ values, therefore windowing is not smoothing per se. Note however that at the left and right sides, the signal is attenuated (known as tappering) toward zero. This may have an indirect smoothing effect (as the amplitude variations is mildered). Windowing in the signal domain yields a convolution in the Fourier domain, hence a smoothing of the complex spectrum.
For windows like Bartlett or Gauss, that are unimodal, symmetric with positive coefficients, their samples can be used as weights of a smoothing filter, for instance with a form like:
$$ y[\cdot] = \frac{\sum w[k]x[k]}{\sum  w[k]}  $$

Applying a window to a signal


Peskin & Schroeder's QFT problem 4.1(a)

Question: I am troubled for understanding P&S's problem 4.1 (a) on p. 126. Consider a Hamiltonian for the creation of Klein-Gordon particles by a classical source:
$$H=H_0+\int d^3 x(-j(t, \mathbf{x}) \phi(x)).\tag{p.126} $$
In 4.1 (a), the book said the probability that the source create no particles is given by
$$P(0)=\left|\left\langle 0\left|T\left\{\exp \left[i \int d^4 x j(x) \phi_I(x)\right]\right\}\right| 0\right\rangle\right|^2.\tag{p.126} $$
So why they use the free ground state $| 0\rangle$, not $| \Omega\rangle$? Since according to the book's eq.(4.31):
$$\langle\Omega|T\{\phi(x) \phi(y)\}| \Omega\rangle=\lim _{T \rightarrow \infty(1-i \epsilon)} \frac{\left\langle 0\left|T\left\{\phi_I(x) \phi_I(y) \exp \left[-i \int_{-T}^T d t H_I(t)\right]\right\}\right| 0\right\rangle}{\left\langle 0\left|T\left\{\exp \left[-i \int_{-T}^T d t H_I(t)\right]\right\}\right| 0\right\rangle} . \tag{4.31}$$
what they show about $P(0)$ is just the denominator of eq.(4.31).
Comment: Your hamiltonian is time dependent, so your groundstate is too. Typically, you assume the sources to be compactly supported in time, so far enough in the future and past the ground state is the free ground state.
Answer: I recommend you to look and understand the subsection related to the S-Matrix. There, it is explained that the overlap between an initial state of the interacting theory $|k_1 k_2\rangle_{\mathrm{in}}$ of particles of momentum $k_1,k_2$ with a final interacting state $|p_1 p_2 ...\rangle_{\mathrm{out}}$ with momentum $p_1, p_2,...$ can be computed with the corresponding momentum of the free theory, using the relation
$$ \sideset{_{\mathrm{out}}}{} \langle p_1 p_2 ... |k_1 k_2 \sideset{}{_{\mathrm{in}}}  \rangle = \langle p_1 p_2 ... | S | k_1 k_2 \rangle = \left \langle p_1 p_2 ... \left | \ \mathrm{exp} \left(T \left \{ - i \int dt H_I (t) \right \} \right ) \ \right | k_1 k_2 \right \rangle  $$
where now $|k_1 k_2\rangle$ are momentum states of the free theory, and $S$ is the $S$-matrix. The probability associated with the transition from $k_1 k_2$ to $p_1 p_2 ...$ is then the modulus square of the above expression.
This relation also holds for the vacuum in which we are interested :
$$ \sideset{_{\mathrm{out}}}{} \langle \Omega  | \Omega \sideset{}{_{\mathrm{in}}}  \rangle = \langle 0 | S | 0 \rangle  $$
So the probability that the far-past vacuum $|\Omega \rangle_{\mathrm{in}}$ goes into the far-future vacuum $|\Omega \rangle_{\mathrm{out}}$ is
$$ P(0) = |\sideset{_{\mathrm{out}}}{} \langle \Omega  | \Omega \sideset{}{_{\mathrm{in}}} \rangle |^2 = \left | \left \langle 0 \left | \ \mathrm{exp} \left(T \left \{ - i \int dt H_I (t) \right \} \right ) \ \right | 0 \right \rangle \right |^2 $$
Comment: Thank you very much! Actually, P & S propose this in eq.(4.90), and proved it in Section 7.2. I thought eq.(7.45) is important, the L.H.S of (7.45) is about momentum in full interacting eigenstate, while the R.H.S are our free input momentum. Would my understanding right? Thanks!

Peskin & Schroeder's QFT problem 4.1(a)


Can users with less reputation be allowed to chat?

Question: This is something I have faced quite recently. Someone very new to Stack Overflow asked a question, but is not able to communicate properly or exactly understand the answers that has been given for his question. He normally clarifies that in comments. But sometimes, it is necessary to have a one-to-one conversation with the one who has given the answer, so that the comments section is not populated with some trivial comments. So, I just felt that it'd be great if the reputation limit for talking in chat is removed.
Comment: A question or answer should be clear in and of itself. If it isn't then it probably needs to be revised. Comments clear up odds and ends (which may potentially end up being edited into the post if intrinsic to the query / solution.) Disjointing the areas of coverage in this respect isn't a solution. Actually, I don't even think there is a problem... (Plus, you only need 20 rep to chat.)
Comment: this is a fine question to ask, we're just not sure we want to open the floodgates to random users for chat at this time.
Comment: Its not about the answer being clear or not, just that the OP is not able to clearly implement the answer and has problems with it,
Comment: @von we've seen some abuse (ok, actually *a lot of abuse*) by Android users on chat.so -- however if it was triggered only by extended comment chains that might be OK, because they'd have a hard time gaming that.
Comment: possible duplicate of [How do inexperienced members get enough reputation to participate in the chat rooms?](http://meta.stackexchange.com/questions/80464/how-do-inexperienced-members-get-enough-reputation-to-participate-in-the-chat-roo), [SO Chat: Why is it that "Only members of Stack Overflow with at least 20 reputation may talk…"?](http://meta.stackexchange.com/questions/74086/so-chat-why-is-it-that-only-members-of-stack-overflow-with-at-least-20-reputati)
Comment: @Jeff: would you consider granting access to those low rep users only if they are invited to a "get a room" chamber (that is, if that feature will be available on demand, and not just when the number of comments reach a certain threshold), in the spirit of http://meta.stackexchange.com/questions/90969/chat-can-i-grant-write-access-to-a-unregistered-user?
Comment: @Jeff: ok, but how one could "game" a "get a room" chat? It is only for two people, and only if one of the participant (with enough rep) invite the other.
Comment: @Jeff: am not talking about "open the floodgates", just that a user with privileges to "create a chat room", be allowed to invite users with less reputation to the chat after a threshold has been reached in the comments.
Answer: If you can't ask an intelligent & coherent question on the site, then I'm not really sure we want you participating in chat, either. Comments are great when you need to ask for additional clarification information, but when you get to the point of requiring an extended discussion in the comment section just to make sense of the question, red flags should start going up. This may not be a user who has found a good home on our site...
Yes, the dialogue in chat is a little less formal than the Q&A site, but the ability to participate in chat is a privilege that we only afford to certain users. Your proposal to "open up the floodgates", metaphorically speaking, is one that runs quite contrary to this notion and is a dangerous one in my mind.
And it's not that hard to gain chat privileges—only a nominal 20 reputation points are required. In other words, you need two upvotes on (an) answer(s). That seems like a sufficiently minimal bar to me. If you don't have any insights to share that are worth a measly two upvotes somewhere on the site, then we can probably afford to stand the chance that you'll take your online presence elsewhere.
Remember that all users start out at 1 reputation, including spammers. There's no way to tell a spambot from an actual contributor until they gain a few rep points. And spam is even more annoying in chat.
Comment: +1 To be fair, 20 rep isn't even enough to signify a user is "chat ready" but 20 is better than less or nothing.
Comment: That's somewhat limiting regular people to join the community. I've just started a chat room inviting the scientific community, but then when they joined I and they realized that they couldn't even post anything in my chat room, even though I tried to grant them writing permission.
Comment: Maybe the use could come with a 20 reputation, and then if they get kicked/muted from a chat room they will just lose reputation and won't be able to post anymore


What does the word Entropy refer to in Entropy encoding

Question: I have come know of Huffman and Arithmatic encoding that try to curtail redundant data and thus compress data. Why are they called Entropy encoding? What does that mean? Why not just call them compression encoding?
Comment: http://en.wikipedia.org/wiki/Entropy_(information_theory)
Answer: The term entropy comes from the field of information theory.  Information theory posits that unexpected messages bear more information than expected ones.  For instance, saying that there will be a solar eclipse tomorrow has much more information (assuming it's true) than saying the sun will rise tomorrow.  Saying the sun will rise tomorrow, while true (and important!), has very little information for most recipients because they have pretty much 100% expectation of it.
Anyway, you can prove mathematically that information is maximized when all of the possible messages have equal probability.  This maximizes the randomness or "entropy".
A perfect, lossless compression scheme could theoretically reduce the number of bits of a message to $ceil(log_2(entropy))$ but no further.  Lossy compression schemes can reduce further, but information will be lost.
I personally am not fond of the term "entropy" because I associate it more with the 2nd law of thermodynamics.  I believe that that association was intentional though, in the sense that entropy (in the thermodynamics sense) implies randomness and chaos, while low entropy implies orderliness.
Comment: Actually I learnt entropy in thermodynamics too and that is why it was not clear why entropy which is associated with disorder is being used in the term "entropy encoding"
Comment: Because unpredictability, as quantified by entropy, is what makes a signal informative. A signal you can predict is a signal you need not sample. It contains no information. Thus the connection to information theory.


Hodge diamond of complete intersections

Question: Suppose we have a smooth complete intersection of hypersurfaces with degrees $d_1,...,d_r$ in some $\mathbb{P}^N$. This should be a surface and in certain situations a surface of general type. What can one say about the Hodge diamond? Or what is its Grothendieck group ?
Comment: So are you assuming $r = N - 2$ since you say you get a surface?
Answer: This question is addressed in Appendix I of Topological Methods in Algebraic Geometry. Let $V_n^{d_1, \ldots, d_r}$ denote the complete intersection of $r$ generic hypersurfaces of degrees $d_1, \ldots d_r$ in $\mathbb{P}^{n + r}$. Let
$$
\chi_y(V_n^{d_1,\ldots, d_r}) = \sum_{p,q \geq 0} (-1)^qh^{p,q}(V_n^{d_1,\ldots, d_r})y^p = \sum_{p \geq 0} \chi^p(V_n^{d_1,\ldots, d_r})y^p
$$
where $y$ is an indeterminate and $h^{p,q}$ are the Hodge numbers and
$$
\chi^p(V_n^{d_1,\ldots, d_r}) = \sum_{q \geq 0} (-1)^qh^{p,q}(V_n^{d_1,\ldots, d_r}).
$$
Then Theorem 22.1.1 of the above reference says that
$$
\sum_{n \geq 0} \chi_y(V_n^{d_1,\ldots, d_r}) z^{n+r} = \frac{1}{(1-z)(1 + zy)}\prod_{i=1}^r\frac{(1 + zy)^{d_i}-(1-z)^{d_i}}{(1+zy)^{d_i}+y(1-z)^{d_i}}.
$$
This let's you compute the numbers $\chi^p(V_n^{d_1,\ldots, d_r})$ which aren't exactly the Hodge numbers. However, the next Theorem makes it possible to find the actual Hodge numbers from this data. Thereom 22.1.2 in the same section says that
$$
h^{p,q}(V_n^{d_1,\ldots, d_r}) = \delta_{p,q} \enspace \enspace \text{for} \enspace \enspace p + q \neq n,
$$
$$
\chi^p(V_n^{d_1,\ldots, d_r}) = (-1)^{n-p}h^{p,n-p}(V_n^{d_1,\ldots, d_r}) + (-1)^p \enspace \enspace \text{for} \enspace \enspace 2p \neq n
$$
and
$$
\chi^m(V_n^{d_1,\ldots, d_r}) = (-1)^mh^{m,m}(V_n^{d_1,\ldots, d_r}) \enspace \enspace \text{for} \enspace \enspace 2m = n
$$
Comment: So, this computation based on Lefschetz hyperplane theorem?
Comment: Yes. In particular, the computations of theorem 22.1.2 use Lefschetz hyperplane theorem. The argument for packaging them together into the generating function of theorem 22.1.1 uses Grothendieck-Riemann-Roch to relate that generating function to the Chern classes.
Answer: The Grothendieck group/ring tensor $Q$ is the same as the Severi-Chow group/ring tensor $Q$, which varies a lot when you vary your hypersurfaces. This happens already in the case of algebraic surfaces in $P^3$.
Comment: Can you give an explicit example of this phenomena?
Comment: Well, take a look of surfaces of degree 4 in P^3. Configurations of curves on them can be vastly different (for example, some of them contain lines, (which are rigid -- can not be moved), while most surfaces of degree 4 have no lines on them. Thus their Picard (= Neron-Severi, in this case) lattices will be diffenet, and thus their K-groups are different.
Answer: I have written a small (Python) program which computes Hodge numbers of hypersurfaces;
It is very easy to modify to work for complete intersections, too.
It contains references (to Hirzebruch and Deligne) in the comments section, and also a couple of examples in dimensions two and three:
Link, at the GitLab

Hodge diamond of complete intersections


Qgis load a set of excel points into a googlemap with only one point with real coordinates

Question: I am working with a google map on which I want to attach a grid of five points. Only one of them has real coordinates in the centre, point O ( 8.32688E, 48,32933N). For all the rest only the excel coordinates with respect to this know central point.
I want to plot the grid on the map and also I want to determine properly the coordinates of the other 4 points.
Comment: I seem not to get it. Why don't you just calculate the missing coordinates in Excel, export the table as csv and import it as delimited text layer with CRS WGS84?
Answer: as Bernd V suggests, it might be easier to just add the appropriate x and y offsets in excel.
another possibility is to use the Affine Transform plugin (when installed, it's under Vector > Geoprocessing Tools > Affine Transform)
You'd want to select all points except the O point - unless it's (0,0), in which case you should include it too.
Settings would then be
<code>Selected points only
x' = 1.0x + 0.0y + 8.32
y' = 0.0x + 1.0y + 48.329
</code>


identifying duplicate entries from a file on unix server

Question: My file is semicolon separated file with multiple columns.
I want to remove duplicate records from first column only. Also, i want a count of these duplicate entries from column first only.
any suggestion please?
Comment: Could you edit your question to show some sample input and output, at least a mock-up of the general structure?
Answer: Something like this should work:
awk -F";" '!seen[$1]++{print}END {for (i in seen) if (seen[i]>1) print i,"found :" seen[i] "times"}' file

The first part before END will not print duplicates emulating uniq. That means tha if an entry is found two or more times only the first entry will be printed.
The code in END will print all entries found more than once.
If you need to print pure unique entries emulating uniq -u meaning tha if an entry is found two or more times will not be printed at all then you may use:
awk -F";" '{seen[$1]++}END {for (k=1;k<=2;k++) for (i in seen) if (seen[i]==1) {print i;delete seen[i];continue} else {print i,"found :" seen[i] "times"}}' file

This will iterate the array two times. The first time true uniq entries will be printed and the second time duplicate entries will be printed.
Alternative:
awk -F";" '{seen[$1]++}END {for (i in seen) print "found :" seen[i] "times:",i}' file |sort

This will print each entry along with the counting (unique entries will be found once, non unique entries will be found more than once)


StackExchange theme problem: is the website hacked?

Question: Every time I check the website, I see the following theme. And the mouse cursor has tails now. Does any one else have the same problem? Is the site hacked?
Answer: No. It's something that happens from time to time when holiday hats arrive or April Fools day arrives or just no particular reason.
See the links on the sidebar here for an explanation or the question this is a duplicate of.
The Time Machine control in the top bar will help navigate back to last week's design or back to the 90's as you please.


Wrong resolution on grub2?

Question: My optimal screen resolution is 1600x900px, however when I first turn on my laptop, grub2 displays at 1024x768. I have an optimus system, so I am assuming that grub is using the intel card. When I do vbeinfo it says the maximum resolution is 1024x768, but the optimal resolution is 1600x900. I have tried adding i915.modeset=1 to my grub config and changing GRUB_GFXMODE to 1600x900 but to no avail. All help would be appreciated!
Comment: I think that Grub doesn't support fancy high resolutions. It uses a fail-safe resolution. That way, if you spill coffee or something on your monitor, and you have to use a 'backup' monitor that only goes up to 1024X1280, it'll work, with a little margin of safety added, just incase. However, this is purely speculation. Do you really need to choose your OS in HD, though?
Answer: There's no guarantee that GRUB will be able to use exactly the same resolution your Xserver is running at with your video hardware. The only way to find out what settings will be acceptable here is to use GRUB to tell you.
To find out, boot your computer and press your C key from your GRUB Menu to switch into command-line mode.

To prevent text from scrolling up the screen uncontrollably, first use the command set pager=1.
Then you can run the vbeinfo command for a list of resolutions your hardware can support.
Write the numbers down on a piece of scrap paper if you need to.

Now, let see how you can change change GRUB menu resolution:

Open your /etc/default/grub file with a text editor and change your settings there: gksudo gedit /etc/default/grub.
Alter the numbers after where it says"GRUB_GFXMODE=" with a suitable resolution for your hardware.
Save the file before closing it.
Run sudo grub-mkconfig -o /boot/grub/grub.cfg to write the changes to your grub.cfg.
Reboot and see if it worked.

Wrong resolution on grub2?


Using a single context from many threads in Entity Framework 6

Question: Is there a way to use one dbContext in a different threads asynchronously?
 var context = new Entities();
 Task.Factory.StartNew(() => context.Companies.Include(x => x.Address).First());
 Task.Factory.StartNew(() => context.Companies.Include(x => x.Owner).First());
 //after some changes...
 context.SaveChanges();
 context.Dispose();

The main idea is to save everything at once and if something fail to return all changes.
In the reality I'm using Unit of Work object which is passed to viewmodel and its child viewmodels so they try to get information asynchronously...  The code above illustrates the problem.
The code above will throw an exception:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code
The context cannot be used while the model is being created. This exception may be thrown if the context is used inside the OnModelCreating method or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe.
The main problem is if I'd like to use multiple instances of DbContext each of the Data Transfer Object will contains different information for the fields.
Any suggestions?
Thanks!
Answer: A context is not thread-safe. Period. So never ever address a context from multiple threads and don't jump through hoops to try and make it thread-safe.
You can simply wrap your code in a TransactionScope and start each Task with an action that creates its own context and saves its changes:
using (var tran = new TransactionScope())
{
    Task.Factory.StartNew(() => DoSomething());
    Task.Factory.StartNew(() => DoSomethingElse());
    // Wait all
    tran.Complete();
}

Comment: Thanks, your idea cross my mind, but when the time for SaveChanges() comes the last SaveChanges throw an exception which says "Statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded."
Comment: That means you've become your own concurrent user. You update the same records from different threads.
Comment: @Teomanshipahi Use `lock`, where? Anyway, no, don't even try to use a context in a thread-safe manner.
Comment: @GertArnold got you, it is better to go with "Context per thread" solution.
Comment: can we create a new thread to do second operation instead use `TransactionScope`
Answer: If you are using SimpleInjector to get an instance of your DbContext then you will have a problem of thread-safe.
For this scenario, you need to use ThreadScopedLifestyle and encapsulate your code. See:
Container container = new Container();
container.Options.DefaultScopedLifestyle = new     SimpleInjector.Lifestyles.ThreadScopedLifestyle();
container.Register<IUnitOfWork, UnitOfWork>(Lifestyle.Scoped);

using (SimpleInjector.Lifestyles.ThreadScopedLifestyle.BeginScope(container))
{
    var _uow = container.GetInstance<IUnitOfWork>();
    // put your business code here ...
}


Adding two Power series or Maclaurin sums together and their radius of convergence

Question: Say you have two power series. One of them has ROC of 2, and the other one has an ROC of 4. If you add the two series together is the ROC ALWAYS the lesser ROC? It seems to be a trend I've noticed, not sure if it's a fact though.
Comment: If the two ROC are different, the ROC of the sum is the smaller ROC. If the two ROC is the same, the ROC of the sum can become bigger. Look at answers for a [related question](http://math.stackexchange.com/q/309466/59379) for more details.
Answer: This isn't true. A silly example is to take any $f(x)$ at all with finite radius of convergence, and then
$$
f(x) + (-f(x)) = 0
$$
so the right hand side has an infinite radius of convergence.
We can disguise this example as well as we like; e.g. Taylor expand something ugly like $e^x + \frac{\sin(x)}{x-3}$ around $x = 0$ and Taylor expand $\cos(x) - \frac{\sin(x)}{x-3}$ there too.
However, what you said will be true if the radii of convergence for the two functions are distinct. I think the easiest way to see this is complex-analytically, by interpreting the radius of convergence is equal to the distance to the nearest singularity. If $f$ is singular at $P$ and $g$ is not, then $f + g$ is singular.
I don't know if you've seen this (the complex-analytic property of the radius of convergence) before or not, but it is very nice for thinking about questions like yours. It doesn't work over the real numbers -- e.g. $\arctan(x)$ is perfectly continuous on all of $\mathbb{R}$ but the Taylor series at $x = 0$ only has radius of convergence 1; what's secretly going on is that $\arctan(x)$ blows up when $x$ gets close to $i$.


Is it worthwhile to offer a "recover your status" functionality for a paid version in phone app?

Question: I'm thinking about offering this functionality for the paid version of an app, I think it would take around to 80 hours to achieve the development of such functionality.
To better clarify what the functionality is about, it would allow an user to uninstall its app, be it because he has got tired from it, it fails for whatever reason and the user wants to reinstall it, the user needs to make space in his phone for a certain temporal app and it needs my app to make enough space for that temporal app.
It's to notice that in my app, you may lose several weeks of app use if you decide to uninstall it, so it's not that bad a functionality, but even then, I think cases like the previous ones are not common enough to compensate for the effort of developing such functionality.
Do you think that functionality is worthwhile to develop or do you think that it wouldn't compensate?
Comment: I think it really depends on how valuable it is to the users. Difficult for use to answer that without knowing more.
Answer: It's not possible to give a precise answer in hours against the value of your time, but in a generic sense what you seem to be describing is a way to "recover/undo" an action.
Whilst typically such functionality is isolated within and app, you seem to be describing a function which sits outside of your app.
Some approaches you could consider:

A clear warning to the user that uninstalling will remove their data and it cannot be recovered
Allowing the user to export and import their data manually (perhaps they are prompted when about to uninstall)
Saving the data outside of the app itself (such as to an account online)

Option 1 is your lowest effort solution, but Option 3 is perhaps the best experience, this way the user's data is not tied to your app directly and would be more resilient to cases such as upgrading versions or the user needing to use the app on a different device (be it another phone, or perhaps desktop etc).


Push an item onto the end of array in Java

Question: I want to make a method arrayIntPush(3, {5,4,8}) that will return {5,4,8,3}.
This method seems to work:
public static int[] arrayIntPush(int item, int[] oldArray) {
    int len = oldArray.length;
    int[] newArray = (int[]) Array.newInstance(oldArray.getClass().getComponentType(), len + 1);
    System.arraycopy(oldArray, 0, newArray, 0, len);
    System.arraycopy(new int[] {item}, 0, newArray, len, 1);

    return newArray;
}

Is there a better way to do this that would be faster?
Comment: Is there a reason why you can't use ArrayList or any of the list structures already provided by Java? Not only are these built-in data structures fast, but they also provide means of converting to a normal array (if you need)
Answer: Is this really needed?
int[] newArray = (int[]) Array.newInstance(oldArray.getClass().getComponentType(), len + 1);

I would do something like:
public static int[] arrayIntPush(int item, int[] oldArray) {
    int len = oldArray.length;
    int[] newArray = new int[len+1];
    System.arraycopy(oldArray, 0, newArray, 0, len);
    newArray[len] = item;

    return newArray;
}

So for an array of length 10 you make a new array or length 11, copy all existing data into it and then assign the last index to the item.
Answer: Before Java 8, an even more simplified way is to use Arrays.copyOf(int[], int):
private static int[] push(int[] array, int value) {
    int[] result = Arrays.copyOf(array, array.length + 1);
    result[array.length] = value;
    return result;
}

Java 8's IntStream gives you a way to have only a single return statement:
private static int[] push(int[] array, int value) {
    return IntStream.concat(Arrays.stream(array), IntStream.of(value)).toArray();
}

Small tip: Since you are pushing a new value to the end of the array, you may want to consider reordering the method parameters so that the incoming value is indeed to the right of the array.
Answer: Just to be an annoyance and since this is code review not give me an answer... the more important question is what is the actual use case of this method? Do you have control over the code that is calling it or is this a library method?
I ask because Java already has data structures to handle adding and removing of elements (Vector and ArrayList). If instead you could shift your code to using one of those, not only do you save a memory allocation and memory duplication every time the method is run you will decrease it significantly increasing your performance drastically. It's important to keep in mind that both these structures use Array as their backing data structure... it just wraps it with helpful methods like the one you have written.
If you do this, your old code would look something like this:
int [] data = [1,2,3,4];
data = arrayIntPush(5, data);

To
Vector<int> data = new Vector<int>([1,2,3,4]);
data.Add(5);

Or something like that. It's been a while since I've done Java :-)