In my class I have unmanaged objects in managed collection (pendingFramesBuffer). I need to implemented IDisposable interface. My question: Where I need to clear pendingFramesBuffer collection? In the if (disposing) {...} condition or not. public class Example : IDisposable {     // unmanaged pointer in managed collection     private BlockingCollection&lt;IntPtr&gt; pendingFramesBuffer = new BlockingCollection&lt;IntPtr&gt;();      /// SOME CODE TO FILL pendingFramesBuffer COLLECTION      public void Dispose()     {         this.Dispose(true);         GC.SuppressFinalize(this);     }      private bool disposed = false;      protected virtual void Dispose(bool disposing)     {         if (!this.disposed)         {             if (disposing)             {                      }              // CLEAR pendingFramesBuffer COLLECTION             while (pendingFramesBuffer != null &amp;&amp; pendingFramesBuffer.Count &gt; 1)             {                 var tookFrameBuffer = pendingFramesBuffer.Take();                 Marshal.FreeHGlobal(tookFrameBuffer);             }              this.disposed = true;         }     }      ~Example()     {         Dispose(false);     } }
I know from reading  that the "primary" use of the IDisposable interface is to clean up unmanaged resources.  To me, "unmanaged" means things like database connections, sockets, window handles, etc.  But, I've seen code where the Dispose() method is implemented to free managed resources, which seems redundant to me, since the garbage collector should take care of that for you.  For example:  public class MyCollection : IDisposable {     private List&lt;String&gt; _theList = new List&lt;String&gt;();     private Dictionary&lt;String, Point&gt; _theDict = new Dictionary&lt;String, Point&gt;();      // Die, clear it up! (free unmanaged resources)     public void Dispose()     {         _theList.clear();         _theDict.clear();         _theList = null;         _theDict = null;     }   My question is, does this make the garbage collector free memory used by MyCollection any faster than it normally would?  edit:  So far people have posted some good examples of using IDisposable to clean up unmanaged resources such as database connections and bitmaps.  But suppose that _theList in the above code contained a million strings, and you wanted to free that memory now, rather than waiting for the garbage collector.  Would the above code accomplish that?
Sci Fi action movie where an elite group of people control business through a game they play online I have seen many folks doing this  concluding that shadow from point A on the Moon can travel to point B on the Moon faster than light.  What I fail to understand here (and I am sure I am wrong), is nothing can travel faster than light. I also read about Relativity where Einstein stated that every event happening for you depends on how fast the light gets from where the event is happening to you.  This is my particular problem with this Moon shadow experiment. You cannot make a shadow travel faster than light, because in order for the "disappearance" of light to get to the Moon, it has to travel at light speed.  Here is one way to understand my point. Consider we shine a flashlight on Moon, like the guy in the linked video did, we move the finger across the face of the flashlight, before we moved the finger it was casting the shadow at Point A on Moon, after we finish moving our finger, the shadow is at Point B on the Moon.  When the finger reaches the end of it's moving length, the light waves that have left the flashlight before the finger reached there will have to hit Point B and it will take them a second and a half to get there, and another second and half for us to see that shadow on point B, which makes it 3 seconds + finger moving time for us to actually see the shadow at point B. That means shadow traveled (say) across the diameter of the Moon in 3 seconds.   So. about 3000 Km in ~3 seconds make it 1000 Km per seconds which is very tiny compared to the speed of light. How can these experiments conclude that Shadow could be made to travel faster than light? What is the obvious clue that I am missing here? Show that the function $g(x) = x^2 \sin(\frac{1}{x}) ,(g(0) = 0)$ is everywhere differentiable and that $g′(0) = 0$ Are there any guarantees in JLS about order of execution static initialization blocks? If someone else is booking international ticket for me using his credit or debit card, does he need to be present physically at the time of check-in?   Suppose I am coming back from Singapore to my home country and my ticket is booked by my friend for me, who lives in my home country. Do airlines in Singapore ask for the person to be present physically to check in? data.table and table unexpected behavior Can I have too many mods? I found a lot of mods that make thinks lighter, and add mark and recall, and a basement I like. They are all on Steam, and what I want to know is if I can have too many? Will they all work together? Or should I just leave them alone? Is it possible to cross the Wagan border by car? I was planning a trip by car when I found something a bit weird in :if you try to cross from Lahore to India, it tells that you have to 6457 km detour.  Is it possible to cross this border driving? If not, is there another way to cross without having to make more than 6000 km? QGIS ->ArcGIS Server configuration possible? Is it possible to connect a QGIS Desktop 1.8.0 to an ArcGIS Server 10.0 ? and of course publish services on it?.   The configuration would be like this Quantum GIS-> ArcGIS Server 10.0 on Amazon EC2+ POstgreSQL (+PostGIS)-> web app.   Is it possible to create a configuration like this? Do you think I could use it for networking? Opposite of Alternatives Arithmetic progression topology Is there any difference between like best and like the best? Is there a difference between these two sentences? Are they the same?   What color do you like the best? What color do you like best?   Is there a difference in their meaning? Two blue arrows at top right of icons On some icons I am seeing a two blue arrows at the top the right pointing towards each other. I first noticed it on the icons on folders which I archived which happened randomly. I archived the folder and the text went blue as expected, then when I went to the folder again the text was black and the folder icon has these arrows. When I just recently installed Office 2007, I noticed the same arrows on the icons for the programs. OS: Windows 10 Pro 64-bit (the latest update: 1115) Application: Microsoft Office 2007 suite and file explorer Object Positions Reset On Blender Load So I am attempting to make a modular environment in Blender, so I'm modeling many pieces in one scene to make sure they all match up properly before separating them out.  However, whenever I restart Blender after saving and closing it, many of my grouped objects (and their subobjects) have positions reset NOT to where I placed them.  For example, take a look at this:   Here you can see that the door pieces are in the "open" state, when I left them closed AND the "column" for the wall on the left has been moved from being flush with the wall (on the side) to being inside it.  It appears to be trying to move all of the objects to 0,0,0 which is what is messing this up. I'm not sure if it's an object hierarchy problem, but here is my hierarchy if anyone has ideas there:  Wall_Normal (parent)   Wall_Normal_Column (child)   Empty Axis Object (parent)   Door_Left (child a) Door_Right (child b)   Is there a reason why object positions (and their relative subobjects) aren't being saved? I am given this problem: Suppose you have a complete graph with $n$ edges. How many vertices does your graph have?  I have this math figured out so far: We know that a complete graph has $m$ vertices, with $m-1$ edges connected to each. This makes the sum of the total number of degrees $m(m-1)$. Then, since this sum is twice the number of edges, the number of edges is $\frac{m(m-1)}{2}$.  But I don't think that is the answer. I think I am missing a piece of the math, but I can't figure out what else I need to do. Can anyone help me with what I'm missing or doing wrong? What happens to matter in a standard model with zero Higgs VEV? Return vs. Enter? I noticed that my MacBook's keyboard has the word enter above the return key. I also noticed that on Mac OS X, there's a special symbol for return ↩, and another for enter ⌤. How would I send the enter key if my MacBook has no numpad?  Is there any difference between these two keys? Any questions relating to status updates, or asking if anything is going to be patched for these vulnerabilities should be closed as duplicates of this question.    are in the news right now and sound pretty severe. I don't see any security updates from Ubuntu that cover these vulnerabilities.  What is Ubuntu doing about these vulnerabilities, and what should Ubuntu users be doing?  These are CVE-2017-5753, CVE-2017-5715 and CVE-2017-5754. How to make sense out of the $\epsilon-\delta$ definition of a limit? The informal intuition for the limit of a function is this:     What is the value of the function $f$ as $x$ gets infinitely close to $c$?   How on earth does this monster  $$ \lim_{x \to c} f(x) = L  \iff  (\forall \varepsilon &gt; 0)(\exists \ \delta &gt; 0) (\forall x \in D)(0 &lt; |x - c | &lt; \delta \ \Rightarrow \ |f(x) - L| &lt; \varepsilon)$$ capture our intuition?  I want the answer to explain and motivate every bit of this formal statement. Remember: I am able to parse the statement, I just don't see how it captures our informal intuition. I've got the following two tables (in MySQL): Phone_book +----+------+--------------+ | id | name | phone_number | +----+------+--------------+ | 1  | John | 111111111111 | +----+------+--------------+ | 2  | Jane | 222222222222 | +----+------+--------------+  Call +----+------+--------------+ | id | date | phone_number | +----+------+--------------+ | 1  | 0945 | 111111111111 | +----+------+--------------+ | 2  | 0950 | 222222222222 | +----+------+--------------+ | 3  | 1045 | 333333333333 | +----+------+--------------+  How do I find out which calls were made by people whose phone_number is not in the Phone_book? The desired output would be: Call +----+------+--------------+ | id | date | phone_number | +----+------+--------------+ | 3  | 1045 | 333333333333 | +----+------+--------------+