Background: I am implementing a custom cache handler in PHP. The cache script is triggered on-demand by website traffic. I want to intelligently handle an influx of simultaneous requests. To do this, I'm using the first request to trigger the cache writer. Concurrent requests are be deferred until after the cache is built. I welcome debates regarding this approach, but I still want an answer to my actual question below.  Question: I'd like to know the best method to defer loading of webpage content. Here are two options I'm considering.  Option 1: Delay the response server-side. I don't like this option because I could end up having hundreds of sleeping connections, and I don't think hosts would like that.  &lt;?php while (!file_exists($cache)) sleep(1);   Option 2: Reload the page client-side. I don't like this option because the requests could be doubled, or trippled, depending on how long it takes to build the cache. With this I'm also worried about SEO Optimization. Will bots retry the page? Will they try more than once if the page still isn't ready?  &lt;?php header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); // Maybe code 408 Instead header('Retry-After: 1'); header("Refresh: 1"); // Maybe some JavaScript to reload the page instead   Maybe there's another best approach?
I have a website the seems to load very slowly. When I run a speed test on it I see there seems to be a 6 secound gap before the HTML loads. Images and JS scripts load very fast after that point.  You can see in the pic below the yellow 'wait time' bars:    This seems to be consistant no matter what the HTML content on the page is.  This site is using a CMS (ModX Revo) so HTML is actually stored in an SQL database and brought forth by PHP, but I've never experienced this issue before.  Would anyone know what is causing this and how I could speed it up?
Let a,b,c,d be real or complex numbers with absolute value less than $1$. Is the following true:  $$|ab-cd| \leq |a-c| +|b-d|?$$ Control 220V AC line using MCU Cryptoclass Throws Error. Invalid private key. Must be 16 bytes. Sending 16 characters long key key__c :- abcdefghijklmnop  public static String decrypt(String data) {     EncryptionSettings__c settings = EncryptionSettings__c.getOrgDefaults();     if (settings.key__c == null) {         throw new FacebookException('Cannot decrypt without a key!');     }     Blob key = EncodingUtil.base64Decode(settings.key__c);     return Crypto.decryptWithManagedIV('AES128', key, EncodingUtil.base64Decode(data)).toString(); }  public static String encrypt(String data) {         EncryptionSettings__c settings = EncryptionSettings__c.getOrgDefaults();     Blob key = null;     if (settings.key__c == null) {         checkUserCanCustomizeApplication();         key = Crypto.generateAesKey(128);         settings.key__c = EncodingUtil.base64Encode(key);         insert settings;     } else {         key = EncodingUtil.base64Decode(settings.key__c);     }     return EncodingUtil.base64Encode(Crypto.encryptWithManagedIV('AES128', key, Blob.valueOf(data))); } Pulling a CSV file from website into QGIS with ability to automatically refresh? split file lines based on first field I have file with content like below and want to convert my output like below   Input  1,a,b,c 2,b,c 3,e,f 4,l  Required output  1,a 1,b 1,c 2,b 2,c 3,e 3,f 4,l    Values on first field is unique and no duplicate lines for 1st field in the input.  I am new to scripting and not sure how can we do this. I want to exclude certain local folders with Google Drive but I *keep* them on the computer Using Google Drive on Windows (although I think the same question applies to OS/X) I want to exclude certain local folders but keep them on the computer.  When I go to Drive preferences and deselect specific folders, it wants to remove them from the local PC and keep them only in the cloud.  This doesn't work for me.  I feel like I could do this in earlier versions of the Google Drive client but I cannot recall for sure.  Is this possible? So I have an old unlocked phone and I'd like to load up my own OS.  I've seen some mods out there.  CyanogenMod seems to be the most popular.  However, I was curious if I could just install a pure untouched version of the OS -- as distributed by Google. I seem to remember being able to download a clean compiled version of the Android OS.    Does Google distribute any binaries like this, and if not, is there someone out there that does?    Additionally, is this even worth trying?  These days is it necessary for Android to be packaged with special drivers and such for all of the different hardware out there? I've got a bunch of files named with a the pattern 99 - DescriptiveName.txt and I'd like to remove the number from the front so I just have DescriptiveName.txt.  How can I do this? Can I do it from the command line or is there a utility that can do this? MacBook Pro: How to disable discrete GPU permanently from EFI? Find the infinite sum of the series $\sum_{n=1}^\infty \frac{1}{n^2 +1}$ This is a homework question whereby I am supposed to evaluate:  $$\sum_{n=1}^\infty \frac{1}{n^2 +1}$$  Wolfram Alpha outputs the answer as   $$\frac{1}{2}(\pi \coth(\pi) - 1)$$  But I have no idea how to get there. Tried partial fractions (by splitting into imaginary components), tried comparing with the Basel problem (turns out there's little similarities), nothing worked. For symmetric stable distributions, why is $\alpha \le 2$? Is it possible to use the fact that $\sum_{n=1}^\infty \frac{1}{n^4} = \frac{\pi^4}{90}$ to compute $\sum_{n=1}^\infty \frac{(-1)^n}{n^4}$? Equivalent of "former" and "latter" for more than 2 items Former and latter are valid only when there are two choices.  If I have a list of more than two items, is there an elegant way to say the first one or the last one? How to force a table into page width? I have the following table:  \begin{table}[htb] \begin{tikzpicture} \node (table) [inner sep=0pt] { \begin{tabular}{ l | l }   {\bf Symptom} &amp; {\bf Metric} \\ \hline Class that has many accessor methods and accesses a lot of external data &amp; ATFD is more than a few\\ Class that is large and complex &amp; WMC is high\\ Class that has a lot of methods that only operate on a proper subset of the instance variable set &amp; TCC is low\\ \end{tabular} }; \draw [rounded corners=.5em] (table.north west) rectangle (table.south east); \end{tikzpicture} \caption{God class symptoms} \label{tbl:god_class} \end{table}   Now I want to force the width of the table to be the same as the \textwidth, either by linewrapping of table text or by scaling. How can I achieve that? I recently saw a question about a problem (or possible bug) with some product on Stack Overflow. At first, I wanted to suggest that the asker post his question to that product's support forum.  When searching for the URL of that forum, I noticed that the product developer closed its support forums and now advises users to post all their questions on Stack Overflow instead.  Is this within the intended use cases of Stack Overflow, or is this abuse? I have the following text:    A   Hello   world   B   Hello   world   C   Hello   world   I know that I can replace Hello by Hi using sed:  sed 's/Hello/Hi/g' -i test   but this replace each Hello with Hi:    A   Hi   world   B   Hi   world   C   Hi   world   what I really want is to replace only the Hello after B:    A   Hello   world   B   Hi   world   C   Hello   world   so I have tried this:  sed 's/"B\nHello"/"B\nHi"/g' -i test   but nothing happened, How can I do this?  Note: There are some white-spaces on the beginning of each line of the file. Use central limit to solve a problem I am asked to solve the following question using central limit theorem. In an election between two candidates, A and B, one million individuals cast theirvote. Among these, 2000 know candidate A from her election campaign and vote unanimously for her.The remaining 998000 voters are undecided and make their decision independently of each other byflipping a fair coin.Approximate the probability pA that candidate A wins up to 3 significant figures.  It's easy to solve directly. PA = $\frac{0.5(10000-2000)+2000}{10000}$ = 0.501. However, I am quite confused about how to solve this problem by central limit theorem. Just downloaded a .zip file from the internet. I want to use the terminal to unzip the file. What is the correct way to do this? How long does the new dwellers queue last? When clicking the radio room icon that attracts a new dweller to your vault, how long will they stay queued out in front of the vault for before giving up?  Or will they?  I'm at max population and would rather not kill existing dwellers to accommodate them in my vault. I have both Windows 7 and Ubuntu installed on a shared machine. Because a lot of the non-developers use Windows, I'd like to change the boot order to make it easier for them.  Currently the boot order looks like the following:   Ubuntu 11.10 kernelgeneric *86 Ubuntu 11.10 kernelgeneric *86 (safe boot)  Memory test Memory test Windows 7 on /dev/sda6   How do I change the default order so that Windows 7 is at the top of the list?   Windows 7 on /dev/sda6 Ubuntu 11.10 kernelgeneric *86 Ubuntu 11.10 kernelgeneric *86 (safe boot)  Memory test Memory test