example shows how to produce PDF slides with syntax highlighting of source code. The example uses beamer and (presumably) pdflatex.     example shows syntax coloring for HTML output using htlatex. It's an unpleasant kludge   it precludes calling pdflatex on the same LaTeX file one must experiment to find what ectt-1000 maps to one defines colors for css categories, not for code syntax categories   but it works.  The following code revisits this problem and asks to do better.  \documentclass{article} \usepackage{color} \usepackage{listings} \usepackage[T1]{fontenc}  \lstset{     basicstyle=\ttfamily,     language=C++,     keywordstyle=\rmfamily\bfseries,     commentstyle=\sffamily, }  \begin{document}  \Css{div.lstlisting .ectt-1000 {font-family: monospace;color:blue}} \Css{div.lstlisting .ecss-1000 {font-family: monospace;color:green}} \Css{div.lstlisting .ecbx-1000 {font-family: monospace;color:red}}  \section*{Inserting source code} \begin{lstlisting} #include&lt;stdio.h&gt; #include&lt;iostream&gt; // A comment int main(void) {     printf("Hello World\n");     return 0; } \end{lstlisting}  \end{document}   Now commenting out the \Css lines and running pdflatex gives one output    and processing with htlatex gives another.    Can you suggest a way to make this kludge more usable by   correlating the two "blue" colors—even though ultimately one is defined in LaTeX's color package and the other in HTML, making the \Css definitions point to colors through syntax category, making it possible to process the file with pdflatex while writing/for debugging (htlatex is considerably slower)   ?
I'm trying to convert some LaTeX into HTML but my code listings don't preserve their code coloring. Why is that and how do I fix it?  This is what it looks like:    Side note: I'm also wondering why the caption on the table was removed.  Edit  Here is an example listing with colors:  \documentclass{article} \usepackage{color} \usepackage{listings} \lstset{     basicstyle=\footnotesize\ttfamily,     language=[Sharp]C,      keywordstyle=\color[rgb]{0,0,1.0}\bfseries,       commentstyle=\color[rgb]{0.133,0.545,0.133}\bfseries, }  \begin{document} \begin{lstlisting} int x = 10;  // This is a comment string str = "hello"; \end{lstlisting} \end{document}   This produces the following HTML when doing: htlatex myfile.tex:  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd"&gt;   &lt;html &gt;  &lt;head&gt;&lt;title&gt;&lt;/title&gt;  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;  &lt;meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"&gt;  &lt;meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"&gt;  &lt;!-- html --&gt;  &lt;meta name="src" content="LaTeX4.tex"&gt;  &lt;meta name="date" content="2012-07-20 12:30:00"&gt;  &lt;link rel="stylesheet" type="text/css" href="LaTeX4.css"&gt;  &lt;/head&gt;&lt;body  &gt;    &lt;!--l. 12--&gt;    &lt;div class="lstlisting" id="listing-1"&gt;&lt;span class="label"&gt;&lt;a   id="x1-2r1"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;int&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;x&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;=&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;10;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;br /&gt;&lt;span class="label"&gt;&lt;a   id="x1-3r2"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;br /&gt;&lt;span class="label"&gt;&lt;a   id="x1-4r3"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;//&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;This&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;is&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;a&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;comment&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;br /&gt;&lt;span class="label"&gt;&lt;a   id="x1-5r4"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;string&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;str&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;=&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;"&lt;/span&gt;&lt;span  class="cmtt-8"&gt;hello&lt;/span&gt;&lt;span  class="cmtt-8"&gt;"&lt;/span&gt;&lt;span  class="cmtt-8"&gt;;&lt;/span&gt;     &lt;/div&gt;  &lt;/body&gt;&lt;/html&gt;   Which looks like this:    I would want the HTML result to look like this:
Was it just coincidence that Tahir Mahmood went on stage? In episode 3 of “Bodyguard,” Tahir Mahmood steps onto stage at St. Mary’s college as the Home Secretary is speaking and the two of them, plus others, are blown up by a bomb. In the next episode we discover that the stage had a weight trigger and that his arrival set it off. This heavily implies that whoever asked him to go on stage was affiliated with those who planted the bomb.  We know that Mahmood was sent on stage by advisor Rob Macdonald as part of a scheme, together with other members of the home secretary’s staff, to embarrass her. The audience knows that some of the people in on this scheme have been plotting with the U.K. security services. This, together with interference in video recordings of the event, characteristic of the security services, implicates the security services in the assassination.  In the final episode it is revealed that the bomb had been set by members of an organized crime gang who had gotten the explosives from an Islamic terrorist. A senior member of the police force had been helping them by leaking information. So, were the security services involved? If so, why? If not, who got Mahmood to go up on the stage? Was it just coincidence that he went up there at the right time? Find the functions $f:\Bbb R_*^+ \to \Bbb R_*^+$ such that:  $$f(x)f \left(\frac{1}{x}\right)=1$$ Copy files and directory tree for filesize in specified range I would like to make a small script copying files from different directories example /pp/01 /pp/02/ etc... to another destination with the same directory design. But only those files within the directory with a size larger than 88MB but smaller than 93MB...   I would use a for loop and the find function. Are there more efficient ways? And how can I implement the find function exactly. 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. What is the most straightforward way to pad empty dates in sql results (on either mysql or perl end)? I'm building a quick csv from a mysql table with a query like:  select DATE(date),count(date) from table group by DATE(date) order by date asc;   and just dumping them to a file in perl over a:  while(my($date,$sum) = $sth-&gt;fetchrow) {     print CSV "$date,$sum\n" }   There are date gaps in the data, though:  | 2008-08-05 |           4 |  | 2008-08-07 |          23 |    I would like to pad the data to fill in the missing days with zero-count entries to end up with:  | 2008-08-05 |           4 |  | 2008-08-06 |           0 |  | 2008-08-07 |          23 |    I slapped together a really awkward (and almost certainly buggy) workaround with an array of days-per-month and some math, but there has to be something more straightforward either on the mysql or perl side.   Any genius ideas/slaps in the face for why me am being so dumb?    I ended up going with a stored procedure which generated a temp table for the date range in question for a couple of reasons:   I know the date range I'll be looking for every time The server in question unfortunately was not one that I can install perl modules on atm, and the state of it was decrepit enough that it didn't have anything remotely Date::-y installed   The perl Date/DateTime-iterating answers were also very good, I wish I could select multiple answers! Why a line is said to have infinite number of points? How exactly does a  work?  This is an extremely broad question. What code keeps things bouncing against each other, what code makes the player walk into a wall instead of walk through the wall? How does the code constantly refresh the players position and objects position to keep gravity and collision working as it should?  If you don't know what a collision engine is, basically it's generally used in  to make the player acutally hit walls and the like. There's the 2D type and the 3D type, but they all accomplish the same thing: collision.  So, what keeps a collision engine ticking? How can I improve Ubuntu overall system performance? What are your tips for improving overall system performance on ubuntu? Inspired by this  I realized that some default settings may be rather conservative on Ubuntu and that it's possible to tweak it with little or no risk if you wish to make it faster.  This is not meant to be application specific (e.g. make firefox load pages faster), but system wide.  Preferably 1 tip per answer, with enough detail for people to implement it.  A couple of mine would be:   Install  (via Software Center or sudo apt-get install preload); Change  value - "which controls the degree to which the kernel prefers to swap when it tries to free memory";   What are yours?  PS: Since this is not intended to have a unique answer but rather, several useful tips, I'm making this community wiki out-of-the-box. How do I set up Ruby on Rails? I am interested in setting up a Ruby on Rails environment on my 10.10 laptop.   Is there anything special I need to keep in mind for installation (i.e. that could be new or unique to 10.10)?   Are there any suggested walkthroughs that I could follow along with?  Thanks in advance. Dual boot Ubuntu with Windows on Acer Aspire I've installed Ubuntu 16.04 LTS along side with Windows 10 (I shrinked my Disk using Windows Disk Management) on my Acer laptop (ES1-531-C13G), but when I restart/reboot my system no menu (Grub screen) appears from where I can select the operating system that I want to boot with, but instead, system takes me into Windows 10 everytime. I've tried several things from internet including :    Ran bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi from windows command prompt.  Reset  Bootorder i.e. first Ubuntu then Windows from Ubuntu terminal (after successful Ubuntu installation) etc, but nothing works for me so far. Please guide me ! I read this book once when I was in middle school. A girl solves a murder or a mystery on a spaceship. It was a thin paperback books.   All I can remember is that there was an alien, and there was a movie star or actress or famous makeup artist on the ship traveling with another woman. By the end of the book the murderer was the woman the actress was traveling with who forced her to use her makeup skills to disguise her, and she was really some kind of alien. Simulating the Windows key on an old keyboard How to determine if $n (n \geq 2)$ given numbers can be summed up to a certain number? I'm interested in knowing if there's a theorem for checking if combinations of $n$ given positive numbers can be summed up to a certain number.   For example, if I was given $n = 2$ numbers, which are $k_1$ and $k_2$, and I was asked if I could make a combination like $n_1 * k_1 + n_2 *k_2 = C$, all $\in \mathbb{N}^+$, I could check remainders to see if it is possible.   However, if $n = 3$ or higher, how could I check if combinations of $k_1, k_2, ..., k_n$ can be summed up to a $C$? Thank you for any inputs! What are turret connectors? While working on a project recently, I noticed that Digi-key has a product category . I've never seen connectors like this before, and they don't look like any kind of contact I've seen before. What does the mating connector look like? I can't envision any mating contact that makes any sense for these.  On top of that, they look like they have to be individually machined, which can't be a cost-effective process. Find the number of solutions of $a_0+a_1+a_2=17$ if $2\le a_0\le 5$,   $3\le a_1\le 6$, $4\le a_2\le 7$.   This is an exmaple given by my professor, and his solution is:       The number of solutions to this equation satisfying the given   constraints is equal to the coefficient of $x^{21}$ in the expression   $$\left(\sum_{n=2}^5x^n\right)\left(\sum_{n=3}^6x^n\right)\left(\sum_{n=4}^7x^n\right)=x^9\left(\sum_{n=0}^3x^n\right)\left(\sum_{n=0}^3x^n\right)\left(\sum_{n=0}^3x^n\right).$$   This must be 3, since the coefficient of $x^8$ in $(1+x+x^2+x^3)^3$ is   3.   I understand actually nothing here. The expression of summation just pops up, and then comes the answer. What I only know that the idea of generating function is used here. Can someone help explain how the steps in the solution come? General question I have an app X installed on my device in version Y. I don't want to update it to any newer version (Y+z) for some reason. Still, the Google Play Store app always lists updates for X, which keeps me from a simple &quot;update all&quot;. My question, put to a single sentence:  How to hide updates for X permanently from the &quot;available updates&quot; list?   Specific examples First, I know there are alternatives as e.g. the , which can handle this quite well (skip this update, skip all future updates). I prefer a &quot;generic solution&quot;, which does not depend on a 3rd party's market app. Second, I know that  includes a &quot;Market doctor&quot;, which can be used to disconnect an app from Google Play.1 However, in my specific case that only worked for a few hours: I disconnected GTalk, as I don't want it replaced by Hangouts. The update notification disappeared for a few hours, then it was back. No idea what restored the &quot;link&quot;. Third, just to make sure: I'm not talking about the &quot;auto update&quot; feature as discussed e.g. in . I was rather hoping for something close to , but without the need to &quot;freeze&quot; the app in question (which I still want to use, but in the version installed, not in a &quot;future version&quot; available). Fourth: No, uninstalling the app in question is no option here, though it would perfectly hide any future updates from being displayed :) Nor is &quot;freezing&quot;, as the app is used regularly. Fifth: There is a related question for my GTalk example:  However, I want the opposite: No update.  It might very well be that &quot;Google Apps&quot; (and other pre-installed apps) are handled in some specific way, and restore their &quot;market links&quot; themselves somehow. For this case, my question includes: How to prevent that from happening?  Update There's a  discussing the very same issue. Until recently, a work-around for &quot;user installed apps&quot; was to uninstall them and then sideload the .apk – but even that stopped working. Well, re-signing the .apk with a different key might work for user-apps. But both would fail for pre-installed apps (can't sideload them to override; different signature would refuse that install completely). Moreover, there's an  on this by some &quot;joel.bou..&quot;. Not hard to guess, though blanked out: that would be Joël Bourquard. If it's really him, then that's really an issue (for those who don't know: Joël is the dev behind Titanium Backup). Let me quote from the issue:  For the record: in the Android Market days it was possible to &quot;Attach&quot; or &quot;Detach&quot; apps (on rooted devices) with a system tool such as Titanium Backup. But nowadays (with the Google Play Store app) this has become nearly impossible to do, because the complete app list seems to sync from Google's servers and the user has no control over that.  Which explains why detaching with apps like Titanium Backup is no longer permanent. And I'm afraid I've asked the impossible. But I thought the same in the past with other questions, and surprisingly got solutions here. So I do not yet give up hope on this one!  1: what that does is explained by eldarerathis  (thanks to  for digging that up!) How can reincarnated souls be summoned using Edo Tensei? Quoting ,     Reincarnation is the philosophical or religious concept that an aspect of a living being starts a new life in a different physical body or form after each biological death. It is also called rebirth or transmigration, and is a part of the Saṃsāra doctrine of cyclic existence.   Then, since Ashura has reincarnated into Naruto, and Indra into Sasuke, how can Uchiha Madara and Senju Hashirama (their previous reincarnation) be summoned using Edo Tensei? Suppose $n$ is an even positive integer and $H$ is a subgroup of $\mathbb Z/n \mathbb Z$. Prove that either every element of $H$ is... Suppose $n$ is an even positive integer and $H$ is a subgroup of $\mathbb Z/n\mathbb Z$. Prove that either every element of $H$ is even or exactly half of its elements are even. (Gallian, Contemporary Abstract Algebra, Exercise 24, Chapter 3.) Is the electric force a vector or a vector field? Show that $$\int_{0}^{\infty} \frac{x - \sin(x)}{x^3} \, dx = \frac{\pi}{4}$$   My attempt is as follows: Let $$f(z) = \frac{z - i e^{iz}}{z^3}$$ and consider the contour on $[\epsilon, R]$ followed by a semicircular arc in the counter clockwise direction, then on $[-R, -\epsilon]$, then the semicircular clockwise contour avoiding the origin. We have, then, that  $$0 = \int_{\Gamma} f(z) dz = \int_{[\epsilon, R]} f(t) dt + \int_{C_R}f(Re^{it})Rie^{it}dt + \int_{[-R, -\epsilon]}f(t)dt + \int_{C_{\epsilon}}f(\epsilon e^{-it})\epsilon i e^{-it} dt$$  Then the first and third integrals ( $I_1$ and $I_3$) combine so that  $$I_1 + I_3 = 2\int_{\epsilon}^R \frac{t - \sin{t}}{t^3}\,dt$$  Further,   $$|I_{C_R}| \leq \int_0^\pi \left|\frac{Re^{it} - ie^{-R\sin{t}}e^{iRcos{t}}}{R^2 e^{2it}} \right|dt \rightarrow 0 \text{ as } R\rightarrow \infty$$  (I've omitted the details, it isn't too bad to bound)  However, I'm having trouble computing the limit  $$\lim_{\epsilon \rightarrow 0}\int_{C_{\epsilon}} f(\epsilon e^{-it})\epsilon i e^{-it} dt$$  No matter which way I look at it, it seems like this limit does not exist. Perhaps I'm seeing something wrong or have I chosen a bad $f(z)$?