Single line calculator - problem with last number
Evaluating string "3*(4+2)" yield int 18
I have a  and I connected it to my servo () per these details:   PIC pin 1 to positive pin 8 to negative pin 2 to servo red wire (signal) servo brown wire to negative servo orange to positive (servo has three colors: brown, red and orange wires)   I programmed PIC with this code:      #include &lt;xc.h&gt;     #define _XTAL_FREQ 20000000     #pragma config WDTE=OFF , BOREN=OFF , PWRTE=ON , MCLRE=OFF , FOSC=INTRCIO      void main(){     TRISIO = 0b0000000;     GPIO = 0b000000;         while(1==1){             GPIO = 0b000000;             __delay_ms(1);             GPIO = 0b111111;             __delay_ms(19);         }  }   But servo does not move a bit. What is the problem?  Edit: i found out it rotate servo arm very fast to its end(the point it couldn't rotate any more then it sound like tick tick tick .....)  i changed my code to this(to reverse it back):              GPIO = 0b000000;             __delay_ms(1);             GPIO = 0b111111;             __delay_ms(19);             GPIO = 0b000000;             __delay_ms(2);             GPIO = 0b111111;             __delay_ms(18);   but it behave the same. How can I use sed to replace a multi-line string? I've noticed that, if I add \n to a pattern for substituting using sed, it does not match. Example:  $ cat &gt; alpha.txt This is a test Please do not be alarmed  $ sed -i'.original' 's/a test\nPlease do not/not a test\nBe/' alpha.txt  $ diff alpha.txt{,.original}  $ # No differences printed out   How can I get this to work? "The following packages have been kept back:" Why and how do I solve it? Is there any way to accept only numeric values in a JTextField? What do I say to make a new line when using voice recognition? I've found I can make punctuation happen by saying "comma", or "period", but I can't find the word for new line.  I tried "paragraph", and "line break", but it just prints those words. Say I have a metric space $(X, d)$ and a set $A\in X$.  I want to prove that if $a \in \overline{A}$ then there is a convergent sequence $\{x_n\}$ that converges to $a$. Could I have any help? I am familiar with the set-theoretical definition of functions.   A function $f : A \rightarrow B$ from a set $A$ to a set $B$ is a subset $f \subseteq A \times B$ of the Cartesian product $A \times B$ such that the following conditions hold:   $\forall a \in A : \exists b \in B : (a,b) \in f$ $\forall a \in A : \forall b, b' \in B : (a,b), (a,b') \in f \rightarrow b=b'$   Is there a purely set-theoretical definition of the function evaluation $f(a)$ for every $a \in A$? I get as far as defining  $f(a) = \{ b \in B : (a,b) \in f \}$ but that defines rather the set of values of a multi-valued function. Do lightsabers have safety settings? While rewatching Star Wars my skin was crawling while watching Luke practice saber technique against a remote on the Falcon.  There's no way I'd want to be in the same room with a beginner waving a lightsaber around, let alone a beginner with his eyes covered.  Samurai apparently practiced with  to reduce training injuries.  Do lightsabers have lower power settings so that a wrong move while practicing doesn't sever a limb or chop through the hull into vacuum? I have a COM dll written in vb6. When I try to create a new object of a class module from this dll I get a Run timer error 430: Class does not support automation or does not support expected interface. The interesting thing is that this happens only from outside the IDE, when I am debugging from within the IDE there is no error thrown and the new object of the class is created successfully. What can be the cause?  In general I occasionally get these kind of errors in COM dlls. What is the best way to debug COM issues? How can I know the path of the dll that is being used when a program is running? How do I get a Seraph Crystal? Can I download the Winter Bash hats for use as profile picture? Can I download  and use them as my profile picture?  I actually like some of them, and want to keep them for future use. I'm working with some code that widely uses the idiom of returning a pointer to a static local variable.  eg:  char* const GetString() {   static char sTest[5];   strcpy(sTest, "Test");   return sTest; }   Am I right in thinking that this is safe?  PS, I know that this would be a better way of doing the same thing:  char* const GetString() {   return "Test"; }   Edit: Apologies, the function signature should of course be:  const char* GetString(); how to show only changed rows if want querying the following table :  EventDateTime (DateTime), Host (guid), Flag ( bit) 2013-04-01 05:00, {id-x}, 0 2013-04-01 05:01, {id-x}, 0 2013-04-01 05:02, {id-x}, 0 2013-04-01 05:03, {id-x}, 0 2013-04-01 05:04, {id-x}, 1 2013-04-01 05:05, {id-x}, 1 2013-04-01 05:06, {id-x}, 1 2013-04-01 05:07, {id-x}, 0 2013-04-01 05:08, {id-x}, 0 2013-04-01 05:09, {id-x}, 0 2013-04-01 05:10, {id-x}, 0 2013-04-01 05:11, {id-x}, 1 2013-04-01 05:12, {id-x}, 1 2013-04-01 05:13, {id-x}, 1 2013-04-01 05:14, {id-x}, 1 2013-04-01 05:15, {id-x}, 0   and the result should be:  2013-04-01 05:04, {id-x}, 1 2013-04-01 05:07, {id-x}, 0 2013-04-01 05:11, {id-x}, 1 2013-04-01 05:15, {id-x}, 0   i have try it with LAG,LEAD and OVER Clause. but no luck :( $\lim\limits_{n\to \infty} \int_0^1 |f(x)-a_nx-b_n| dx=0$ implies $(a_n)_n,(b_n)_n$ are convergent Let $f:[0,1] \to \mathbb R$ be a continuous function and the sequences $(a_n)_n,(b_n)_n$ s.t. $$\lim_{n\to \infty}  \int_0^1 |f(x)-a_nx-b_n| dx=0.$$ Prove that $(a_n)_n,(b_n)_n$ are convergent.   I know that $$\left|\int_0^1f(x)dx\right| \le \int_0^1|f(x)|dx.$$ Can somebody help me, please? So basically in SQL Server a NULL means there is no value and thus can't be compared which returns some unexpected results.  For example, the following query doesn't return rows where value IS NULL but I want it to:  SELECT * FROM table WHERE   (value != 26)   AND date IS NULL   AND last_modified &gt;= '5/21/2014'   I understand I can do the following as a workaround but seriously? Having to add parentheses and check if is null for every single field every single time I want to include it? Seems ugly, not intuitive and crazy.  SELECT * FROM table WHERE   (value != 26 OR value is null)   AND date IS NULL   AND last_modified &gt;= '5/21/2014'   I mean I know NULL is not a value and thus can't be compared but can't you infer that it is, in fact, definitely not 26? If 26 is something and NULL is nothing and nothing is not something then NULL is not 26. Seems logical to me.  Does anyone know how I can, in a cleaner way, include nulls in my results when using comparisons without having to include an explicit check each and every time. Also turning off nulls on my tables is definitely not an option.  Edit:  My real problem of why I don't want to do it the way I showed was not exposed. So here goes. I am writing a program that let's you build queries to database tables and let's the user dynamically create filters and such which essentially at the end of the day constructs a SQL statement and gets the results to display to the user. The fields chosen by the user can be any and/or all fields in a given database and if I have to literally put that ISNULL check on every single field that would be really inefficient and make looking at the SQL super ugly. My program is table-definition-agnostic meaning I don't care what's in your table and don't want to know what your table's definition is. I just want you to pick a table, choose some fields to filter on with equals, not equals, in, not in, etc ... and then click a button to view the results of that request. Is there a way to make Git mark a file as conflicted? How do I resolve these unmet dependencies? Difference between "been to" and "been in" I run below command on ubuntu 16.4 :  sudo add-apt-repository ppa:noobslab/apps  of below question:    and get below error:  Traceback (most recent call last):   File "/usr/bin/add-apt-repository", line 11, in &lt;module&gt;     from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler   File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in &lt;module&gt;     import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Error in sys.excepthook: Traceback (most recent call last):   File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook     from apport.fileutils import likely_packaged, get_recent_crashes   File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in &lt;module&gt;     from apport.report import Report   File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in &lt;module&gt;     import apport.fileutils   File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in &lt;module&gt;     from apport.packaging_impl import impl as packaging   File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in &lt;module&gt;     import apt   File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in &lt;module&gt;     import apt_pkg ModuleNotFoundError: No module named 'apt_pkg'  Original exception was: Traceback (most recent call last):   File "/usr/bin/add-apt-repository", line 11, in &lt;module&gt;     from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler   File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in &lt;module&gt;     import apt_pkg ModuleNotFoundError: No module named 'apt_pkg'   Thanks for help How do camera body motors compare to in-lens motors for focusing? What is the difference between using a motor on the camera body and the motor built into lenses?   Aside from how both compare in terms of speed, what differences would I notice if I use a body with a motor and motor-less lens, and a lens with motor on a body that lacked one?  A comparison chart outlining the various lens motor types would be a great help as high end USM motors for Sigma lenses are faster then their regular versions.