I am trying to download a file from my onedrive using the microsoft graph api. I have managed to get to the point where i can retrieve the item from the GraphServiceClient. However, once i get the file using /me/Drive/Items/{itemid}/Content it returns to me a System.IO.Stream object.  How do i use this System.IO.Stream object to download the file?  Here is the code i have now for getting the file (for security purposes i did not put the itemid in the sample code, but i can assure you it is correct.) :  public async Task&lt;ActionResult&gt; OneDriveDownload() {     string token = await GetAccessToken();     if (string.IsNullOrEmpty(token))     {         // If there's no token in the session, redirect to Home         return Redirect("/");     }      GraphServiceClient client = new GraphServiceClient(         new DelegateAuthenticationProvider(             (requestMessage) =&gt;             {                 requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);                  return Task.FromResult(0);             }));      try     {         var stream = await client.Me.Drive.Items[ItemID].Content.Request().GetAsync();         return View(stream);     }     catch (ServiceException ex)     {         return RedirectToAction("Error", "Home", new { message = "ERROR retrieving messages", debug = ex.Message });     } }   Additionally, i would like to create a button that can execute this download in the view.
I have a StreamReader object that I initialized with a stream, now I want to save this stream to disk (the stream may be a .gif or .jpg or .pdf).  Existing Code:  StreamReader sr = new StreamReader(myOtherObject.InputStream);    I need to save this to disk (I have the filename). In the future I may want to store this to SQL Server.   I have the encoding type also, which I will need if I store it to SQL Server, correct?
How to get horizontal black line when coloring cells? Find all $n\in\mathbb N^+$ such that the sum of the digits of $5^n$ is equal to $2^n$.   I've solved this, but I think the proof is a bit weird and I wonder if there's a better one.    My proof:  We can see that $n\neq 1$, $n\neq 2$, $n=3$, $n\neq 4$ and $n\neq 5$.  Let $n&gt;5$. Notice that $5^6$ has $5$ digits, while $\frac{2^6}{9}=7\frac{1}{9}$, so $5^6$ has to have at least $8$ digits in order for the sum of the digits to be able to at least reach $2^6$.  Everytime $1$ is added to the exponent of $5$, the amount of digits $5^n$ gets is at most $1$, while $\frac{2^{n+1}}{9}-\frac{2^n}{9}=\frac{2^n}{9}&gt;3$, so the lowest amount of digits it has to have to reach $2^n$ becomes higher by at least $4$.  When $n=6$, the amount of digits $5^n$ has is already lower than the amount it has to have in order to reach $2^n$, and I've just proved that the amount it has to have in order to reach $2^n$ grows faster than the amount of digits $5^n$ has, therefore $5^n$ will never be able to reach $2^n$ when $n&gt;5$.  Hence the only solution is $n=3$. How to count entities with commands/check if there are only one or a certain number of entities or players left? I want to run a command when there are only 10 entities left. I know you can use /execute unless entity to detect when all matching mobs have died, but it doesn't work if you want to run a command when there are for example 10 entities left.  A command like /execute if entity @e[limit=10] does not work, it also triggers if there is only one entity.  Such a counting system could also be used to determine once there is only one player left in an arena, meaning they have won a battle or similar. Multiple Apple Developer Accounts Idiom for a speech with redundant information I have been struggling for one hour with this simple problem (QGIS 1.8.0-Lisboa, Windows 7) :  I have a raster layer. I would like to display the label and not only the band value when I use the Identify Features button. Is it possible? If $\tan(\frac{\pi}{4}+\frac{y}{2})=\tan^3(\frac{\pi}{4}+\frac{x}{2})$,then prove that $\sin y=\frac{\sin x(3+\sin^2 x)}{(1+3\sin^2 x)}$ If $\tan(\frac{\pi}{4}+\frac{y}{2})=\tan^3(\frac{\pi}{4}+\frac{x}{2})$,then prove that $\sin y=\frac{\sin x(3+\sin^2 x)}{(1+3\sin^2 x)}$    $\tan(\frac{\pi}{4}+\frac{y}{2})=\tan^3(\frac{\pi}{4}+\frac{x}{2})$ $\frac{1+\tan\frac{y}{2}}{1-\tan\frac{y}{2}}=(\frac{1+\tan\frac{x}{2}}{1-\tan\frac{x}{2}})^3$ Applying componendo and dividendo rule on both sides, $\tan\frac{y}{2}=\frac{\tan\frac{x}{2}(3+\tan^2\frac{x}{2})}{(1+3\tan^2\frac{x}{2})}$ I am stuck here. Travelling from London, Heathrow to Lusaka, via Jo'burg, how much time should we allow for the international connection in Jo'burg?  Is it a matter of arriving at one gate and leaving at another, or do you have to go through passport control, customs, security? What is this heart in the crimson biome? I found this heart while exploring the crimson biome - what is it? , but how can I add or edit a URL (or URI) in the history? How do I install a .tar.gz (or .tar.bz2) file? I have downloaded tar.gz files. But I don't know how to install it. How do I install this kind of file? Android cancel Toast when exiting the app and when toast is being shown How do I switch to first person? Getting new files to inherit group permissions on Linux Restrict certain mods to certain worlds Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like this: __myPrivateMethod(). How, then, can one explain this  >>> class MyClass: ...     def myPublicMethod(self): ...             print 'public method' ...     def __myPrivateMethod(self): ...             print 'this is private!!' ...  >>> obj = MyClass() >>> obj.myPublicMethod() public method >>> obj.__myPrivateMethod() Traceback (most recent call last):   File "", line 1, in  AttributeError: MyClass instance has no attribute '__myPrivateMethod' >>> dir(obj) ['_MyClass__myPrivateMethod', '__doc__', '__module__', 'myPublicMethod'] >>> obj._MyClass__myPrivateMethod() this is private!!   What's the deal?!  I'll explain this a little for those who didn't quite get that.  >>> class MyClass: ...     def myPublicMethod(self): ...             print 'public method' ...     def __myPrivateMethod(self): ...             print 'this is private!!' ...  >>> obj = MyClass()   What I did there is create a class with a public method and a private method and instantiate it.  Next, I call its public method.  >>> obj.myPublicMethod() public method   Next, I try and call its private method.  >>> obj.__myPrivateMethod() Traceback (most recent call last):   File "", line 1, in  AttributeError: MyClass instance has no attribute '__myPrivateMethod'   Everything looks good here; we're unable to call it. It is, in fact, 'private'. Well, actually it isn't. Running dir() on the object reveals a new magical method that python creates magically for all of your 'private' methods.  >>> dir(obj) ['_MyClass__myPrivateMethod', '__doc__', '__module__', 'myPublicMethod']   This new method's name is always an underscore, followed by the class name, followed by the method name.  >>> obj._MyClass__myPrivateMethod() this is private!!   So much for encapsulation, eh?  In any case, I'd always heard Python doesn't support encapsulation, so why even try? What gives? How does the Ready action work? So from reading the Player's Handbook, it seems that the Ready action is taken instead of any other action as it is an action in its own right. However, can you move on the same turn that you ready an action? For instance, (taking the example from the Player's Handbook):     If the cultist steps on the trapdoor, I’ll pull the lever that opens it   Presumably, when you ready this action, you would want to move near to the lever so you can pull it when the time is right. Likewise, with readying a spell, you would obviously want to move away from combat so you could concentrate on the spell.  Secondly, when the trigger goes off do you have to wait for your turn, or do you in effect get a bonus turn? For instance, the cultist starts running towards you, but on his way he steps on the trap door - so you immediately pull the lever, even though it wasn't your turn. I assume you then act as normal when your actual turn comes around? Photoelectric Effect - Dependence of current on frequency We all know that the amount of current flowing b/w the plates is independent of the frequency. If I were to ask why doesn't it depend then you'd probably say that it depends on the number of electrons rather than the frequency or you might show me a current vs frequency graph.  But here is my theoretical argument. Electric current is defined as the amount of charge flowing through a point/space/wire per unit time. Let I be current due to photo electrons ejected by photons of some frequency. Now if I would increase the frequency, the kinetic energy of the ejected electron would increases, therefore it will move faster and therefore contribute more current (charge will through the same point many times per unit time) . Thereby, giving a net current greater than I.  What is wrong with my argument?  After thinking a lot, I came up with a possible reason. However fast the electrons may move, but when they hit the metal plate, they would lose their velocity and start moving in drift velocity. Now there is a problem with this argument. If this were to be true then I should expect to see a big chunk of extra electrons getting stuck at the anode.  If my reasoning was correct, then why can't I see a big charge buildup at the anode. I have 3 accounts that I am deleting - however, several hours after the 24 hour (+ grace period - end about 4-5 hours ago), the countdown completed, but disappeared and the accounts are still there.   I would rather not go through another 24 hours, and would like to have these accounts deleted (and yes, I have thought about it and this decision is not up for discussion).  Currently, the accounts are still there.  Could this please be seen to? Why doesn't the Moon fall onto the Earth?