How can I check memory usage of an object in java
In Java, what is the best way to determine the size of an object?
iPhone SDK: what is the difference between loadView and viewDidLoad? When working with views and view controllers in an iPhone app, can anyone explain the difference between loadView and viewDidLoad?    My personal context, is that I build all my views from code, I do not and will not use Interface Builder, should that make any difference.  I've found that often when I add init code to loadView, I end up with an infinite stack trace, so I typically do all my child-view building in viewDidLoad...but it's really unclear to me when each gets executed, and what is the more appropriate place to put init code.  What would be perfect, is a simple diagram of the initialization calls.  Thanks! My family PC has Windows Vista and lately it has became unusable, having strange errors and taking hours to do anything at all, so I'm installing Ubuntu 11.10 alongside it.  I went into GParted to resize the Vista partition but found that it had an exclamation point in a red circle next to it:   I tried to resize it but the Resize/Move button was grayed out.  I thought that this might have to do with the exclamation point so I looked at the information and found a load of errors:   What does the exclamation point mean?  How can I resize my partition?  UPDATE 1  I booted into Safe Mode with Command Prompt in Vista as suggested by eug and ranchkdsk c: /F /R (/F Fixed errors on the disk, /R Locates bad sectors and recovers readable information) and got:  Chkdsk cannot run because the volume is in use by another process.  Would you like to schedule this volume to be checked the next time the system restarts? (Y/)   When I reboot it doesn't run chkdsk, I'm selecting Safe Mode with Command Prompt again because I can't boot normally.  How can I stop it being used?  UPDATE 2  I tried doing what Luis suggested.  Here is the terminal output:  ubuntu@ubuntu:~$ sudo ntfsfix /dev/sda3 Mounting volume... OK Processing of $MFT and $MFTMirr completed successfully. NTFS volume version is 3.1. NTFS partition /dev/sda3 was processed successfully. ubuntu@ubuntu:~$ sudo apt-get install ntfsprogs Reading package lists... Done Building dependency tree        Reading state information... Done Note, selecting 'ntfs-3g' instead of 'ntfsprogs' ntfs-3g is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.   I still cannot resize the partition.  Ntfsfix doesn't look like it did anything and ntfsprogs is already installed.  I can access the hard drive and do backups with the Ubuntu Live CD which I'm using now.  Any other suggestions?  UPDATE 3  I attempted to use the ntfsresize command but I got an error:  ERROR: Volume is scheduled for check. Run chkdsk /f and please try again, or see option -f.   This is because I ran chkdsk in Vista Safe Mode with Command Prompt and it couldn't do it because it was in use but offered to do it at the next reboot.  I reboot and I get to the menu to the menu to choose whether to Start Windows Normally, Safe Mode, etc instead of checking the disk.  Is there any way I can unschedule?  EDIT  I just found out that I could use the -f option to force it.  It failed and told me to run chkdsk /f in Windows and then reboot twice.  But the chkdsk program is in the partition I am trying to check so it says it is in use. What is the difference between #include  and #include "filename"? How to make pages metabox display all hierarchy in menu admin? Running WP 3.9.1  I've got lots of pages and sub pages.  When I get to create menu lots of sub pages doesn't display on the right level, but some do?    The pages metabox should display something more like this    EDIT  Number in screenshot are a bit screwed sorry about that.   The problem is after the first few all the pages are displayed on the same level but they shouldn't.  It should look like this       Page 1                      SubPage A of Page 1             SubPage B of Page 1                                      SubPage 1 of SubPage B                     SubPage 2 of SubPage B                     SubPage 3 of SubPage B                                                 Page 2                      SubPage A of Page 2                                      SubPage 1 of SubPage A                     SubPage 2 of SubPage A                                           SubPage B of Page 2                                      SubPage 1 of SubPage B                     SubPage 2 of SubPage B                                               ...    Any idea what cause this or how to fix it, so i can manage my menu? How to properly ignore exceptions Same gravatar is displayed for different users in stackexchange.com filters Same gravatar is displayed for different users in the stackexchange.com , under the Top Network Askers in the right side bar.   The red circled image's source (&lt;img src=) are from   https://www.gravatar.com/avatar/?s=18&amp;d=identicon&amp;r=PG&amp;s=30                                ^   Seems the gravatar id is missing here in the image source.  For an example from the list, the user  gravatar id should be    https://www.gravatar.com/avatar/66c66c4d97a7bc3859a85253f003e1fb?s=18&amp;d=identicon&amp;r=PG&amp;s=30   but it is mapped with   https://www.gravatar.com/avatar/?s=18&amp;d=identicon&amp;r=PG&amp;s=30   which caused the display issue. Does "until [date]" mean "before that date"? R stem and leaf values Let's say I have the following class X where I want to return access to an internal member:  class Z {     // details };  class X {     std::vector&lt;Z&gt; vecZ;  public:     Z&amp; Z(size_t index)     {         // massive amounts of code for validating index          Z&amp; ret = vecZ[index];          // even more code for determining that the Z instance         // at index is *exactly* the right sort of Z (a process         // which involves calculating leap years in which         // religious holidays fall on Tuesdays for         // the next thousand years or so)          return ret;     }     const Z&amp; Z(size_t index) const     {         // identical to non-const X::Z(), except printed in         // a lighter shade of gray since         // we're running low on toner by this point     } };   The two member functions X::Z() and X::Z() const have identical code inside the braces.  This is duplicate code and can cause maintenance problems for long functions with complex logic.    Is there a way to avoid this code duplication? Double rm verification in zsh When I do a rm * in zsh, I get something like this:  2014-06-08 10:14:23 $ rm * zsh: sure you want to delete all the files in /home/assay/assay/log [yn]? y rm: remove regular file `development.log'? y   First zsh asks me if I am sure I want to delete all, and then rm asks for for each specific file.  How can I just have the zsh verification? Finding all differentiable $f(z) = u(x) + iv(y)$ in $\mathbb{C}$ where $u(x),v(y)$ are real valued functions.   I’m not sure what to do. Would $f$ be differentiable simply if and only if both $u$ and $v$ were differentiable?   My thinking is that if the limit $$ \lim_{h \to 0}\frac{f(z+h)-f(z)}{h} $$  exists then it would be equal to  $$ \lim_{h \to 0}\frac{u(x+h)-u(x)}{h} + i\lim_{h \to 0}\frac{v(y+h)-v(y)}{h} $$  and therefore would exist if they existed. But that doesn’t seem quite right.  I also thought about using Cauchy-Riemann equations, but seeing that I’m trying to find ones that are differentiable rather than those that aren’t, I thought they wouldn’t be of much help. What do the "+n" values mean at the end of a method name in a stack trace? In discussing , I noted that while the statement:     Any vector space has a basis   is equivalent to the axiom of choice, I wondered if the statement that:     Any vector space either has a finite basis or an infinite set of linear independent vectors   was weaker than the axiom of choice. It feels weaker - it feels like you can inductively define a countably infinite set of linearly independent vectors without full choice, but I'm not sure if that is possible with ZF alone, or requires all of the Axiom of Choice, or is weaker but requires some form of choice. How do I get attention for old, unfixed bug reports and feature requests without official responses here on Meta? I posted a question here on Meta Stack Exchange, or on a per-site meta, regarding a bug I found in the system. I got no comments, or a few comments stating that this is a legitimate bug (and not by design). However, it's been quite a long time, and no official response was ever posted there.  Or, I had an idea for a new feature, but realized it's already requested, either by searching or posting a request myself only to have it closed as a duplicate of the existing one. It's been a while since the original request was filed, but no official response has been made.   I'm aware that staff members are , but either my post isn't about one of the indicated topic areas for which they're accepting escalation requests for that month, or I already flagged to request escalation but it was declined, so the instructions there don't apply for my post.  What can I do to draw attention to meta questions for the SE team, so they can give an official response, and possibly implement the bug fix or feature?  Note: This is different from other general questions which ask for how to get attention for unanswered questions, since the procedures on meta sites are different, and getting an official response isn't necessarily the same as getting a good answer. I've just started using matlab-prettifier.    Since the line \begin{lstlisting}[style=Matlab-editor] is a lot to type, I created my own environment:  \newenvironment{myMP}      {\begin{samepage}\begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting}\end{samepage}}   I've used this syntax many times before, but in this case it doesn't work.  Is there any reason why I can't enclose the lstlisting inside my own one?  Here's sample code, illustrating the problem.  \documentclass{minimal} \usepackage[framed]{matlab-prettifier}%For matlab code \newenvironment{myMP}      {\begin{samepage} \begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting} \end{samepage}} \begin{document} \begin{myMP} matlab word \end{myMP} \end{document}   When I run this with pdflatex it returns a *, indicating that the environment wasn't closed properly.  Thanks! How can I stream live video on YouTube? Nowadays, I see a lot of users live streaming on YouTube and wanted to try it for myself. However, when I go to my channel I don't see an option for live streaming.  I tried researching how to do this on YouTube and Google, but without luck.  So I was wondering, how can I live stream on YouTube?  I don't have any pro account or any of that, but I've watched livestreams from users who I don't think have pro accounts either.  So livestreaming is open for everyone, right? Normal text is invisible when using beamer with notes and XeLaTeX I'm using beamer with xelatex to prepare a talk.  If I switch on notes on right I'm experiencing strange behaviour:  When using csqoutes in the title, all normal text afterwards becomes invisible (or white). The text selectable in the output pdf. Note that the text is also visible in the small preview on the note page.  This does not happen when using pdflatex or lualatex.  MWE:  \documentclass{beamer} \usepackage[autostyle=true,german=quotes]{csquotes}  \usepackage{pgfpages} \setbeameroption{show notes} \setbeameroption{show notes on second screen=right}  \begin{document}    \begin{frame}         \frametitle{\enquote{Enqouted Title}}     \end{frame}      \begin{frame}         \frametitle{This is the second slide}         Lorem ipsum dolor sit amet, consectetuer adipiscing elit.     \end{frame} \end{document}   Update:  csqoutes is not the culprit. Seems to be a general problem when using xelatex and beamer with notes enabled.  New MWE:  \documentclass{beamer}  \usepackage{pgfpages} \setbeameroption{show notes} \setbeameroption{show notes on second screen=right}  \begin{document}     \begin{frame}         \frametitle{First Slide Title}         Here be text     \end{frame}      \begin{frame}         \frametitle{This is the second slide}         Lorem ipsum dolor sit amet, consectetuer adipiscing elit.     \end{frame} \end{document} How to return multiple objects from a Java method? I want to return two objects from a Java method and was wondering what could be a good way of doing so?  The possible ways I can think of are: return a HashMap (since the two Objects are related) or return an ArrayList of Object objects.  To be more precise, the two objects I want to return are (a) List of objects and (b) comma separated names of the same.  I want to return these two Objects from one method because I dont want to iterate through the list of objects to get the comma separated names (which I can do in the same loop in this method).  Somehow, returning a HashMap does not look a very elegant way of doing so. iPhone App › Add voice recognition? Selecting a security team that includes at most one of the oldest man or oldest woman A security company consists of $7$ men and $6$ women. Determine the number of ways to form the night shift team of $3$ men and $3$ women if it can include at most one of the oldest man or oldest woman.  I know the first step is to pick $3$ from each group which is   $_6C_3 \cdot _7C_3 $  but I am not sure how to account for the "include at most one of the oldest man or oldest woman"   The answer is $_6C_3 \cdot _7C_3 + _6C_3 \cdot _5C_3 + _6C_2 \cdot _5C_3 $  Also, how do I account for it in my calculations if I want to include the oldest man and oldest woman from the group?