Consider the following situation:   A base class named Result. A derived class of Result named RBTResult. A derived class of RBTResult named ResultNL  class Result {}  class RBTResult : Result {}  class ResultNL : RBTResult {}    There's a List of 'Result' which holds concrete instances of RBTResult. So far so good.      static void Main(string[] args) {         List&lt;Result&gt; results = new List&lt;Result&gt; {           new RBTResult(),            new RBTResult()          };          append&lt;ResultNL&gt;(results);     }   We pass that list to a generic function append&lt;T&gt;() where the generic type T is ResultNL.  In append there is a loop casting every item in the list to the generic type argument but there an InvalidCastException is thrown every time.      static void append&lt;T&gt;(List&lt;Result&gt; res) where T : Result     {         List&lt;Result&gt; l = new List&lt;Result&gt;();         foreach (var r in res)         {             try             {                 _ = (T)r;                 l.Add(r);             }             catch (InvalidCastException e) { }         }     }   I would say it should be possible to cast from RBTResult to T (ResultNL) because it is a derived class, but it doesnt.   Why is that? How to make this work?
Is it possible to assign a base class object to a derived class reference with an explicit typecast in C#?.  I have tried it and it creates a run-time error.
Strange Pop-up appldnld.apple.com:80 I received a strange Pop Up message. The unsettling part is password will be sent in clear text.  Is my phone affected with any malware or app virus ? Big Endian vs. Little Endian in Qiskit I've noticed that Q# favors Little Endian. Meaning that most operations are designed for this type of encoding.  Is is it the same with Qiskit? How can I assign the output of a command to a shell variable? If $\sigma_n=\frac{s_1+s_2+\cdots+s_n}{n}$ then $\operatorname{{lim sup}}\sigma_n \leq \operatorname{lim sup} s_n$ This is a question from the book Methods of Real Analysis by R. R. Goldberg.     If $(s_n)$ is a sequence of real numbers and if $$\sigma_n=\frac{s_1+s_2+\cdots+s_n}{n}$$ then prove that: $\operatorname{{lim sup}}\sigma_n \leq \operatorname{lim sup} s_n$.   I don't have any idea how to start working on this problem. Please help. Thanks. Could I replace headphones NIMH battery with Lithium Ion phone battery of the same voltage? How do I find out which folder an app is in in iOS 11? In older versions of iOS, if I searched for an app with Spotlight, it would tell me which folder the app was in. (E.g., this feature still works on my iPad, which is running iOS 9, but not on my iPod Touch, which is running iOS 11.)  This feature seems to have been removed at some point. When I search for an app under iOS 11 using Spotlight, it will find the app and let me run it, but it doesn't tell me which folder it is in.  How can I find out which folder an app is in now? Getting nauseated from air travel, but it's not motion sickness... what to do? How to change permission external hard drive in ubuntu 12.04 I want to copy any file to my external hard drive. But always when I tried to do this I have next output:  cp: cannot create regular file /media/NameOfCard/[file]' : Read only file system  I also tried:  sudo chmod -R 775 /media/NameOfCard sudo chmod -R 777 /media/NameOfCard   But the same effect - ... Read only file system  Update:   After mount I have next output:  nazar_art@nazar-desctop:~$ mount /dev/sda1 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) /dev/sdb1 on /media/sdb1 type vfat (rw) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) gvfs-fuse-daemon on /home/nazar_art/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=nazar_art)   Any suggestions?   How to solve this trouble and let permission to copy and delete files to hard drive? root@SERVER ~$ df Filesystem  512-blocks  Free    %Used   Iused   %Iused  Mounted on /dev/YXCV   655360      365632  45% 6322    13% / /dev/ASDF   3801088     670648  83% 41759   32% /usr /dev/ASR    1048576     500496  53% 5555    9%  /var   How can I pipe the df command's output to only display lines that have more usage than 80%?  e.g.: it would only display:  /dev/ASDF   3801088     670648  83% 41759   32% /usr E:Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages I am not sure what caused this error, but here is what the whole error says, and also this is sitting as a notification, and preventing me from updating any software using Update Manager - Please provide some assistance or tell me how to figure out what to do to fix it.  Could not calculate the upgrade  An unresolvable problem occurred while calculating the upgrade.  Please report this bug against the 'update-manager' package and include the following error message: 'E:Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' Kinetic energy conservation in a collision Kinetic energy conservation in collision.  In any type of collision type of collision if we take the system to comprised of both bodies then the net external force is zero. So the work done by external force is also zero. By the relation $W=K_f-K_i$ as $W$ is zero hence kinetic energy is conserved. But this not the case.   Can you tell me what is the flaw in my argument? Some people say that the argument has neglected the fact that some kinetic energy is transformed into heat. But heat is created due to the interactions between bodies during collision which is thus an internal force and thus shouldn't affect kinetic energy. I've believed for a long time that every Lie group can be decomposed as the semidirect product of a connected Lie group and a discrete Lie group. However, in , it is mentioned that this is not true, and that there exist obstructions to this decomposition. Unfortunately, the level of complexity in the answers goes a bit over my head.  This type of decomposition is also addressed in .  With this loss of faith in my intuition, I have three questions:   Is it true that Lie groups do not necessarily decompose into the semidirect product of a connected group and a discrete group? If this decomposition doesn't always work, then is there a particularly nice argument as to why it doesn't? If this decomposition doesn't always work, then is there a nice example I can use to convince myself that my intuition is wrong?   Edit: As much as I love Qiaochu Yuan's answer, which is thorough and (as usual) a role model among Stack Exchange answers, this is not what I'm looking for. I'm aware of the general extension problem, and that not every short exact sequence splits, but my intuition has led me to think that each Lie group can be decomposed this way. I will certainly play around with his outline for a construction, but I would much prefer a more concrete answer. Once again, thank you!  Edit: As of yet, playing with the construction suggested by Qiaochu hasn't yielded anything interesting. This question is still open to answers! Maximum and minimum of $f(x)=\cos(\sin(x))-\sin(\cos(x))$ Given the function: $$f(x)=\cos(\sin(x))-\sin(\cos(x))$$ it has absolute maxima at $x=(2k+1)\pi$ with $k=0,1,..N$ and relative maxima at $x=2k\pi$. It is not clear where are the minima. Putting the derivative to zero doesn't help. Any suggestion on how to find the minimum value and where is it? Thanks. How does the Wizard spellbook work? How do I determine what spells are in my spellbook when creating a character? Do I simply have a spellbook with all Pathfinder spells? Or if I'm creating a level 6 wizard, do I start knowing all level 6 spells, and then have to learn the rest as I play the game? Is the electromagnetic spectrum discrete? Boats from Manaus, Brazil to Leticia, Colombia? I've heard of and met a few people who have done this route, and I hope to do it at the end of this year or early next year.  However, the descriptions were mostly sketchy, and I'm wondering if it's a regularly scheduled service, or more ad-hoc.  So I guess the question is, how can I find out which boats go from Manaus to Leticia, and when they go?  Ideally this wouldn't be a tour, but a 'locals' boat. Avoiding "(Not Responding)" label in windows while processing lots of data in one lump I occasionally need to process a large amount of data from one package off the network, which takes sufficiently long that when the user tries to interact with the application windows adds the "(Not Responding)" string to the window title. I am aware this is because the processing is being done within a call to handle a message (some way up the stack) and therefore is blocking the message pump. I'm also aware the ideal way to deal with this is to process the data asynchronously in a separate thread so the pump can continue running, however this is a LARGE desktop application which is single threaded from top to toe and safely spinning this processing off is not feasible in our time frame.  So with that in mind, is there by any chance a way I can at least avoid the "not responding" moniker (which to most users reads as "has crashed") by telling windows my application is about to be busy before I begin the work? I believe there is something along these lines when responding to a request to close, one can keep asking windows for more time to avoid it proclaiming that your not "closing in a timely fashion"  I should add this is a C++ MFC application. Is there a way to change the restrictions passcode on an iPhone without restoring the phone? I haven't forgotten the passocde; I just want to change it. 80's pop song with lyric "It's the story of my life if you wanna know" I'm trying to identify a song by a female 80's pop group.   Here are the lyrics I remember:     It's the story of my life if you want to know   a play where everything is meant to be   you're the story of my life and I can't let you go Different methods to compute $\sum\limits_{k=1}^\infty \frac{1}{k^2}$ (Basel problem)