When rolling out a new website change or web application change, sometimes browsers load old javascript or image files when you navigate to the site. Oftentimes it takes a manual refresh of the page for the browser to load in the newly updated files.  How can I make sure that after an update, users receive the most up-to-date files the first time they load the page, rather than having to manually refresh to clear out any cached files. Is there a very reliable way to do this through sending expires headers or last modified?
I have noticed that some browsers (in particular, Firefox and ) are very zealous in using cached copies of .css and .js files, even between browser sessions. This leads to a problem when you update one of these files, but the user's browser keeps on using the cached copy. What is the most elegant way of forcing the user's browser to reload the file when it has changed? Ideally, the solution would not force the browser to reload the file on every visit to the page.  I have found  and  suggestion to be useful. It turns out there is a term for this: auto-versioning. I have posted a new answer below which is a combination of my original solution and John's suggestion. Another idea that was suggested by SCdF would be to append a bogus query string to the file. (Some Python code, to automatically use the timestamp as a bogus query string, was .) However, there is some discussion as to whether or not the browser would cache a file with a query string. (Remember, we want the browser to cache the file and use it on future visits. We only want it to fetch the file again when it has changed.)
Related:   I know I must describe my past and current research in my personal/research statement or statement of purpose. But do I use technical terms?  I was given the advice that since the people reading my statement are mathematicians (I am applying to US for applied mathematics), they should know what I am talking about.  Although I am applying to applied mathematics, it would also be nice to hear from other fields (biology, computer science, engineering etc) about this. Why do universal constants have the values they do? This is meant to be a generic question of the type that we get repeatedly on this site, in different versions:        Why do universal constants have the values they do? Can we predict their values theoretically? Do they change over time? How would the world be different if a particular constant had a different value? How to control fan speed? If $p,q,r$ are all primes,and $p|qr-1$,$q|pr-1$ and $r|pq-1$,find all possible values of $pqr$. If $p,q,r$ are all primes,and $p|qr-1$$~~~~~~~~~~~~~$$q|pr-1$$~~~~~~~~~~$ and $~r|pq-1$. Find all possible values of $pqr$.    My work: $qr-1=pk_1$ $pr-1=qk_2$ $pq-1=rk_3$ From the above equations, we can conclude that either $k_1,k_2,k_3$ are all even or one of the primes is $2$. I can also get that, $p^2q^2r^2=(pk_1+1)(qk_2+1)(rk_3+1)$ Now, I cannot proceed. Please help! Add self-answer delay for all users TL;DR:  I believe there are still some issues with self-answers, particularly near-immediate self-answers, which are not addressed by the current system.  This could be remedied by imposing an automated restriction on how soon self-answers will be displayed in the thread.  Allow users to submit self-answers at any time, but do not display them until certain reasonable conditions (a relatively short timeout, or the posting of a competing answer) are met.    History  This thread covers a good deal of the concerns surrounding self-answers, and some mechanisms in place to prevent "bad" self-answers from new users and other abuse of the self-answer system.    As I understand it, the following restrictions apply:   Users with &lt;100 rep cannot self-answer within 8 hours of posting a question. Self-answers cannot be accepted within 48 hours of posting. Self-answers do not provide rep from being accepted. Accepted self-answers are not pinned to the top of the thread.   Problem  This does a good job of preventing users from posting answers which should probably be comments (or not posted at all), allows superior answers to rise above accepted self-answers, and prevents some other abuses of the system.  However, there is a less tangible element of self-answers which this does not address:    Self answers are a disincentive to other users who may otherwise be willing to post more accurate, detailed material stemming from broader or deeper knowledge and/or experience than the asker has.  When someone posts an answer to their own question, it presumably means that the problem which spawned the question is solved to their satisfaction.  This is fine for the purposes of sharing information with the community, but it deters others from providing solutions to the question which may be more complete or accurate since there is not so much likelihood that the self-answerer will accept a competing answer.  Worse, in the case of near-immediate self-answers, this can remove the incentive for other users to gain reputation via up-votes because the asker has an unfair head-start.  Unless everyone is required to view new answers to questions where they have already voted on an answer, most people probably vote on a good answer and never look at the question again.  This can put (potentially) better answers at a disadvantage even when the head-start is within an hour.  Suggested Solution  Add a delay to the posting of self-answers.  The delay should be the least of these:   Until a competing answer has been posted. A reasonable amount of time to allow competing answerers a chance to post, without preventing self-answers outright.  (Suggestion: 2 hours)   To better facilitate this, and avoid completely turning people off from appropriate self-answering, I suggest the delay be handled through automation more than user limitation.  That is, the user should be allowed to submit the self-answer at any time.  But the answer will not actually be displayed to other users until one of the above conditions have been met.  This could also be applied to the existing 8-hour delay for low-rep users.  Example:  T:0 - A user finishes resolving a tough problem, just before he would have gone to SE for assistance, and decides to share his new-found knowledge with the community.  He posts a question describing his problem.  T:5 minutes - The user then posts a self-answer.  There has not yet been another answer posted to the thread.  The user is given a notice describing the restrictions in place regarding self-answers, and the answer is submitted into the database but not displayed to other users.  (Similar to how suggested edits are only displayed to the user suggesting them, until they are approved.)  T:1 hour, 15 minutes - Another user sees the unanswered question, and posts their answer.  Their answer is displayed immediately, and the self-answer is now also displayed.  T:2 hours - Had the second answer not been posted, the self-answer would automatically be displayed after this point. I'm attempting a mass update on Contacts via Execute Anonymous. My code gives me the following error:     System.LimitException: Apex CPU Time Limit Exceeded   Here's my code:  List &lt;Contact&gt; contactList = [select Id, Mass_Update_Checkbox__c from Contact Limit 1000];  for (Contact contact : contactList) {     contact.Mass_Update_Checkbox__c = TRUE;  }  update contactList; How can I set the location (as it's picked up in CoreLocation services) in the iPhone Simulator? Book identification about boy who gets computer zapped into head I remember this book from 15+ years ago about a normal boy who was working on his computer (replacing the motherboard maybe?) and he touched something and got zapped. When he came to he came to realize that the computer shocked itself into his head.   Cut to being the hero sometime down the line and maybe saving someone who was kidnapped? Or was kidnapped himself and had to get out of it using the computer?  I don't know why it's in my head all of the sudden but Google isn't helping me at all! Where are Time Machine local backups/snapshots stored? Out of curiosity, I'm wondering where in the file system Time Machine stores its local backups/snapshots. I need Mac OS X 10.6.8 (Snow Leopard) in order to work with some legacy software and I want to buy new Mac Mini computer.  Is it possible to install this OS on a new Mac Mini or it's not compatible with it?  If so, what is the latest model of Mac Mini that I can use in this scenario? Automatically solve dependencies of deb packages while using dpkg -i Installing Deb packages on the command line, using dpkg -i, only installs the package in question and displays errors of unresolved dependencies (manually solved by apt-geting the packages it complains about). How do I automatically resolve dependencies when installing standalone packages? How to deal with travel excitement? How does one usually deal with excitement about travel, prior to travel ? A lot of people feel them butterflies in their stomach before a big travel is coming up. Is there an effective way to put these feelings away ? Or how can one best deal with such excitement/feelings (which almost cause interference with day to day activities) ? public static IQueryable&lt;TResult&gt; ApplySortFilter&lt;T, TResult&gt;(this IQueryable&lt;T&gt; query, string columnName)   where T : EntityObject {   var param = Expression.Parameter(typeof(T), "o");   var body = Expression.PropertyOrField(param,columnName);    var sortExpression = Expression.Lambda(body, param);   return query.OrderBy(sortExpression); }   Because the type for OrderBy is not inferred from sortExpression I need to specify it something like this at run time:  var sortExpression = Expression.Lambda&lt;T, TSortColumn&gt;(body, param);   Or  return query.OrderBy&lt;T, TSortColumn&gt;(sortExpression);   I don't think this is possible however as TSortColumn can only be determined during runtime.  Is there a way around this? What determines SPECIAL inheritance in children? Which prepositions are followed by accusative pronouns instead of reflexive pronouns? I have read answers to questions like  but I couldn't find a general rule for using "you" or "yourself", "him" or "himself" that could explain things I see in some examples.  For example, I think that one normally say (according to examples I see in ):   You bring something with you. You have something in you. You have something on you. You pressed her to you.   But on the other hand one would say:   You draw attention to yourself. He killed himself. You can try it out for yourself.   As a general rule, it seems that the reflexive pronoun is used when the object is the same as the subject of the verb. But for prepositional phrases, it seems more complicated. Do some prepositions (like "with", "in", "on") always come with the accusative form of the pronoun, and some other (like "for") don't? What about "to", that seems to be followed by both in different circumstances? How to install aircrack on Ubuntu 12.04 How does a credit card company make any money off of me using their card if there are no fees associated with the card (I don't pay any extra) and I pay off my balance on time every month (so I don't pay any fees ever for this either).  Are they just banking on the fact that many people don't do this and end up owing them money? Why is $x^0 = 1$ except when $x = 0$? How do I set focus follows mouse? Is there a way to set up "focus follows mouse" behavior in Unity? Using while loop to ssh to multiple servers I have a file servers.txt, with list of servers:  server1.mydomain.com server2.mydomain.com server3.mydomain.com   when I read the file line by line with while and echo each line, all works as expected. All lines are printed.  $ while read HOST ; do echo $HOST ; done &lt; servers.txt server1.mydomain.com server2.mydomain.com server3.mydomain.com   However, when I want to ssh to all servers and execute a command, suddenly my while loop stops working:  $ while read HOST ; do ssh $HOST "uname -a" ; done &lt; servers.txt Linux server1 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux   This only connects to the first server in the list, not to all of them. I don't understand what is happening here. Can somebody please explain?  This is even stranger, since using for loop works fine:  $ for HOST in $(cat servers.txt ) ; do ssh $HOST "uname -a" ; done Linux server1 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux Linux server2 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux Linux server3 2.6.30.4-1 #1 SMP Wed Aug 12 19:55:12 EDT 2009 i686 GNU/Linux   It must be something specific to ssh, because other commands work fine, such as ping:  $ while read HOST ; do ping -c 1 $HOST ; done &lt; servers.txt