I'm trying to understand why printing to a closed PrintStream does not display a stream closed exception, the way FileOutputStream does.   For example, the following code does not display an exception on Eclipse's console:  public class Try {     public static void main(String[] args) {         try {             PrintStream printStream = new PrintStream(System.out);             printStream.close();             printStream.println("ABC");         } catch (Throwable t) {             System.err.println("Throwable caught");         }     } }   Is it because the exception is happening on a separate thread?  Or perhaps is PrintStream.Println defined not to throw an exception?  Edit: Non of PrintStream's methods do. Even the ones inherited from FileOutputStream, which do throw exceptions. Possibly a violation of LSP.
Some days ago I realized that  (as well as ) never throw an IOException when writing, flushing or closing.  Instead it sets an internal flag (trouble=true) when an error occurs. It's not possible to get the exact exception, but only if there was some exception ().  My question is: why would one want to have such behavior? Isn't that bad API design?
How do I force Python's print function to output to the screen? Visual Studio C# statement collapsing When editing really long code blocks (which should definitely be refactored anyway, but that's beyond the scope of this question), I often long for the ability to collapse statement blocks like one can collapse function blocks.  That is to say, it would be great if the minus icon appeared on the code outline for everything enclosed in braces.  It seems to appear for functions, classes, regions, namespaces, usings, but not for conditional or iterative blocks.  It would be fantastic if I could collapse things like ifs, switches, foreaches, that kind of thing!  Googling into that a bit, I discovered that apparently C++ outlining in VS allows this but C# outlining in VS does not.  I don't really get why.  Even notepad++ will so these collapses if I select the C# formatting, so I don't get why Visual Studio doesn't.  Does anyone know of a VS2008 add-in that will enable this behavior?  Or some sort of hidden setting for it?  Edited to add: inserting regions is of course an option and it did already occur to me, but quite frankly, I shouldn't have to wrap things in a region that are already wrapped in braces... if I was going to edit the existing code, I would just refactor it to have better separation of concern anyway. ("wrapping" with new methods instead of regions ;) Why does an error appear every time I try to open the Ubuntu Software Center? There is a glitch on the Ubuntu Software Center and whenever I open it an error appears and it keeps loading and never opens.  Why does this happen?  I have installed Ubuntu 13.04 on a disk and partitioned it.  Please help me and ask for excess information if you need it.  If you know of any duplicates please show me them!!  I get the following error in a terminal  SystemError: E:Type '&lt;!DOCTYPE' is not known on line 1 in source list /etc/apt/sources.list.d/medibuntu.list   The /etc/apt/sources.list.d/medibuntu.list file contains a HTML document. How to derive $[x_i, F(\vec p)] = i \hbar \frac {\partial F(\vec p)}{\partial p_i}$ indicates that the following relation is &quot;easily shown&quot;: $[x_i, F(\vec p)] = i \hbar \frac {\partial F(\vec p)}{\partial p_i}$, however I'm having some trouble showing it.  I think I'm just messing up the multivariable Taylor expansion (of $F(\vec p)$).  Can one of you walk me through it or link me to site that will?  Thanks.  Edit: Here's what I get (without using $x=i\hbar \frac \partial {\partial p}$ which I haven't proven yet): $$F(\vec p) = F(\vec 0) + \sum^3_{j=1} \frac {\partial F(\vec 0)}{\partial p_j}p_j + \frac 12 \sum^3_{k=1} \sum^3_{j=1} \frac {\partial^2 F(\vec 0)}{\partial p_k \partial p_j} p_j p_k + \dots$$ so $$(x_iF(\vec p) - F(\vec p)x_i)\psi$$ $$= x_i[F(\vec 0)\psi -i\hbar \sum^3_{j=1} \frac {\partial F(\vec 0)}{\partial p_j}(\nabla \psi)_j + \hbar^2\frac 12 \sum^3_{k=1} \sum^3_{j=1} \frac {\partial^2 F(\vec 0)}{\partial p_k \partial p_j} (\nabla \psi)_j (\nabla \psi)_k + \dots]$$ $$- [F(\vec 0)x_i\psi -i\hbar \sum^3_{j=1} \frac {\partial F(\vec 0)}{\partial p_j}(\nabla x_i\psi)_j + \hbar^2\frac 12 \sum^3_{k=1} \sum^3_{j=1} \frac {\partial^2 F(\vec 0)}{\partial p_k \partial p_j} (\nabla x_i\psi)_j (\nabla x_i\psi)_k + \dots]$$ where $$(\nabla x_i\psi)_j=\frac {\partial x_i}{\partial x_j}\psi + x_i\frac {\partial \psi}{\partial x_j} = \delta_{ij}\psi + x_i\frac {\partial \psi}{\partial x_j}$$ and $$(\nabla x_i\psi)_j(\nabla x_i\psi)_k=(\delta_{ij}\psi + x_i\frac {\partial \psi}{\partial x_j})(\delta_{ik}\psi + x_i\frac {\partial \psi}{\partial x_k}) = \delta_{jk}\psi^2 + x_j \psi \frac {\partial \psi}{\partial x_k} + x_k \frac {\partial \psi}{\partial x_j} \psi + x_i^2 \frac {\partial^2 \psi}{\partial x_j \partial x_k}$$ Thus: $$(x_iF(\vec p) - F(\vec p)x_i)\psi$$ $$=  x_i[F(\vec 0)\psi -i\hbar \sum^3_{j=1} \frac {\partial F(\vec 0)}{\partial p_j}\frac {\partial \psi}{\partial x_j} + \hbar^2\frac 12 \sum^3_{k=1} \sum^3_{j=1} \frac {\partial^2 F(\vec 0)}{\partial p_k \partial p_j} \frac {\partial \psi}{\partial x_j} \frac {\partial \psi}{\partial x_k} + \dots]$$ $$- [F(\vec 0)x_i\psi -i\hbar \sum^3_{j=1} \frac {\partial F(\vec 0)}{\partial p_j}(\delta_{ij}\psi + x_i\frac {\partial \psi}{\partial x_j}) + \hbar^2\frac 12 \sum^3_{k=1} \sum^3_{j=1} \frac {\partial^2 F(\vec 0)}{\partial p_k \partial p_j} (\delta_{jk}\psi^2 + x_j \psi \frac {\partial \psi}{\partial x_k} + x_k \frac {\partial \psi}{\partial x_j} \psi + x_i^2 \frac {\partial^2 \psi}{\partial x_j \partial x_k}) + \dots]$$ From here it doesn't look like those higher order terms are all going to cancel out. What is the difference between String.Empty and "" (empty string)? Solving $\sqrt{x+5} = x - 1$ I'm currently learning about radicals and simplifying them, and I came across this problem on the internet and tried to solve it:  $$\sqrt{x+5} = x - 1$$  So I used this logic:  $$ \begin{align} \sqrt{x+5} &amp;= x - 1 \\ x + 5 &amp;= (x-1)^2 \\ x + 5 &amp;= (x-1)(x-1) \\ x + 5 &amp;= x^2 - 2x + 1 \\ 0 &amp;= x^2 - 3x - 4 \\ 0 &amp;= (x-4)(x+1) \\ \end{align} $$  Therefore, $x = -1$ and $x = 4$ satisfy the equation $0 = (x-4)(x+1)$.  But then I tried to plug them in the original problem $\sqrt{x+5}=x-1$:  $$ \begin{align} \sqrt{4 + 5} &amp;= 4 - 1 \\ \sqrt{9} &amp;= 3 \\ 3 &amp;= 3 \end{align} $$  So using 4 works as expected, but when using $-1$:  $$ \begin{align} \sqrt{-1 + 5} &amp;= -1 - 1 \\ \sqrt{4} &amp;= -2 \\ 2 &amp;\ne -2 \end{align} $$  At what stage am I going wrong?  And according the , the solution is $x = 4$. How to find real world Selenium projects Where can I find sample or real Selenium projects. All the material I can find on github and on internet are basic, and never intermediate or advanced.  How does a real Selenium project look in real life? How can I find sample code? How do I get 0-padded numbers in {} (brace expansion)? I'm trying to write a simple script to retrieve mem and swap usage from a list of hosts. Currently the only way I've been able to achieve this is to write 3 seperate scripts:  for a in {1..9}; do echo "bvrprdsve00$a; $(ssh -q bvrprdsve00$a "echo \$(free -m|grep Mem|/bin/awk '{print \$4}';free -m|grep Swap|/bin/awk '{print \$4}')")"; done &gt; /tmp/svemem.txt; for a in {10..99}; do echo "bvrprdsve0$a; $(ssh -q bvrprdsve0$a "echo \$(free -m|grep Mem|/bin/awk '{print \$4}';free -m|grep Swap|/bin/awk '{print \$4}')")"; done &gt;&gt; /tmp/svemem.txt; for a in {100..218}; do echo "bvrprdsve$a; $(ssh -q bvrprdsve$a "echo \$(free -m|grep Mem|/bin/awk '{print \$4}';free -m|grep Swap|/bin/awk '{print \$4}')")"; done &gt;&gt; /tmp/svemem.txt   The reason for this is that the hostname always ends in a 3 digit number and these hosts go from 001-218 so I've needed to do a different for loop for each set (001-009, 010-099, 100-218). Is there a way in which I can do this in one script instead of joining 3 together? How are the best director award winners chosen? I do not understand how the best director awards are determined each year. It seems impossible to assess the method of a movie director unless you are part of the crew.  So, how do the nominators/judges assess the directors' performance each year? I have always believed that it was ok to replace a capacitor with a slightly higher voltage rated one. eg 16v with 25v.Going higher than this would risk the capacitance value being out at the working voltage. However I just read the following quote from this       Electrolytic capacitors are non-ferroelectric with a very low dielectric constant. Their capacitance is derived from a very high surface area and nanometer thick dielectric layers. Their capacitance is not a function of applied voltage.‐Design Solutions For DC Bias In Multilayer Ceramic Capacitors (August 2010 Electronic Engineering Times)   So does this rule not apply to aluminum electrolytics? Eg will I have no issues replacing an electrolytic 25v 100uf with a 50v 100uf assuming both are low esr, similar footprint and good quailty? Abnormal behavior with iwlwifi driver: the device is shown as not working Recently I've installed Kubuntu in a newly bought laptop with an Intel WiFi 6 AX200 network card, I can connect to the wifi without apparent problems but when I open the driver manager in the settings I face this weird situation:  Intel Corporation: Wi-Fi 6 AX200 This device is not working.  [ ] Using iwlwifi driver backport in DKMS format from backport-iwlwifi-dkms (open source)  [ ] Continue using a manually installed driver  [x] Do not use the device   Note that "Continue using a manually installed driver" is the only voice selectable in the list.  Here is some additional information:  $ lspci -nnk | grep 0280 -A3 02:00.0 Network controller [0280]: Intel Corporation Wi-Fi 6 AX200 [8086:2723] (rev 1a)         Subsystem: Intel Corporation Wi-Fi 6 AX200 [8086:0084]         Kernel driver in use: iwlwifi         Kernel modules: iwlwifi  $ rfkill list all 0: hci0: Bluetooth         Soft blocked: yes         Hard blocked: no 1: phy0: Wireless LAN         Soft blocked: no         Hard blocked: no  $ dmesg | grep iwl [    2.888227] iwlwifi 0000:02:00.0: enabling device (0000 -&gt; 0002) [    2.945179] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-cc-a0-50.ucode failed with error -2 [    2.945217] iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-cc-a0-49.ucode failed with error -2 [    2.947244] iwlwifi 0000:02:00.0: TLV_FW_FSEQ_VERSION: FSEQ Version: 43.2.23.17 [    2.947250] iwlwifi 0000:02:00.0: Found debug destination: EXTERNAL_DRAM [    2.947252] iwlwifi 0000:02:00.0: Found debug configuration: 0 [    2.947697] iwlwifi 0000:02:00.0: loaded firmware version 48.4fa0041f.0 op_mode iwlmvm [    3.145585] iwlwifi 0000:02:00.0: Detected Intel(R) Wi-Fi 6 AX200 160MHz, REV=0x340 [    3.159226] iwlwifi 0000:02:00.0: Applying debug destination EXTERNAL_DRAM [    3.160060] iwlwifi 0000:02:00.0: Allocated 0x00400000 bytes for firmware monitor. [    3.336456] iwlwifi 0000:02:00.0: base HW address: 50:eb:71:d7:0b:40 [    3.353553] iwlwifi 0000:02:00.0 wlp2s0: renamed from wlan0 [    4.457920] iwlwifi 0000:02:00.0: Applying debug destination EXTERNAL_DRAM [    4.621843] iwlwifi 0000:02:00.0: FW already configured (0) - re-configuring [    4.629999] iwlwifi 0000:02:00.0: BIOS contains WGDS but no WRDS   Someone have idea why this happened? My phone was stolen last night. I made sure it was in Lost Mode in iCloud and it was immediately in Offline status when I open iCloud. I am positive the thief switched it off. Now I am 100% certain the Find my iPhone option was turned on on my iPhone, but will the "Lost Mode" be of any help if it was not turned on on the iPhone? Would it be showing "Offline" if I did not turn on the option? Is "logicalising" a valid word? Is logicalising a valid word, if the meaning was to make something supposedly 'illogical', logical? I know than an ellipsis can be used to show a broken sentence, the same way an em dash can be used. What I don't know is that if the two are interchangeable and it is writer preference or if different meaning is conveyed by their use.  Are ellipses and em dashes commutable? Why does latex stretch small sections across the whole page vertically? If $E[X|Y]=Y$ almost surely and $E[Y|X]=X$ almost surely then $X=Y$ almost surely My laptop has 500gb hard disk in which for 250gb I installed Windows xp on C drive(primary partition). I want to install Ubuntu 12.04 in the remaing hard drive with dual boot option. When I am going to install Ubuntu it is showing something like  /boot /boot/   Can anybody help me in this regard that where and how to install Ubuntu? Bash copy all files that don't match the given extensions When I import pictures from my camera in Shotwell, it also imports the video clips. This is somewhat annoying, as I would like to store my videos in another folder. I've tried to write a bash command to do this, but have not had success.  I need a command that meets the following requirements:   Locate all files in a directory structure that do not have an extension of .jpg, .png, .gif, or .xcf (case insensitive). Move all of these files into a target directory, regardless of whether the file names or directory paths contain spaces or special characters.   Any help would be appreciated!  EDIT: I'm using the default shell in Ubuntu, meaning that some commands are aliased, etc.  EDIT 2: I've attempted this myself (not the copy part, just the listing of files part). I turned on extglob and ran the following command:  $ ls -R /path | awk '   /:$/&amp;&amp;f{s=$0;f=0}   /:$/&amp;&amp;!f{sub(/:$/,"");s=$0;f=1;next}   NF&amp;&amp;f{ print s"/"$0 }'   This lists everything. I tried using grep on the end of it, but haven't the foggiest idea of how to get it to not match a pattern I give it. The extglob switch didn't help much with grep, even though it does help with other commands. How does delete[] know it's an array? Ireland Transit Visa when flying from IND - Abu Dhabi - Dublin - US