I have created a singleton class, And Here is code  static DPGameManager *sharedManager = nil;   + (DPGameManager *)sharedManager   {       static dispatch_once_t singletonPredicate;       dispatch_once (&amp;_singletonPredicate, ^(){                sharedManager = [[DPGameManager alloc]init];   });   return sharedManager;   }  DPGameManager *m1 = [DPGameManager sharedManager];   DPGameManager *m2 = [DPGameManager alloc]init];   DPGameManager *m3 = [DPGameManager alloc]init];     m1, m2, m3 are three different objects.     But we should not be able to create three different object  for a singleton class.     How can we achieve this.?      Or is This fine to create different object for a Singleton class.
My singleton accessor method is usually some variant of:  static MyClass *gInstance = NULL;  + (MyClass *)instance {     @synchronized(self)     {         if (gInstance == NULL)             gInstance = [[self alloc] init];     }      return(gInstance); }   What could I be doing to improve this?
Process Unicode files with BOM correctly with POSIX tools I have the following problem:  Let $a, b \in\mathbb{Z}$. Show that $\,\{ ax + by\ :\ x, y \in \mathbb{Z}\} = \{ n \gcd(a,b)\ :\ n\in \mathbb{Z} \}$   I understand that the Bezout's lemma says that $gcd(a,b) = ax +by$, so Im not really how you would go about proving the above, it doesn't really make sense to me. Any help is appreciated1 How did Groot manage to raise the axe of Thor when even Hulk failed? In Avengers Hulk tried to raise Thor's hammer and failed miserably. In Avengers: Infinity War, Groot raises Thor's new axe and holds it for a few seconds! Is the axe made of some other light material, or is Groot stronger than Hulk? Find the condition on $a$ and $b$ so that the two tangents drawn to the parabola $y^2=4ax$ from a point are normals to the parabola $x^2=4by$ Find the condition on $a$ and $b$ so that the two tangents drawn to the parabola $y^2=4ax$ from a point are normals to the parabola $x^2=4by.$  The required condition is $a^2&gt;8b^2$.I dont know how to prove it.I tried.  Let $(h,k)$ be the point from where tangents are drawn to the parabola $y^2=4ax$.Let $m_1,m_2$ be the slopes of the tangents.Equations of tangents are $y=m_1x+\frac{a}{m_1}$ and $y=m_2x+\frac{a}{m_2}$ and equations of normal to the parabola $x^2=4by$ is $y=m_1x-2bm_1-bm^3_1$ and $y=m_2x-2bm_2-bm^3_2$.  As $y=m_1x+\frac{a}{m_1}$ and $y=m_1x-2bm_1-bm^3_1$  are the same lines.Therefore,$\frac{a}{m_1}=-2bm_1-bm^3_1$  $bm^4+2bm^2+a=0$  And I am stuck.I cannot get the desired condition.Please help me. The day before yesterday I think, my daughter asked me where we were going and since I was not planning to do the weekly shopping on that day and I just wanted to buy some stuff from two stores, I said offhand we are going to the shops! Looking back, it seems when I don't find a NAmE word I turn to UK if I know of.  So what do you say when:   go shopping (it's just go shopping!) you go to buy something specific; I mean you're not going shopping, and it's usually found in any store. You don't have to shop around. you want to buy non grocery or clothing stuff, maybe a can of paint and a spare part for your car together.    I have found some kind of answer for this question on , but I prefer to get a clear answer to my points above, and also if you agree with this native speaker about using store in singular form not plural:     Just as a side note, we don't use the plural in American English. "I'm   going to the store" (even if I may visit several stores), not "I'm   going to the stores". (If we know we are going to several stores I   think it would be more likely to say "I'm going shopping" or even "I'm   going downtown" in smaller towns.) Turn off display in Windows on command This is tricky. I would like to install Ubuntu on a machine that is intended to work as server, and for some reason I do not have an option to connect a screen to it.  I expect this may be similar to remote installation. However, there is currently no OS on that machine, so I will have to set up everything from scratch.  On the other hand, I do have a physical access to that machine. Therefore I can get it to boot from a CD/USB. But that's not enough.  Is there a way to do such installation remotely? Is there a version of Ubuntu image that comes with a SSH server preinstalled, and starts it once booted, so that I can boot the machine with such image, connect to it via SSH and process the installation from a different computer?  If not, what other options do I have? In my resume, I'm describing several projects I've worked on in the past. Most of them were done in teamwork. What is the best way to say this?  Examples:  Together with XY, I built ... OR  In collaboration with XY, I built ... OR  XY and I built ...  Are the first two examples grammatically correct? I'm unsure since first I state that something has been done in collaboration with a second person, but then I use "I built ...". On really old Ubuntu 6.06 - How to upgrade I'm on an old Ubuntu version (Ubuntu 6.06.2 LTS Server) which isn't really supported any more. So the automatic updates don't work. I have ISPConfig installed to manage a few web sites.  What's the best course of action? I'd like to upgrade to something current, but I can't figure out how to go about doing this, given that the apt-get scripts don't really work any longer. How can I use an array of function pointers? How should I use array of function pointers in C?  How can I initialize them? Integral of sinc function multiplied by Gaussian I am wondering whether the following integral $$\int_{-\infty}^{\infty}  \frac{\exp( - a x^2 ) \sin( bx )}{x} \,\mathrm{d}x$$ exists in closed form. I would like to use it for numerical calculation and find an efficient way to evaluate it. If analytical form does not exist, I really appreciate any alternative means for evaluating the integral. One method would be numerical quadrature including Gaussian quadrature, but it may be inefficient when the parameters $a$ and $b$ are very different in scale.  EDIT : In view of  discussion, we have decided to add OP's self-answer to the end of the question, for it does not qualify as an answer yet contains vital details. The copying is unabridged. Thanks very much for your comments, and the following result was obtained including the case for $x_0 \ne 0$: $$ \int_{-\infty}^{\infty} dx \exp[-a(x-x_0)^2] \frac{ \sin(bx) }{ x } = \pi \exp(-a x_0^2) \mathrm{Re}\left(\mathrm{erf}\left[\frac{b+2iax_0}{2\sqrt{a}}\right] - \mathrm{erf}\left[\frac{2iax_0}{2\sqrt{a}}\right]\right) $$ where $a\gt0, b, x_0$ are assumed to be all real. (note: coefficients etc may be still wrong...) This integral appears in a type of electronic structure calculation based on a grid representation (sinc-function basis). I believe the above result should be definitely useful. Thanks much!! --jaian How to do a bias-variance analysis on a machine learning modelling process How can I change the default program installation directory in Windows 7? Windows 7 is installed on my C drive, which is quite small.  I am very tired of instructing new programs to put their files on my larger D drive during installation; I would like to change the default drive.   says that you can use a registry hack, but I am giving Microsoft the benefit of the doubt and naively assuming that a configuration option exists somewhere.  It's 2010... do I really have to hack my registry to make a simple tweak like this?  Also, there's a  that explains how to move the "Users" directory and create a symlink, which could also work.  However, at the moment I have some apps in C:\Program Files, some apps in C:\Program Files (x86), and some apps in the corresponding folders on D:\, so it would be a hassle.  Also, my small OS boot drive is a 10k RPM WD Raptor, and I feel like that probably gives a speed boost to apps installed on it that need to read &amp; write to their directories a bunch.  I wonder if it actually matters. Guests see the Protected notice , somewhat displaced:    Logged in, all is fine:    It actually belongs there, at the bottom, but then it has some design glitches, or it needs to be placed at the top.  Verified on Firefox and Chrome stable. I am in the process of creating a LaTeX template for a conference submission, and up until now I've been working only with the anonymous submissions. Now I need to create the "camera-ready" version, which means I need to add authors to the document.   The template is based on article.cls, with some tweaks to meet the font and formatting specifications. The following image contains the examples from the Word template for the conference:    Basically, I need to be able to bold the author's name (which could I suppose be done manually in the document rather than in the template) and more importantly: divide the authors into two columns, with an optional centered last column with an odd number of authors. The font size of the author block corresponds to my \LARGE defined in the class file.  Are there any packages that facilitate this type of conditional formatting, either in a document, or in a .cls file? How can I use those packages to achieve the formatting I require? How to read ANSI encoded files in the right way? I have some files that Ubuntu can't read it ( ANSI encoding ) but Windows can read it well.  When I open it in gedit or notepad++ it seems like this :     Êã ÇáÊÍæíá áÜÜ   How can I make Ubuntu read ANSI encoded files well? Mobile SE sites not allowing edits to edits When you have less than 2K rep and your edit goes in a queue, you are usually allowed to revise your edit while it is being reviewed, by clicking the edit button again on the question page. However, when on mobile SE sites, the edit button disappears when you have submitted an edit for review.    Editing  by  into the question: It seems that the cause of this is when the mobile site hides the edit link (when there is a pending edit), it doesn't check who is making the edit, which means that it hides it for your own as well as other's edits. I am having trouble understanding the estimation of an AR process. In some textbooks, the AR(1) process is defined as follows: $y_{t}=\theta y_{t-1}+ϵ_t$ (which does not contain a constant). So the OLS estimator is biased. I am confused about the cause of the bias. It is explained that $y_{t-1}$ is dependent on $ϵ_{t-1}$ although it is independent of $ϵ_t$. However in linear regression, if the equation does not contain a constant, we cannot make sure the expectation of disturbance is zero. So the OLS estimator is bias without a constant. Does it mean that the OLS estimator is unbiased if I add a constant in AR process? Where does the curve $x^y = y^x$ intersect itself? This problem is quite easily solved by using logarithms and derivative and forming the function $f(x,y) = x^y - y^x$, however there are assertions that this problem can be solved without using either of the two. I can not see how one would proceed to solve this problem in the absence of logarithmic manipulation and differentiation. Can anyone shed some light on this? Correlations between continuous and categorical (nominal) variables