Synchronization - Difference between locks
Is there an advantage to use a Synchronized Method instead of a Synchronized Block?
What can I do on a Visualforce page that is a renderAs="pdf" that will result in the name of the file that shows up when the user clicks Save As... to not be the name of the Visualforce page.  The page is generated via a GET request coming from clicking a custom button.  Below is some code that is representative of the PDF.   &lt;apex:page standardController="Account" extensions="AccountPdf"           showHeader="false"           sidebar="false"           renderAs="PDF"          title="AccountReport.pdf"          contentType="application/pdf#AccountReport.pdf"          &lt;head&gt;              &lt;title&gt;AccountReport.pdf&lt;/title&gt;          &lt;/head&gt;          &lt;apex:outputText value="Hello World"/&gt;  &lt;/apex:page&gt;   The browser bar does not have the title value in it and when the user clicks Save As... the name of the file is the name of the Visualforce page (e.g., myPageName).  If I remove the renderAs="pdf" the file downloads automatically with the correct file name due to the contentType, but the actual content type doesn't appear to be a PDF. Pearson VS Deviance Residuals in logistic regression I know that standardized Pearson Residuals are obtained in a traditional probabilistic way: $$ r_i = \frac{y_i-\hat{\pi}_i}{\sqrt{\hat{\pi}_i(1-\hat{\pi}_i)}}$$ and Deviance Residuals are obtained through a more statistical way (the contribution of each point to the likelihood): $$ d_i = s_i \sqrt{-2[y_i \log \hat{\pi_i} + (1 - y_i)\log(1-\hat{\pi}_i)]} $$ where $s_i$ = 1 if $y_i$ = 1 and $s_i$ = -1 if $y_i$ = 0. Can you explain to me, intuitively, how to interpret the formula for deviance residuals? Moreover, if I want to choose one, which one is more suitable and why? BTW, some references claim that we derive the deviance residuals based on the term $$-\frac{1}{2}{r_i}^2$$ where $r_i$ is mentioned above. Generalization of Hölder inequality How does deleting work? What can cause a post to be deleted, and what does that actually mean? What are the criteria for deletion? Has user testing found that the "three horizontal bars" for main menu on mobile is commonly understood? "Three horizontal lines" aka "hamburger icon" seems to be becoming a convention for the "main menu" button, especially on mobile sites:    Has anyone done any user testing of this convention, or got any A/B testing results? (i.e. is there an increase in bounce rate compared to using the word "Menu"?)  I did some quick user testing with wireframes featuring this icon for the main menu. 3 out of 6 people got it and used it. The others did not.  One person in particular had a lot of trouble "getting back to the top" (i.e. restarting their navigation from the top level of the site) as they didn't know about the convention, or that the logo would link to the home page.  I guess it will be different for different demographics - users of Facebook on mobile probably know it.  Anyone got any findings they can share? As the title says. How do I get from  $\frac{n}{\varphi(n)}$ to $\sum\limits_{d \mid n} \frac{\mu^2(d)}{\varphi(d)}$?  I know that $$\frac{n}{\varphi(n)}=\frac{\sum\limits_{d \mid n} \varphi(d)}{\sum\limits_{d \mid n} \mu(d)\frac{n}{d}},$$ and I suspect it is down this road I should go. But I get totally confused by the sums and I have no clue on how to divide them and "combine" them into one again. Any hints or advice would be much appreciated. How to Prevent the System.QueryException I am getting "Error System.QueryException: List has no rows for assignment to SObject".   Line 1: Account ac = [select id from Account where name='testaccount' limit 1] Line 2: if(ac != null) {           //do something         }   I got the above error in line 2 if there is no record.   Any help? Why is my Mac constantly trying to connect to another server? After logging on, I see this dialog box pop up. Whenever I dismiss it, it reappears 30 seconds later. (Stealing focus at the same time! Grrrr!)    "Slate" is my old iMac, which is sitting on the desk next to me, turned off. How can I stop my new Mac from constantly trying to connect to my old one? Both are running 10.7.1. "the Red Cross" but no article in Greenpeace, UNICEF, or Amnesty International In an English language textbook for Italian middle school students, there is a reading exercise where students have to fill in the gaps. Here is a completed excerpt     The International Red Cross/Red Crescent is a global charity and humanitarian organisation. It believes that people everywhere have a right to life and health. …blah, blah, blah… The Red Cross / Red Crescent began its work in 1863. Today, it operates in 186 countries and every year it gives help to about 250 million people.    My two private students had to write a paragraph about a charitable institution of their own choice. We came up with 1. Médecins Sans Frontières (in Italian Medici Senza Frontiere) which is also known as Doctors Without Borders 2.  and 3. Amnesty International. They each chose an institution and they all started their paragraphs with the definite article "the" just like in the textbook.         The Doctors Without Borders is a global charity and humanitarian…   The Greenpeace is a global charity and pacific organisation…      I crossed out the articles and said they weren't needed. Samuele asked me why–good for him–but I didn't know what to say, so I promised I would look into it.  While I can explain that the definite article is needed when we mention the  because it is a collection of states/nations, and it is omitted when it is shortened to UNICEF. I don't know why the article is needed for the  but not for  or .   I'm also aware that if the name of a company or band starts with "The" e.g. The Beatles,  The Leathersellers’ Company, and The Body Shop  the article is always obligatory and always capitalised. However, the charity's name used in the book name is , and yet the article is needed.    Is there a reason? Why is the definite article necessary in the International Red Cross, but not for Greenpeace or Amnesty International? I’ve recently purchased a new Mac Mini, and I’ve been importing my old pictures into the Photos app.  I want to have these photos backed up to iCloud, along with the photos currently on my iPad. I then want everything synced to my Mac Mini, but not to my iPad, which has limited storage capacity.  Is it possible to have the Mac Mini and iPad set up to backup to iCloud, but only download backed-up photos to the desktop? Why are my wrists the first part of my body to start aching during a long ride? Most riders seem to say it's their groin, neck or lower back that starts hurting first after a decent distance has been ridden. For me it is my wrists.  I have no history of wrist pain (strains, breaks etc) so it can't be explained by that and I try to adjust my hand positions across my handlebars as often as I can.  My question has 2 parts:   1. Is there anything I can do to minimise pain in terms of riding position, gloves, exercises etc which will reduce soreness?  2. Why might this pain be occurring?  *I do all of my riding on paved roads on a road (Specialized Allez) bike. Zero integral of measurable $f$ on every interval implies $f=0$? Let $f:\mathbb{R} \rightarrow \mathbb{R}$ be a Borel measurable function, such that $\displaystyle \int_{a}^{b}f(x)dx=0$ for every $a&lt;b$ in $\mathbb{R}.$ Is it true that $f(x)=0$ for every $x\in \mathbb{R}$?  Comments: the starting point of this is to prove that the (Borel measurable) density function $f$ (if exists) of a symmetric random variable $X$ (meaning that $X,~-X$ have common cdf's) is even. If my question has a positive answer, it follows easily.   Thanks a lot for any comments! Proof of matrix norm property: submultiplicativity I've been searching for the definition of the submultiplicative (I think it has multiple names from what I've seen) property in proof form. Some books define it as part of the properties that define matrix norms, and some include it as an additional property. I still haven't been able to work it out for myself or find it anywhere.  Let $A$ and $B$ be $n\times m$ and $m\times l$ matrices respectively, prove that:  $$\begin{align} \|AB\| \le \|A\|\|B\|  \end{align}$$ Is the Nintendo 3DS region-locked? I am thinking of buying a 3DS when the price drop comes into place in America, however I live in Australia. Will Australian 3DS games work on a North American 3DS? Suggested improvements to badges index page ()  Currently,  shows the possible badges, number of total recipients, and brief descriptions. However, I have a few suggestions (mostly minor changes) that could make it a bit nicer.   There is no way to see (on that page) which badges I've earned multiple times — they all appear with a green checkmark. It would be nice to show something like "x 4" like in the badges section of the user profile page. For example:      There is no way to see which badges can be awarded multiple times — you have to click on a specific badge to see yea or nay. It would be nice to have a small, simple icon next to badges that can be earned multiple times, similar to the checkmark showing which badges I've earned. The layout would be nicer if the number of recipients for each badge were in a separate column — since the badge images are different sizes, the overlap and ragged right alignment makes the numbers harder to read. An alternative view that groups badges by "achievement level" (gold/silver/bronze) would be nice, as would a view that groups progressive degrees of the same accomplishment. (e.g. Nice Answer &rarr; Good Answer &rarr; Great Answer OR Popular Question &rarr; Notable Question &rarr; Famous Question) Suppose I sold an option on stock X, with strike price Y, and expiry date Z. Suppose I later buy an option on the same stock, with the same strike price, and the same expiry date. Do these two positions cancel out each other (i.e. both contracts cease to exist anywhere), or will I end up with two separate contracts?  Is it the same with the reverse situation? e.g. I bought an option on stock A, with strike price B, and expiry date C. If I later sell an option on the same stock, with the same strike price and expiry date, will I end up with two contracts (one long position, one short position)? When did the word "so" begin to be used to start a sentence? In the last few years, I've noticed a growing usage of the word "so" to begin a sentence, especially in the context of higher education.  For example:   Interviewer: "What is the nature of your research"  Researcher: "So, what we wanted to find out is..."  It seems to be a replacement the word "well", or, more informally, "ok".  Has this usage of the word been around for a long time and I'm just now noticing it?  Do you think that is a valid use of the word? What is the argument selector tracking a defined score (not [score_min=])? What if I want to make a command like this:  execute @e[score_A=10] ~ ~ ~ summon Creeper   So that the entity must have a score of 10 (not less, not more)?  Does it even exist that or a [score_A_max=] argument?  I know about scoreboard players test, but i guess it is not the case to use it. Will Windows 10's reset delete my Linux partitions? I want to use the "reset my PC" feature of Windows 10 to wipe the data on my Windows partition. But I have also a Linux system installed, which I want to keep.  Will Windows 10's full reset wipe all my disk, or just Windows's partitions ? Are static fields open for garbage collection? Given an hypothetical utility class that is used only in program setup:  class MyUtils {    private static MyObject myObject = new MyObject();    /*package*/static boolean doStuff(Params... params) {        // do stuff with myObject and params...    } }   will myObject be garbage collected when it is no longer being used, or will it stick around for the life of the program?