Homogeneity of variance is violated for z-scores but not for raw data?

Question: Is this a normal thing to happen or have I done something wrong in SPSS? I am using a Levene's test.
Comment: This seemed trivial, but turned out to be quite an interesting question for me.
Comment: I think you made an error in your question, however. If anything the relationship should be reversed. The Levene's *W* should be higher for raw data and *p* smaller.
Answer: This depends on how you normalized your data: calculated z-scores for the whole set of data OR used group-by-group standardization.
If you transformed your data into z-scores using the mean and the standard deviation of the whole set, then the result should not be different. If, however, you standardized your data for each of the groups separately (i.e. using group averages and standard deviations), then the Levene's W statistic is diminished.
The first case is very simple to check, using R's in-built set of data Moore. Merely try out the following two commands, where the first one performs the Levene's test (from carpackage) on the untransformed data and the second one on the z-scores.
leveneTest(Moore$conformity,Moore$fcategory)
leveneTest(scale(Moore$conformity)[,1],Moore$fcategory)

The result is the same in both cases, namely:
    Levene's Test for Homogeneity of Variance (center = median)
      Df F value Pr(>F)
group  2   0.046 0.9551
      42

 The option center is irrelevant for the purpose of this illustration.

Showing why, analytically, is not straightforward. Some intuition can be gained, however, by studying the equation for Levene's W (taken from the Wikipedia's article with the test's name):
$$W = \frac{(N-k)}{(k-1)} \frac{\sum_{i=1}^k N_i (Z_{i\cdot}-Z_{\cdot\cdot})^2} {\sum_{i=1}^k \sum_{j=1}^{N_i} (Z_{ij}-Z_{i\cdot})^2}$$
with $Z_{ij}=|Y_{ij} - \bar{Y}_{i\cdot}|$ and $\bar{Y}_{i\cdot}$ the mean of i-th group, $Z_{\cdot\cdot} = \frac{1}{N} \sum_{i=1}^{k} \sum_{j=1}^{N_i}Z_{ij}$ the mean of all $Z_{ij}$, and $Z_{i\cdot} = \frac{1}{N_i} \sum_{j=1}^{N_i} Z_{ij}$ again the group mean.
While the denominator of the second fraction does not differ no matter how you standardize the data (which is not immediately apparent at all), the numerator is smaller when you standardize each group separately. This is because $Z_{i\cdot}$ and $Z_{\cdot\cdot}$ are closer together in this case.
An analytic derivation would be much more convincing here, but for illustration purposes your own example and the one I mentioned above will have to suffice.
Edit
To see an example, where the variances are non-homogeneous for raw data and how this changes with z-scores, you can use the mtcars dataset:
leveneTest(mtcars$mpg,mtcars$am,center=mean)
Levene's Test for Homogeneity of Variance (center = mean)
      Df F value  Pr(>F)
group  1   5.921 0.02113 *
      30
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

versus
attach(mtcars)
df<-mtcars[order(am),]
df$mpgZ<-rbind(scale(mtcars$mpg[which(mtcars$am==0)]),scale(mtcars$mpg[which(mtcars$am==1)]))
    #scale the data separately based on transmission type (am)
    leveneTest(df$mpgZ[,1],df$am,center=mean)
Levene's Test for Homogeneity of Variance (center = mean)
      Df F value Pr(>F)
group  1  0.0818 0.7769
      30

Comment: I agree with your answer, but the OP is asking about an example where the 'homogeneity of variance is violated for z-scores but not for raw data', which is exactly the opposite case (and which sounds like a *very* strange (impossible?) case, cf. your answer).
Comment: @KarlOveHufthammer Thank you for the comment. I would agree the proposed scenario is very unlikely, so I assumed the OP must have made a mistake when asking the question. I would be happy, however, if OP could elaborate on the matter, i.e. give specific *W* and *p* values.
Comment: Of course, when you think about this in the broader context of homoscedasticity testing, an intuitive explanation might be grasped easier. See my other answer.
Answer: For a more intuitive explanation, one should think about what testing for homogeneity of variance really means. Roughly put, it serves to determine whether dispersion of data is the same for all groups. A naive approach would be to take ratios of variances and see if they are all (approximately) equal to one.
When standardizing the data for each of the group separately, by definition, the standard deviation of each is made to equal 1. Therefore, all variances are equal and the Levene's test gives a non-significant result.
When standardizing the whole set of data, the variances are all scaled by the same factor. Their relationship remains the same as before standardization, i.e. the outcome of any test of homogeneity of variance remains the same.


Is rebase -i better then revert?

Question: Say a branch is created with many merges/commits, then you figure out 1 merge was bad.  Would it be better to undo it with rebase -i or with git revert or by manually undoing some changes and adding them in a new commit?  It seems like both revert and manually undoing it with new commits both add an unnecessary extra commit.  Is rebase -i less error-prone?
Comment: I'm not one of the down voters, but can you explain a little more about the state of this branch? Have you pushed any commits? Are you wanting to rebase any commits you pulled from someone else?
Comment: @GregBurghardt Thanks.  It's a bunch of commits, from various tickets, for a deployment, if some turn out to be buggy.  I think it's not feasible now, and we'll need to do an additional commit.
Answer: Rebasing is not less error prone. The choice to rebase or revert depends on whether the commits you are rebasing have been pushed to any remotes. If they have been pushed, rebasing has the potential to erase history. This will screw anyone else who has pulled those commits to their repository. In other words don't rebase commits that have been pushed or commits you pulled in.
If you have not pushed those commits then rebasing is an option. Reverting preserves the history, including the bad merge. If you prefer to forget that bad merge ever happened then rebase and skip that commit.
Have a look at my answer to Is using Git Stash as a workflow an antipattern? for more info, and a rant by Linus Torvalds specifically about rebasing commits.
One is not better than another. Rebase operations are a way to clean up your local history before sharing it with the rest of the team. Reverting is a safer option if you want to preserve history, and if those commits have been pushed or pulled  you want to preserve history.

Is rebase -i better then revert?


How to press Ctrl+a+A

Question: I was reading an answer about placing a tabs bar at the bottom of GNU Screen, and it said to press Ctrl+a+A. Clearly I cannot press A again while still pressing a, and why are the two capitalized differently?I have tried pressing Ctrl+A, Releasing, and than pressing A, which does nothing, and Pressing Ctrl+A, releasing A, and then Pressing it down again. Nothing of the sort works.
The answer is at: How do I use tabs with the Linux "Screen" program?.
Comment: Can you post a link to that answer? maybe they ment CTRL-ALT-A?
Comment: http://superuser.com/questions/181100/how-do-i-use-tabs-with-the-linux-screen-program
Comment: looks like a failure in the documentation to properly inform the users on the proper keypresses.
Answer: You can't press ctrl+a+A.
The answer you are referring to contains incorrectly formatted key bindings. To rename a window in GNU Screen press ctrl+a, release both keys and then press shift+a. Conventional format to present this key binding is ctrl+a A.
Answer: According to this page you need to press ctrl+a to send commands to the outer screen, and then press a letter for specific keys.
So you press ctrl+a then release both, then press shift+a to send this ctrl+a A
Comment: I [edited your answer](http://superuser.com/posts/755603/revisions) to add a hyperlink. I believe new users can add two per post, so just use `[text](http://url.com)` in the future to add a hyperlink to your question/answer.
Comment: @Chipperyman Thanks, I actually knew about doing this, but I was doing too many things at the same time and completely forgot. Thanks for adding though.
Answer: You were on the right track... but be aware, that the command are case-sensitive.
So, to rename a GNU screen window do the following:
Press CTRL and a together. Release them. Then press SHIFT and a together. That makes a capital A.

How to press Ctrl+a+A


transactions are performed sequentially by the blockchain, but how are the waiting times managed?

Question: I have a booking dapp where you can make reservations and call the bookRequest method. If many users call this method, it is not possible to know the order in which they will be performed and therefore it is not possible to know the order of confera. But how is it possible to manage this mechanism? A user cannot wait too long to receive the booking confirmation. How can I avoid pending transactions?
Answer: The one who mines the block decides the sequence of its transactions. Usually the order is decided by the transactions' gas prices (default logic for most miners). In that case, users may influence it by "speeding up" the transaction, meaning: re-broadcast the transaction with a higher gas price.


Creating or Updating Custom Entites in MS CRM 4.0

Question: For a requirement i was asked to export information into a custom entity that was created in MS CRM 4.0. I am trying to do this programmatically and I have not found a single code that actually accomplishes this. I wrote code to check if a certain value for a field exists in the entity but creating a new entity seems to be a little bit of puzzle for me. Any help on this would be appreciated.
Answer: To create a custom entity from code, you need to use the MetadataService web service.  The 'CreateEntity' method is used to create custom entities.
The CRM SDK for v4.0 shows you how:
CreateEntity Message (MetadataService)
Answer: This is my experience when I had a similar requirement in MS CRM 3.0. I started using the CRM sdk to import data but found it was not easy.
Then I ended up using Scribe adapter for CRM. It is not free but will easily solve your problem for importing to custom entities. Will post some links on that. need to go through some old bookmarks.
Not sure if this feature exist out of the box for CRM 4.0.
Answer: One product i have been using is DataSync from Simego (It has a plugin that supports MS CRM 4.0) http://www.simego.net/products/Data-Synchronisation-Studio
Answer: Thanks for the link. I was familiar with the Scribe Adapater. Catch is client wanted this import wizard inside MS CRM 4.0. In anycase i found the answer to my solution here. Thanks for you reply :).
Answer: Whats wrong with using the import from CSV function within MSCRM 4.0? It caters for custom entities (3.0 didn't) and allows good mapping functions and saving of the mappings?


Unable to right click on the cmd windows prompt

Question: I am unable to right click on the cmd windows prompt in order to paste something there. How can I fix this problem?
  Thanks
Comment: Which version of Windows?
Answer:
CMD Shell
In Windows 10 the standard Ctrl-X & Ctrl-C shortcuts are supported.
For earlier versions of Windows you can enable QuickEdit cut and paste
  at the Command Prompt as follows:
Activate the control menu at the top left of the current cmd window,
  go to Properties, Options tab and then tick against QuickEdit Mode.
  Now you can select text with the mouse and hit Enter (or right click)
  to copy it to the clipboard. Paste anywhere using Control+V (or Right
  Click) or via the menu.
ESC will cancel any selection and return to editing mode. When copying
  between windows, you need one click to select the window and a second
  click to paste.
source

Windows 10
Right-click on the command prompt window title bar, select Properties, from Options, be sure to check the Insert Mode option to have the Paste option available from the command prompt with a right-click. Optionally, if you also select the QuickEdit Mode and have it checked, when you right-click in the command window, it'll paste what you have copied without needing to select the paste option.

Other Windows Versions
You will basically follow the same instructions as above on other versions of Windows for the cmd.exe properties but the Edit Options location will look a little different, but checking the Insert Mode and Quick Edit options will give you the same results/functionality.
Comment: You can also left-click on the Titelbar icon to open the system menu.


How do you create a list workflow that emails users every 6 months

Question: I'm new to sharepoint 2013 workflows.  How do you create a workflow that will automatically email users every six months?
Answer: You can use Pause for duration action in designer workflows.
Reference:
Reminder Workflow Pause for Specific Duration in SharePoint 2013.
Or you can create site workflow and schedule it to start after every 6 months.
Answer: Another option could be to set up a PowerShell script in the task manager on one of the servers in the farm. This will give you the flexibility you will need as the requirements changes like "for this kind of content the reminders should be every 3 months"
Example: http://chiqnlips.blogspot.com/2016/05/how-to-run-sharepoint-powershell-script.html
Answer: On a side note, I ended up using powerautomate, and this task was very simple to do.  It would email every user on the list.  Lets see how it pans out when the users get slammed with the emails in January.


What's the point in having each user belonging to her own group in linux?

Question: Wouldn't it be simpler to adequately set the umask and avoid polluting the group file?
Answer: in fact, the real problem is that every user MUST belong to a group.
the "old" way of adding users (in the first linux distros) was to put all users in one group, "users". it lead to problems, so the secure way of adding users: everyone is different.
unless you run a shell access box with many users, there is no real reason to put all accounts in the same group.
Comment: Yeah, but what are the problems involved in having a single group for all the users which cannot be solved by setting the right umask, such as 600?
Comment: not many, i'm not a fan of having many groups. one possible case: manually creating an username that will be used for a system process and forgetting to change its default  group
Answer: In Linux, a process can belong to several groups at once. It has to belong at least to one, so give each user their own group, and use extra groups if you really want to give extra access. In original Unix only one group was allowed.
Answer: This seems like it's a duplicate of
https://unix.stackexchange.com/questions/153390/why-does-every-user-have-their-own-group ,
which has a better answer, describing the "User Private Groups" practice.  In short: having a group for every user, combined with a few other things, makes it easier for teams to share a folder without each user having to do a lot of fidgety things like setting their umask and doing a lot of chmod'ing all the time.


Unable to boot Kali Linux from External Hard Drive, with Ubuntu

Question: I have installed Kali Linux on an external hard drive. ON my laptop Ubuntu is installed. When I connect the external hard drive via USB cable and booted the laptop from external USB/hard drive. Kali Linux welcome screen appears but after that instead of showing login screen of Kali Linux it shows login screen of Ubuntu.
Answer: I ask is because the wifi adapter I use for injection takes up 2 USB ports on my Mac when it's plugged in. This means I won't be able to use it if the external USB has to stay plugged in because my Mac has 2 USB ports. So...does the external USB you boot kali from have to stay plugged in while using kali?


Did the Truman Doctrine contribute to the Cuban Missile Crisis?

Question: I have heard that the brinkmanship foreign policy of Eisenhower and Kennedy lead, in part, to the Cuban Missile Crisis. However, I am curious: did the Truman Doctrine also contribute, in part, to the Cuban Missile Crisis?
Comment: It was certainly a stepping stone. What would you consider to be sufficient to make it a 'contribution' to the Cuban Missile Crisis?
Answer: It is unfair, in my opinion, to qualify all resistance to Soviet expansion post WW2 as brinkmanship.  Truman managed, quite well, the response to an unprovoked attack in Korea and was confronted with a powerful block of nations subjugated by the USSR with a fundamentally inimical drive to impose their ideology on the world.  Led, until 1953, by which time Truman was gone, by Stalin, who was a homicidal paranoid.
The Truman Doctrine, coming soon after WW2, was basically saying "we will not sit idly by as the world did in 1933".  It is a fairly measured stance, although the USSR was, on occasions, reminded that US nukes were on standby, should it not do as the US wanted.  Yes, there were abuses in anti Communist hysteria, such as McCarthy, but that does not make resistance against a political system which spawned the Gulags and the 1932 Ukraine famine unjustified.
If brinkmanship there was, it was all Kennedy's.  He got elected in 1960 by campaigning on a missile gap at the US's detriment.  But he was also on the Senate Defence Committee so he knew perfectly well that, while there was a missile gap, it was all the other way, which is why he strongly suspected they would blink during the crisis.  The US had stationed missiles in Italy and Turkey - long range nukes which were not so much a defence for the country hosting them as a threat to Russia itself.
Bay of Pigs.  Involvement in Vietnam.  Cuban Missile Crisis.  These are all Kennedy's.  The Truman Doctrine provided a reasoned and thoughtful framework to counteract the Soviet threat, but was just a formalization of US intents.  Kennedy went all in on his own judgment, mostly with fairly negative results.  Later on, to little benefit, US fighting capacity would be getting bled out in Vietnam while US forces in Western Europe were understrength, all without a single Russian being at risk.
Contrast Kennedy in a way with Reagan, who also got elected on a tough-on-Communism approach.  But was smart enough to grasp the opportunity Gorbachev's reform was offering and avoid direct US military adventures (although it must be said, the stain of the Central American CIA-supported death squads is largely on his watch).
No, Kennedy's reckless adventures are his own and the Truman Doctrine is not to be blamed for it.  The intent was good, to resist Communism.  The ways he went about it were unnecessarily risky and I am always surprised by how popular he remains.  More to do with his looks and his assassination than his achievements, in my opinion.  Even his handling of the Civil Rights movement is nothing to brag about.
Comment: Fwiw, reading an SF novel that is very much about international negotiations.  Author clearly is a history buff and claims *less* brinkmanship from JFK during the Cuban Missile Crisis would have resulted in his impeachment, for weakness, by hawks.  Not qualified to have an opinion, but I will cautiously, treat that as a potential reason to temper the above criticism.
Answer: To start, I think it's safe to say that regardless of doctrine, the USA was not going to tolerate nuclear weapons on its doorstep.
While it's clear that the USA was staunchly anti-communist, the Truman Doctrine also had a focus on providing aid to countries fighting the threat of Communism.  By this point Cuba was already Communist, and the Bay of Pigs Invasion was an attempted overthrow of the Communist government.
Indirectly, with this doctrine of providing aid to other countries, American nukes were placed in Turkey and Italy (NATO members), which scared and angered the Russians, and prompted the installation of nukes in Cuba.
In summary, as with many events during the Cold War, the causes are not always singular and categorical, and there may be multiple reasons and their interactions for what eventually transpires.
Answer: The Truman Doctrine had absolutely nothing to do with The Cuban Missile Crisis.
First, in terms of chronology, The Truman Doctrine was inveigled in 1947, at the starting point of The Cold War, whereas the Cuban Missile Crisis took place in 1962.
Second, The Truman Doctrine, was specifically interested in aiding-(and eventually allying with), the nation-states of Greece and Turkey, in anticipation that both  these countries-(which were in close geographical proximity to the Communist Soviet Union), would likely fall victim to Communist Soviet southward expansion....(and beyond).
At the time, Greece was entangled in a brutal civil war pitting Communists-(who were probably supported, both financially and logistically by the Soviets) and Anti-Communists-(who may have also had some financial and logistical support from the British). In addressing the Greek Civil War, the United States was expanding its geopolitical interests beyond mainland Europe and focusing on Southern Europe and the greater Middle East, in relation to an expanding Soviet Union.
Third, The Cuban Missile Crisis, which involved U.S. President, John F. Kennedy, had to do with The Soviet Union's expansion beyond the Eurasian geopolitical "theater".  With the rise of Fidel Casto and his Communist regime in Cuba, the Soviet Union "took notice" and forged a geopolitical friendship/partnership with Havanna-(much to the chagrin of the United States).However, the Cuban-Soviet geopolitical friendship/ partnership, would eventually involve the Soviet Union's depositing of nuclear and radiological weapons inside Cuba-(which is only 90 miles from the Florida Keys).  If left unaddressed by the United States, the Soviet nuclear advancement into Cuba may have grown far bigger and more threatening to the United States.
These were the distinct differences, both chronologically and geopolitically, between The 1947 Truman Doctrine and The 1962 Cuban Missile Crisis.


Express: How can I read a value from the configuration

Question: I am a NodeJS newbie and have a really simple question.
I want to store the port of the server in the application configuration. I use something like this to store it in the app config:
app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.bodyParser());

  // My configuration:
  app.set('port', 80);
});

But how can I use the value of port? I cannot find an answer in the Express documentation.
Something like console.log('Port: ' + app.get('port')); doesn't work (TypeError: Array.prototype.toString is not generic).
Is there a better/other way to store a simple config value with the express framework?
Answer: Even simpler: app.set(setting) with only one argument returns the value of setting. This has the advantage of not using implementation-dependent features, and will work in 3.x.x as well
Answer: If you use Express 2.x.x then take a look at the definition of the function set(key, value):
https://github.com/visionmedia/express/blob/2.5.11/lib/http.js#L436
Line 444: this.settings[setting] = val;
So this should works:
console.log(app.setting['port']);


Opening a bootstrap modal on click of a custom button on standard salesforce page

Question: I have a bootstrap modal that I want to open on click of a Custom button on the standard Salesforce page.
So for that I need to Execute a Javascript on the 'Onclick' action of the button (that'll be how the custom button will be configured)
Can anybody guide me as to how should I go about writing the jQuery?
The code for modal bootstrap looks like this:
<apex:page sidebar="false" standardStylesheets="false"  standardController="Festival__c" extensions="MyController" showHeader="false" >

    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />

    <link rel="stylesheet" media="print" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />

here myModal is the Id of the modal dialog that contains the fields that the user needs to enter and click either SAVE or CANCEL
Comment: I'm voting to close this question as off-topic because Abandoned
Comment: What issue are you having? Looks like you have the correct line to open the modal. The selector could be changed to $('[id$=myModal]') though if you do not have tags on every element
Comment: hey Eric..I want to open the popup on click of a custom button. I am confused how to call this bootstrap modal (in html) using jquery
Comment: Use $("#myModal").modal('show'); in the onclick of the button
Comment: This will not work because 'MyModal' does not exist when the button is clicked and hence the error shows up
Answer: You're going to run in to a number of issues with this.
1) Your modal window requires style sheets. Stylesheets cannot be added to a standard page layout.
2) The modal dialog has to be created prior to you calling your code:
$(document).ready(function(){ $("#myModal").modal('show'); });

3) And this is the hardest part: It sounds as if you want to have an inline form within this modal window. This is not possible without dynamically creating all your form elements in javascript. This is not a good idea - and will be very costly.
To pull this off, I would do the following:
1) Within your custom button: your script would need to dynamically create the stylesheet links. These sheets will be dumped on the page only when a user clicks the button.
2) Create your modal dialog dynamically as per Eric's answer (I'm not familiar with bootstrap). Since you have the style sheets and scripts on the page, the modal window will look normal. In the onHide attribute of the modal: add something to refresh the page: window.location.reload
3) Instead of attempting to dynamically create your html form on the click of the button: create a visualforce page that does what you need. You can make it iframe friendly by using the page attributes to hide unneeded elements. eg:
<apex:page showHeader="false" standardStyleSheets="true" showChat="false" sidebar="false">

</apex:page>

Now, the content of the modal window will just need to be an iframe to the custom visualforce page.
On the page, include all needed fields, and a save button.
The end result will be a modal window that iframes out to a completely versatile, and yet separately managed visualforce page. when the user makes edits, he clicks save. Once saved, he can close the modal window - at which point the script window.location.reload is called: and the edits are now visible, and the page is refreshed.
Answer: You need to include the modal into your page's html.

It will not render by default because of aria-hidden="true".
Then you can trigger the modal block to appear with a few attributes on a button. For example, if you can also use an outputLink:
<apex:outputLink styleClass="btn btn-primary" value="#myModal" html-data-toggle="modal">Click me!</apex:outputLink>

Bootstrap's engine will do the magic.
Check this working example (no VF): http://jsfiddle.net/5XM3J/
Comment: He mentioned he is on a standard page layout. The VF tag is not applicable - but yes: he does need to plop the element in to the DOM.
Answer: Ok. Since you do not have an element on the page you can add this to your button code:
BootstrapDialog.show({
            title: 'Your Title',
            message: 'Your Message,
            size: BootstrapDialog.SIZE_LARGE,
            onhide: function(dialogRef){
                //Code to execute on hide
            }

        });


How to purify myself

Question: If impurity like urine or madhi touch my lip or face. How to wash it?
If I wash my face like wudu water will enter my nose and drop in clothes. Do this make my clothes and nose impure?
Comment: How will urine or madhi reach your lips? Washing actually means that you remove the najasah.
Comment: baby touch with his dirty hand
Answer: I have found your answer in youtube, here it is.
The answer is: NO, your nose and clothes will not be impure because when you wash your face with water, the water overwhelms the impurity and water itself will not be impure. The reason for this is water overwhelms impurity. In that video I have given the link above, there Shykh Assim al-Hakeem explains nicely about why the rules is like this and you will understands the matter completely. Jajakallahu khairan.

How to purify myself


Martial Arts wannabe accosting and threating neighbor who simply complains over parking issue

Question: I have a neighbor who proclaims and is reputed to be a martial arts practitioner. This individual has a habit of parking his commercial truck so that it protrudes into my driveway. Being fed up over this, I requested this individual to move his clunker out of my driveway. Immediately he advanced toward me in a nose-to-nose stare-down and muttered a threat that he would kill me. I calmly replied "that's good to know" then called him a "punk ass little bitch" saying "I'll bounce around you around like a rubber ball". This guy is a known 5150 and a convicted felon. I also told him "back off butt-head" while he spewed incoherent expletives. My question is: how close can a belligerent, hostile, known mental case approach you?
Comment: I interpreted it as a general question about what to do in this scenario and how to keep a crazy neighbor away from you. It does sound like Frank is eager to start a fight with him and is looking for legal grounds to allow him to fight the crazy neighbor in "self-defense" (in other words, to get away with hurting him, legally). I have advised filing a police report and/or getting a restraining order instead. Egging on and getting into a fight with a crazy person, a known felon, who also knows where you live, isn't a smart idea.
Comment: Currently this question is an anecdote about a neighborly dispute and is only tangentially related to martial arts. If the question can be improved to be more on topic then it can possibly be reopened.
Comment: Are you asking how close he can get in before you can claim that you feel your safety was threatened? How close is too close to be able to react to attack? How close he physically can approach (which is how it literally reads)?
Comment: Can you rephrase the question?  I really need clarification on what you're asking here.  Right now, it just reads as "dealing with a jerk, am I right?" and yeah, dude sounds jerky.
Comment: Verbal threatening is assault, and can be prosecuted as such if you feel the threat is credible. Doesn't matter how close they get. On a side note, are you sure that escalating things by taunting a known psychiatric case with a felony history is a good thing to do?
Comment: @JohnP I do not think this is a great forum to either give or seek legal advice.  Also, the definition of assault in particular is fairly dependent on jurisdiction.
Answer: I answered a question that was similar to this before, which you might want to read:
Close quarter's defense: when you stand face to face with an attacker
That answer deals with an aggressor who attempts to stand face to face with you, violating your personal space but not actually throwing the first punch. A situation like that is best seen through the lens of psychology, and understanding the aggressor's psychology would help you determine what to do.
You didn't help yourself by saying what you said back to him. In general, I think the best response to this situation is to stand your ground and stare at him until he gets bored and leaves. Backing down or escalating things are choices that will tend to lead to a bad outcome, in my opinion.
When you call him names and egg him on, you're aggravating the situation. You're encouraging him to attack you. It's not a good strategy. It's especially bad since, as you apparently have learned somehow, he's a convicted felon, and the police consider him to be a crazy guy with a short fuse. Even if he's smaller than you, a guy like that could easily mess you up, especially since he knows where you live. Bad idea to taunt him. Now you'll need to watch out whenever you come home. It's not a good way to live.
You asked how close someone like that can approach you. First of all, legally you're probably in a grey area until you get a restraining order filed against him. Until then, the laws will vary.
I encourage you to file a police report whenever an aggressive individual threatens you even just verbally and/or violates your personal space. You want to have a record of everything for when things go really bad, and you and the other guy are taken into police custody after your neighbors call the police to come investigate a domestic disturbance.
You may not need a lawyer, by the way. Just head to the police station and ask to talk with someone about it. That's what they're there for.
The best thing to do legally is to have a restraining order filed against him. A judge will review your situation and will present options to you. Sometimes this involves just a general order for both of you to stay away from each other (by a specific distance or in more general terms). If you mention the part about him trespassing on your driveway, then that will also get made into the restraining order.
And whenever the restraining order is violated, you need to report it. It's up to the police and the courts to figure out whether the violation warrants an arrest.
Which brings me back to my advice: Don't say anything to him. Don't attempt to escalate the situation. You want to make this as easy as possible for the police and the courts. When you involve yourself as an actor in the fight between you two, the judge won't know who is the aggressor and who is the victim.
Also, if you can, get a witness. If you know your crazy neighbor is going to be there at a certain time when you're also there, and you know from past history that he's going to be threatening, then have a witness with you. And maybe have the witness record it on video for you as discreetly as possible. Even just knowing he's being recorded will likely set him off.
That's my advice. Hope that helps! And from now on, be mindful about your surroundings. Watch out for anything that doesn't seem right.


Is it normal to reject a paper based on the review of a single referee?

Question: I just received the answer for my first submitted paper. It was rejected but they annexed the answer of just one referee. Is it normal to reject a paper based on the review of a single referee? Can I use this as an argument to ask for reconsideration? Of course this would not be my single argument, since I found issues with the review itself as well. (It questioned the validaty of my methodology even though I cited a review just about the methodology used.)
Comment: It's totally standard.  In fact, lots of papers are rejected by the editors without even being sent to a referee!
Answer: It is normal. Often there is one referee who writes an extensive review, whose judgment weight heaviest with the editor. If there are 4 reviews, 3 are in the "publish" half of the spectrum but are brief (not adequately justifying the recommendation), and there is 1 "reject" review which extensively argues against publication, an editor will either have to apply his/her own knowledge of the field and decide which argument carries the day, or will need to request an additional review. Good editors do not just count up the plus and minus values, they have to evaluate the evidence in the reviews.
If you make the case for reconsideration, I think it should focus on the question of whether positive evidence in the reviews has been undervalued. There's not much you can do if the negative reviewer is (unbeknownst to you) The Leading Authority.
Comment: It's also common for only for one reviewer to actually return a review of the paper.  In that case, if the review is negative and other reviewers weren't even interested enough to review the paper, it's a good candidate for rejection.
Comment: @BrianBorchers: To add to this, if another reviewer agreed to review but did not do it for whatever reason, it might not be the best choice from the editor to wait for another review, and thus (under the assumption that the existing review is appropriate) wasting everybody's time: The reviewer's as they are reviewing a sub-par manuscript and the author's as they are waiting for a negative review, when they could be improving the manuscript.
Answer: In my experience, it is typical for papers to receive either zero reviews (editorial rejection) or multiple reviews (usually 3-4, but occasionally 2 or 5). Having just a single review (accept or reject) is very unusual.  One possible explanation is that the editor formatted their editorial rejection as a review; another possible explanation is that you were dealing with a publication venue with a rather slipshod process.
You can email and ask for clarification.  It is not, however, likely that you can get the decision changed in any way: if the editor found your paper problematic enough that they willing to reject with a single review, they are unlikely to change their mind on for purposes of "due process."  Improve the paper, find a better venue, and move on.
Comment: This is also field specific, I think. In mathematics, it seems to be common that even very good journals assign only 1 reviewer.
Comment: Nate is right. As an editor for mathematics journals, I ordinarily sent papers to a single referee.  And as an author, I usually got one referee report per paper (in mathematics --- not in computer science or physics).
Comment: In addition to the field specific as pointed out by @NateEldredge and Andreas, it is also journal specific, and all journals do not concur. e.g. in Physics, there are journals (e.g. _Journal of Physics_ series by IOP Publishing) where it is customary to have two reviewers (minimum), and there are some (e.g. _Physical Review C_, an APS journal) where it is usually only one review, and additional reviews only occur if there is an appeal by the authors. So, as far as Physics goes, we don't have one standard convention AFAIK. :)
Comment: That is very surprising to me: in the fields I participate in, that would be unheard of.
Answer: It happens -- at least it's happened to me -- and although I don't know about the etiquette of asking for reconsideration, if you believe the bad review is based on an incorrect reading of the manuscript, then I think it's warranted.
The time this happened to me, I had two very good reviews on a paper and one really bad review. The two good reviews were short because they liked everything in the paper and had nothing else to say. The one bad review was bad because the reviewer was biased against my premise and did not examine the evidence I presented. I contacted the editor and pointed these things out and eventually the paper got published. So, there's not much to lose by touching base with the editor unless in your situation doing so would be a serious faux pas.
Answer: It is not so common but it still happens quite often that a paper is rejected by only one referee, especially for smaller conferences. Usually a paper is assigned to a few reviewers. But some reviewers may be busy and may not send their review on time. In that case, the decision may be taken without all reviews.
And generally, it will not work if you ask for reconsideration unless there would be some major error or some very serious reason to do so. Besides, according to my experience, it happens quite often that some reviewers don't understand something in a paper. But most of the time, it is the fault of the author because something in the paper is not clear enough. So if the reviewer did not understand, it may just be an indication that you need to rewrite the paper to make it more clear so that the reviewers will not think about something else. Don't forget that reviewers are not always expert on your topic.


Do my original photos move to iCloud if imported to Photos?

Question: I have a large collection of photos (80Gb) stored on my Macbook and I've imported them to Photos, these are now available through Photos on my other devices with the same iCloud account. Does Apple move the originals into the cloud and free up the 80 Gb space on my Macbook?
Answer: No - You don't initially save any space on your Mac if you choose iCloud storage.
Yes - if you set "optimize" in Photos preferences, then once you fill your storage with other files, the Photos library will shrink itself.

You can choose to store the original size images in the cloud and let the Photos app "optimize" and resample/recompress images to reduce the storage space burden on selected devices.
For example, if your 80 GB library is half RAW files and/or very large JPEG files, you might save a substantial amount of space by selecting Optimize and then filling up your storage with other files to trigger the optimization.

As you can see from Photo preferences, only when you run low on storage space will the optimization start to take place. I've not tested this yet, but hope to try it on a second Mac with limited storage to see how the library looks when space runs low and "optimization" kicks in.


However does UDP socket receiver buffer size impact latency?

Question: I am setting the multicast UDP socket receiver buffer size to a big value to avoid packet drop. I tried to use a small buffer size, I did not see any latency diff. I am wondering how does it impact latency? When the app is fast enough to handle incoming packets, does bigger socket buffer size really impact latency and why?
Answer: UDP latency is going to depend more on the network that you're passing the traffic through than the local configuration. Small buffer size will mean you drop packets more often for high throughput streams but that isn't technically a latency issue. Latency will be affected by your local machine by how fast you can pull packets out of the buffer which will be negligible.
Answer: It doesn't impact latency at all. It just uses extra memory, that's why it's tuneable.


What is more pleasing to the eye fade in or suddently appear

Question: I have a pop up menu. What is said to be easier on the users' eyes? Should I just have it appear immediately using visibility = true or should I have it fade in using opacity animation?
Answer: Users hate slow UIs, just as they hate slowly loading websites. Pop in, fade out.
Your users are not here to admire your application. It's just a tool to help them achieve a goal, and when that's done, it doesn't matter how pretty the app - they're out of there. Now, that doesn't mean you should strive for dull, grey, boxy interfaces. But it does mean prioritizing speed of service and accessibility (in the broadest sense of the word).
Comment: Apple FADES/ANIMATES IN on their pop ups and notifications on OSX and iOS, although it is very quick. It it almost had to notice but it doesn't just pop up.
Comment: +1 Apple does this too in their menus in the OS and it's both very pleasant to the eye and fast.
Comment: iOS utilizes implicit animations almost everywhere. The default transition time is 0.3 seconds, so I would argue that transitions of that nature have little to no negative impact on perceived UI speed. What's important is how quickly a UI change begins. I personally don't tolerate things popping in. It's hard to sometimes tell what just happened in the UI, especially if it's something subtle like a button becoming disabled. Transitional animations can and do offer important usability affordances.
Comment: @Matt How do you know it fades in? Is there any way to find out exactly how long the animation is? I'm not seeing it, but maybe it's just so quick I can't tell?
Comment: Try getting a text message in the iPhone (if you have one). The blue "bubble" that appears animates in or kind of grows in.
Comment: I think the key here is fast animation. If its time is below 0.5 sec. (~0.3 sec aprox.) then it is fast enough to cognition senses (appears as popped up) but an eye (unconscious recognition) will recognize its transitioned behaviour.
Answer: Why just popping in is bad: Nothing in the real world does that and thus it is disorienting for users. If something in the natural moved that fast and stopped right in front of us it would be startling, haha. The user must take a few moments to reorient themselves and return to scanning the new window.
Why fading in is bad: It catches the users attention with its movement but then they must wait for it to fully stop animating to scan it. So unless it happens in less than a second, its bad.
My suggestion: what ever transition you do make it happen fast, under 1 sec. (Unless your program is slow and you want to hide that, which in case distract them haha)
Comment: Under 1 second might be too loose. I've found that 0.3 seconds is fast, yet not startling. I use that for all my animations.
Comment: I agree with this.  I don't know why but it is completely jarring to see the popup come up in my game.  I'll see if putting something like a .3 makes a difference.  If it does I'll come back and change the answer.
Comment: I disagree that popping in is bad: as Rohan expresses below, we already have the user's attention, so I don't think an immediate response would be especially surprising.
Comment: @jojo I totally agree. I wrote under 1 sec as in 1 sec is the longest it should be.
Comment: +1 Right on Jon. There is a fine line between too long and just right. It should be quick enough that you don't really perceive it, but it just feels right. 0.3 seconds is perfect.
Comment: Exactly Matt, well put. It should be quick and you really can find this nice timing that just flows.
Comment: Evidently, this is contentious. Is there any research that backs up either position?
Answer: It's a popup. The user asked for it - so give it to them - right away. Don't slowly hold your hand out to give it to them, it's just annoying.
The user knows what to expect, and the faster it popups up the faster the app will feel.
There is absolutely no need for noticeably fading-in popups.
Comment: Yes, the [Apple HIG](http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGUserInput/XHIGUserInput.html#//apple_ref/doc/uid/TP30000361-TPXREF7) agrees with you: "The effect of a click should be immediate and obvious."
Comment: Windows (for example) uses a default delay of 0.4s - No wonder then that Google shows 1.7 million results for 'Windows MenuShowDelay' (the registry entry that controls this delay) and it's listed among 'Top 10 things to do first on Windows'. I concede that a 150ms fade-in might take the edge off, while still seeming to appear 'instantly'. Windows has it way too long. [Interestingly, my Windows 7 'Start Menu' (left click) seems to appear 'instantly' which I don't have a problem with at all.]
Comment: Exactly. The user wants something, so why defer it?
Comment: Apple is right, but immediate to them is "very fast", as they themselves use a .3 sec or so long animation in there iOS notification system.
Comment: @Matt Is that in response to a click?
Comment: @Patrick I was talking about the notification system, which isn't usually triggered by a click, but if you click on a text field, it will animate the keyboard onto the screen as well (it will slide up from the bottom).
Answer: I agree with Jonshariat, but would suggest between
200ms (just noticable)
and
700ms (not yet annoying)
Answer: If you are going to use a transition effect, it's not a bad idea to actually put some information in it;  use the transition to show the user how they got there and how to get back.  Fading doesn't really provide much information.  Instead, you could have the new content grow over the old content, or have both new and old content slide off one edge and on the other, both in such a way that emphasizes the ui elements the user will use to navigate between the two screens.
All of this should be part of an overall spatial design of the application so that your users can use the visual queues to build a mental understanding of where they are and how each interaction will affect that.  If your transitions don't do any of this, then they are just wasteful.
Comment: Google+ does this when you click on a circle - the friend list 'grows' from the circle you clicked on, and 'shrinks' back into it.
Answer: From your question i can gather that you are talking about the user triggering the action. The user clicks on the menu link and then it opens up.
I would suggest an appearance without any animation.

Animation can slow down the users browser experience why take a chance. I have often seen animation slowing down or hanging my Firefox or Chrome browsers.
Animation has the effect of something important happening. If you already have the user attention why do it again with a fade in.


Do roots of a monic polynomial contain an open cube?

Question: Let us consider monic polynomials of $n^{\text{th}}$ degree $p(t) = t^n + a_{n-1} t^{n-1} + \dots + a_1 t + a_0$ with real coefficients. We know the roots are continuous functions of the coefficients. Let us define a map $F: \mathbb R^n \to \mathbb R_+^n$ by
\begin{align*}
F: (a_{n-1}, \dots, a_0) \mapsto (r_1, \dots, r_n) \mapsto (|r_1|, \dots, |r_n|),
\end{align*}
where $r_j = r_j(a_{n-1}, \dots, a_0)$ are roots of the polynomial and $|\cdot|$ denotes the modulus of a complex number. Clearly $F$ is a continuous function. Let us take the Euclidean norm on $\mathbb R^n$. Suppose for some fixed coefficients $b = (b_{n-1}, \dots, b_0)$, the roots are all nonzero and let $(c_1, \dots, c_n)$ be the roots. if we take an open ball $B_b(\varepsilon)$ around $b$, will the image $F[ B_b(\varepsilon) ]$ contain a cube, i.e., $(|c_1|-\varepsilon', |c_1|+\varepsilon') \times (|c_2|-\varepsilon', |c_2|+\varepsilon') \times \dots \times (|c_n|-\varepsilon', |c_n|+\varepsilon')$ for some possible smaller $\varepsilon'$?
Comment: Your map $F$ is not well-defined: the roots are only defined as an unordered collection, not as an ordered $n$-tuple.  It would be well-defined (and continuous) if you changed the codomain to $\mathbb{R}^n_+/S_n$.
Comment: You could still consider your $F$ as a "multi-valued function" and ask your question about the image $F[B_b(\epsilon)]$, though.
Answer: As I commented, your function $F$ is not well-defined.  However, your question still makes sense without it.  You can ask, given a multiset of nonzero complex numbers $c_1,\dots,c_n$ invariant under conjugation and $\epsilon>0$, does there exist $\epsilon'>0$ such that for any $r_1,\dots,r_n\in\mathbb{R}$ with $|r_k-|c_k||<\epsilon'$ for each $k$, there exist $d_1,\dots,d_n\in\mathbb{C}$ also invariant under conjugation such that $|d_k|=r_k$ for each $i$ and coefficients of the monic polynomial of with the $d_k$ as roots are within $\epsilon$ of the coefficients of the monic polynomial with the $c_k$ as roots.  (The invariance under conjugation condition here corresponds to the requirement that the polynomial has real coefficients.)
The answer to this question is no.  For instance, let $n=2$, and $(c_1,c_2)=(i,-i)$ and consider $r_1=1+\epsilon'/2$ and $r_2=1$.  Notice then that if $|d_k|=r_k$ for $k=1,2$, then $d_1$ and $d_2$ cannot be conjugates of each other, and so they must both be real in order to be invariant under conjugation.  It follows that there are no such $d_1$ and $d_2$ that give rise to a polynomial close to the polynomial $t^2+1$ with roots $c_1$ and $c_2$.
Or, in more concrete terms, there is no polynomial with real coefficients close to $t^2+1$ whose roots have distinct absolute values, since any nearby polynomial has no real roots and hence the roots must be a complex conjugate pair.
Comment: Thanks. Will the ''conclusion'' hold: if we let the roots to be identical real numbers, i.e., $c=(\beta, \beta, \dots, \beta)$? Here by conclusion I mean: an open cube $(|\beta| - \varepsilon', |\beta| + \varepsilon' )^n$ such that all the conjugate invariant subset is contained in the image of $F[B_b(\varepsilon)]$?
Comment: Yes, it is true if the roots are all real.  This follows immediately from the fact that the function taking a collection of roots to the coefficients of the corresponding polynomial is continuous (since it's just given by the elementary symmetric polynomials).  So, just pick a collection of real roots near $\beta$ with the desired absolute values, and if they are sufficiently near $\beta$, the resulting polynomial will be sufficiently near the initial polynomial.


How fast can I deal damage with a weapon?

Question: Is there a limit to how fast I can do damage to a mob or player using a weapon, such as a sword? If so, what are those limits?
Answer: All enemies (and I believe this is actually Entities, not just hostile mobs) have an invulnerability period after you strike them. That is when they turn red and only lasts for a split second (for the most part).
You can see it when you are striking a cow or the like and while its harder to see on things like a blaze, you can swing your sword to check. A blaze I believe takes three hits with an Iron sword to kill it. If you swing your sword fast you will be able to hit it I believe 4-5 times before it dies as only three of the hits will actually register and do damage.
Please note that this is regardless of how fast you swing, and in fact the faster you swing the more wasted uses of your weapon will occur so if you are buffed by a potion, beacon or whatever else may be available to you, then watch your attacks a bit more carefully.
Side Note: A mod where this is very easy to see is Aether and their cube boss (Which is what first brought it to my attention). You could go through 2-3 picks constantly hacking at the boss but any strike done while it was red would not actually cause it damage when it would only take a pick and a half or so of hits to take it out.
Comment: Any idea where to look for an exact value for the invulnerability period? Is it the same for all entities?
Comment: @AndresRiofrio Unfortunately I do not know the answer for this. It appears to be the same to me for all creatures but knock-back and the like make this often difficult to tell. I have not looked through the code or the like to see the information there but maybe a modder who has will speak up. Sorry I can not be more helpful.
Comment: Get a stopwatch and test it
Answer: Yes, your swing speed. There are two effects that can change this. Haste, which can be acquired from a beacon, will quicken the speed at which you mine, ergo your swing speed. Mining fatigue, which must be spawned as a potion in via commands, or other mods, makes your block breaking slower, ergo reducing your swing speed and the rate at which you output damage.
I bet there is a more mathematical answer, but this is all i could do at a moments notice :)
Comment: I'm pretty sure this is false - Haste is for block breaking rate, and you can attack as fast as you can click. DPS is limited only by the invulnerability period of the enemy.
Comment: Thanks! I wasn't able to find a number for the swing speed. Maybe it has another name?
Comment: @AndresRiofrio Perhaps? I looked on both the 'digging' and 'swords' page of the Minecraft wiki, but nothing came up about swing speed. However, you can find the specifics on the status effects here: http://www.minecraftwiki.net/wiki/Status_effect
Comment: @KevinReid I just read James answer, I never knew that was what the red was implying, I thought it just showed that they were being hurt and it had no over significance. So haste doesn't affect swing speed? Maybe I just clicked faster when I got it... I'll edi this tomorrow after I mess around with the effects...
Answer: From my experience, there is definitely an upper limit to damage given in a specified time.
I run a bunch of macros on my PC and one of them makes me 'left-click' once every 5 milliseconds. Ive destroyed an iron sword in about 10 seconds by holding it on a player. The green durability bar just vanishes!  haha
While I should have killed them in roughly one second, it still took longer. Though it WAS incredibly effective! I use this for PVP, but with mobs it behaves the same way. I HAVE tested it though and it really does click that fast.
Answer: The limt is 35. If you use hacks/macros then that limit may pass. I went to minecon and I got to meet Notch and I asked him how many clicks will minecraft allow, his answer was 35 with regular clicking. Happy to answer your question! Zook~
Comment: 35 what? Clicks per second?
Answer: From the official Minecraft wiki:

Against a single target, DPS is effectively limited to 2 due to damage immunity.

Thus, the delay is 0.5 seconds, or 10 server ticks.
Source: https://minecraft.wiki/w/Damage#cite_ref-dpsLimit2_1-0


Phone starts ringing for caller long before phone starts ringing, why?

Question: When I call my wife's phone from my phone, I hear three or four rings through my handset before her ringtone starts.  Is there a way to reduce or eliminate this delay?  (Yes I have checked the audio file.  The sound starts instantly in the file.)
Comment: I expect this is more about your carrier's network than anything that can be done locally on your handset. In my experience, it has been ever thus. Anyone I call I will hear two or three rings (or more) before my recipient's phone starts to chime.
Answer: There's quite a bit that goes into placing a call to a mobile phone. Here's an excerpt from the Wikipedia article on GSM services, slightly edited for clarity, which does a good job explaining some of what happens when a call is placed to a GSM cellular phone.

When someone places a call to a mobile phone they dial the telephone
  number associated with the phone user and the
  call is routed to the mobile phone operator's Gateway Mobile Switching
  Centre (MSC). The first job of the Gateway MSC is to determine the current
  location of the mobile phone in order to connect the call. It does
  this by consulting the Home Location Register (HLR).
When the HLR
  receives this query message, it determines whether the call should be
  routed to another number (called a divert), or if it is to be routed
  directly to the mobile. If the Home Location Register knows that the phone is    roaming in a particular Visited Location Register area, then it will
  request a temporary number (called an MSRN) from that VLR. This
  number is relayed back to the Gateway MSC, and then used to route the
  call to the MSC where the called phone is roaming.
When the call arrives at the Visiting MSC, the MSRN is used to
  determine which of the phones in this area is being called.
  The MSC pages all the mobile phone masts in the area in order to
  inform the destination handset that there is an incoming call for it. If the
  subscriber answers, a speech path is created through the Visiting MSC
  and Gateway MSC back to the network of the person making the call, and
  a normal telephone call follows.

All of this and more (depending on the origin of the call, the carriers involved, and how smoothly things are running on that particular day) happens in fractions of seconds. When taken altogether, though, it can create a noticeable delay. That's why it takes so long for your wife's phone to start ringing and that's also why there's not much you can do about it. It's all pretty cool if you think about it.
Comment: That answers why it takes the call a period of time to connect, but why does the ring sound begin at the callers end five to fifteen seconds before the receiving phone begins it's incoming call notification?
Comment: For the same reason. While the system is trying to process the call request and then identify, locate, and notify the subscriber called, the caller is given a sound to let them know the process is working. That's the rings you hear when you dial someone. With landline phones there has also always been a delay between when the caller hears rings and when the phone called rings, but a) landlines connect much quicker and b) you're not normally in the same room as the landline you're calling.
Answer: If you use TrueCaller, the phone has to do a query on the internet connection, download the caller details, and then start ringing. That would take a few seconds on a weak mobile internet connection.


When a user opens a team site in sharepoint online it should display name

Question: Is there a way to show the user name when user logins to team site it should Show welcome the user with current user name
Welcome CurrentUser
Answer: There is no OOB way to do that, you can use JSOM to achieve it.
An example for you:

If you want to show it on a modern page, you need to install modern script editor web part, then add the above code into it.
About installing modern script editor web part, you can refer to:
SharePoint | Online | Best Practice | install Modern Script Editor Web Part for SharePoint Online Modern Site.
Answer: It already displays the current user's photo in the upper right hand corner. If you want a customized welcome message, there is no oob method, but this can be done via code, either an SPFx web part or perhaps a custom SPFx extension.
Answer: I am not sure, there is OOB method available to get that. But you can use JSOM to get user display name and show it on page.
Below link may help to get started:
https://stackoverflow.com/questions/20981226/sharepoint-2013-get-current-user-using-javascript
If you are using classic experience, you can add Script editor webpart to add script on page.
If you are using Modern experience, you will need to either use SPFX or react-script-editor webpart available on Github.


Able to transfer files from phone to PC via USB, but not vice versa

Question: Just as the title states, I am encountering a very strange issue with USB transfer between my PC (Win10) and android devices. While I am able to transfer files from my android devices to my PC, I am unable to move files to them (the transfer gets stuck at 0%). I've tried different cables, USB ports, heck even multiple devices (OnePlus 6, Xperia XA Ultra and Galaxy S9) and the same problem crops up across all of them. I am beyond frustrated and any help would be much appreciated.
Answer: Did you set the USB mode to file transfer? When you connect your phone via USB, you should get a notification on the phone (phone has to be unlocked), choose "Use USB for: File Transfer" Then you should be able to transfer files. Make sure the directory you are trying to write to is not write protected.
You can also try to enable developer / debugging mode if it doesnt work.
More information can be found here:
https://support.google.com/android/answer/9064445?hl=en
Comment: Yes, I have tried both setting the mode to File Transfer and also USB Debugging Mode but is met with the same problem.


air mobile controls

Question: Having downloaded Flashbuilder 4.5 it seems there are very few spark mobile controls available at the moment - no datepicker , not even a combobox. Is there a third party resource for such items? Does Adobe have plans to make a more complete set available?
Answer: The answer to both of your questions is yes, I'm pretty sure Adobe is going to make a fuller set of controls for mobile eventually and also there are 3rd party providers already gearing up for mobile, Flextras for example (who is an active SO member btw) is definitely on the case judging by his blog: https://www.flextras.com/blog/

air mobile controls


Creating a terminal from a shell script in Ubuntu

Question: What is the name of the executable for the Ubuntu Terminal program?  I want to launch a terminal from within another terminal.  For example inside an XTerm I can write:
    xterm&
How do you do that for the Ubuntu default terminal emulator?
Answer: The name of the package is gnome-terminal
Here is a page with all of the switches you can use along with it
http://manpages.ubuntu.com/manpages/karmic/man1/gnome-terminal.1.html
Comment: Thanks - don't know why I can't accept this answer as correct immediately.  Having to wait 8 minutes is rediculous.
Answer: Just this command will do:
gnome-terminal

Normally if you want a command to open from the terminal and separate (so it returns to the prompt without having to close the opened program),  you have to use something like this:
gnome-terminal & disown

However the parent terminal seems to detect that the same command is being used so you don't need to do that and gnome-terminal will suffice. This also seems to happen when running xfce4-terminal from Xfce's terminal, konsole from KDE's as well (doesn't seem to work when running xterm from xterm - Running konsole from Gnome/Unity & Xfce's terminal works as well, but for Xfce's terminal in gnome terminal you need xfce4-terminal & disown).
For more visit gnome-terminal's manual page:
 gnome-terminal  [-e,  --command=STRING]   [-x, --execute ]  [--window-with-profile=PROFILENAME]  [--tab-with-profile=PRO‐
       FILENAME]    [--window-with-profile-internal-id=PROFILEID]    [--tab-with-profile-internal-id=PROFILEID]    [--role=ROLE]
       [--show-menubar]   [--hide-menubar]   [--geometry=GEOMETRY]   [--disable-factory]  [-t, --title=TITLE]  [--working-direc‐
       tory=DIRNAME]  [--usage]  [-?, --help]

Reference
Comment: Good. But also might wanna include redirecting output of stderr


Effect of SEO on Mixed Language Content in a Single page

Question: I want to know what will happen, if I prepare a single page content in two languages. For example English & Hindi content in same page. Main keywords are in English. By considering Google can translate the Hindi content to English, will they able to show this page in search results ? Or it will affect badly?
Answer: It probably will negatively affect your SEO.
Here is why:
Page titles and meta description have small character limits. This means the title and meta description can only conceivably have 1 language in them.
A title can have 55-60 characters.
https://searchengineland.com/title-tag-length-388468.
A meta description has 120 characters mobile or 155 desktop. https://www.brightedge.com/glossary/meta-description
What this means is that you'd have to pick a language to show for your search results.  In the below image the title text is in blue, whereas the meta description is on black text for each search results.

This is basically your free advertisement that google lets you give to people searching for a term on the web that describes what is on your page. Now if a user visits a website who's title and meta description are in English and most of the page is in Spanish, only the people that speak both languages will be able to read it.
In the above scenario most users would have a bad user experience and leave your website. Google would in turn refer less traffic in the future to you as a result of the poor user experience on the page.
Now if for example, you have one part of the page in English and that same text translated into Spanish you would probably not have your page penalized, but, you'd be missing out on the opportunity to target the phrase in 2 languages and get the traffic for that term in each language. By having 2 pages, one on each language, you gain the ability to target the same term, but in two different languages.
For example, in English you could target, "Cruise ship vacations". You'd make a title saying, "Browse Luxury Cruise Ship Vacations Today". You'd make a meta description saying, "View our luxury cruise ship vacations with Carnival, Holland America and other prominent lines today!"
You could make a second page in Spanish to target the phrase, "vacaciones en crucero". You'd have a title saying, "Explore vacaciones en cruceros de lujo hoy!" You'd have a meta description saying, "¡Vea nuestras vacaciones en cruceros de lujo con Carnival, Holland America y otras líneas destacadas hoy!"
By having two pages you'd gain traffic in both languages all while having a better user experience.
Answer: Using English and Hindi simultaneously in the same content is against Google's policy for multilingual websites:

Make sure the page language is obvious


When to subclass AbstractBorder and when to implement the Border interface?

Question: Is there a time when it's more appropriate to subclass AbstractBorder than to implement the Border interface when developing a custom Swing border? And vice versa?
From the example code that I've seen, it seems quite arbitrary.
Answer: For clean OOP you should implement the Border interface. But, if you do not to plan to extend any more your new Border class with new classes that inherit from your Border, it is more convient to extend AbstractBorder.
AbstractBorder makes part of Swing to make your work easier. So use it, but do not make it the base of a class hierarchy.
Answer: Sometimes when Java has an interface XYZ and a class AbstractXYZ the class does quite a bit of work and leaves you just the bare minimum to implement (e.g List and AbstractList). Sometimes the abstract class just provides a do-nothing implementation (e.g. MouseInputListener and MouseInputAdapter).
AbstractBorder is more of the latter case; it doesn't really help the implementation of Border but it does provide some helper methods which (AFAICS) are of more use to the component 'hosting' the border than the border itself.
So, I would say it probably is a bit arbitary which one is used. I'd recommend using AbstractBorder anyway, there's no reason not to (unless you need to derive from another class of course.)
@PeterMmm, why shouldn't you use it as part of a hierarchy? A lot (All?) of the standard Swing borders derive from AbstractBorder.


$G_{\mathbb Q}$ and primes of $\overline{\mathbb{Z}}$

Question: I know that if $K/\mathbb Q$ is a finite Galois extension (i.e. a Galois number field), then for any prime $(p)\subseteq \mathbb Z$, the Galois group $G=\operatorname{Gal}(K/\mathbb Q)$ acts transitively on the finite set of primes of $\mathcal O_K$ lying over $p$. I was wondering if something similar is true for the infinite case $K=\overline{\mathbb{Q}}$, but the proof I know for the finite case does not generalize to the infinite case at all, because it asks us to use the CRT on the set of primes (whose finiteness is established by the unique factorization in the Dedekind domain $\mathcal O_K$). The Going-Up Lemma tells us that if $(p)\subseteq \mathbb Z$ is a prime, then there is at least one prime $\mathfrak p\subseteq \overline{\mathbb{Z}}$ lying over it. However, since $\overline{\mathbb{Z}}$ is no longer a Dedekind domain, this proof does not apply. Do we know if there are only finitely many in this case too, or can there be infinitely many such primes? Do we know if the absolute Galois group $G_\mathbb{Q}$ acts transitively on this set of primes too?
Comment: Not only there can be, there necessarily will be. In fact I believe the set of primes lying over any prine $p\in\mathbb Z$ will be uncountable, and I think $G_{\mathbb Q}$ does act transitively on it. To prove it, note that for any two such primes $\mathbb p_1,\mathbb p_2$, the set of automorphisms taking $K\cap\mathbb p_1$ to $K\cap\mathbb p_2$ form an inverse system as we go over all Galois extensions $K/\mathbb Q$, and the inverse limit is hence nonempty.
Comment: @Wojowu, can you point me to a source for your first assertion?
Answer: There are infinitely many prime ideals $\mathfrak p$ in $\overline{\mathbf Z}$ that lie over $p$ since you can find an arbitrarily large (finite) number of prime ideals lying over $p$ in suitable number fields. I'll show how to do this using composites of quadratic fields. For each $n \geq 1$ there are $n$ primes $q_1, \ldots, q_n$ such that $p$ splits completely in $\mathbf Q(\sqrt{q_i})$ by using $q_i \equiv 1 \bmod 4p$ for all $i$.  When a prime splits completely in number fields $K_1, \ldots, K_n$, it splits completely in the composite field $K_1\cdots K_n$, and the composite of the fields $\mathbf Q(\sqrt{q_i})$ has degree $2^n$ over $\mathbf Q$ because those quadratic fields are linearly disjoint, either since $q_1, \ldots, q_n$ are multiplicatively independent mod squares (Kummer theory proof), or since the discriminants of those quadratic fields are $q_1, \ldots, q_n$ and these are pairwise relatively prime (not Kummer theory proof). Thus $p$ has $2^n$ distinct primes lying over it in the number field $\mathbf Q(\sqrt{q_1}, \ldots, \sqrt{q_n})$. For each prime over $p$ in $\mathbf Q(\sqrt{q_1},\ldots,\sqrt{q_n})$, pick a prime ideal lying over it in $\overline{\mathbf Z}$ and that gives you $2^n$ different primes over $p$ in $\overline{\mathbf Z}$.
The transitivity of the action of $G_\mathbf Q$ on the primes over $p$ in $\overline{\mathbf Z}$ is proved in the appendix on infinite Galois theory in Washington's book on cyclotomic fields. The proof uses transitivity of the Galois action on number fields plus compactness of $G_\mathbf Q$, as mentioned in Wojowu's comment above.
Comment: Thank you for the excellent answer! That was very helpful!


VC-dimension of the infinite intersection of two spheres

Question: I'm searching for an upper-bound for the VC-dimension of the infinite intersection of two spheres.
Thanks
Comment: How many spheres are interesting—two or infinity? And in what space? Finite-dimensional Euclidean or more exotic?
Comment: To be more precise, VC-dimension of the infinite phases of the moon. Each phase is the intersection of two spheres. In 2D
Answer: Once the OP has clarified that the question is about the VC-dimension of the 2-fold intersection of spheres in $\mathbb{R}^d$ (in fact, $d=2$ was specified), a simple upper bound can be stated. The VC-dim of spheres in $\mathbb{R}^d$ is the same as that of half-spaces (via an easy scaling argument) --- namely, $d+1$.
Lemma 3.2.3 of Blumer et al. (1989) bounds the VC-dim of the $k$-fold union/intersection of a class of VC-dim $d$ by
$$
2kd\log(3k).
$$
Thus, $2\cdot2\cdot2\log(6)\approx 14$ is an upper-bound on the VC-dimension in the OP.
A. Blumer, A. Ehrenfeucht, D. Haussler, and M. K. Warmuth. Learnability and the Vapnik-Chervonenkis dimension. J. Assoc. Comput. Mach., 36(4):929–965, 1989. ISSN 0004-5411.
Comment: Thank you very much!


getElementById javascript undefined

Question: I am currently working on this script for Greasemonkey. The goal of this script is to remove posts from specific users on the feed of the website MeetMe.com.
My code is:
// ==UserScript==
// @name        PostBeGone
// @namespace   TestingNameSpace
// @include     http://www.meetme.com/apps/home
// @version     1
// ==/UserScript==
var posterId;
var blacklist = new Array();
var toDelete;
blacklist [0] = 45112400; //These are just random peoples' user Id's that I am
blacklist [1] = 9649820;  //using to test this script
blacklist [2] = 55907221;
blacklist [3] = 56788411;
window.onload = function checkAndRemove () {
    var children = document.getElementById('feedReloadArea').childnodes;
    alert(children); //alert says "undefined"
    i = 0;
    While (i < children.length)
    {
        posterId = children[i].getAttribute('data-poster');
        toDelete = null;

        i2 = 0;
        while (i2 < blacklist.length)
        {
            if (posterId == blacklist[i2])
            {
                toDelete = children[i];
                break;
            }
            i2++;
        }
        if (toDelete != null)
        {
            toDelete.parentNode.removeChild(toDelete);
        }
        i++;
    }
}

Using various alerts with multiple executions, I know that the code executes up to the point where I have alert(children), which is returning undefined.
Prior to having window.onload = in my script, in scouring Google and this website for answers, I read many places that the problem might be that the script could be trying to execute before the page was loaded, so I added the window.onload =. The problem persisted, however, and I can't find any questions similar enough to mine to make sense of it.
To see the html code for the elements, I've been using Firefox's "Inspect Element" feature. A snippet of the html code on the page that may help is:

To clarify, that is only part of the HTML code. There are many of those classes on the feed, as each one represents one user's post. Also, each class has multiple within it, for things like the user's link and the user's profile picture. I, however, am wanting to remove full feedItemArea classes that have the same poster id as any that are on the blacklist.
I hope that I have been clear and concise enough to be easy to help, but if any other information is needed in order to help me, let me know and I will post it. My question is what is causing children to be undefined? Thanks in advance.
Comment: `.childnodes` should be `.childNodes`. And note that not every child is an element node. If you only want element nodes, use `.children`.
Answer: JavaScript is case-sensitive, and it's childNodes instead of childnodes. Btw, since you probably want to iterate element nodes only (no text nodes, comments, etc.), use the children collection. Also, you hardly need the window.onload, since GreaseMonkey scripts are executed on DOMready by default.
Comment: Also, thanks for the other tip as well. I am looking into it now.
Comment: If this answer worked for you (it should), please [tick the check-mark next to it](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235).
Answer: Capitalization!
var children = document.getElementById('feedReloadArea').childnNodes;

getElementById javascript undefined


Android emlator size problem

Question: My Emulator is bigger than my screen.i tried to resize emulator size bt could not do it.
plz help?
Answer: If starting from the command line you can add the switch "-scale 0.75" to scale the UI 75%. You can also use "-scale 96dpi" to get an interface that's pretty close to the actual size of a phone on most monitors.
If using Eclipse, you should be able to add the -scale switch as an additional emulator option, but it doesn't work. Try creating the AVD using a screen resolution of HVGA. This will fit on a 1024x768 monitor without problems.
Hope this helps.
Answer: To adjust the size of the Android Emulator from Eclipse, from the menu bar choose:

Run --> Run Configurations
Choose the "Target" tab and scroll down to the "Additional Emulator Command Line Options" box
In that box, you can put "-scale 0.75" or "-scale 96dpi"

Android emlator size problem


Should I tell interviewer about my sports activity in interview as my strength?

Question: Currently I am applying for job of an IT professional as a fresher.So I wanted to know if I can take my sports activities(I have played basketball at state level) as my strengths as I don't know how that'll be helpful for job I'm applying for.
Moreover I wanted to know what are the counter questions I should be prepared for.
Comment: In my view - sport should probably have trained your soft skills like team work and discipline. Please take this comment just as an opinion it really depends on the interviewer, position and many other factors. But I think you may need to explain how in your view basketball have helped you for the position you are applying (team play, discipline and so on). Still - make sure not to stress too much on it as you are applying for an IT job.
Comment: Maybe if the company has a basketball team in their social club, otherwise who cares?
Answer: I do believe that mentioning your participation in basketball may be beneficial to your application, this would be dependent on the position you're applying for, the company culture and the interviewer(s)' biases.
If you're applying for a position where you'd be functioning as part of a team, having played basketball (especially at a state level) would indicate that you're able to work, co-ordinate and function as part of a team.
Playing a competitive sport also indicates that you've got a go-getter attitude, would give the impression that you're not lazy and also that you lead an active and healthy lifestyle (people tend to associate sportsmen / women with physically healthy traits).
In terms of counter questions, you can expect something along the lines of:

How did you handle any losses?
Which position did you play?
Did you ever get into a physical altercation whilst playing?
Why did you stop playing?

The list could go on, but in all likeliness the interviewer(s) may not pay too much attention further than noting down that you'd played a sport.
Comment: Just be yourself, stay calm and know that playing at a state level is something to be proud of. I hope everything works out in your favour.
Comment: I'm applying as a fresher so kind of tensed about every cross question.
Answer:
I wanted to know what are the counter questions I should be prepared
  for.

If they ask you your strengths and you say something like "I have played basketball at state level", there are some obvious questions that could come up:

What about basketball qualifies you to be an IT professional?
How do you see your strength in basketball being an asset as an IT fresher?
Do you have any strengths directly related to IT?
Basketball is very physical, where this IT position is not. How will you deal with that?

Be prepared to show a direct connection between whatever you learned playing basketball and whatever you imagine you'll need to do in IT.
Frankly, I think there is at best a very weak connection. But if you choose to go this route, make sure you can clearly articulate the connection and why it makes you more qualified for this IT position over those who didn't play basketball.
And hopefully basketball isn't the only strength you mention, nor the most important.
Comment: This is a great answer. I could also add that, as an interviewer, when asking about strengths for the job, and receiving an answer about sports, my outer response would be "Ok, interesting, tell me how that applies to IT." But my inner response would be, "That's all you could come up with?" Unless elsewhere in the interview you can show me you're qualified for the job, the sports mention, with nothing else, would actually hurt your chances.
Answer: Most definitely, yes. I mention my sport(I do martial arts and compete at highest amateur level) in interviews for two reasons: first, competing in any sport at elite, senior level shows you are committed to goals, you are efficient with your time and you are, well, a winner. Plus, soft skills - as mentioned in a comment here - would be a positive point at least in team sports.
If you plan on competing during your potentially new job, it's also important to mention depending on the sport. I straight up asked if they had a problem with me turning up Monday morning with a black eye. Not that it'll happen every Monday morning, but as I compete on weekends, it is a possibility(albeit surprisingly small, compared to what people think about martial arts). This is to eliminate any surprises from either side. With basketball, the probability of getting hurt - i am guessing - is quite smaller, but still a higher risk than if they hired a couch potato whose physical activity is non-existent, right?
IT/Software is in my mind 80% mentality: If you aren't persistent and keep going, you are not going to do well in the IT/Software industry. Having a competitive mindset from sports would be a plus if I were to hire someone.
So TL;DR: It's good for two reasons. 1.) Showcasing your commitment and soft skills. And 2.) Managing expectations if you choose to do the sport while working.
Comment: Basketball - you wouldn't want  your face to connect with a jumper's flying elbow as they are going back down to Earth. Basketball has its (small) share of fatalities. Martial arts is safer - just don't engage in professional boxing.
Comment: Pro boxing/mma, I agree, but I'm an amateur boxer and in competition we don't use head guards either. Gloves are larger than in pro boxing, thus safer, but black eyes and cuts from head clashes is fairly normal
Comment: In terms of rate of fatalities, MMA is safer than basketball, and basketball in turn is safer than pro boxing. It's all about rules and I understand that MMA has the stiffest rules of engagement of any contact sport. Plus, those who engage their MMA have conditioned their bodies to take punishment. It's possible yoga is less safe than MMA - after all, you have people who don't condition themselves launching themselves into all sorts of intricate positions :)
Comment: I get your point. Also MMA fights are usually stopped quite fast due to the smaller gloves(solid punch=you're going down), whereas boxing can go on forever. Anyhow. We're on a different track here :)
Comment: +1 for informing them of active involvement and the potential to clash with work expectations. In my case it was the chance of short-notice unavailability for a week, but I took almost zero other time off, so they were okay to accommodate.
Comment: @Njj somewhat the same here, I just informed them that I'd use vacation days on fridays and mondays for long weekends, to go to events and participate. I knew some weeks in advance so it wasn't an issue, but it's always good to align expectations of such things.
Answer: "Being good at basketball" is highly unlikely to be perceived as a strength that they are interested in. Instead, it shows that you are a well-rounded individual, and it can provide evidence of more relevant strengths.
I work in IT, and have found that interviews often start with a question such as "Tell us about yourself". This is an ideal opportunity to mention the basketball, provided that it is not the only thing you talk about - you need to make sure that your interest in IT takes centre stage.
The relevant strengths might include team work, dealing with pressure, and determination. If you get a direct question on any of these topics, you can refer to your basketball experience as evidence. If you get asked what your strengths are, then you can pick one of these, again based on your basketball experience. Try to use a range of examples over the course of the interview though - if you only talk about basketball then you start to look a bit one-dimensional.


Unmanaged Packages

Question: I have an assignment to check pros & cons of managed and unmanaged packages. It's the first time i get into this part. I investigated pros & cons and in my dev org i created an unmanaged package. Then, i uploaded it. Afterwards, from another dev org i went there and installed the package i just created. It doesn't contain something special, just 1 custom object. The problem is that, it it showing in number of objects: 0. And when i drill down to the object, it redirects me to Object Manager. Is this logical ? I feel that maybe i do something wrong.
Comment: I'd suggest an [edit] here as you have two different questions in one (the # of objects in package, metadata migration). Question #2 is also pretty open-ended and a little opinion-based as there's no "best" solution given we don't know your org specifics. You may want to remove question 2 and ask it with more focus as a separate question.
Answer: The benefit of managed packages is that they can be upgraded. You can add new content to them, and those changes can be applied with a simple update. The downside to managed packages is that they have restrictions on deleting metadata from them, so it becomes very important to design your application beforehand, lest you end up with lots of stuff you can't delete. Some care also needs to be taken to not accidentally link the package to another package or unwanted metadata for the same reason. It's nearly impossible to fix these mistakes.
Unmanaged packages can be freely modified, even after installation (e.g. someone an install your package, then delete a field). The downside is that you cannot upgrade those packages. They must be fully uninstalled and reinstalled to apply a new version. This is problematic in many cases, as you need to make sure that you have all the metadata you need in one shot, and making changes is easy, but non-trivial to fix in orgs where the package is installed.
You may want to look at Unlocked Packages. They have the editability of unmanaged packages, and the upgradeability of managed packages. This would require moving to DX, which is not terribly difficult, but will take a little bit of time.
Everything is migrating to Lightning, so I'm not surprised that clicking on the object name takes you to Object Manager. The "zero objects" bit may just a bug of some sort. There's clearly one object in the package.

Unmanaged Packages


Hausdorff and non-discrete topology on $\mathbb{Z}$

Question: Construct a topology $\mathfrak{T}$ on $\mathbb{Z}$ such that $\mathbb{Z}$ is Hausdorff and non-discrete with respect to $\mathfrak{T}$.
$\textbf{My idea}$ : We know that $\mathbb{Q}$ is Hausdorff and non-discrete with respect to the topology inherited from $\mathbb{R}$. So we should use this fact in a following way.
Let $\pi:\mathbb{Q}\to\mathbb{Z}$ be any $\textit{onto}$ function. We define a topology $\mathfrak{T}$ on $\mathbb{Z}$ such that $U\subset\mathbb{Z}$ is open in $\mathbb{Z}$ if and only if $\pi^{-1}(U)$ is open in $\mathbb{Q}$. In other words, we define the largest topology on $\mathbb{Z}$ such that $\pi$ becomes continuous. Now it is a matter of choosing an appropriate onto map $\pi$. I am having a difficulty in choosing such $\pi$.
I have tried the integer part function as $\pi$, and the resultant topology $\mathfrak{T}$ on $\mathbb{Z}$ is indeed $\textit{non-discrete}$ but the $\textit{Hausdorffness}$ is not clear. Can anyone please suggest me some other functions as $\pi$ ? Also I would be really grateful if someone suggests me an entire new way to define a topology $\mathfrak{T}$ on $\mathbb{Z}$.
Comment: Consider the [evenly spaced integer topology](https://en.wikipedia.org/wiki/Evenly_spaced_integer_topology)
Comment: Any bijective $\pi$ will do. For a different example let $f:\Bbb Z\to S=\{0\}\cup \{1/n: n\in \Bbb N\}$ be a bijection and let $A$ be open iff $f[A]=\{f(x):x\in A\}$ is open in $S.$
Answer: Perhaps the simplest solution is to let $\tau$ be the topology on $\Bbb Z$ generated by the following base:
$$\big\{\{n\}:n\in\Bbb Z\setminus\{0\}\big\}\cup\{\cup(\leftarrow,-n]\cup\{0\}\cup[m,\to):n,m\in\Bbb Z^+\}\;.$$
That is, each point of $\Bbb Z\setminus\{0\}$ is isolated, and nbhds of $0$ contain a tail of the positive integers and a tail of the negative integers.
For your original idea I'd not even bother with an explicit $\pi$: $\Bbb Q$ is countably infinite, so there is a bijection between it and $\Bbb Z$, and you can use that to define a topology on $\Bbb Z$ making it homeomorphic to $\Bbb Q$. That's sufficient unless you absolutely need an explicit description of the topology on $\Bbb Z$.
Answer: I'm really beginning with topology so if I make any mistakes please correct me.
A  general surjective map $\pi \colon \mathbb{Q} \to \mathbb{Z}$ will not guarantee that the obtained topology is Hausdorff.
The map $\pi \colon \mathbb{Q} \to \mathbb{Z}$ is the integer part map if given $q \in \mathbb{Q}$, $\pi(q) = [q]$ where $q - 1 < [q] \leq q$ and $[q] \in \mathbb{Z}$.
Given $z \in \mathbb{Z}$, $\pi^{-1}(z) = [z,z+1) \cap \mathbb{Q}$. If $A \subset \mathbb{Z}$ is a subset, we know that $\pi^{-1}(A) = \cup_{a \in A}\pi^{-1}(a) =$ $\cup_{a \in A} [a , a+1) \cap \mathbb{Q}$ and so $\pi^{-1}(A)$ is open if, and only if, $\cup_{a \in A} [a , a+1) \cap \mathbb{Q}$ is open in $\mathbb{Q}$ with the induced topology from $\mathbb{R}$.
If the set $A$ is a finite set, then it has a minimal element $\alpha$, and as it is minimal in $A$, for sure it will be minimal in $\cup_{a \in A} [a , a+1)$, hence $\cup_{a \in A} [a , a+1)$ is not open, so $\pi^{-1}(A)$ is not open which implies $A$ not open in $\mathbb{Z}$.
If $A$ in infinite, then it is open if, and only if, all the elements of $A$ are consecutive numbers, cause if there are $a,b \in A$ such that $a < b$ and $a \neq b-1$, then $b$ is a problematic point for the openess of $\cup_{a \in A} [a , a+1)$, as the ball $B(b; \frac12)$ is not contained in the set. Hence, all the elements must be consecutives, so $A$ is infinite and not lower bounded.
We can conclude, then, that the topology you're looking at is $\tau = \{A \subset \mathbb{Z} \mid \exists z \in \mathbb{Z}, A = (-\infty, z) \cap \mathbb{Z}\}$.
Answer: It seems to me the simplest solution is to find a countable space $X$ that is Hausdorff and non-discrete, and then endow a topology on $\mathbb{Z}$ through a bijection with $X$.
Explicitly: suppose $X$ is countable and Hausdorff and non-discrete. Let $\varphi: \mathbb{Z}\rightarrow X$ be a bijection. Define a topology on $\mathbb{Z}$ by
$$\text{A set }\mathcal{U}\subseteq\mathbb{Z}\text{ is open } \iff \phi(\mathcal{U}) \text{ is open in }X.$$
You can readily check that this defines a topology $\tau$ on $\mathbb{Z}$ such that $(\mathbb{Z},\tau)$ is homeomorphic to $X$. In particular, $(\mathbb{Z},\tau)$ is Hausdorff and non-discrete.
Now the problem is reduced to finding a space $X$ that's countable and Hausdorff and non-discrete. And you already stated $\mathbb{Q}$ is one such space. Another easy example is a $\{0\}\cup\{\frac{1}{n}\}_n$ with the subspace topology inherited from $\mathbb{R}$.


Identifying products

Question: How to determine the major and minor products in a reaction? What factors are useful to do so?
For ex: Nitration of phenols, gives the ortho nitro phenol as the the major product and para nitro phenol as the minor, while Nitrosation of phenols give para nitroso phenol as the major product and ortho nitriso phenol.
Comment: This is a very broad question as the major product of a reaction may depend upon multiple factors each different for each reaction.
Comment: It is almost like asking *How to learn organic chemistry from a 1 page answer ?* The  right answer is even shorter: *Study many textbooks, books and articles and gain years of experience in chemistry.* // I guess the 80-20 rule is applicable even here: Understanding 80% of cases takes 20% of effort.
Comment: You won't know until you run the reaction. You may be able to predict the likely course of the reaction based on pre-existing literature and you may be wrong.
Answer: The main factors used to determine the major and minor products are:

Stability of products
Kinetics of the reaction
Reaction conditions
Catalyst used , etc.

I just gave out a few examples but, there are hundreds of other factors which you can only learn by practice.

Identifying products


If an animagus witch or wizard loses their magic through emotional stress will they still be able to transform?

Question: In the world of Harry Potter: If a witch or wizard, who is an animagus loses their magic through emotional stress (like Ariana Dumbledore or Merope Gaunt) will they still be able to transform? And if so does that technically mean a Squib could become an animagus?
Answer: I'm going to say no. Given the magic used to become an animagus is very complex, it took James and Sirius 3 years to learn how to do it.

'Yes, indeed,' said Lupin. 'It took them the best part of three years to work out how to do it. Your father and Sirius here were the cleverest students in the school, and lucky they were, because the Animagus transformation can go horribly wrong
Harry Potter and the Prisoner of Azkaban | Chapter 18 – Moony, Wormtail, Padfoot and Prongs
Comment: Animagus transformations may be complex, but Sirius and Lupin were able to "force" Peter to "untransform". I am guessing the spell they used might've been something that "stresses" the wizard into letting go of the transformation.
Comment: @Arcane there are counter-spells of various types though, I don't see this as special for animagus
Answer: I agree that a witch or wizard who lost magic would be unable to transform into an animagus. However, i don't think either of the examples you gave actually demonstrate a loss of ability to do magic completely.
Ariana was attacked by muggles, and driven mad. Aberforth explains in Deathly Hallows that

"It destroyed her, what they did: She was never right agin. she
  wouldn't use magic, but she couldn't get rid of it; it turned inward
  and drove her mad, it exploded out of her when she couldn't control
  it, and at times she was strange and dangerous."

Merope is shown as choosing to not do magic. In Harry Potter and the Half-Blood Prince, Dumbledore says

...it is my belief -- I am guessing again, but I am sure I am right
  -- that when her husband abandoned her, Merope stopped using magic. I do not think that she wanted to be a witch any longer. Of course, it
  is also possible that her unrequited love and the attendant despair
  sapped her of her powers; that can happen.

Emotional stress appears to cause problems with spell casting, so it is highly unlikely that someone who is not fully in control of their powers could do an animagus transformation. As ATB points out, it is quite difficult and dangerous.  Harry was unable to conjure a patronus while he wore the locket in Deathly Hallows, something he was normally known for being quite good at.

"Shut up, Ron, " snapped Hermione.  "Harry, what happened? Why do you
  think you couldn't make your Patronus? You managed perfectly
  yesterday!" ... "Of course! cried Hermione, clapping a hand to her
  forehead and startling them both into silence. "Harry, give me the
  locket!"
Answer: Animagi cannot transform in that state.
When Sirius explained how he was able to avoid losing his mind in Azkaban, he said that the knowledge he was innocent helped him keep his powers, so that when the effects of Azkaban became too much, he was able to become a dog in his cell.

"I think the only reason I never lost my mind is that I knew I was innocent. That wasn't a happy thought, so the Dementors couldn't suck it out of me … but it kept me sane and knowing who I am … helped me keep my powers … so when it all became … too much … I could transform in my cell … become a dog. Dementors can't see, you know …' He swallowed. 'They feel their way towards people by sensing their emotions … they could tell that my feelings were less – less human, less complex when I was a dog … but they thought, of course, that I was losing my mind like everyone else in there, so it didn't trouble them." - Harry Potter and the Prisoner of Azkaban, Chapter 19 (The Servant of Lord Voldemort)

This implies that if Sirius had not been able to keep his powers in Azkaban, he would have been unable to transform, since he clearly links the ability to retain his powers with the ability to transform.