I'd like to replace broken images with default one in a image gallery. I use jQuery to do this:  &lt;img src="#{articleController.getArticleMainImageLink(index)}"       class="articleImage" alt="#{msg['no.image.data']}" /&gt;  &lt;script type="text/javascript"&gt;     $(document).ready(function () {         $("img.articleImage").on("error", function(){             $(this).attr("src", "http://images5.fanpop.com/image/photos/28900000/Adriana-Lima-adriana-lima-28919058-1280-1024.jpg");         })     }); &lt;/script&gt;   The problem is that the default images do not appear immediately after page reload but after about two minutes (browser timeout?)  (tested with Firefox 31, Safari 6.1.6). Is there any way to resolve this problem?
I have a web page that includes a bunch of images. Sometimes the image isn't available, so a broken image is displayed in the client's browser.  How do I use jQuery to get the set of images, filter it to broken images then replace the src?    --I thought it would be easier to do this with jQuery, but it turned out much easier to just use a pure JavaScript solution, that is, the one provided by Prestaul.
I've noticed the following happen a few times:   A user posts a question. The question is closed as a duplicate and the usual "Possible Duplicate" links are added at the top. The user promptly removes the duplicate links, even though the question is still closed as a duplicate. (excessive use of list items =P)   Now, I could understand this behavior if there was some dispute about whether or not the question was a duplicate, and the OP were to remove the links and post reasons why they disagree with the closing. However, I've noticed this happening without any attempt to defend the question (such as ).  In my opinion, no one should be allowed to remove the "Possible Duplicate" links as long as the question is still closed as a duplicate. The links should remain for the benefit of the community, so they can navigate to the duplicate questions and either post answers there or read them over and judge if the closing was actually fair. Once/if the question is reopened the links could be edited out if one so chooses.  I guess this is part discussion, part feature request:  Could the "Possible Duplicate" links remain un-editable for as long as the question is still closed? how to decode this JSON string? GRUB doesn't show Windows 10 Whenever I boot into my system, Linux directly boots. If I press shift, GRUB shows only Linux, not Windows. Here are results of fdisk and update-grub. I think I have installed Linux the wrong way.  $ fdisk WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.   Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00000000     Device Boot      Start         End      Blocks   Id  System /dev/sda1               1  1953525167   976762583+  ee  GPT Partition 1 does not start on physical sector boundary.  $ update-grub Generating grub configuration file ... Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. Found linux image: /boot/vmlinuz-3.19.0-32-generic Found initrd image: /boot/initrd.img-3.19.0-32-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin   No volume groups found done In an exam paper, there was a picture of an air stewardess in the aeroplane serving passengers. One of my pupils wrote the following:      The air stewardess works on an aeroplane.    Shouldn't it be the air stewardess works in an aeroplane? Assign VNC password using script I am using a script to automatically set up a computer. I need to assign a password to the vnc server for the user, which is normally done using the vncserver command. However, it prompts for the user to enter and re-enter their password, neither of which the script is capable of doing. So, how can I set up the VNC password without an interactive prompt?   Thanks. Stopping xcode from indexing Impact of changing instances' passwords As part of a security policy, the company I work for has given me the task of changing the sa's and SQL Server Agent service accounts' passwords for several instances.  What's the possible impact of doing this? Is there anything in particular I should watch out for? Is there any whitepaper, guide or even blog post about this kind of task? What kind of 'backup' plan should I have in place in case anything goes wrong?  Any guidance is appreciated. I've taken up self-study of math. (How smart can that be?) I've just about finished a course in real analysis which spent a lot of time on metric spaces and some time revisiting calculus.  I was thinking of trying abstract algebra. I would appreciate any book recommendations.  Thanks in advance.  Andrew Disabled mac os SIP but still can't delete default apps I'm using mac os 11.2.1 Big Sur. My question concerns using the Terminal utility to delete Apple default apps protected by SIP. I have disabled System Integrity Protection and confirmed that it is off by typing: csrutil  Terminal duly returns &quot;disabled&quot; to confirm that SIP is definitely off. I then attempted to delete various Apple default apps, as follows: sudo rm -rf FaceTime.app/  sudo rm -rf TV.app/  sudo rm -rf Mail.app/  But nothing seems to happen. The apps are still in my Applications folder and launch normally. If I try to delete them manually, I get a beep and the deletion is rejected just as if SIP were still enabled. Can someone suggest a better way to remove Mail? How to compress / reduce the size of JPEG photos for archiving? I have 50,000 high resolution JPEG photos, where a couple of them might occasionally be needed, about once a year.  I wanted to zip them to save disk space, except that zipping gives no space benefit - so trying to reduce the images disk usage using winzip, winrar or 7zip was not successful.  Is there any software or algorithm similar to zip to compress image size on hard disk for storage without loosing any image information? Finding $\lim_{n\to\infty} a_n^n$ where $a_n=\frac{(n!)^2}{(n+k)!(n-k)!}$ What is the inverse of CoefficientList? A 64-bit double can represent integer +/- 253 exactly. Given this fact, I choose to use a double type as a single type for all my types, since my largest integer is an unsigned 32-bit number. But now I have to print these pseudo integers, but the problem is they are also mixed in with actual doubles. So how do I print these doubles nicely in Java? I have tried String.format(&quot;%f&quot;, value), which is close, except I get a lot of trailing zeros for small values. Here's an example output of of %f  232.00000000 0.18000000000 1237875192.0 4.5800000000 0.00000000 1.23450000  What I want is:  232 0.18 1237875192 4.58 0 1.2345  Sure I can write a function to trim those zeros, but that's lot of performance loss due to string manipulation. Can I do better with other format code?  The answers by Tom E. and Jeremy S. are unacceptable as they both arbitrarily rounds to two decimal places. Please understand the problem before answering.  Please note that String.format(format, args...) is locale-dependent (see answers below). How do I invoke a private static method using reflection (Java)? Why is English written and read from left-to-right as opposed to right-to-left, top-to-bottom, or (not even sure any language does this) bottom-to-top? How can I increase my Vault Dweller's Happiness? How are Contacts in Marketing Cloud counted? Salesforce bills Marketing Cloud on total number of Contacts within the system. I'd like to know what exactly is used to count these? Is this the Email Studio > All Subscribers list or the Contact Builder > All Contacts list?  When we have Marketing Cloud connector and synchronise the Contacts object, is this counted towards that number? (or only when they have been inserted into the All Subscribers / All Contacts list, as they are not done so automatically) Chain length. how long or how many links I measured from the middle of each sprocket and it's 17 inches. Not sure what length of chain I should get We have a pool of N number of balls.  There are: A number of white balls (W), B number of green balls (G), C number of blue balls (B), and D number of pink balls (P)  In how many ways (combinations) we can pick X number of balls from this pool? Is there a formula for something like this?  This is similar to combinations with replacement, but there are limitations to how many times a certain object can be replaced. Prove that there are infinitely many primes and non-primes in the numbers $10^n+1$, where $n$ is a natural number. So numbers are 101, 1001, 10001 etc.