Why are user input dates losing a day? (But not when run locally?)

Question: First, I hope this is the right place for this question. Because I believe this to be a server configuration problem, I wasn't sure if this should go on serverfault.
So we have a spring-mvc webapp running on Tomcat servers and connected to an Oracle database. On one of these pages is a form for the user to fill out where they can enter a set of dates. When I or another developer run the webapp locally on our own machines for testing (still connecting to an external Oracle instance), we have no problems. But now that the webapp has been deployed to two different external Tomcat servers we've noticed problems with the dates.
Somewhere between when the data is submitted from the page (verified using Firefox's TamperData plugin) to the controller and when it is inserted into the database, all of these user inputted dates lose one day. For example, entering 09/02/2010 gets inserted into the table as 09/01/2010. If we submit 09/01/2010, it is inserted as 08/31/2010. These user dates are never explicitly modified in our code.
Those date fields in our spring entity beans are annotated with the following :
@Temporal(value = TemporalType.DATE)
@Column(name = "START_DATE", nullable = false, length = 7)
@DateTimeFormat(pattern="MM/dd/yyyy")

Also, at some point during the data processing. we set up a field with the current date:
obj.setActivityDate(new Date());

Those activity dates are unaltered and always come through with the correct date when we check the database.
Like I said, we're unable to reproduce this error when we run the app locally, so we (want to) believe the problem is with one of the other Tomcat servers that we have deployed to. Has anyone ever run into a problem like this before, or do you have any ideas of what could be causing it?
UPDATE:
So I took the timezone hints and it sent us off in the right direction, but we're still not there yet. I went into my entity bean, changed the field from java.util.Date to a jodaTime DateTime object, like this:
@Column(name = "START_DATE", nullable = false, length = 7)
@DateTimeFormat(pattern="MM/dd/yyyy")
@Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
private DateTime startDate;

After making adjustments to handle the new type, I ran some more tests and we can now see that the date 09/01/2010 is being inserted into the database as 08/31/2010 8:00:00 pm. I think that the TemporalType=DATE may have been forcing a truncation somewhere along the line, which is why we didn't see the timestamp before. Here are the timezone settings that I know of (our office is in Virgina, US-Eastern):

Tomcat is launched with the timezone set to EST5EDT.
The linux servers that host Tomcat are set to EST.
The linux server that hosts the Oracle instance is set to EST.
The Oracle database timezone is set to UTC (+00:00)
The timezones for the user sessions in Oracle are (currently) set to -04:00.

If this was all there was to it, then I could understand why a user input date (with no explicit time zone) would be translated in the database as -04:00. But we still cannot reproduce the problem locally on our own machines (Windows 7 and Fedora, both set to US/Eastern). I've tried manipulating dates to force a time zone, but it always comes through as 8:00pm. Here is the log output from two separate runs:
Storing date startDate: 2010-09-01T00:00:00.000

Storing date startDate: 2010-09-01T00:00:00.000-04:00

Each of those dates went from Tomcat (with Spring/Hibernate) into the database as 08/31/2010 8:00PM when run on the external Tomcat servers, but inserted as 09/01/2010 12:00AM when run locally. The only good thing to come out of this so far is that the dates are re-translated when pulled from the database and displayed to the user on the screen, so that it matches what they originally typed in.
In order to be able to develop consistently, we need to know what setting we could be missing on our local machines that is avoiding this problem. We're currently using Tomcat 6.0.20, bundled with NetBeans to run locally.
Comment: @BalusC Wow, that's a great question (immediately favorited). Thanks.
Comment: Lot of hints here: http://stackoverflow.com/questions/2532729/daylight-saving-time-and-timezone-best-practices
Answer: As an idea:
Something to do with time zones. You submit a datetime value with one timezone information, the database is configured to use another timezone so it's converting your dates on-the-fly.
A few hours can already make a difference. You insert a 09/01/2010 01:55, it can easily become 08/31/2010 23:55.


So what do we use instead of PartitionMagic now that Symantec's killed it?

Question: Apparently, since the last time I had to do a lot of playing with partitions and images, Symantec acquired, neglected, and killed off PartitionMagic.  (Yeah, it's been a while.)  What, then, are we meant to use instead, that gives us that general behavior of actually doing what it's goddamned supposed to that PartitionMagic so nobly displayed?
Comment: How things have changed. These days I'd vote to close this in the blink of an eye.
Answer: There are quite a few alternatives, both commercial and Open Source. One of the more popular OS programs is GParted.
Comment: I find the gparted live CD invaluable on that front.
Comment: +1 Easy to use and free, though even Windows in its latest incarnations can finally handle most partition resize jobs just fine. Also, as Partition Magic seriously required a working backup, I always found it more efficient to just wipe and reload a machine instead anyway.
Comment: Windows can resize a partition from the end only, it cannot move a partition, or shrink it from the beginning. gparted can!
Answer: My vote is for Gparted also.  I have a USB stick as an Ubuntu 10.04 boot disk.  Gparted let's you move and resize NTFS partitions, which is especially handy when managing windows boxes :)
Answer: Acronis Disk Director suite
Paragon Partition Manager
Answer: There is also a gparted Live CD
Answer: There are a number of programs that do this, some of them have been mentioned already. If you're interested in something that also offers a compliment of other tools in addition to several partition managers you might try MultiBoot USB.
Answer: While I myself voted for GParted, there is also EASEUS Partition Master Home Edition (Sure, not for business).
I`v been doing job with that soft, but once some errors occured (nothing was corrupt, but couldn't finish the job), I tried GParted to do the same and it succeeded.


Problem with colors of camstudio recorded video

Question: I am using windows 7 and try to capture a video of my screen using camstudio 2.7. I am using camstudio lossless codec v1.5. The problem is that colors in my recorded video are inverted somehow. For example blue color is red. How I can repair this. I want just normal screen video.
Answer: You might want to check the recording setting, maybe a non-standard color space is being used or the video is simply being interpreted falsely by your video player.
Try to play it with a different player.
If thats not the issue you should double check the record setting you are using for this codec or maybe change the codec you are recording with.


Magento2 module activation license

Question: I want to add license to magento2 modules.
I am magento2 developer. i want to set license to my modules for free or sell. but don't know how can i add domain license to my modules.
Want to set domain license mean that when some one wants to buy or download my module, should give me his domain to activate the module.
Anybody can help me?
Answer: The is a broad topic and not all your logic for licensing and key validation needs to be written in magento.  Especially if you are going to have a licensing domain that validates keys and enables uninterrupted use of your extensions.
Something like this might get you started
https://stackoverflow.com/questions/16213566/check-if-a-generated-license-is-valid
However this is just to get you started.
My best advice though is to nag users into getting a key.  Display prompts about licence key not being valid on frontend or within admin.  Don't start disabling extensions or adding logic which negatively affects functionality.

Magento2 module activation license


Save a test suite as a single file in Selenium

Question: Is it possible to save a test suite as a single file as opposed to a group of files when using Selenium? Normally the test suite file is just a list of links to the test case files; I'm wondering if it is possible to store the test cases within the test suite file itself.
Comment: I wish it was too. UI in Selenium IDE is fairly unforgiving and clunky.
Answer: I don't know if it's possible, you could always just copy and paste the source of a number of files into one huge file.
However, if you have a site of any decent size, it's much better to have your tests in many separate files, broken out by function or site areas.
I create a single test file for each major functional part of the site, and sometimes even break those down into smaller pieces.
One advantage of this is that you can test just a specific portion of a site, instead of having to run a test on the entire site, so you can check your test code in small sections.
It's also tons easier to scroll through a few hundred lines of selenium code to check errors in one specific section of the site than it would be to have to scroll through thousands of lines of code to track down the errors.
And unless you're very diligent in commenting the code, it can be difficult to backtrack and figure out what page or specific function experienced the error.


Found these bugs in bed, not sure what they are?

Question: I found these bugs in the morning, my dogs bed is on our bed and he has a lot more in his bed than ours. He does not have any on his body so I decided to exclude fleas. They look like pieces of lint but they move slowly and can not really see the legs. What could these be?
Comment: Ensure all the bedding gets washed in hot water and thoroughly dried on hot as well. The heat will kill everything. If you have carpet, ensure you vacuum often to collect any that have made it to the floor (sweep often if you have bare floors) and empty the bin every time or replace the bag often. The dog may need to see a to remove any embedded ticks and a bath (possibly more than one) to remove any loose insects. Also treat carpets with Diatomaceous earth, which is just a ground up rock, but has abrasive and physico-sorptive properties (https://en.wikipedia.org/wiki/Diatomaceous_earth)
Answer: This is almost certainly a tick of some sort. Which tick it is, is hard to say without a close (macro) photo and knowing where in the world you are.
If you have found a number of them on bedding, it is highly likely that they have been on him for a while and finished their blood meal and are now looking for a place to either progress to a new stage in their life-cycle or to lay eggs.
Ticks are also really really good at hiding and often seek out crevices on the body (e.g. armpits, groin) and sometimes even inside noses or ears. These are pretty hard places to search and the early life-cycle stages of ticks are tiny and pale (<2 mm and skin coloured), so they can be really hard to detect.
You can get over-the-counter tick treatments from most veterinary stores.
Comment: agreed, looks like a bloated tick to me.
Comment: I don't believe this is "almost certainly a tick". It "could" be, but calling it that because you don't know what else it could be, is NOT helpful. Most of us know what ticks look like. No legs are visible whatsoever in this photo (or mouthparts, though the photo is admittedly blurry). My dog is currently dealing with something that looks very similar, shiny and nearly round, but black. They have legs *underneath* them like beetles, bite, and occasionally jump a short distance when disturbed. Ticks don't jump. Nothing in this photo shows scale, but the bugs on my dog are TINY… less than half t


salary negotiation after verbal acceptance of job offer

Question: I have verbally given acceptance to an offer which I think is a very low for me.Since this is my first job change and I like the current position in the company ,I said yes.The HR reverted back with background check form and said that after the check the offer will be given in writing.
Is it too late to say I want a better offer.Should I fill the background verification form and wait and say I want to reconsider when they give the final offer in writing? .
I don't want to blow them off,but I think I could do better
Answer: You are quite late in the game for salary negotiation in my opinion. If you accepted their offer, even verbally, they set aside certain amount of funds to sustain your existence in the company. Now, on the 11th hour, you come back with a counter offer, you had better have a very good leverage that makes them not being able to live without you. Since you mentioned first job change, I am assuming you are in the junior stage of your career. So, this company not being able live without you is not a likely scenario. So, tread the waters carefully at this stage.
Having said all this, you can go back to them, before handing them the background check forms and say something like:

After our last talk when we discussed my compensation, I did a little bit more investigation and found out that, this salary (or hourly rate
  if you are being hired on contract basis) is significantly lower than
  the industry average in this area. If we can not come to a mutually
  agreeable compensation, I will not be able to work for your
  organization

And leave the ball in their court. If they come back with a better offer, or ask you how much you expect, you can tell them what you want, in a tactful way, by supporting it with data obtained from a reputable source (glassdoor.com for instance in US; since I don't know your location). But at this stage, be prepared to be dismissed from the hiring process and probably not being able to work for this company, as long as the HR and the hiring manager is at their same position.
Your choice.
Answer:
Should I fill the background verification form and wait and say I want to reconsider when they give the final offer in writing?

I'd tell them before that, nothing is set in stone so long as it's just a verbal acceptance. Be prepared not to get an offer at all though because normally you would have already negotiated before accepting even verbally.
Judgement call on your part, how badly do you need the job versus how badly do you want more money. If you're only going to try and negotiate a small increase it might not be worth the risk. If you want a substantial increase then it might be, because not only will you start off with more pay, but future negotiations will be about more as well. People who start a job with low pay tend to stay under the average until they leave that company. Because quite often raises are done as percentages.


Could Jon have been made ruler of Dragonstone?

Question: Jon Snow from Game of Thrones is a Targaryen. Does that mean he's the actual ruler of Dragonstone now? Could Jon have been made ruler of Dragonstone due to his heritage?
Comment: That's...alotta woulds 'n coulds, which might be what causes the "primarily opinion-based" close-votes. I guess the question for his claim to Dragonstone is a genuine question about the rules of the *GoT* universe, but you're using quite a few what-ifs to reach it. Maybe you can concentrate on the core aspect a little more?
Comment: ok ill edit my question accordingly
Answer: Basically, yes.
But not as a Targaryen.
As a rewards for his services.
It is customary at the end of a war to do the Title Dance.
Enemies are stripped from title, land and castles (if let alive at all), while allies and important persons (Sir Bronn of the Blackwater for example) are given titles, land and castle that are currently available, either because the family died in war (Tarly house for example, in fact the all reach is mentioned in the show to be available, and of course, Harrenhal the hot potato), or because it was stripped from enemies.
So he can get any Castle he wants as long as he asks nicely.
Answer: Could Jon have been made ruler of Dragonstone?

Before S08E06, he could have asked Dany for Dragonstone, and she probably would have granted his request.

Isn't he the actual rule of Dragonstone now (in exile)?
If Dragonstone is passed to the heir by birth, then yes - Jon is the last remaining Targaryen, so he would inherit Dragonstone.
But - as you say, he is in exile. So as a member of the Night's Watch, he is unable to inherit property at all.
Comment: @Kepotx Prince of Dragonstone is a traditional title for the heir to the throne.  So yes, it would acknowledge his birth, but it would also clearly demonstrate that he was lower in the line of succession than Dany.
Comment: "she probably would have granted his request." Making him ruler of dragonstone would mean Jon is a Targaryen, I doubt Dany would do this.


iOS segue executed twice

Question: I have a table view with different types of table view cells in it. In one of the cells, there are two buttons, which load a view controller when pressed. I am using the following function to handle the button press:
<code>- (IBAction)leftButtonPressed:(id)sender
{
    // Getting the pressed button
    UIButton *button = (UIButton*)sender;
    // Getting the indexpath
    NSIndexPath *indPath = [NSIndexPath indexPathForRow:button.tag inSection:0];
    // Loading the proper data from my datasource
    NSArray *clickedEvent = [[[SOEventManager sharedEventManager] eventsArray] objectAtIndex:indPath.row];
    [[SOEventManager sharedEventManager] setSelectedEvent:clickedEvent[0]];
    // Everything working as it should up to this point
    // Performing seque...
    [self performSegueWithIdentifier:@"buttonSegue" sender:self];
}
</code>
My buttonSegue is supposed to push a new view controller. Somehow instead of pushing once, it appears to be pushing twice, so I get the following warning:
<code>2013-11-27 01:48:30.894 Self-Ordering App[2081:70b] nested push animation can result in corrupted navigation bar
2013-11-27 01:48:31.570 Self-Ordering App[2081:70b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
</code>
In my case it leads to a crash, since there is an event in which I want the app to immediately pop the view controller so it an go back to my table view. I use an alertview for this and handle the event with the following:
<code>- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    NSString *buttonTitle = [alertView buttonTitleAtIndex:buttonIndex];
    // ...
    // Additional checking of button titles....
    else if ([buttonTitle isEqualToString:NSLocalizedString(@"Vissza", nil)])
    {
        [self.navigationController popViewControllerAnimated:YES];
    }
}
</code>
It might me interesting to note that I have an other segue from my "regular" table view cell, and in that case I use the prepareForSegue: method
<code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"detailSegue"])
    {
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        SOEvent *selectedEvent = [[[SOEventManager sharedEventManager] eventsArray] objectAtIndex:indexPath.row];
        [[SOEventManager sharedEventManager] setSelectedEvent:selectedEvent];
    }
}
</code>
In this case the view controller gets pushed perfectly, and even popped immediately if that is required. I am testing this on iOS7 and Xcode 5. I haven't encountered a problem like this before, any help would be greatly appreciated.
Comment: are you sure you've wired up the actions correctly in interface builder? maybe you've wired the event for, say, both touch up inside and touch down inside instead of just touch up inside. or maybe you've also assigned the segue from both code and again in interface builder. have you checked them? it's a common mistake.
Comment: Oh damn.. You are actually right, I assign my buttons also in the table view datasource methods.. Thank you for your answer!
Answer: Maybe you want to wire up your segues with View Controllers instead of UIButtons!
You should probably have the segues wired with some button like this:

But you should wire them with the view controllers instead:
Comment: This worked for me! (Swift 4, Xcode 9). Not sure why this is not emphasized more! Using a delegate, if the segue was wired between a button (in a table cell), it would always fire, and my delegate would be executed afterward. Wired to the cell view, this does not happen, so my manual call to do the segue works as planned.
Answer: Answer by can poyrazoğlu:

are you sure you've wired up the actions correctly in interface
  builder? maybe you've wired the event for, say, both touch up inside
  and touch down inside instead of just touch up inside. or maybe you've
  also assigned the segue from both code and again in interface builder.
  have you checked them? it's a common mistake. –

I was assigning the touch up inside actions for each button both the storyboard and my tableview's datasource methods.
Thank you for your quick help can poyrazoğlu!!
Comment: I was loading the new view controller 2x also. I connected the segue from the view controller instead of the tableview cell and this solved the problem.
Comment: oh, I didn't really think about table view, but glad to see it helped. you are welcome :)
Answer: For Swift 3, xcode, and ios 9+, which is what I am using: Make sure you are drawing segue from your UIViewControllers and not buttons or other interfaces.
I had the same problem, and simply changing the start of the segue from the UIController instead of the button removed this bug.
Answer: I always get this issue when I have my buttons directly wired up to the destination view controller. You need to make sure that you first delete the old segue you made, then click on the present view controller (where you are coming from) and CTRL + click to destination controller.
This should fix it :)

iOS segue executed twice


Operation and Control of EOD Bot

Question: Are there any other controls for the EOD bot, other than the forward/left/right/back for movement and left mouse button for using the torch?  It seems like there might be a way to raise or lower the torch, and to arm an MCOM is it just LMB click?
Answer: The "interact" button (default E) can be used to arm MCOMs with the EOD bot.
The repair tool (fire key, default Left Mouse) can repair friendly vehicles, damage enemy vehicles, and also disarm/dispose of enemy explosives, such as C4.  It can also kill, just like the normal repair tool, although getting close enough to do so can be tricky.
You can "aim" the repair torch to an extent by moving your mouse, but there's no control for moving the torch arm around any more than that.
Comment: EOD bots can spot enemies as of the latest patch as well, that is worth mentioning.
Comment: Also, a little known fact to make the EOD bot more controllable, you can go into third person view using the normal button for vehicles. (this was not obvious to my circle of friends)
Comment: Cool, thanks for a quick answer.  I've been driving it around quit a bit and have also cut fences with it, and exploded a fuel tanker.  I've capped flags with it, but never armed an MCOM yet.  I've heard you can have a teammate strap some C4 to it and drive it up to vehicles or people and detonate it.

Operation and Control of EOD Bot


Calculate new columns from existing

Question: I have excel files with anywhere from 30-35 columns and 50-1500 rows of data depending on the company. The columns in question are as follows; USED REMAIN REFUND. These three columns are made up of calculations from other columns.
USED is each row of GAL added up as it goes along so the excel calculation looks like this: starts with one =W2, then the next row is W2+W3 then W3+W4 and so on
REMAIN is ASSIGNED-USED
REFUND is GAL*CREDIT
Would something like this even be possible, currently I'm doing all the calculations in excel which is time consuming and after some research I figure it would be easier to code something to automate this.
Grateful for any help even if its just the calculations for one column
I've looked for some ideas online and figure pandas is the best way of going about it, but if anything else is suggested I'm open to anything
import pandas as pd
filename = home/itdept/Documents/BestWines.xlsx
df = pd.read_excel(filename)
df['Refund'] = df['QUANTITY IN GAL']*df['CBMA Credit']
df.head(5)
df.to_excel("path to save")

This is what I came up with for the one column: Refund, I wasn't sure how/if I could incorporate all of the other columns in the code as well
Comment: Could you please clarify your post, by expecting how and from witch column computation should be performed. A minimal viable exemple will also be appreciated.
Answer: """importing packages to be used in our code"""
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile

"""importing excel content to df DataFrame"""
df = pd.read_excel('sflowone.xlsx', sheetname='Sheet1')

""" we will use LIST for updating (USED)column"""
newlist = []        # created empty list

x=int(0)            # created a variable which will take all values of "GAL"
for value in df["GAL"]: # FOR LOOP will run for every value in "GAL" and takes data in "value"
    x = value + x       # add all earliear entries of "GAL"
    newlist.append(x)   # here we append the new values of x inside empty list
df.drop("USED",axis=1,inplace= True)  # deleted the "USED" column if exist before updating.
df.insert(3,"USED",newlist)     # inserted updated "USED" column with newlist in index number "3"

"""Updating (REMAIN) and  (REFUND)"""
df ["REMAIN"]= df["ASSIGNED"]- df["USED"]
df ["REFUND"]= df["GAL"]* df["CREDIT"]

""" Visualising first 5 entries"""
df.head(5)
""" saving to Excel sheet """
df.to_excel("sflowfinal.xlsx")

"""CODE IS TESTED AND RUNNING, for query please reply"""

Answer: Consider Series.cumsum for cumulative sum:
df['USED'] = df['GAL'].cumsum()

From there, any basic arithmetic like subtraction and multiplications can be run directly on columns:
# SUBTRACTION
df['REMAIN'] = df['ASSIGNED'] - df['USED']

# MULTIPLICATION
df['REFUND'] = df['QUANTITY IN GAL'] * df['CBMA Credit']

Or their functional forms, sub, and mul (among other similar operators):
# SUBTRACTION
df['REMAIN'] = df['ASSIGNED'].sub(df['USED'])

# MULTIPLICATION
df['REFUND'] = df['QUANTITY IN GAL'].mul(df['CBMA Credit'])

Altogether, consider assign for one compact statement:
import pandas as pd

filename = "home/itdept/Documents/BestWines.xlsx"
df = (pd.read_excel(filename)
        .assign(USED = lambda x: x['GAL'].cumsum(),
                REMAIN = lambda x: x['ASSIGNED'].sub(x['USED']),
                REFUND = lambda x: x['QUANTITY IN GAL'].mul(x['CBMA Credit'])
               )
     )

df.head(5)
df.to_excel("path to save")

Calculate new columns from existing


The direction of friction

Question: How does friction change its direction? What I have learnt till now is that friction opposes the motion of an object. Please explain me the conept of applying friction in free body diagrams when there is relative motion of two objects.
Comment: Remember that Kinetic friction opposes **relative** motion
Comment: Instead of thinking of friction as opposing **motion** (or more correctly: **relative motion**, as @Kevin points out), then think of it as opposing **sliding**. It will always point in the direction that tries to prevent the two surfaces from sliding over one another. This is the case for both kinetic and static friction.
Answer: As you mentioned in your answer the definition of friction start and end with this statement 'friction opposes relative motion or seem to make relative motion' for understanding the friction in f.b.d (this example contain both static and kinetic friction.).
Let us take an example suppose you have this question
As i apply force on lower block with respect to ground ,block will move forward ,which make the friction active , friction start acting back ward.and with respect to upper also the block 1 move forward hence friction act backward,and according to newton third law every action there is equal and opposite reaction,when we write f.b.d for upper since it is moving relatively back with respect to lower hence friction act forward hence practicing more f.b.d you will able to analyse by yourself.
Answer: At an atomic level, friction represents the energy that is turned into heat as a result of overcoming very many very small attractions between the atoms/molecules of one object and the atoms/molecules of the other object. When one object is moving relative to the other, this heat energy reduces the kinetic energy of the moving object. In order to reduce kinetic energy then friction must always act in the opposite direction to the motion of one object relative to the other.
And Newton's Third Law tells us that if object A exerts a force on object B then object B exerts an equal and opposite force on object A.
Drag forces work (qualitatively) in the same way - a drag force is always in the opposite direction to the direction of motion relative to the surrounding gas or liquid.
Answer: Friction tries to oppose the relative motion between two bodies.
If the bodies are not in motion relative to one another then the frictional forces act in such directions so as to keep the bodies from moving relative to one another.
The diagram below shows two bodies moving at the same speed $v$ relative to the ground which is increasing with an acceleration $a$ due to an external force acting on body $1$.

The frictional forces are shown in the diagram with $F_{12}$ the frictional force on body $1$ due to body $2$ and $F_{21}$  the frictional force on body $2$ due to body $1$.
The two static frictional forces are a Newton third law pair being equal in magnitude and opposite in direction.
The equation of motion for body $2$, with left as the positive direction, is $F_{21} = m_2\,a$ and for body the equation of motion is $1$ $F-F_{12}= m_2\, a$
If the bodies are in motion relative to one another the frictional forces act in such directions so as to reduce the relative motion which will mean increasing the speed of one of the bodies whilst reducing the speed of the other body.
The diagram below is of two bodies moving at different speeds , $V$ and $v$, relative to the ground with $V>v$.

The frictional force $F_{12}$  on body $1$ due to body $2$ is reducing the speed $V$ of body $1$.
The frictional force $F_{21}$  on body $2$ due to body $1$ is increase the speed $v$ of body $2$.
The two dynamic/kinetic frictional forces are a Newton third law pair being equal in magnitude and opposite in direction.

The direction of friction


Is hands free masturbation worse or the same as with hands?

Question: I researched quite a lot into masturbation (not an imam or scholar) and my conclusion on it was makruh. I was wondering if it is worse to not use your hands e.g rubbing it on something.
I do not want to do something wrong.
Comment: The thing that is makruh - as you say - or even haram in Islam in this context is called استمناء or الاستمناء باليد which means making oneself ejaculat (or doing so using the hand) so it doesn't make any difference how you do it as long as you do it or the hand is somehow involved.
Comment: It is still استمناء.
Comment: I was asking if it is the same without hands e.g water
Comment: Thank you for answering
Answer: Allah made clear what is right (legal, halal, etc.) and what is wrong (illegal, haram etc.) in the qur'an. And for men or women the halal kinds of intercourse are mentioned too:

And they who guard their private parts (5)
Except from their wives or those their right hands possess, for indeed, they will not be blamed - (6)
But whoever seeks beyond that, then those are the transgressors (23:5-7)

The last verse already should show that anything beyond intercourse between husband and wife (from today's perspective, as slavery is regarded as no more -legally- existing) is haram and has the same level!
And if somebody thinks the rule above only applies for men, the qur'an includes other verses including women too:

...the men who guard their private parts and the women who do so, ... ([33:35])2

Therefore if we understand masturbation as haram or in best case frowned upon it doesn't matter how and with whatever tools you practice or perform it. The ruling or qualification of the act would be the same.


Bipartite graph with exactly one perfect matching.

Question: $\textbf{Problem:}$ Find all bipartite graphs $G[X,Y]$ satisfying the following properties:
$1.$ $|X|=|Y|$, where $|X|\ge 2$ and $|Y|\ge 2$.
$2.$ All vertices have degree three except for two vertices in $X$ and two vertices in $Y$, which have degree two.
$3.$ $G$ has exactly one perfect matching.
$\textbf{My approach:}$ By trying out some examples it seems fair enough to conjecture that there doesn't exist such a graph $G$. I haven't yet found a proof to the above conjecture, but for the sake of contradiction if I assume that there exists such a graph $G$, then it seems that the bipartiteness of $G$ along with property $1$ and $2$ would end up with $G$ having at least two distinct perfect matchings, a contradiction to property $3$.
There is a very close result to the above problem which states the following:

Let $G[X,Y]$ be a bipartite graph on $2n$ vertices in which all vertices have degree three except for one vertex in $X$ and one vertex in $Y$, which have degree two. Then $pm(G)\ge 2(4/3)^{n-1}$, where $pm(G)$ is the number of perfect matchings in $G$.

Is there any way to use this result to solve the above problem? Actually, even any kind of hint to proceed along my lines of approach would be of great help. Thanks!
Comment: Cross-posted: https://mathoverflow.net/q/401100/23297
Answer: It might help you.
See Gjergji Zaimi's response at MathOverflow and Hall's article


Function equal its integral implies zero function

Question: Let $f:\mathbb{R}\to \mathbb{R}$ be continuous such that
$$f(x) = \int_0^xf(s)ds $$
and $f(1) = 0$. Can we prove that $f=0$ without resorting to ODE solving techniques?
Comment: If you have a reason for " without using (whatever)", you should state it clearly *in the body of your question*. Otherwise, it just reads like "do it blindfolded, with your hands tied behind your back". And this site is about mathematics, not about stunts.
Comment: As is you'll get numerous answers just stating $f'=f\implies f(x)=ae^x$ then $a=0$. So maybe you should ask, can we prove $f=0$ without resorting to ODE solving, for instance using only mean value theorem, or without resorting to differentiation using only inequalities (e.g. $f$ continuous, let suppose $f\neq 0$ then $f(x)\ge M>0$ on $[a,b]$...).
Answer: Note that the differential equation you derived implied that $$ \frac{\partial}{\partial y}\left( f(x+y)f(x-y)\right)=f'(x+y)f(x-y)-f(x+y)f'(x-y) =0.$$
And hence that $$f(x+y)f(x-y) = g(x).$$
We can specify the function $g$ by letting $y = 0$ to get
$$f(x)^2 = g(x)$$
and hence
$$f(x+y)f(x-y) = f(x)^2.$$
now sub $x=y$ and note that $f(0) = 0$ to get that
$$f(x)^2 =0$$
Comment: Where is this coming from ?
Answer: Put $g(x) = |f(x)|$. Note that for $x \ge 0,$ we have
$$g(x) = |f(x)| = \left|\int_0^x f(s) {\rm d}s\right| \le \int_0^x |f(s)| {\rm d}s = \int_0^xg(s) {\rm d}s.$$
(The reason for assuming $x \ge 0$ is to have the integration in the "correct" order and not worry about extra modulus signs.)
Thus, we have
$$g(x) \le \int_0^x g(s) {\rm d}s.$$
Using Grönwall's inequality, we directly get the answer. I give a proof anyway.

Putting $G(x) := \displaystyle\int_0^x g(s) {\rm d}s,$ we see that $G'(x) \le G(x)$ or $G'(x) - G(x) \le 0.$ Also, note that $g \ge 0$ and thus, $G(x) \ge 0$ for $x \ge 0$.
Multiplying with $\exp\left(-\displaystyle\int_0^xG(t){\rm d}t\right),$ we see that
$$(G'(x) - G(x))\exp\left(-\displaystyle\int_0^xG(t){\rm d}t\right) \le 0$$
or that
$$\left(G(x)\exp\left(-\displaystyle\int_0^xG(t){\rm d}t\right)\right)' \le 0.$$
Thus, $$G(x)\exp\left(-\displaystyle\int_0^xG(t){\rm d}t\right)$$ is a decreasing function. However, note that the above is a nonnegative function which is $0$ at $x = 0$. Thus, we must have $G(x) = 0$ for all $x \ge 0$ and thus, $g = G' \equiv 0$ on $[0, \infty)$. A similar argument shows the same for $x < 0$ as well. Thus, we get $g \equiv 0$ or that $f \equiv 0$.
Answer: There is a straightforward way to get your result. You will have
$$
f(1)=\int_0^1f(s)ds=0.
$$
This identity can be solved taking for example $f(s)=Ce^s$ because the exponential has the property to be equal to its integral. Putting this in the above equation will yield $C=0$ and you are done.
Comment: This only proves that there is no solution of the form $Ce^s$ with $C\ne0$.
Comment: The other route is to say that this is an integral equation with the only solution $f(s)=0$.
Comment: Uniqueness is ruled out.
Comment: No, in the current OP's question, ODEs are ruled out.


Effective lagrangian in minisuperspace

Question: I am driving the paper (http://arxiv.org/abs/gr-qc/0412089) as part of my research project, i have some problems to obtain the effective Lagrangian for Einstein Hilbert action the eq.(4). If any one knows about this, please help me.
Answer: They begin with evaluating the Ricci scalar $R$ (2) using the metric given by the equation (1). Then they substitute it in the Einstein-Hilbert action with cosmological constant (3). The final step is integration over space coordinates $r^i$ and $\rho$ to obtain the Lagrangian analogous to the one in classical mechanics of two particles with coordinates $R(t)$ and $a(t)$ and highly non-trivial interaction between them. Is it OK?
Comment: Thanks. I followed this way but i can not obtain the exact form of terms. The shape is true but factors are different.

Effective lagrangian in minisuperspace


Why are combi airliners no longer being built?

Question: Why are combi airliners no longer being built?  Is the reason structural, economic or regulatory?
Comment: I guess it's economic: Now passenger volume is high enough to justify passenger-only aircraft. Also, previously only the big aircraft had the range for intercontinental routes, and passenger volume on thin routes was too low to justify a full DC-7C or DC-8 or Boeing 747 on them. Since smaller aircraft did not have the range, there were no aircraft available to serve those routes without adding cargo.
Comment: @PeterKämpf -- there are still routes thin enough to justify combis, usually in remote areas.  I suspect the problems of firefighting in large class B bays have more to do with the lack of new-build combis than any economic reason -- otherwise we'd be seeing replacements soon for the gravelkitted B732 combis flown in the Canadian Arctic.  (They're getting close to their cycle life...)
Comment: This seems only makes sense when you need a fraction of airplane worth of cargo or passengers. e.g. you have one flight per day and you want it to be split this single flight half and half between cargo and passenger. Most airlines operates dozens of flight per day per destination and don't need to split on the single flight level. Likewise nobody need a half-burger-half-sub meal because most people can eat a burger at noon while a sub in the evening.
Comment: I may be misunderstanding but even in full passengers configuration [airliners are able to transport cargo](http://aviation.stackexchange.com/q/8936/3394). Thus it may not be interesting to change the volume dedicated to passengers from flight to flight as it seems to be possible for combi, the airliners being able to transport both cargo and passengers.
Answer: While combi configurations are rare, they do have a place -- for instance, when operating narrowbodies into remote locations which have a demand for cargo that exceeds what can be put in the belly, but also need pax transport.
The most recent combi configuration I can find a source for is the 2008 work done by Aviation Traders to configure Iron Maiden's touring plane.  In this case, they used the existing seat rails to mount pallet fittings in order to avoid structural changes to the floor, and also are taking special steps (such as firebagging of cargo) to mitigate against a main deck cargo compartment fire.
As to why they aren't made otherwise?  It clearly isn't operating economics, at least for Alaska Airlines, Canadian North, First Air, and other current combi operators -- otherwise they'd have retired their combis by now.  The main issue, I strongly suspect, is actually the unsolved problem of fire suppression in large, main deck class B cargo compartments, such as those found on combi aircraft.  Aviation Traders' work on Class F is intended to solve this problem, made famous by the crash of SAA 295 after its main deck class B bay experienced a fire of unknown origin that proved catastrophic.
Answer: Combi aircrafts are basically modified airliners that carry passengers and/or cargo.
Though there are multiple reasons for not combi aircrafts not in use nowadays, the main reason is economic.

In case of mixed passenger/cargo operations, the cargo is usually one directional. The aircraft will be half empty in the return flight.
The conversion of passenger aircrafts involve some significant structural changes like cutting open a cargo loading door.

Source: www.airtransport.cc

Air cargo is highly seasonal, while the passenger traffic is not (Except for some spikes during festive occasions). It makes little economic sense to operate combi aircraft while passenger and cargo aircrafts can be operated separately more economically.
The conversion of he aircraft to carry cargo is not one of simply removing seats. it involves modification/installation of cargo handling systems, fire extinguishing systems etc. For example, air cargo pallets are standardized and cannot be transferred through cabin doors. The figure shows the work involved in the conversion of a Boeing 757

Source: staero.aero

The airline passenger traffic has grown enormously through th years, while the air cargo has not seen such robust growth. So it makes sense to concentrate on only a single sector.

Source: centreforaviation.com
The only places combi aircraft are used are those in which operating such aircraft is necessary. Simply put, combi aircrafts belong to another age of air transportation, while in the present (and near future), it makes more economic sense to operate specialized passenger and freight aircraft.
Answer: I think the term is being slightly misused :)
A combi aircraft is not a type of aircraft to be built, but rather an aircraft that is simply configured to transport both passengers and freight.
Alaska is an example of an airline that uses aircraft configured in this fashion.
One reason they aren't more widespread is that they inhibit economies of scale. They are more difficult to use effectively - you need a special purpose for them.
Comment: Yes, but the configuration usually involves special fittings. Different floors designed to handle pallets, cargo doors, that sort of thing.
Comment: @egid True, a significant investment perhaps. 'simply' is probably a bit strong of a qualifier.
Answer: In addition to the above answers:

Tightened cargo security since September 11. Comparing to cargo-only aircraft,
the cargo on passenger aircraft or combi aircraft must be restricted and limited.
Airfreight charge was kept lower due to big competition in the market.
Passenger business might be more profitable in using aircraft space.


Unix: Is there a way to "copy" file or directory permissions?

Question: I have two files in a directory. One has correct permissions and the other has not. Is there a way I can "copy" the set of permissions from one file to another?
Answer: The GNU version of the chmod utility can copy the mode from one file (RFile) to another (file).
chmod --reference=RFile file

GNU coreutils is found in most Linux distributions and Cygwin, among other places.  Not all chmod implementations provide this option.
Comment: *chmod* is not a *bash* builtin command.  it is a separate utility available on many unixes.  the `--reference` option is included in the GNU version; OSX probably uses a *chmod* that originates with BSD instead.  OSX *man chmod* : http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/chmod.1.html
Comment: Hm... looks like this is supposed to work, but not supported on Mac OS X? There I only get illegal option...
Comment: Svish, you might consider installing the GNU versions through MacPorts.
Comment: Just figured that it would be useful to mention here that `cp -dpR  ` will, when copying a file, copy permissions as well as the file.r
Answer: I came up with this:
find $SOURCE -mindepth 1 -printf 'chmod --reference=%p\t%p\n'|sed "s/\t$SOURCE/ $DEST/g"|sh

It is not fully bullet proof, but does what I need.
Answer: try this:
find /PATH/TO/TARGET -exec chmod --reference /PATH/TO/SOURCE/{} {} \;
this would go up recursivly and chmod every file, if two directory don't match on files you will see lots of "No such file or directory" error.
Comment: `find /home/myubuntuuser/Desktop/test1 -exec chmod --reference /home/myubuntuuser/Desktop/test2/{} {} \;`
Comment: chmod: failed to get attributes of '/home/myubuntuuser/Desktop/test2//home/myubuntuuser/Desktop/test1': No such file or directory
chmod: failed to get attributes of '/home/myubuntuuser/Desktop/test2//home/myubuntuuser/Desktop/test1/111.txt': No such file or directory
chmod: failed to get attributes of '/home/myubuntuuser/Desktop/test2//home/myubuntuuser/Desktop/test1/222.txt': No such file or directory
chmod: failed to get attributes of '/home/myubuntuuser/Desktop/test2//home/myubuntuuser/Desktop/test1/333.txt': No such file or directory
Comment: tested it on 2 folders: test1 and test2. each have the same files 111/222/333.txt with different permissions. test1 has the default ones. test2 has 777 permissions.
this is the error i get.
Answer: You can use getfacl to retrieve the full listing of file permissions, owner, group, and additional ACLs (access control lists).
$ getfacl filename.txt
# file: filename.txt
# owner: score
# group: score
user::rw-
group::---
other::---

If you save that output to a file (e.g. acl.txt), you can then restore from this format with setfacl --restore acl.txt. If you only want to restore a single file, and that file has a different filename to the original, you will want to use setfacl --set-file acl.txt filename.txt (where filename.txt is the new filename).
Steps

Save original permissions to acl.txt:
$ getfacl filename.txt > acl.txt

Overwrite permissions (for demonstration; this is just so that you can see that restoring it in the next step works)
$ chmod 777 filename.txt
$ sudo chown nobody:root filename.txt
$ ls -l filename.txt
-rwxrwxrwx 1 nobody root 0 Jan  8 14:24 filename.txt

Use setfacl to restore correct permissions from acl.txt:
$ sudo setfacl --restore acl.txt
$ ls -l filename.txt
-rw------- 1 score score 0 Jan  8 14:24 filename.txt

The filename is taken from the # file: comment generated by getfacl, so there is no need to specify it on the command line.
If you want to restore those permissions to a different file, you can use --set-file instead of --restore like so:
$ setfacl --set-file acl.txt second_filename.txt

Example
If you end up overwriting the permissions on some files in /usr, but you don't know what files you have overwritten, you can usually fix it by restoring from another similarly configured system.

Backup permissions from working system (note: getfacl generates relative paths, so ensure you cd to a consistent location on both machines)
# cd /
# getfacl -R usr > /root/acls.txt

Copy the ACL dump to the system with broken permissions
$ scp root@working-system:/root/acls.txt .
$ scp acls.txt root@broken-system:/root/

Restore the ACL dump to overwrite the broken permissions with those from the known good machine
# cd /
# setfacl --restore /root/acls.txt


I woud like to know what type of effect has been used in the UI design of the website?

Question: What type of effect has been used in the home page of this website as the image moves with the cursor .
https://www.niarratravel.com/
Answer: If you mean what's the effect called, I'd say "parallax effect" is what you're looking for ☺
Answer: in development is not an "effect" but a function used to accomplish such effects. This effect is done with GSAP a Javascript library, and you can find an example here for the developer to use. Hope iot helps GSAP TILT CANVAS


Asynchronised loading of image in supersized

Question: I am using a supersized slider, and I want to implement something which I am unable to do.
Say I have a image slide-interval of 3 secs,
I have four images a.jpg, b.jpg, c.jpg and d.jpg.
Now b.jpg is a very big image, so it takes time 4 secs to load.
Now after a.jpg is loaded and stayed, it slides to give way to image b.jpg.
Now since slider interval is 3 secs and b.jpg needs 4 secs to load, the slider changes in such a manner that before b.jpg gets completely loaded, the slider changes and c.jpg gets loaded.
So as such b.jpg cant be seen because c.jpg gets loaded before the b.jpg.
I want the slider to act like this:
untill and unless one image gets totaly loaded, the slider won't transit.
Say if b.jpg takes 6 secs to load, the slider would give it 6 secs to load. After loading completely it will stay for 3 secs (transition interval) and then the slider would change.
Here's my script:
<code>$(window).load(function(){
            jQuery(function($){

                $.supersized({

                    // Functionality
                    slide_interval          :   3000,       // Length between transitions
                    transition              :   1,          // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
                    transition_speed        :   1200,       // Speed of transition

                    // Components
                    slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
                    slides                  :   [           // Slideshow Images
                                                                                <?php
                                                                                foreach($wed_image as $wi)
                                                                                {?>
                                                        {image : '<?php echo base_url().$wi['wed_pic_image'];?>', title : 'Image Credit: Maria Kazvan', thumb : 'http://buildinternet.s3.amazonaws.com/projects/supersized/3.2/thumbs/kazvan-1.jpg', url : 'http://www.nonsensesociety.com/2011/04/maria-kazvan/'},
                                                        <?php
                                                                                }?>

                                                ]

                });
            });
           });
</code>
Answer: First Store your php code in Javascript variable:
<code> <script type="text/javascript">

    var x="<?php echo base_url().$wi['wed_pic_image']; ?>";
</code>
// Near your image src user like this
<code>{image : x, title : 'Image Credit: Maria Kazvan', thumb : 'http://buildinternet.s3.amazonaws.com/projects/supersized/3.2/thumbs/kazvan-1.jpg', url : 'http://www.nonsensesociety.com/2011/04/maria-kazvan/'},
</code>

// Use the Javascript variable near image.  it's worked for me


How can I stop the mesh from stretching when posing?

Question: I'm trying to rig a model starting from a rigify metarig and it's been going pretty well. It looks like, though, the mesh is morphed and stretched everytime i pose it, which is a problem mainly for the head and hands. Is there a way to make these parts rotate while keeping their shape and size? Am I doing something wrong? (probably but still)
Comment: Hi, welcome to Blender.SE. "Wrong" distorsion are probably caused by incorrect weights. Are you familiar with weight painting and have examind the weights?
Comment: @Leander Yes, I did weight paint in what I assume is the right way for this model. From what I can gather weight painting only signifies where the mesh should be affected and not how, am I wrong? How should I weight paint so that this won't happen?
Comment: Well, the weights determine how much the mesh is affected by certain bones. Try changing (painting) the weights in the deformed pose and check if you can improve the deformation.
Comment: @Leander It doesn't seem to help much. There's an effect only when I paint an area completely "blue" aka unaffected, then it shoots back up in the default position. I think there's gotta be a different way to go about fixing that.
Comment: upload your file to www.blend-exchange.giantcowfilms.com ?
Comment: The site you're suggesting won't upload the file for some reason. Here's a MediaFire link: http://www.mediafire.com/file/hdgosz9fyvf7q0g/yeeeee.blend/file
Answer: Apply the scale on your armature.

Select the armature and go to Object Mode.
Press ⎈ CtrlA > Apply Scale.
Comment: I tried it, but when I import it into the Unity project that it's for the model condenses into one big pile of limbs. It seems like the connections between the vertex groups are broken or something. What do I do from here?
Comment: @Scrillrock That sounds like another question. The deformation problem, described in this question, is solved by applying the scale, right?
Comment: It does seem to have done the job actually, so yes, sorry for that. I guess I'll mark your answer as accepted but any information on the deformation bit would be greatly appreciated. Great thank you for the help anyways, couldn't have figured it out myself!
Comment: When using matrix transformations from different object (like with an armature modifier), it is best to have the scale of all objects applied. If there are any specific subtopics, which are unclear or bothering, I think it would be best to include them in a detailed edit of the question. Also, feel free to open up a new question for a variation on the topic. You can link to this answer in a new question; and you open as many threads as you want.
Comment: Thanks, will do if needed!
Comment: https://blender.stackexchange.com/questions/146822/model-limbs-condensed-in-one-place-in-unity3d-after-applying-scale-to-armature
Answer: When in pose mode, go to the rig main properties tab, and turn ik stretch for the feet and hands to zero. This will keep the mesh from stretching when posing.


Is the thermal expectation value of a square of Hermitian operator always finite?

Question: If $\mathcal{O}$ is an hermitian operator in a system given by Hamiltonian $H$ and inverse temperature $\beta$, is $$\langle \mathcal{O} \mathcal{O} \rangle =  Tr (e^{-\beta H} \mathcal{O} \mathcal{O})$$ always convergent, or do we have to regulate it ? I am assuming that the system is a very general quantum field theory and the hamiltonian is bounded from below.
Comment: Well it's simultaneously diagonal.  So do a basis expansion and see..
Answer: In general, the expectation value $tr(A e^{-\beta H})$ is not defined for a generic selfadjoint operator $A$ (of the form ${\cal O}^2$ or not) if it is unbounded as it is the standard situation in QFT.
$tr(A e^{-\beta H})$ however converges if (with the written order!) the range of $e^{-\beta H}$ belongs to the domain of $A$ and the composition is trace class.
As an example, the hypotheses are valid if $H$ is selfadjoint and bounded below, with pure point spectrum and the dimension of eigenspaces is finite and bounded. In this case, for instance, $A= H^n$ for $n=0,1,2, \ldots$ satisfies all conditions.
When the expectation value is not defined with the formula above,  one may try to regularize taking some thermidynamical limit or directly use a more advanced formalism like the algebraic one,  together with the KMS condition to characterize thermal states.
In QFT in Minkowski spacetime, for a free theory, $e^{-\beta H}$ though bounded is never trace class, since its spectrum is not a pure point spectrum. Therefore you always must regularize, independently from the choice of $A$, barring forced unphysical choices ($A$ of trace class).
Answer: No.
Consider for example observables of the form $\mathcal O = e^{\beta H/2}$; the value exponentially increases as the probability exponentially decreases and you can get what's in principle an infinite sum of constant terms.
Comment: Your counter example is not really illustrative, because taking $\mathcal{O}$ to be a function of Hamiltonian itself, you often run into problems, and in practice $\mathcal{O}$ operator has a finite support over energy eigen basis. For instance Eigen-state thermalization hypothesis fails when the operator itself is considered as the Hamiltonian.
Answer: Now I have a clear reason why thermal expectation value of a square of an operator is not convergent. In any generic field theory I can express the expectation value as
$$ Tr (e^{-\beta H} O O) = \sum_{i,k} e^{-\beta e_{i} }O_{ik} O^*_{ik}$$ Since there is no damping factor in the summation k, the sum is not convergent for any theory and operator.


What does "classical logic" mean?

Question: I'm a junior researcher in Computer Science field and I've had some difficulties with some scientific terms like the one on the title "classical logic" which is used to represent and identify some other things. Could any one "simplify" the meaning a bit??
Comment: Have you looked at the Wikipedia article?
Comment: One cannot rely on uniformity of terminology. Among non-classical logics the author may have in mind are the various flavours of modal logic.
Answer: What does it take to establish a proposition of the form $\exists x Fx$? Do you think you must be able to exhibit or at least give a recipe for constructing a particular object $a$ such that $Fa$? Or is it on occasion enough to proceed indirectly and show that the supposition that $\neg\exists xFx$ leads to absurdity?
If you take the first line, you are giving a constructivist or intuitionist reading of the quantifier. On the second line, you are giving a non-constructive or classical reading of the quantifier. The latter goes with a classical understanding of negation more generally, according to which showing that $\neg P$ leads to absurdity shows not just that $\neg\neg P$ (which is agreed on all sides) but also to plain $P$ (which is disputed by constructivists).
Depending how you read the quantifier and negation, your logic will vary. On the constructive readings you will probably end up with intuitionist logic, and you will not endorse double-negation elimination or some related principles like excluded middle. On the non-constructive readings you get the standard classical quantification logic  of the founding fathers such as Frege, Russell and Whitehead, Hilbert and Ackermann, etc.
So, in headline terms, "classical" indicates the logic developed by the classic authors of the modern era, and contrasts principally with intuitionist logic.
(Some people, less helpfully I think, use "classical" to contrast the old core you find in e.g. Hilbert and Ackermann with later developements like modal logic. etc.: but I think the usually intended contrast is not "classical" vs. "new-fangled" but "classical" vs. "constructivist".)
Comment: No. In standard modern usage, classical logic means Frege and after -- see e.g. http://plato.stanford.edu/entries/logic-classical/ In this sense, ancient Aristotelian logic is pre-classical. (Compare: classical dynamics does not mean ancient theories of motion!)
Comment: A quibble: '..."classical" indicates the logic developed by the classic authors of the modern era...' Isn't classical logic also referred to as Aristotelian logic, implying that it dates to long before the modern era?
Comment: Note that the distinction between classical and intuitionistic logic is not limited to reasoning about quantifiers. It shows up already on the propositional level (at least formally; the philosophical considerations behind the distinction seem to become rather degenerate without quantifiers).
Comment: @HenningMakholm "[T]he philosophical considerations behind the distinction seem to become rather degenerate without quantifiers". Absolutely. Which is why I started from there. The late Michael Dummett is very good on this sort of thing in his classic *Elements of Intuitionism*.
Answer: Classical logic is the logic usually used for mathematical reasoning, where things such as $P\lor \neg P$ are always provable no matter what the formula $P$ is.
The most prominent alternative to classical logic is intuitionistic logic, which started out as an attempt to formalize the kind of reasoning that the "intuitionist" school of mathematicians about a century ago accepted as valid. In intuitionistic locic $P\lor \neg P$ is not always a theorem, nor does $\neg\neg P$ mean the same thing as $P$ itself, and De Morgan's laws are not exact equivalences. (On the other hand, every proof in intuitionistic logic is also valid in classical logic).
There are very few (if any) mathematicians today who think ordinary mathematical reasoning should be restricted to something like what intuitionistic logic allows. It is still interesting as a formal object of study in its own right.
Of particular interest for computer science is that "formulas" and "proofs" in propositional intuitionistic logic correspond exactly to "types" and "terms" in the simply typed lambda calculus extended with product and sum types, via the Curry-Howard isomorphism.
Comment: It is perhaps worth adding, though, that an intuitionistically acceptable proof can give you more information -- e.g. by providing a recipe for a witness for an existential quantification. And such extra info can be worth having.
Comment: @PeterSmith: Yes, and this is very closely connected with the fact that terms in the lambda calculus (which encode intuitionistic proofs) can be _executed_ as programs, giving a direct natural semantics for the "constructive" content of intuitionistic proofs.

What does “classical logic” mean?


Enemy AI Reacts To Player

Question: I'm making a horror game using Blender, but there's just one code I struggle with.The code is how to make an enemy follow you, but stop when looked at by the player's camera. I'm pretty sure this action is done using Python scripting.
Answer: Without Python, you can have a steering - 'path following' logic brick to target your player.
A ray/near sensor from the players eyes that detects the enemy can then toggle a (boolean) property that sets the state of the enemy to follow or not.
Like the Weeping Angels from Dr. Who, your enemy would only move when they are not looked at.

Enemy AI Reacts To Player


Correct way to install Pentaho Kettle from existing system or scratch

Question: What is the correct way to install Pentaho Kettle 4.0.1
Intent is to only install the component to create and run kettle jobs\transformations
It is installed on one of the machines. I took the .exe package from that m\c and installed it on my new system.
I also copied the DataIntegration folder from that machine. But when it starts, it complains about missing\invalid license.
Where I need to copy the license file. Also if I don't want to copy anything from an existing system, what is the right way to install it from scratch
Thanks
David
Answer: Pentaho Data Integration (Kettle) 4.0 is 2 years old. The current release is 5.0.
As to how to install it.. You can find the source code here:
http://sourceforge.net/projects/pentaho/files/Data%20Integration/5.0.1-stable/
Download the zip file, extract it, done. To run, click on Spoon.bat in the folder you just extracted. Spoon will handle your jobs and transformations.


Email to Case, Task has been created automatically

Question: In my scenario, I don't want task to be created automatically when an email-to-case has been created. I checked the Routing address name and 'Create Task to Email' is disabled but still the task is being created. What I am missing? How can I have the email-to-case functionality not to create any task on case creation?
Comment: Have you checked all other possibilities for the Task creation? Like, Processes, other workflows, Triggers and any sort of automation around the Case-Task objects?
Answer: @Arnold Jr. brings up good suggestions. Salesforce has a knowledge article regarding this exact issue ("Create Task to Email" is disabled, but yet it still creates a task).
The two things that cause this behavior according to that article:

Routing Address in Pending State. Check your "Verification" column in your email-to-case settings.
Setup --> Email-to-case --> Routing Addresses
If the verification has not completed, please do so.

Automated Case User's profile does not have access to Record Type
Find the record type being set in the email-to-case settings under
the Routing Address
Check your Automated Case User by going to Setup --> Support
Settings. Confirm the profile on this user has access to the record
type.


Domain of the quantum free Hamiltonian in 1D

Question: Consider the quantum free Hamiltonian $H_0 =-\frac{d^2}{dx^2}$ (the Laplacian on the real line). I want to show that it is (essentially) self-adjoint in its domain of definition. The usual approach works with the Fourier transform and proceeds to show that $H_0$ is unitarily equivalent to a multiplication operator. The domain of definition is taken to be those $\psi\in L^2(\mathbb{R})$ such that $-\psi''\in L^2(\mathbb{R})$ in the weak (distributional) sense. My question is: is it possible to prove self-adjointness without resorting to Fourier and distributions, just by using Hilbert space techniques?
Comment: Using the Cayley transform is one possible way to show that a symmetric operator is essentially self-adjoint. See Wikipedia and many books on functional analysis.
Comment: To apply results related to the Cayley transform of symmetric operators you need to show first that the domain is dense (I think this is included in the definition of `symmetric'). In fact, this is almost what I am asking for: once we get a densely defined domain for $H_0$ it is (relatively) easy to show self-adjointness. What I want to know is if it is possible to show this without using distributions...
Comment: Yes, a dense domain is required. This is not necessarily the case for a general symmetric operator. Your H_0 is symmetric with domain C_0, the infinitely differential compactly supported functions. Now note that C_0 is dense in L^2(R).
Answer: Let's try to show that the closure of a "smaller" symmetric operator is the desired self-adjoint operator. (A self-adjoint operator is always closed.) Take $\Delta = H_0$ just on the domain of the test-functions $D(\Delta) = \mathcal{C}_0^\infty$ (dense in $L^2$) as a starting point. It is clearly symmetric as twice partial integration shows. Now every symmetric operator is closable, i.e. it has a smallest closed extension $\overline{\Delta}$ on some larger domain $D(\overline{\Delta}) \supset D(\Delta)$.
To construct the closure operator take all $x \in L^2$ s.t. a sequence $\{x_n\} \subset D(\Delta)$ that converges to $x$ (in $L^2$-norm) also has $\{\Delta x_n\}$ converging to some $y \in L^2$ (in $L^2$-norm). We set $\overline{\Delta}x=y$ and thus define the extension. (This is unique, i.e. does not depend on the selected sequence, because the operator is symmetric.)
To get the domain of the closure operator we need to collect all these $x$. Putting the two convergences together it says we take all $x$ that have correponding sequences $\{x_n\} \subset D(\Delta)$ converging to $x$ but w.r.t to the stronger norm $\|x\|_\Delta = \|x\|_2 + \|\Delta x\|_2$. (This is called the graph norm of $\Delta$.) But the closure of the test functions w.r.t. to this graph norm is just the Sobolev space $H^2$ of twice weakly (not distributionally) differentiable functions. So this is our new domain $D(\overline\Delta) = H^2$ and we suspect this is the right domain for a self-adjoint operator.
For self-adjointness we need $D(\overline\Delta) = D(\overline\Delta^*)$ so the domains of the operator and its adjoint must coincide. The domain of the adjoint is defined as
$$
D(\overline\Delta^*) = \{ x\in L^2 | \exists y \in L^2 \,\forall z \in D(\overline\Delta) : \langle \overline\Delta z,x \rangle = \langle z,y \rangle \}.
$$
But this is just the definition for twice weakly differentiation with the additional condition that the second (weak) derivative $y$ is still in $L^2$ (because we are not using test functions $z$). So $x \in L^2$ and $y = \overline\Delta x \in L^2$ and thus
$$
D(\overline\Delta^*) = H^2 = D(\overline\Delta)
$$
$\Box$
Comment: Nice! Well-motivated, clear and clean... The trick with the graph norm is the step I was missing.


AngularJS - using angular.forEach and console.log to loop through arrays is unpredictable

Question: This is a zip-code guessing app, built with FireBase and Angular. For each digit that the user inputs, a query is made to a FireBase database that returns an array with zip codes that have the corresponding digit in the corresponding place(lines 3-48). Then the newGuess() function is called. For each of the inputs that have a number entered, the array that was returned is placed in an array called compareArray(lines 50 - 66). The length of compareArray (line 76) determines what happens next, which is where I was trying to iterate through each of the nested arrays. This is the brick wall that I cannot seem to get past. The arrays do not print out. Am I using $scope wrong? It seems to iterate through the arrays SOME of the
time, but not all. Does this mean that the arrays may not be populating in time?
It should be noted that both the compareArray and the resultsArray have been placed in and out of the $scope object, with the same results. I have also used a regular for loop to try and iterate through the arrays, but the angular.forEach loop seemed to worked more often than it.
The end goal is that once we know how many arrays there are nested in the compareArray, we will be able to pull them out, iterate through them, and compare them for similar zip codes. These zip codes, that are present in all returned arrays, are then places into a resultsArray, and a random one is chosen. The computer uses this random zip-code to "guess" where the user lives.
I also realize that there are parts of the code that are not as DRY as they could be. I was planning on getting the code working first, and then spending time re-factoring. Any advice on that is also appreciated.
I'll also link to the github. The only other files that are relevant are the app.js and the index.html file.
https://github.com/nhwilcox/zip-code_angular
<code>zipCodeApp.controller('ZipCodesCtrl', function ZipCodesCtrl($scope, $firebaseArray) {

    var ref = new Firebase('https://zip-it.firebaseio.com/zips');

    $scope.detectChangeDigit1 = function() {
        var query = ref.orderByChild("digit1").equalTo($scope.zipCode.firstDigit.toString());
        $scope.digit1Array = $firebaseArray(query);
        $scope.digit1Array.$loaded().then(function() {
            $scope.digit1Array.sort();
        });
        newGuess();
    };

    $scope.detectChangeDigit2 = function() {
        var query = ref.orderByChild("digit2").equalTo($scope.zipCode.secondDigit.toString());
        $scope.digit2Array = $firebaseArray(query);
        $scope.digit2Array.$loaded().then(function() {
            $scope.digit2Array.sort();
        });
        newGuess();
    };

    $scope.detectChangeDigit3 = function() {
        var query = ref.orderByChild("digit3").equalTo($scope.zipCode.thirdDigit.toString());
        $scope.digit3Array = $firebaseArray(query);
        $scope.digit3Array.$loaded().then(function() {
            $scope.digit3Array.sort();
        });
        newGuess();
    };

    $scope.detectChangeDigit4 = function() {
        var query = ref.orderByChild("digit4").equalTo($scope.zipCode.fourthDigit.toString());
        $scope.digit4Array = $firebaseArray(query);
        $scope.digit4Array.$loaded().then(function() {
            $scope.digit4Array.sort();
        });
        newGuess();
    };

    $scope.detectChangeDigit5 = function() {
        var query = ref.orderByChild("digit5").equalTo($scope.zipCode.fifthDigit.toString());
        $scope.digit5Array = $firebaseArray(query);
        $scope.digit5Array.$loaded().then(function() {
            $scope.digit5Array.sort();
        });
        newGuess();
    };

    var newGuess = function() {
        var compareArray = []
        if (typeof $scope.zipCode.firstDigit !== "undefined") {
            compareArray.push($scope.digit1Array);
        }
        if (typeof $scope.zipCode.secondDigit !== "undefined") {
            compareArray.push($scope.digit2Array);
        }
        if (typeof $scope.zipCode.thirdDigit !== "undefined") {
            compareArray.push($scope.digit3Array);
        }
        if (typeof $scope.zipCode.fourthDigit !== "undefined") {
            compareArray.push($scope.digit4Array);
        }
        if (typeof $scope.zipCode.fifthDigit !== "undefined") {
            compareArray.push($scope.digit5Array);
        }

        var resultsArray = [];

        // if there is only one number, only one query is needed, and it can be
        // assigned to the results array.
        // if there are two numbers, we need two queries, and the resulting arrays
        // need to be checked against each other to find zipcodes that are only
        // present in both arrays.

        if (compareArray.length === 1) {
            console.log("1!");
            resultsArray = compareArray[0];
            angular.forEach(compareArray[0], function(value, key) {
                console.log(value);
            });
        } else if (compareArray.length === 2) {
            console.log("2!");
            angular.forEach(compareArray[0], function(value, key) {
                console.log(value);
            });
            angular.forEach(compareArray[1], function(value, key) {
                console.log(value);
            });
        } else if (compareArray.length === 3) {
            console.log("3!");
            angular.forEach(compareArray[0], function(value, key) {
                console.log(value);
            });
            angular.forEach(compareArray[1], function(value, key) {
                console.log(value);
            });
            angular.forEach(compareArray[2], function(value, key) {
                console.log(value);
            });

        } else if (compareArray.length === 4) {
            console.log("4!");
        } else if (compareArray.length === 5) {
            console.log("5!");
        }
        $scope.resultsArray = resultsArray;
    }
});
</code>
Comment: I would guess this is a timing issue. I don't know what $firebaseArray(query) does but if it returns immediately and/or you are counting on the digitArray.sort() to happen BEFORE calling newGuess(), then that may not be happening. Perhaps move newGuess() inside of the .then and see if that fixes it. Certainly newGuess will be called prior to the digitArray sort
Comment: Yes, I think this is solving it. I moved the newGuess() functions and everything is appearing in the console
Answer: I would guess this is a timing issue. Put the newGuess() call inside the .then() and that should fix it.


How to check SqlSetPos compatibility on database?

Question: I have a database tool with the possibility to suppress the use of SqlSetPos. According to the documentation, some databases are not fully compatible with this function. How can I check if my database is compatible with this function or not?
Comment: Have you tried reading what the manual says about compatibility issues with this function?
Comment: Depends which manual you are referring to. If it is the ODBC driver manual, then I have read some, but it is not really making sense.
Answer: You'll need to check the documentation for the specific ODBC driver you are using. I would expect the SqlSetPos function to return SQL_ERROR or SQL_SUCESS_WITH_INFO if the driver doesn't support (or partially supports) the function. In that case, a subsequent call to SQLGetDiagRec should return a SQLSTATE with the error/warning cause, such as IM001 (Driver does not support this function).  See the SQLSetPos function reference for details.
Comment: Thanks for your reply. How would you try to make the SqlSetPos return anything? I am using the standard ODBC driver for SQL Server: SQLSRV32.DLL (version 6.01.7601.17514)
Comment: The "SQL Server" ODBC driver included with Windows WDAC is legacy. The stand-alone "ODBC Driver 13 for SQL Server" should be used instead (https://www.microsoft.com/en-us/download/details.aspx?id=50420). I would still expect the old driver to work but you'll need to use your database tool or custom code to test the function if you don't read the driver documentation.
Comment: I will look into this, thanks! Do you know if the Driver 13 supports SqlSetPos?
Comment: I would expect it to since SetPos is part of the ODBC 1.0 conformance.


Justification for Loop de Loop minimum speed

Question: I was trying to figure out the minimum speed an object would have to travel on a loop not to lose contact with the loop. Setting the centripetal force equal to gravity $m\frac{v^2}{r} = mg$ gives $v = \sqrt{gr}$ that explanation is valid and makes sense to me but I was wondering why a conservation of energy approach wasn't. Entering the loop with speed $v$ and setting Kinetic energy equal to gravitational potential $0.5mv^2 = mgR$ gives $v = \sqrt{2gr}$ which obviously is not the same. Why is this explanation not correct?
Comment: @JoshZwiebel there are two $v$s--one at the bottom, one at the top..think about it
Comment: If you use the search box to search for "loop de loop" you'll find other questions that may address this.
Comment: @SKDash What is my assumption?
Answer: First case :- In the first case(where you used centripetal force), the velocity $v=\sqrt{gr}$ is, in fact, the velocity of the object at the top of the loop. To find the velocity of the object at the bottom of the loop, you will need to use energy conservation.
$$\frac{1}{2}m((\sqrt{gr})^2-v_{bottom}^2)=-2mgr \Rightarrow v_{bottom}=\sqrt{5gr}$$
Second case :- In the second case, you assumed the velocity at the topmost point of the loop to be $0$. So, by energy conservation,
$$\frac{1}{2}m(0-v_{bottom}^2)=-2mgr \Rightarrow v_{bottom}=\sqrt{4gr}$$

Well, you can see that in the second case, the bottom velocity comes out to be lesser than that in the first case. It is because, the assumption that the velocity at the topmost point being zero is wrong. Imagine it this way: If, somehow, the velocity at the topmost point becomes zero(well, that would never be the case as the object, when thrown with bottom velocity $=\sqrt{4gr}$, will surely leave the contact from the loop before reaching the topmost point), then how do you expect the object to complete the loop. The object would stop and gravity would take over and pull the object back to the ground without letting it complete the loop. So you need to throw the object a little faster($v=\sqrt{5gr}$) such that it always stays with the loop and does not fall down midway between the loop.
Answer: What you have done is, you have taken the initial kinetic energy as $\frac{1}{2}mv^2$, then you have taken the change in potential energy to be $2mgR$ at the topmost point not$mgR$, that was your first mistake. Even then you are having zero velocity at the topmost point, which means the body has no velocity, and hence would just fall down instead of completing the loop.
Answer: $\sqrt{gr}$ is the minimum speed needed at the top of the loop to maintain circular motion
$\sqrt{2gh}$ is the minimum speed needed at the bottom to reach a height of $h$. To reach the top of the loop $h=2r$, the diameter of the circle.
Conservation of energy can be applied to find the minimum speed needed at the bottom to maintain circular motion. If $u$ is the speed at the bottom and $v$ is that at the top, then
$$\frac{1}{2}mu^2=\frac{1}{2}mv^2 + 2mgr$$
$$\frac{mv^2}{r}=mg$$
This gives
$$\frac{1}{2}mu^2=\frac{1}{2}mgr+2mgr$$
which leads to
$$u=\sqrt{5gr}$$.
This is the minimum speed needed at the bottom for circular motion to occur and should not be confused with other minumum speeds.
Answer: To work out the minimum speed, the speed at the top must be 0. The speed at the bottom is the minimum speed that you are looking for; it can be calculated by equating the PE at the top to the KE at the bottom because the energy has been converted from PE to KE when an object travels down a loop.
$0.5mv^2$ = $mgh$
$h$ = $2r$
Here you can work out the speed by simple algebraic manipulations.


Can my employer retaliate for my refusal to aid in patent trolling?

Question: My employer requires employees to submit patent applications for the things they work on. My manager has identified my project as one that needs a patent, but I strongly disagree that the project qualifies in any way. I'm being asked to submit a patent application that is clearly frivolous. I'm pretty sure the application will be rejected, but I've seen other applications accepted that shocked me. I have, so far, refused to create the application. My employer is of course free to submit the application themselves, but I want no part of the process, or any patents granted. Can my employer retaliate for my refusal to participate in their patent trolling?
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/115993/discussion-on-question-by-conditionracer-can-my-employer-retaliate-for-my-refusa).
Answer:
Can my employer retaliate for my refusal to participate in their
patent trolling?

Certainly.
For example, you might get a poorer raise, due to some generic reason which never mentions your refusal to participate in patent applications.
Or you could be reassigned to lesser projects that won't end up in a patent.
Or in extreme cases you could be fired. The reason given may or may not directly indicate something about patents.
Clearly there are direct and indirect ways that your company could make work more difficult for you. You get to decide if this is the hill you want to die on, or not. And you get to decide if this is the kind of company where you wish to work, or not.
Comment: The big difference: racism at work is illegal. Patent trolling is not.
Comment: I see your point, and agree with it. My question is more along the lines of would it be legal to retaliate if I felt my employer could use these patents for patent trolling. My employer could relegate me to the basements for objecting to blatant racism too, and I'd have a hard time proving it, but that would be illegal.
Answer: Yes they can, and it should not surprise you.
Unless you are a patent lawyer you have no real knowledge of whether a patent is likely to succeed or not. Patent trollery is not only legal but established practice in the US, regrettably. While it is OK to express your objection to it, if the company does not listen to your objection then not cooperating would amount to failing to do your job. If you don't do your job the company is within it's rights to fire you with cause.
I am not a lawyer so I would strongly recommend consulting one if you are intending to make a real stand.
Answer: Yes, they can.
Refusing work assignments in the scope of your work is justified grounds for firing in pretty much every circumstance.
If you don't want to participate, you will have to not continue to suckle money from their teat.


Javascript empty object

Question: This is an example of code, from a book called JavaScript: The Definitive Guide, 6th Edition, that I do not understand.
He is talking about Objects.
var book ={
    topic: "javascript",
    fat: true
};
book.topic              => "javascript"
book.["fat"]            => True
book.author="flanagan"; // creates new property
book.contents= {};      // empty object*

So what I don't understand is the last part. Is he adding in a new property called "contents" that is empty? Because he is calling it an object and it's confusing me.
Comment: No, he is adding a new property called `contents` and is assigning it a new Object with no properties.
Comment: `book.["fat"]` will give you `SyntaxError`. Use either dot or square brackets but not both of them simultaneously.
Answer: Yes {} is an empty object in javascript which is being assigned to the contents property of the book object.
Here you can see that we can use functions defined globaly on object such as toString()
Answer: Take a look at the way the book variable is defined. It is an Object declaration.
In the last line, we add a property named contents and assign it an object declared exactly the same way as book except that this one has no property and therefore is an empty object : {}
Answer: The curly bracket { } notation denotes an object literal.
The fact that there is nothing between them means that a new object reference pointing to a blank object (inheriting from the base object) is stored in the book.contents property.
Answer: {} create an empty object. Means now this object can have new property same as defined by book.author="flanagan";
// Both are same
book.contents = new Object();
book.contents = { } ;

Answer: In JavaScript you can create an object with {} notation, called object literal and you can add what ever you want to this object in future by dot even a function , in your example in first step:
var book ={topic: "javascript",fat: true};
book object is created with two property topic and fat and then this object is extended with author as String and contents as an inner object, as I said you can use it for creation empty objects (var t={} //example);
and if you use
typeof book.contents // returns "object"
Answer: It's creating a new property of the original book object, and setting the value of that property to a new empty object.
Answer: He's adding a new property called contents of the object book which itself is an empty object.
Here is a structure of what it would look like when he's made his changes to help you visualise it.
var book = {
    topic: "javascript",
    fat: true,
    author : "flanagan",
    contents : {}
};

Comment: So is there another way to say that a property has no value? If one just typed "contents" instead of "contents : {}"
Comment: You can assign object properties in two ways. `book["contents] =` or `book.contents = `. The value you assign to it can differ from a function to an empty object or array to a string or number. `book.contents = ""` now `book.contents` is a blank string.
Answer:

Javascript empty object


Comparison of the relative merits and appropriate scenarios for the supported WCF authentication credentials

Question: I'm trying to select the correct authentication mechanism for a WCF service. This article explains what the supported credentials are - I just don't understand how to decide between them.
Please could somebody supply an explanation of when each of the authentication options are appropriate to use, and the advantages/disadvantages of each over the others.
For reference, the authentication options are:

None
Basic
Digest
Ntlm
Windows
Certificate
Password

Note: I have seen a great MSDN article on this, but I cannot for the life of me find it anymore.
Answer: None:
Pretty straightforward - use this when you don't want to identify or authenticate your users.
Basic and Digest:
These authentication types aren't used much any more, but occasionally you might need to connect to an older web service hosted in IIS, which might be configured to use Basic or Digest authentication.  Traffic won't be encrypted. For Basic, the password will be sent in plain text, and for Digest the password will be sent in a poorly encrypted form.  Avoid using these authentication types.
NTLM and Windows:
NTLM uses the NT LAN Manager to control security.  Windows, by default, will use Kerberos (ie Active Directory) to control security.  If Kerberos is not available, it will default to NTLM.  Only use NTLM if you specifically need to avoid Kerberos (I cannot think of a scenario where you would want to do this, but part of WCFs greatness is its flexibility).
Certificate:
If your users have their own certificates which can be used to identify them, you might consider using this authentication mode.  Passwords can be guessed - it is very hard to guess a certificate, so this is a pretty secure mode of authentication (provided the certificate itself is secure).
Password:
Use Password when you want to create your own method of validating a users username and password.  This might involve accessing an existing user credential store in a custom database.  You will need to write your own UserNamePasswordValidator - example at http://nayyeri.net/custom-username-and-password-authentication-in-wcf-3-5.
To summarize, I usually choose Windows as the authentication mode.  It is secure and simple and works for most people in an enterprise environment.  If you're creating a new service and for some reason Windows cannot be used, go for Certificate or Password.  If you're hooking into an older SOAP service hosted in IIS, you may need to look at using None, Basic or Digest.
Comment: Just to add, certificate is often a good choice for integration services, where the service is being used by another "business system" and you want to ensure that only authorized systems communciate with the services.
Answer: Although I asked this question I will add what I know about Certificates as this is something I have worked with - though if my understanding is imperfect, I'd be happy to be corrected.
An X.509 certificate consists of a Public Key and a Private Key and issued by a trusted Certificate Authority (you can self-sign a certificate, this limits the usefulness of the certificate to trusted sources only). The CA will charge a fee for the certificate, and it will expire after a period of time.
The Public Key does not need to be protected and is given to the server. The Private Key is kept private and is used by the client. Messages encrypted by the Private Key can be decrypted by the Public Key.
A request from a client has a digital signature embedded in the SOAP. This is generated using the Private Key. When the server receives the request, it uses the Public Key to read the signature. If the signature can be read, then the request is considered genuine.
Within Active Directory, there is a mechanism whereby an X.509 certificate can be mapped to a user account, so you can impersonate a user with a certain permission set based on the X.509 authentication.
The benefits of X.509, are:

that it can be used across domains; and
that the Private Key can be securely stored in the client's Certificate Store. So there is no .config file containing credentials.

Failure to control the distribution and storage of a Private Key is akin to writing a username/password on a post-it note and sticking it on your monitor.
Comment: @Greg - Your answer is great BTW. I think there is a little more to certificates than you covered though. Specifically about storing them, their use across domains, and the $cost. These things are important pros and cons. Hopefully, if we add enough detail, then this post might be useful to others. Admittedly, my description of what a certificate is is slightly off topic - but I think it helps people understand why it has the advantages and disadvantages that I've stated.
Comment: @Greg - But I'll tell you what - if you flesh out the Certificate stuff on your answer, I'll delete mine and vote yours up...


How to move individual layers using onion skin when rotoscoping with video layers in photoshop?

Question: I am using a video layer to animate frame-by-frame over a video. Because the video shifts over a little, the rotoscope is not a perfect loop, so I would like to move the shifting frames over one-by-one. I have turned on onion skins to do this, however, when I use the move tool to move my selected contents the contents of the frame are selected but the onion skin disappears, so I can't see the past or next frame so that I know where to move it to.
Comment: Just tried this. It seems that the onion skin is disabled while you drag with the mouse, but not if you just nudge the layer with the keyboard arrows. Could that be a workaround?
Answer: One possible workaround is always using the the transformation tool to move the video layer without making the onion skin bug out, but then you'd always have to press enter.
Personally is much better using either Clip Paint Studio or Krita, CSP also supports direct import of Ps brushes and retains their mechanics so it's great if you want to stick with your brushes.


why not using sample variance (instead of MSE) to estimate the error variance in linear regression?

Question: Assuming the true equation for Y is linear as below:
$$Y_i =\beta_1X_i +\beta_0 + \epsilon_i$$
Assuming X is fixed, then the variance of each Y is:
$$var(Y_i )=var(\epsilon_i)=\sigma^2$$
In order to estimate $\sigma ^2$, we usually use the mse:
$$\hat{\sigma}^2=\frac{1}{n-p-1}\sum_i(Y_i -\hat{Y_i})^2 $$
My question is, why can't we estimate $\sigma^2$ using the sample variance below?
$$\hat{\sigma}^2=\frac{1}{n-1}\sum_i (Y_i-\bar{Y})^2$$
The sample variance is also an unbiased estimator, so instead of predicted value we just use the sample average of Y?
Comment: You say "Assuming $X$ is fixed" but, random or not, the values of $X_i$ usually differ (if they are all the same then linear regression does not work)
Comment: yes, what I mean is the data matrix of X is fixed, each Xi can differ
Comment: The second display actually isn't right. You mean to write: $\text{var}(Y_i | X) = \text{var}(\epsilon)  = \sigma^2$.
Comment: If X is fixed, conditioning on it does not make a difference
Answer: $\hat\sigma=\frac{1}{N-1}\sum_{i=1}^N\left(Y_i-\bar Y\right)^2$ has nothing to do with the model, unless your model is to predict the mean $\bar Y$ every single time, no matter what the features are.
A measure of prediction quality that is unrelated to the predictions does not make much sense.
In fact, the reason for doing regression is to tighten up your estimates and do a better job of predicting the conditional mean than you would do by predicting the pooled/marginal mean every time.
Your $\hat\sigma$ does come up in $R^2$, however, as $R^2=1-\dfrac{
\sum_{i=1}^N\left(
Y_i -\hat Y_i
\right)^2
}{
(N-1)\frac{1}{N-1}\sum_{i=1}^N\left(Y_i-\bar Y\right)^2
}=1-\dfrac{
\sum_{i=1}^N\left(
Y_i -\hat Y_i
\right)^2
}{
(N-1)\hat\sigma
}$.
EDIT
Here is a quick simulation to show that the two equations give dramatically different results, even for a "large" sample size of a million.
<code>set.seed(2022)
N <- 1000000
x <- runif(N, 0, 12)
y <- x + rnorm(N)
L <- lm(y ~ x)
(1 / (N - 2)) * sum((y - predict(L))^2) # I get 0.9992724.
(1 / (N - 1)) * sum((y - mean(y))^2) # I get 12.98154.
</code>
EDIT 2
"Sigma" has two meanings. You are right that $\sigma^2$ can be used to denote the constant variance of the errors. This would related to the conditional distribution, which is our object of interest in regression, and $\frac{1}{n-p-1}\sum_i(Y_i -\hat{Y_i})^2 $ is unbiased for this conditional variance.
However, $\sigma^2$ also could apply just to $Y$, marginally/pooled, in which case, $\frac{1}{n-1}\sum_i(Y_i -\bar{Y})^2 $ is an unbiased estimator for this unconditional/marginal/pooled variance.
If you want to differentiate between them, perhaps consider using subscripts like $\sigma^2_{Y\vert X}$ for the conditional variance and $\sigma^2_{Y}$ for the unconditional variance, but they refer to different random variables that have different variances.
Comment: oh yes, you are correct! As you mentioned, if you treat regressors as "fixed", then the distinction between unconditional and conditional variance gets lost, which resulted in the incorrect derivation of my second equation! MInor edit: In your second paragraph I believe it should be Y bar instead of Y hat for the unconditional variance.
Comment: I understand using the average has nothing to do with the model. But as u can see, both are unbiased/consistent. So it does not matter which one you use assuming you have a large sample size

Are you saying that if the relationship is truly linear and we have small samples, using the MSE version will be more accurate than if we used the sample variance. if we have large samples does this really matter?
Comment: @woowz Unbiased for what? The "divide by N" variance formula is *biased* for (marginal) population variance, leading to [Bessel's correction](https://en.wikipedia.org/wiki/Bessel%27s_correction) and the "N-1" denominator in the usual "sample variance", $S^2$.
Comment: Oh yes my bad, i've edited to include N-1. So now both are unbiased estimators for $\sigma^2$, and so there is really no difference in using either one in large sample sizes. Do you agree with this statement?
Comment: The fractions will be about the same in large sample sizes, as "huge minus one" is almost the same as "huge minus a few", but there is an enormous difference between subtracting the marginal mean and subtracting the predictions, unless you are evaluating a model that always predicts the marginal mean.


Dark spots at intersection of volumetric spotlights

Question: I have a bunch of volumetric spotlights in my scene. These are Spot Lamps parented to cones with a Principled Volume material. When several of these lights shine at the same spot or when one light shines through the cone of another, I get these artifacts that flicker from frame to frame. It almost looks as if the lights are interfering with one another. What does this mean? My memory usage is way below capacity.
Answer: So, I figured out what was causing the issue. It was in fact the intersection of multiple volumetric objects. While I thought at first that using haze only on the actual spotlights would be more render-economical, turns out it creates issues and takes longer to render than if the entire scene is filled with a fog cube.


Odd one out of images

Question: Spot the odd one out.
You must justify your answer.
Answer:
 A for Gardner, C for Highlanders, A for Peron, ?, I for the engine, R for Daley. So the odd one out is probably the fourth (though I can't identify it). Update: Mohirl (thanks!) tells me the fourth is Gareth Hunt. He's used for Cockney rhyming slang rather than Cockney alphabet so is, in fact, the odd one out.
Answer: Probably not the expected answer, but it's still technically correct.
The odd one out is the

top middle one

because

it's the only one with two people rather than one.
Comment: Not only that: it's also the only one that shows someone's both hands. +1.
Comment: @msh210 -- Good point!

Odd one out of images