For sake of simplicity i chose to use a type 'string' instead of 'char'. But i am supposed to lowercase the string that i read in from the input file. I did not know at the time i would not be able to use 'tolower()'. However i did find a way using 'transform'. But i cannot get it to work and cannot find example of using it with an array of stucts. Please help. And if at all possible i also have to capitalize the first letter(s) of each state so if you could point in in the right direction  would be extremely grateful.  #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;cstdlib&gt; #include &lt;string&gt; #include &lt;algorithm&gt;  struct ATdata   {    string state;    double miles;    int shelters; };  int readData( ifstream&amp; input, struct ATdata data[] ); size_t readData( ifstream&amp; input, struct ATdata data[], size_t MAX_ENTRIES );  int main() {     ifstream input;     char filename[256];     ATdata data[14];     int i;      cout &lt;&lt; "Enter input file name: ";     cin &gt;&gt; filename;      input.open( filename );      if ( input.fail() )     {         cout &lt;&lt; "Input file does not exist." &lt;&lt; endl;         exit(1);     }       size_t linesRead = readData( input, data, sizeof ATdata data[], size_t MAX_ENTRIES );     input.close();     return(0);  }  size_t readData( ifstream&amp; input, struct ATdata data[], size_t MAX_ENTRIES ) {     size_t i;     int j;     while ( i &lt; MAX_ENTRIES &amp;&amp; !input.eof() )     {         ATdata entry;         getline( input, entry.state );         transform( entry.state.begin(), entry.state.end(), entry.state.begin(), tolower() );         string nextLine;         if ( !getline( input, nextLine ) )         {             break;         }         istringstream iss( nextLine );         if ( !(iss &gt;&gt; entry.miles &gt;&gt; entry.shelters ) )         {             continue;         }         data[i++] = entry;     }         for ( j = 0; j &lt; 14; j++ )     {         cout &lt;&lt; data[j].state &lt;&lt; data[j].miles &lt;&lt; data[j].shelters &lt;&lt; endl;     } } return i;
I want to convert a std::string to lowercase. I am aware of the function tolower(). However, in the past I have had issues with this function and it is hardly ideal anyway as using it with a std::string would require iterating over each character. Is there an alternative which works 100% of the time?
Calculating $\int_{- \infty}^{\infty} \frac{\sin x \,dx}{x+i} $ I'm having trouble calculating the integral  $$\int_{- \infty}^\infty \frac{\sin x}{x+i}\,dx $$  using residue calculus. I've previously encountered expressions of the form   $$\int_{- \infty}^\infty f(x) \sin x \,dx $$  where you would consider $f(z)e^{iz}$ on an appropriate contour (half circle), do away with the part of the contour that wasn't on the real axis by letting the radius go to infinity, then recover the imaginary part of the answer to get back the sine. However here, I can't replace the sine with $e^{iz}$ in my complex function because $$\operatorname{Im} \frac{e^{ix}}{x+i} \neq \frac{\sin x}{x+i}\cdots$$  How to remedy this? I'm not sure if substituting $\sin x = \frac{1}{2i}(e^{ix}-e^{-ix})$ and solving two integrals is how this problem is meant to be solved, although I'm 99% sure it would work How are strings passed in .NET? Will using 'var' affect performance? I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in many browsers.  I might be able to solve this with a JavaScript trick (I'd like to see those answers, too) -- but I'm really hoping there's something in CSS/HTML directly that works across all browsers. Proof conclusion to: Let m,n $\in$ $\mathbb{N}$ $\backslash$ $\{0\}$ . Prove that $s |\tau (m^{s}) - \tau(n^{s})$, where $\tau$ is a divisor function.   Hello, so I have a tiny question about the summarization of my proof.  I got to the point where I defined my $\tau$ divisor function and got them both $\tau(m^s)$= $\prod$ something +1 and $\tau(n^{s})$ = $\prod$ something +1.    I've noticed that the last terms of the polynomial are both one. Why is it with the +1 part, I can conclude with that:  s| $\tau(m^s)$ - $\tau(n^s)$.   The line for why that is, isn't quite clear. I noticed that after joining a table to a shapefile the headers of each fields in the table used for the join are changed by QGIS and they are attributed to a different name.  For instance, I had a shapefile with vegetation_codes and a table with vegetation_codes and veg_definition (these were the headers). After joining the table to the shapefile and also saving the shapefile and creating a new one, the vegetation_classes header was changed into vegetati_1.  Is there a way to keep the original headers?  I am using QGIS Dufour on Windows 7 and the table that I join to the shapefile is CSV (tried with dbf as well and the problem is the same). Shuffling questions in exam Converting ArcGIS layer style to Styled Layer Descriptor (SLD) file? I am putting together a GIS server using GeoServer and need some help with importing my layer styles from ArcGIS 10 to  format.    I have one layer in ArcMap properly symbolized and labeled, how can I get this layers symbolization and labeling into a SLD file? How can I update my OpenGL to 3.0 or higher I'm trying to re-learn my undergrad math, and I'm using Stephen Abbot's Understanding Analysis. In section 2.7, he has the following exercise:  Exercise 2.7.5 (a) Show that if $\sum{a_n}$ converges absolutely, then $\sum{a_n^2}$ also converges absolutely. Does this proposition hold without absolute convergence?  I'm posting about this here because my answer to that last question about whether the proposition holds without absolute convergence is "Yes", but my suspicions are raised by him merely asking the question. Usually questions like this are asked to point out that certain conditions are necessary in the statement of propositions, theorems, etc. I just want to see if I'm missing something here.  Anyway, here's how I prove the absolute convergence of $\sum{a_n^2}$, and note that I never use the fact that $\sum{a_n}$ is absolutely convergent:  Proof: Let $s_n = \sum_{i=1}^n{a_n^2}$. I want to show that $(s_n)$ is a Cauchy sequence. So, let $\epsilon &gt; 0$ and $n &gt; m$, and consider, \begin{equation}   \begin{aligned}     |s_n - s_m| &amp;= |(a_1^2 + a_2^2 + \cdots a_n^2) - (a_1^2 + a_2^2 + \cdots a_m^2)|\\                 &amp;= |(a_{m+1})^2 + (a_{m+2})^2 + \cdots + a_n^2|\\                 &amp;= |a_{m+1}|^2 + |a_{m+2}|^2 + \cdots + |a_n|^2\\   \end{aligned} \end{equation} Now, since $\sum{a_m}$ converges, the sequence $(a_m)$ has limit 0. Therefore I can choose an $N$ such that $|a_m| &lt; \sqrt{\epsilon/n}$ for all $m &gt; N$. So for all $n &gt; m&gt; N$,  we have, \begin{equation}   \begin{aligned}     |s_n - s_m| &amp;= |a_{m+1}|^2 + |a_{m+2}|^2 + \cdots + |a_n|^2\\                 &amp;&lt; \left(\sqrt{\frac{\epsilon}{n}}\right)^2 + \left(\sqrt{\frac{\epsilon}{n}}\right)^2 + \cdots + \left(\sqrt{\frac{\epsilon}{n}}\right)^2\\                 &amp;&lt; \left(\sqrt{\frac{\epsilon}{n-m}}\right)^2 + \left(\sqrt{\frac{\epsilon}{n-m}}\right)^2 + \cdots + \left(\sqrt{\frac{\epsilon}{n-m}}\right)^2\\                 &amp;= \epsilon   \end{aligned} \end{equation} Therefore $(s_n)$ is Cauchy and $\sum{a_n^2}$ converges. And since $\sum{a_n^2} = \sum{|a_n^2|}$, the series $\sum{a_n^2}$ is absolutely convergent. &#x220E;  Am I doing something wrong here? Am I right in thinking that $\sum{a_n}$ need not be absolutely convergent for $\sum{a_n^2}$ to be absolutely convergent? Converting LAS 1.4 to 1.2 LIDAR files were released for major part of Slovenia few months back in zlas format. Decompressed LAS format is 1.4 version. I have tried many options how to generate DEMs and had some success in programs and tools but unfortunately they were all trial versions of license pay versions.  Problem is that I can't open and generate DEMs of LAS version 1.4 in many open and free tools (such as MCC-Lidar).   Can you help me converting LAS from 1.4 to 1.2 in some free tool? Or if it is any other way for LAS 1.4. Shortcut for toggling between different windows of same app? I opened two Google Chrome windows (because I am using multiple Gmails) and when I do the Cmd ⌘ Tab ⇥ shortcut it just shows me other applications that I opened but does not show me the other Chrome windows that are already opened.  How to switch to the other Google Chrome window that I opened using keyboard shortcut? My PDO Statement doesn't work Use Cauchy product to find a power series represenitation of   $$1 \over {(1-x)^3}$$ which is valid in the interval $(-1,1)$.   Is it right to use the product of $1 \over {1-x}$ and $1 \over {(1-x)^2}$ if I know thier expantion (HOW).. Is there another way? What is the number of invertible $n\times n$ matrices in $\operatorname{GL}_n(F)$? $F$ is a finite field of order $q$. What is the size of $\operatorname{GL}_n(F)$ ?  I am reading Dummit and Foote "Abstract Algebra".  The following formula is given:  $(q^n - 1)(q^n - q)\cdots(q^n - q^{n-1})$.  The case for $n = 1$ is trivial.  I understand that for $n = 2$  the first row of the matrix can be any ordered pair of field elements except for $0,0$. and the second row can be any ordered pair of field elements that is not a multiple of the first row.  So for $n = 2$  there are $(q^n - 1)(q^n - q)$ invertible matrices.  For $n\geq 3$, I cannot seem to understand why  the formula works.  I have looked at Sloane's OEIS A002884.  I have also constructed and stared at a list of all $168$ $3\times 3$ invertible matrices over $GF(2)$.  I would most appreciate a concrete and detailed explanation of how say $(2^3 - 1)(2^3 - 2)(2^3 - 2^2)$ counts these $168$ matrices. What is the trajectory of a photon moving through a vacuum? Since electromagnetic energy is carried by photons and moves in forms of waves, does it mean that a single photon when propagating through space doesn't follow the straight path but instead always moves up and down, up and down like a wave. If so another question arises the speed of propagation of light in vacuum is fixed meaning that it will always take the same amount of time for it to travel from point A to point B, but if a photon always moves up and down it will also mean that it travels longer distance than the distance between A and B and so it ill travel faster than light propagates, is it even possible, could you please clarify these concepts for me? Find the first occurrence/starting index of the sub-array in C# Using natural deduction to prove that $p \implies q \vdash \lnot p \lor q$ Using only rules of natural deduction, I am trying to prove that $$p \implies q \vdash \lnot p \lor q$$ but am having a lot of difficulty. I was able to prove the other direction.   Could anyone show me or point me to the right direction? Unable to play MP3 or MP4 files in Rhythmbox or Movie Player I am unable to play any MP3 or MP4 files. When I try to open any MP3 or MP4 file, both show an error, a Python 2.7 plug-in is required. Enabling Nvidia driver messes up splash screen