Short title in TOC using custom titletoc/titlesec
\section*[toc]{normal section title} not working for me
Callout Mock Responses & multiple HTTP Status Code values I'm trying to unit test the behavior of some code which performs callouts and its logic is dependent on the HTTP status code of the response - 200 vs 401.  The pattern being exercised is familiar:   Make callout Response is (unauthorized) HTTP 401 Logic checks Status value on the response if (status == 200) { /* yay! */ } if (status == 401) { /* make request for auth /* }   retry original callout with newly acquired authorization yay!    I am attempting to test the code's "try, auth, retry" behavior using the MultiStaticResourceCalloutMock but it appears that only a single status code can be set for all requests that the mock provider can respond to using the .setStatusCode(int) method. Is this accurate?  Is there a mechanism for using a single MultiStaticResourceCalloutMock and having it respond with different status codes per URL in the test context?  Is the only solution here to use a Dispatcher such as what Andrew Fawcett documents here in this answer?   Is there another method/mechanism that allows for different status codes to be returned by the mock provider on the HTTPResponse?    Some  showing the one-time usage pattern of the .setStatusCode(200) method and the multimock class.  @isTest private class CalloutMultiStaticClassTest {     @isTest static void testCalloutWithMultipleStaticResources() {         // Use MultiStaticResourceCalloutMock to         // specify fake response for a certain endpoint and          // include response body in a static resource.             MultiStaticResourceCalloutMock multimock = new MultiStaticResourceCalloutMock();         multimock.setStaticResource(             'http://api.salesforce.com/foo/bar', 'mockResponse');         multimock.setStaticResource(             'http://api.salesforce.com/foo/sfdc', 'mockResponse2');         multimock.setStatusCode(200);         multimock.setHeader('Content-Type', 'application/json');          // Set the mock callout mode         Test.setMock(HttpCalloutMock.class, multimock);          // Call the method for the first endpoint         HTTPResponse res = CalloutMultiStaticClass.getInfoFromExternalService(             'http://api.salesforce.com/foo/bar');         // Verify response received          System.assertEquals('{"hah":"fooled you"}', res.getBody());          // Call the method for the second endpoint         HTTPResponse res2 = CalloutMultiStaticClass.getInfoFromExternalService(             'http://api.salesforce.com/foo/sfdc');         // Verify response received          System.assertEquals('{"hah":"fooled you twice"}', res2.getBody());     } } How do you access the matched groups in a JavaScript regular expression? I want to match a portion of a string using a  and then access that parenthesized substring:  var myString = "something format_abc"; // I want "abc"  var arr = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(myString);  console.log(arr);     // Prints: [" format_abc", "abc"] .. so far so good. console.log(arr[1]);  // Prints: undefined  (???) console.log(arr[0]);  // Prints: format_undefined (!!!)   What am I doing wrong?    I've discovered that there was nothing wrong with the regular expression code above: the actual string which I was testing against was this:  "date format_%A"   Reporting that "%A" is undefined seems a very strange behaviour, but it is not directly related to this question, so I've opened a new one, .    The issue was that console.log takes its parameters like a printf statement, and since the string I was logging ("%A") had a special value, it was trying to find the value of the next parameter. Are the eigenvalues of $AB$ equal to the eigenvalues of $BA$? (Citation needed!) First of all, am I being crazy in thinking that if $\lambda$ is an eigenvalue of $AB$, where $A$ and $B$ are both $N \times N$ matrices (not necessarily invertible), then $\lambda$ is also an eigenvalue of $BA$?  If it's not true, then under what conditions is it true or not true?  If it is true, can anyone point me to a citation?  I couldn't find it in a quick perusal of Horn &amp; Johnson.  I have seen a couple proofs that the characteristic polynomial of $AB$ is equal to the characteristic polynomial of $BA$, but none with any citations.  A trivial proof would be OK, but a citation is better. Knowing the interface of ubuntu and editing them Where are the files for the desktop or the interface that appears on the screen stored? And how can we edit them. How are they programmed?  What programming language is used to built the interfaces? How to send a header using a HTTP request through a cURL call? I wish to send a header to my Apache server on a Linux box.  How can I achieve this via a cURL call? How to get a tool that can only break specific blocks and has a name? So, right now I'm using this:  /give @p minecraft:diamond_pickaxe 1 0 {CanDestroy:[minecraft:stone]}   But I need one that also has the Name value. Anyone know this one? What sequence of documents should I read to know "all of" TeX and then LaTeX? The standard files/tools that report memory seem to have different formats on different Linux distributions. For example, on Arch and Ubuntu.   Arch  $ free               total        used        free      shared  buff/cache   available Mem:        8169312     3870392     2648348       97884     1650572     4110336 Swap:      16777212      389588    16387624   $ head /proc/meminfo  MemTotal:        8169312 kB MemFree:         2625668 kB MemAvailable:    4088520 kB Buffers:          239688 kB Cached:          1224520 kB SwapCached:        17452 kB Active:          4074548 kB Inactive:        1035716 kB Active(anon):    3247948 kB Inactive(anon):   497684 kB  Ubuntu  $ free              total       used       free     shared    buffers     cached Mem:      80642828   69076080   11566748    3063796     150688   58358264 -/+ buffers/cache:   10567128   70075700 Swap:     20971516    5828472   15143044   $ head /proc/meminfo  MemTotal:       80642828 kB MemFree:        11565936 kB Buffers:          150688 kB Cached:         58358264 kB SwapCached:      2173912 kB Active:         27305364 kB Inactive:       40004480 kB Active(anon):    7584320 kB Inactive(anon):  4280400 kB Active(file):   19721044 kB    So, how can I portably (across Linux distros only) and reliably get the amount of memory—excluding swap—that is available for my software to use at a particular time? Presumably that's what's shown as "available" and "MemAvailable" in the output of free and cat /proc/meminfo in Arch but how do I get the same in Ubuntu or another distribution? How can I prevent my mail from being classified as spam? What is spin as it relates to subatomic particles? 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 Is the proof of these identities possible, only using elementary differential and integral calculus? If it is, can anyone direct me to the proofs? ( or give a hint for the solution )  1)$$\int_0^\infty { e^{-x^2} \ln x }\,dx = -\tfrac14(\gamma+2 \ln 2) \sqrt{\pi} $$  2)$$\int_0^\infty { e^{-x} \ln^2 x }\,dx = \gamma^2 + \frac{\pi^2}{6} $$  3) $$\gamma = \int_0^1 \frac{1}{1+x} \sum_{n=1}^\infty x^{2^n-1} \, dx$$  and lastly,  4) $$\zeta(s) = \frac{e^{(\log(2\pi)-1-\gamma/2)s}}{2(s-1)\Gamma(1+s/2)} \prod_\rho \left(1 - \frac{s}{\rho} \right) e^{s/\rho}\!$$  I personally think the last is obtained from a simple use of the Weierstrass factorization theorem. I'm unsure as to what substitution is used.  $\gamma$ is the Euler-Mascheroni constant and $\zeta(s)$ is the Riemannian Zeta function.  Thanks in advance. Is GTA Online cross-platform? Grand Theft Auto Online exists on five different platforms: XBox 360, PS3, XBox One, PS4, and PC. Do any of these play on the same servers, allowing people on differing platforms to play together? Why is this trigger finding a null value despite the field being populated? Einstein's big revelation was that time and space are inseparable components of the same fabric. Physical observation tells us that distant galaxies are moving away from us at an accelerated rate, and because of the difficulty (impossibility?) of defining a coordinate system where things have well defined coordinates while also moving away from each other without changing the metric on the space, we interpret this to mean that space itself is expanding.   Because space and time are so directly intertwined is it possible that time too is expanding? Or perhaps it could be contracting? jQuery Datepicker with text input that doesn't allow user input Is it positive or negative for the average website to allow search engines to index user comments? I've been trying to answer this question myself by researching and searching on google but I haven't been able to come with a final answer. I have some hypothesis I would like share anyway:   The average website intends to reach the higher audience possible. User generated content by comments is an efficient way of increasing the relevance and the valuable information of the average website. Indexing comments will make any site attractive to spammers. Indexing comments is more convenient for new/low-traffic websites than it is for old/high-traffic websites. The web in general is currently choosing not to index comments in the average website because of fear to the SPAMMERS. The average author of a content-valuable comment would like his comment to be indexed Not indexing comments discourages the creation of content-valuable comments.   So, what do you think finally? Is it positive or negative for the average website to allow search engines to index user comments? Why? Dual boot system Windows XP Pro and Ubuntu 12.04.  I have the bios set for the correct time and Ubuntu set for US Eastern time.  Ubuntu will boot up and the time will be off by -4 hours.  If I correct the time in Ubuntu then when I boot up in Windows XP the time will be off by + 4 hours.  This is a fresh install of 12.04. I did not have this problem before reinstalling Ubuntu. Force JSF to process, validate and update readonly/disabled input components anyway Can anybody tell me when Application_End is triggered in a lifecycle of an application? When all sessions are ended, will Application_End be triggered automatically? + Are there any other reasons why Application_End could be triggered?