I am trying to create a shell that allows a user to input "ping" commands and use CreateProcess() to execute the command based on user input. I am running into trouble getting the ping command to work when dealing with variables. For example the code below works just fine as long as I have the L in front of the string. However, the string has to be given by user input so after some research I ran across a possible substitution of the L cast in the form of a wchar_t variable.  if (strcmp(buffer, "ping") == 0 || strcmp(buffer, "ping &amp;") == 0){         LPCTSTR path = L"C:\\Windows\\System32\\PING.exe";         LPTSTR link = L"-t www.yahoo.com";         CreateProcess(path,             link,             NULL,             NULL,             0,             0,             NULL,             NULL,             &amp;start,             &amp;info);         if (strcmp(buffer, "ping") == 0){             WaitForSingleObject(info.hProcess, INFINITE);         }         CloseHandle(info.hProcess);         CloseHandle(info.hThread);          printf("MyShell: ");         scanf("%s", buffer);   If I do this change, it stops working (console crashes, no output).           wchar_t wideC = "-t www.yahoo.com";         LPCTSTR path = L"C:\\Windows\\System32\\PING.exe";         LPTSTR link = wideC;   I've tried casting different types of variables both in the CreateProcess() arguments and outside. I don't know what else to do. How can I get the user scanf() into a variable that will work as an argument for creating a process?
This seems like a pretty softball question, but I always have a hard time looking up this function because there seem there are so many variations regarding the referencing of char and tchar.
I'm going to accessing my ubuntu machine remotely from my windows machine through putty. Are there any suggestions for possible ways to get an X server running on my windows machine?  Thanks. Are there gotchas using varargs with reference parameters I have this piece of code (summarized)...  AnsiString working(AnsiString format,...) {     va_list argptr;     AnsiString buff;      va_start(argptr, format);     buff.vprintf(format.c_str(), argptr);      va_end(argptr);     return buff; }   And, on the basis that pass by reference is preferred where possible, I changed it thusly.  AnsiString broken(const AnsiString &amp;format,...) { ... the rest, totally identical ... }   My calling code is like this:-  AnsiString s1, s2;     s1 = working("Hello %s", "World");     s2 = broken("Hello %s", "World");   But, s1 contains "Hello World", while s2 has "Hello (null)". I think this is due to the way va_start works, but I'm not exactly sure what's going on. I want to create an image like below, so a balloon with text on it.     I have been googling for ideas (text, sphere, ....) and came on  earlier question. So I tried Shrinkwrap and Cast modifier.   Here is the situation before applying the modifiers.    This was after trying Shrinkwrap    And this after Cast modifier.    For me it does not look like it is going to work with one of these modifiers.  Question How to create the image of a balloon with text on it ? With one of these modifiers or should I try a complete other approach ?? How to do this ? After upgrading to Ubuntu 17.10, Ubuntu Dock icons of some of my apps are not appearing. They appear properly in the dash. I verified the *.desktop files for the applications in /usr/share/applications and ~/.local/share/applications.  E.g. dock icon is not displaying for "Terminator". Check out the attached image.    This is how the icon for the same application appears in dash search:    Content of /usr/share/applications/terminator.desktop:  [Desktop Entry] Name=Terminator Comment=Multiple terminals in one window TryExec=terminator Exec=terminator Icon=terminator Type=Application Categories=GNOME;GTK;Utility;TerminalEmulator;System; StartupNotify=true X-Ubuntu-Gettext-Domain=terminator X-Ayatana-Desktop-Shortcuts=NewWindow; Keywords=terminal;shell;prompt;command;commandline; [NewWindow Shortcut Group] Name=Open a New Window Exec=terminator TargetEnvironment=Unity   Any pointers to debug this issue will be helpful. The vertical line at the end of the cell where i used cell merge is missing. Reading text file with NSString:stringWithContentsOfFile? GetFeatureInfo from Image WMS Can you grapple/shove with the Hunter Ranger's Whirlwind Attack? The  states:     You can use your action to make a melee attack against any number of creatures within 5 feet of you, with a separate attack roll for each target.   The rules on "" state (the rules in shoving are effectively identical):     When you want to grab a creature or wrestle with it, you can use the Attack action to make a special melee attack, a grapple. If you're able to make multiple attacks with the Attack action, this attack replaces one of them.   I couldn't find any other features spells or abilities that allow a creature to make a flat "melee attack". If they had said "melee weapon attack" instead this would have meant the same thing but specifically have excluded grapple/shove as an option.  I am unsure whether the rules on grappling/shoving mean that the only time you can grapple/shove are when you take the Attack action, which you are not doing when using the Whirlwind Attack feature.   I would like answers to assume that the following ruling made in the  is correct:     Whirlwind Attack is unusual, in that it’s a single attack with multiple attack rolls... How to get a list of current open windows/process with Java? Does any one know how do I get the current open windows or process of a local machine using Java?    What I'm trying to do is: list the current open task, windows or process open, like in  Windows Taskmanager, but using a multi-platform approach - using only Java if it's possible. Last semester I picked up an algebra course at my university, which unfortunately was scheduled during my exams of my major (I'm a computer science major). So I had to self study the material, however, the self written syllabus was not self study friendly (good syllabus overall though).  The course was split up into 3 parts, group theory, ring theory and field theory. As a computer science major we only had to study the first 2.  Now that I passed the exam for this course I want to study the field theory part ( which covers Galois theory, etc).  So, now I want to ask whether any of you know any good books on abstract algebra, which lift off at basic ring theory and continue to more advanced ring theory and to finite fields, Galois theory, ...  Please keep in mind that I am not a math major, and that I would like books which are suited for self study (thus a lot of examples and intuition).  Thanks in advance! Transformation of Random Variable $Y = X^2$ I'm learning probability, specifically transformations of random variables, and need help to understand the solution to the following exercise:      Consider the continuous random variable $X$ with probability density function $$f(x) = \begin{cases} \frac{1}{3}x^2 \quad  -1 \leq x \leq 2, \\ 0 \quad \quad \text{elsewhere}. \end{cases}$$ Find the cumulative distribution function of the random variable $Y = X^2$.   The author gives the following solution:   For $0 \leq y \leq 1: F_Y(y) = P(Y \leq y) = P(X^2 \leq y) \stackrel{?}{=} P(-\sqrt y \leq X \leq \sqrt y) = \int_{-\sqrt y}^{\sqrt y}\frac{1}{3}x^2\, dx = \frac{2}{9}y\sqrt y.$  For $1 \leq y \leq 4: F_Y(y) = P(Y \leq y) = P(X^2 \leq y) \stackrel{?}{=} P(-1 \leq X \leq \sqrt y) = \int_{-1}^{\sqrt y}\frac{1}{3}x^2\, dx = \frac{1}{9} + \frac{1}{9}y\sqrt y.$  For $y &gt; 4: F_{Y}(y) = 1.$    Previous to this exercise, I've managed to follow the solutions of two similar (obviously simpler) problems for a strictly increasing and strictly decreasing function of $X$, respectively. However in this problem, I don't understand the computations being done, specifically:    How does the three intervals $0 \leq y \leq 1$, $1 \leq y \leq 4$ and $y &gt; 4$ are determined? In the two previous problems I've encountered, we only considered one interval which was identical to the interval where $f(x)$ was non-zero. In the case where $0 \leq y \leq 1$, why does $P(X^2 \leq y) = P(-\sqrt y \leq X \leq \sqrt y)$ and not $P(X \leq \sqrt y)$? I have put question marks above the equalities that I don't understand.   I think I have not understand the theory well enough. I'm looking for an answer that will make me understand the solution to this problem and possibly make the theory clearer. How can I make realistic looking potions as handouts This question is from [Number Theory George E. Andrews 1-1 #3].     Prove that $$x^n-y^n=(x-y)(x^{n-1}+x^{n-2}y+\ldots+xy^{n-2}+y^{n-1}).$$   This problem is driving me crazy. $$x^n-y^n = (x-y)(x^{n-1}+x^{n-2}y+\dots +xy^{n-2}+y^{n-1)}$$  $(x^n-y^n)/(x-y) =$ the sum for the first $n$ numbers and then I added $(xy^{(n+1)-2}+y^{(n+1)-1})$ which should equal $(x^{n+1}-y^{n+1})/(x-y)$ but I can't figure it out    This is a similar problem in the book and I tried this method but it wasn't working out      $\quad$Thereom $\bf1$-$\bf2$: $\,\,\,\,$ If $\,x$ is any real number other than $1$, then $$\sum_{j=0}^{n-1}x^j=1+x+x^2+\ldots+x^{n-1}=\dfrac{x^n-1}{x-1}.$$    $\quad$Remark: $\displaystyle\sum_{j=0}^{n-1}A_j$ is shorthand for $A_0+A_1+A_2+\ldots+A_{n-1}.$     $\quad$Proof: Again we proceed by mathematical induction. If $n=1$ then $\displaystyle\sum_{j=0}^{1-1}x^j=x^0=1$ and $(x-1)/(x-1)=1$. Thus the theorem is true for $n=1$.  $\quad$ Assuming that $\displaystyle\sum_{j=0}^{k-1}x^j=(x^k-1)/(x-1)$, we find that $$ \eqalign{ \sum^{(k+1)-1}_ {j=0}x^j &amp; = \sum^{k-1}_ {j=0}x^j+x^k=\dfrac{x^k-1}{x-1}+x^k \\ &amp;= \dfrac{x^k-1+x^{k+1}-x^k}{x-1}\\ &amp;= \dfrac{x^{k+1}-1}{x-1}. }$$   Hence condition $(\rm ii)$ is fulfilled, and we have established the theorem.    $\quad$Corollary $\bf1$-$\bf1$: $\,\,$ If $\,m$ and $n$ are positive integers and if $m&gt;1$, then $n&lt;m^n.$ "+-=,;..." math characters in DejaVu Sans (with mathspec) the following MWE  \documentclass{minimal} \usepackage{mathspec} \setmainfont{DejaVu Sans} \setmathsfont(Digits,Latin,Greek){DejaVu Sans} \setmathrm{DejaVu Sans} \begin{document} \(\mathrm{e}^{\mathrm{i}\pi}=-1\) = -1 \end{document}   typesets with xelatex into    How can I turn the = and - signs in math mode to DejaVu Sans ? I've just gotten through replacing capacitors on a trio of dead LCD screens (nothing's blown up yet, so far) - they either had one or two capacitors on their inverter circuit SLIGHTLY bloated, and not quite leaky. I ended up replacing all capacitors of the same brand/'colour', even the ones that looked fine, in case.  Now, checking a bad resistor is simple - i can use a standard multimeter to test it, and i tend to check my solders with the continuity testing option of the multimeter.  How would i test a capacitor ? Is there some standard, common way to test one? How to clip an Openlayers OSM Background to a Vector Boundary? I'm new to QGIS. In my project i have two layers: one is my vector (city boundaries) and the other is the OSM (obtained with the plugin). How can I cut the OSM along the edges of the vector? I want to obtain only a region of the map, to save it as an image. How do I send a file as an email attachment using Linux command line? I've created a script that runs every night on my Linux server that uses mysqldump to back up each of my MySQL databases to .sql files and packages them together as a compressed .tar file.  The next step I want to accomplish is to send that tar file through email to a remote email server for safekeeping.  I've been able to send the raw script in the body an email by piping the backup text file to mailx like so:  $ cat mysqldbbackup.sql | mailx backup@email.com   cat echoes the backup file's text which is piped into the mailx program with the recipient's email address passed as an argument.  While this accomplishes what I need, I think it could be one step better, Is there any way, using shell scripts or otherwise, to send the compressed .tar file to an outgoing email message as an attachment?  This would beat having to deal with very long email messages which contain header data and often have word-wrapping issues etc. Cartesian products and families I have some trouble trying to understand Halmos' explanations about generalized Cartesian products. I've read these entries already:    This also has the page I'm stuck on.      Is his generalization the same as a Cartesian product of several sets? As here:   What puzzles me is $\{a,b\}$. Where does it come from, what does it do? I know that it is supposed to be arbitrary. How does it identify distinct elements of $X \times Y$? Does some function map each $a \in A$ to an element in $X$? Or is it always the same $a$?  What does he mean by      the set $Z$ of all families $z$, indexed by $\{a,b\}$, such that $z_a \in X$  and $z_b \in Y$   ? What does does an element of $Z$, namely one family $z$, consist of? By family, does he mean an indexing function or the indexed elements? This comes to a very important question for me: Does family mean a function or the set of all indexed elements?   I will try to explain how I understand it thus far: $Z$ contains elements of the form $\{(a,x),(b,y)\}$. The choice of $x$ depends on $a$, so an $x$ in a $z \in Z$ equals the $z_a$ of $X$. Now, we want to map these pairs to $X \times Y$, so we have a function $f$ that takes $z \in Z$ and connects it to the corresponding ordered pair $(z_a, z_b)$, where $z_a \in X$. $X \times Y$ is not the same as $Z$; they only, effectively, contain equal elements.  He goes on:     If $\{X_i\}$ is a family of sets ($i \in I$), the Cartesian product of the family is, by definition, the set of all families $\{x_i\}$ with $x_i \in X_i$ for each $i$ in $I$.   How I understand it: $\{X_i\}$ contains, as elements, several sets, each single one a set $X$ identified by an index/element of $I$. Then, we go over all indeces $i$ in $I$, take from each set $X$, namely $X_i$, an element $x$ and add it to current set of the newly created sets/families. So, the lower index $i$ does not refer to an element of $X_i$ indexed by $i$, but rather calls all elements of $X_i$ $x_i$. We end up with a set, defined as Cartesian product, of sets, in which each element (set) contains ordered elements, each from a different $X_i$. How does the ordering occur?  $\prod_i X_i$, the Cartesian product, becomes equal to $X^I$, if all $X_i$ are the same set $X$. $X^I$ means all possible combinations of mapping from $I$ to $X$. We randomly take an elements $x$ from some $X_i$, put it in a set/family with other randomly obtained $x$, put the entire set into a set denoted $X^I$, and continue doing so, till we have no more options. Then, each set in the new $X^I$ contains a mapping of some $i$ to some $x$. Since we exhausted the options, they are indeed all combinations.  Where did I go wrong? Someone needs to spoonfeed my the answer; I am completely confused by now. The equation $X^{n} + Y^{n} = Z^{n}$ , where $ n \geq 3$ is a natural number, has no solutions at all where $X,Y,Z$ are intergers. Big tilde in math mode