I'm trying to write a unit test for a function that checks a URL string input and increments some stats using a third party package depending on what that URL string is. Since this function only increments stats and returns, how can this be unit tested?  Right now, I just have a test that basically makes sure the function returns and doesn't segfault. The function returns increments different stats and returns no matter what, so my test will pass for all string inputs.   func handleStats(url string) {     if url == "" {         stats.Increment(metricForEmptyStringURL)         return     }     stats.Increment(metricForNonEmptyURL)     if strings.Contains(url, "${") {         stats.Increment(metricCorrectlyEncodedURL)     } }   This is what I currently have (which is not useful since it'll always pass):  func Test_handleStats(t *testing.T) {     tests := []struct {         name string         url  string     }{         {name: "Blank", url: ""},         {name: "No encoding", url: "http://testurl.com/"},         {name: "With encoding", url: "http://testurl.com/${ENCODING}"},     }     for _, tt := range tests {         t.Run(tt.name, func(t *testing.T) {             handleStats(tt.url)         })     } }   What is the best way to test something like this?
What is the best way to unit test a method that calls into multiple methods, for example:  modify(string value) {     if(value.Length &gt; 5)  replaceit(value);      else changeit(value); }   This pseudo code has a modify method that (currently) calls either replaceit() or changeit(). I have already wrote tests for replaceit and changeit, so writing a new test for modify will be 99% the same set of code.  I need to test it thought because it may change in the future.    So do I copy paste the existing test code?  Move the test code to a common function?  Any other ideas?  I'm not sure of the best practice here.
How to install the Boot-Repair tool in an Ubuntu live disc? When the bootloader (GRUB) is broken, I cannot access neither Ubuntu nor Windows.  I heard that an easy solution to fix this is to use the Boot-Repair tool from an Ubuntu liveCD (or liveUSB).  What are the steps to do this? I tried to reproduce the results from the  unfortunately the video link is broken. And I might have overlooked some related settings.  The spot light is barley visible on the ground.    Increasing the Density of the Volume Scatter Node darkens the sky texture but leads to some light cone from the car's headlight. (only 10 samples in preview).    Which settings do I need to change or should I try a different approach?  Integrator settings are default and spotlight settings were copied from the example found in the docs.  Related:    (pre 2.7)  (BI only) I've been wondering why I've never seen any official specifications of the maximum allowed torque that can be exerted upon lens mounts. It seems to me like a very useful specification, but I can't seem to find it from any manufacturer.  indicates that there might be no specifications for Nikon mounts. Are there really no manufacturer that publish these specification of their mounts? Console.WriteLine and generic List I frequently find myself writing code like this:  List&lt;int&gt; list = new List&lt;int&gt; { 1, 3, 5 }; foreach (int i in list) {     Console.Write("{0}\t", i.ToString()); } Console.WriteLine();   Better would be something like this:  List&lt;int&gt; list = new List&lt;int&gt; { 1, 3, 5 }; Console.WriteLine("{0}\t", list);   I suspect there's some clever way of doing this, but I don't see it. Does anybody have a better solution than the first block? A matching or independent edge set in a graph is a set of edges without common vertices.    A perfect matching (also called 1-factor) is a matching which matches all vertices of the graph.    a bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint sets and (that is, and are each independent sets) such that every edge connects a vertex in to one in.    Now imagine a bipartite graph like G which has a perfect matching. Prove that there exists a vertex in G like V such that every edge connected to G is in a perfect matching.  Note : I tried to prove it but i have nothing to start with ! Thanks in advance.  Edit : The graph is a simple undirected graph and i don't know anything about "strongly" connected graphs. Does it make sense to combine PCA and LDA? Assume I have a dataset for a supervised statistical classification task, e.g., via a Bayes' classifier. This dataset consists of 20 features and I want to boil it down to 2 features via dimensionality reduction techniques such as Principal Component Analysis (PCA) and/or Linear Discriminant Analysis (LDA).  Both techniques are projecting the data onto a smaller feature subspace: with PCA, I would find the directions (components) that maximize the variance in the dataset (without considering the class labels), and with LDA I would have the components that maximize the between-class separation.  Now, I am wondering if, how, and why these techniques can be combined and if it makes sense.  For example:   transforming the dataset via PCA and projecting it onto a new 2D subspace transforming (the already PCA-transformed) dataset via LDA for max. in-class separation   or    skipping the PCA step and using the top 2 components from a LDA.   or any other combination that makes sense. I'm writing a technical documentation and I want to explain step-by-step how to go through various menus.  For example I used to write Open with &gt; VLC media player.  That's how it looks in Windows 8:     What I want in Latex should looks similar to this: light grey box, dark grey border and black windows-like font.    I've seen , suggesting the package  - but it looks very old fashioned - are there any more modern approaches? We currently have two rewards checking accounts.  We are nearing the maximums permitted on each account, after which we receive .5% and .25% APY.  It's within our means to perhaps open another one, but at that point we are looking at using our debit cards 50 to 55 times a month.  I feel that running that number of debit transactions is getting out of hands as it's just the two of us.  I realize there are easy ways to game the system, but I want these things to stay around and another person doing just such that could lead to the ends of these accounts.  We are saving towards a new house down payment.  As such we don't require these funds to be fully liquid, but would still like to remain free of as much risk as possible -- however I realize we are unlikely to find anything near our rewards checking accounts (4% APY interest for meeting various rules: direct deposit, a certain number of debit card transactions, and not receiving a paper statement), but would hope we can get at least half of that.  We aren't fully sure when we will be buying, but we are probably a couple of years out.  For that reason I don't think CDs would work.  Even if we ladder them, when we need the money we will need it pretty much instantly.  Do I bite the bullet and just find the best available money market account?  What other options do I have that let me deposit monthly, and not have a timebomb associated to accessing that money that isn't in the initial lump sum? Creation parameters menu greyed out Laptop randomly waking up = Hibernate / Low Battery? Can an integrity check be run against a USB boot disk? Add "paragraphs" to Markdown help Like balpha once , a &lt;br&gt; line break (newline) should be used in very few cases, and surely is not the same as a new &lt;p&gt; paragraph. Still  only explains line breaks, not paragraphs:      Some sites  an additional &quot;New paragraphs only occur when there is a blank line. A single carriage does not create a new paragraph.&quot;, but I feel that's not very clear*, and the emphasis is still on line breaks while it should be on paragraphs:      So: As a minimum, please add (rephrase) a note about the blank line, and maybe use &quot;Only when really needed [...] force&quot;:  Paragraphs and line breaks Simply use a blank line between two paragraphs to start a new &lt;p&gt; paragraph. Only when really needed, end a line with two spaces to force a &lt;br/&gt; line break: How do I love thee?__     Let me count the ways   I'd even prefer an explicit example, simply as I think &lt;p&gt; should be favoured over &lt;br&gt; in most situations:  Paragraphs and line breaks Simply use a blank line to start a new &lt;p&gt; paragraph: First sentence in the first paragraph. Another sentence. And a third. Maybe making this multiple consecutive lines of text, but still one paragraph.  The second paragraph.  Only when really needed, end a line with two spaces to force a &lt;br/&gt; line break: How do I love thee?__     Let me count the ways   Alternatively, slightly change the existing &quot;Linebreaks&quot;† part, and above that add a standalone section, :  Paragraphs A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines: A blank line is any line that looks like a blank line. A line containing nothing but spaces or tabs is considered blank.  Normal paragraphs should not be indented with spaces or tabs.  Line breaks Only when really needed, end a line with two spaces to force a &lt;br/&gt; line break: How do I love thee?__     Let me count the ways   And: maybe even add a section &quot;Paragraphs&quot; to the inline post help on top of the editor? I'm not sure which help tab should then be shown  though.  * Also note how not all sites highlight the two spaces with a different background color. † Yes, I think &quot;line break&quot; likes a space too... Closed form for $\int_0^\infty\frac{1}{(1+x^2)^s}\,dx$ when $s\in (0.5,\infty)\setminus\mathbb{N}$ I know that the improper integral  $$ \int_0^\infty\frac{1}{(1+x^2)^s}\,dx $$ is convergent for $s&gt;0.5$ and divergent otherwise. Furthermore, it has a closed form for $s \in \mathbb{N}$ (this can be obtained using the Residue Theorem). My question is to know whether it has a closed form for any non-integer $s &gt;0.5$. Log of products to sum of logs Expressing hourly temporal recurrence What is the most idiomatic way to put into words a situation where a recurring event happens every hour at a certain minute. For example, consider that some event takes place at the tenth minute of each hour: 0:10AM, 1:10AM, 2:10AM, ...  My first ideas were "every hour at the tenth minute" or "every hour at minute 10". Are these options idiomatic and if not, what would be an idiomatic way of expressing this matter? Traffic (views, visits) is not correctly registered on Site Analytics or Area 51 In the ,  can monitor some things like the total traffic on the site. However, it seems to be broken at the moment, all figures are almost zero. This is how it looks for Meta Stack Exchange (other sites show similar pictures): Sufficient conditions for $x, Ax, A^2x, ...$ being linearly indepedent How to fill a mesh with solid color Which experiments prove atomic theory?  Sub-atomic theories:   atoms have: nuclei; electrons; protons; and neutrons. That the number of electrons atoms have determines their relationship with other atoms.   That the atom is the smallest elemental unit of matter - that we can't continue to divide atoms into anything smaller and have them retain the characteristics of the parent element. That everything is made of atoms.     These sub-theories might spur more thoughts of individual experiments that prove individual sub-atomic theories (my guess is more was able to be proven after more experiments followed). "Holmby hall" or "The Holmby Hall", does the hall have to be capital in either of them?