I'm trying to insert a string into the database , but when it contains single quote('), the query becomes invalid.    $set_content=$_POST['content'];   $result = pg_query($db,"INSERT INTO programmes(title,picture,content) VALUES('$set_title','$pic_path','$set_content');");
If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?
Xorg: High CPU Usage (94%) on Moving Mouse (Ubuntu 18.04) whenever I move my mouse enough it causes high cpu usage. Screenshot provided is on a fresh X session.    This also causes some frequent freeze ups if I'm running some other programs e.g gaming.  [1075299.085] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost. [1077813.434] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost. [1077814.079] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost. [1077814.246] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost. [1077814.682] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost. [1077831.975] (EE) client bug: timer event4 debounce: offset negative (-18ms) [1077831.975] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost. [1077831.975] (II) event4  - Corsair Corsair Vengeance M90 Mouse: WARNING: log rate limit exceeded (5 msgs per 30000ms). Discarding future messages. [1120008.128] (II) event4  - Corsair Corsair Vengeance M90 Mouse: SYN_DROPPED event - some input events have been lost.   Is there any way for the CPU usage not to be this high?  EDIT:  I tried with other mice. The CPU usage appears to increase with the Mouse DPI or to be exact, a generic mouse will cause a CPU usage spike, but not as much as a gaming mouse.  I also checked if I have hardware acceleration enabled.  $ glxinfo | grep "direct rendering" direct rendering: Yes   EDIT 2:  CPU is an AMD FX-6350  GPU is AMD RX Vega 56 Why is this true?  $(\exists x)(P(x) \Rightarrow (\forall y) P(y))$ Proof that total derivative is the only function that can be added to Lagrangian without changing the EOM So I was reading this:  and while the answers for the first question are good, nobody gave much attention to the second one. In fact, people only said that it can be proved without giving any proof or any.  So, if I have a Lagrangian and ADD an arbitrary function of $\dot{q}$, $q$ and $t$ in such a way that the equations of motion are the same, does this extra function MUST be a total time derivative?   EDIT Ok, I changed my question a little bit:  Question: If I have a function that obeys the Euler-Lagrange equation off-shell, this implies that my function is a time derivative? (This was used in Qmechanic's answer of this other question: , equation 14.)  Also, why people only talk about things that change the Lagrangian only by a total derivative? If this is not always the case that keeps the equation of motion the same, so why is it so important? And why in the two questions I posted about the same statement on Landau&amp;Lifshitz's mechanics book only consider this kind of change in the Lagrangian? Is there an SE for Cell-phones? Where would I ask a question pertaining to an ordinary phone? Or just cell phones in general? I saw Windows Phone while browsing the SE database, nothing else really popped out at me. Google didn't bring up anything either. Is that just too small a community to cover with SE? I installed ubuntu 16.04 LTS, but there is no ubuntu one software, not in ubuntu software center also..Though it is showing selected in unity tweak tool.How can I get it. Please reply. How do I speed up my design work? I've been a designer for 6 months, having previously had a 1st class honours degree in Graphic Communication. My issue is that I am a Very good designer, but I work too slow. It's beginning to drive a rift between myself and the creative director who desperately wants me to work quicker. I've always been a workaholic even in university, I put in 110% all the time, really work my ass off, but I'm still not fast enough to complete projects quickly, my work is good, but it's not efficient.  Do you guys have any tips to help me speed up? So we learned telescoping series in class and I came across this question in my textbook and I tried to evaluate it, but I don't understand how to do it.   $$ \sum\limits_{k=1}^n\left(k \cdot k!\right) $$  According to the answers:  $$ \sum\limits_{k=1}^n\left(k \cdot k!\right) = (n+1)! - 1 $$  We learned how to simplify certain telescoping series using partial fractions but I don't have any idea on how to start this question. Where can I find good literature for beginners? I am trying to find some database tutorials,books and similar, since I have started this course in college, and received some material, but it is really hard to manage through all the info on the net. I searched through the questions on the site but didn't find any. Thankfull for all your input. Regression: Transforming Variables Wikipedia introduces the vector product for two vectors $\vec a$ and  $\vec b$ as $$ \vec a \times\vec b=(\| \vec a\| \|\vec b\|\sin\Theta)\vec n $$ It then mentions that $\vec n$ is the vector normal to the plane made by $\vec a$ and  $\vec b$, implying that $\vec a$ and  $\vec b$ are 3D vectors. Wikipedia mentions something about a 7D cross product, but I'm not going to pretend I understand that.  My idea, which remains unconfirmed with any source, is that a cross product can be thought of a vector which is orthogonal to all vectors which you are crossing.  If, and that's a big IF, this is right over all dimensions, we know that for a set of $n-1$ $n$-dimensional vectors, there exists a vector which is orthogonal to all of them.  The magnitude would have something to do with the area/volume/hypervolume/etc. made by the vectors we are crossing.  Am I right to guess that this multidimensional aspect of cross vectors exists or is that last part utter rubbish? Name for these kinds of "sayings"? Best way to deal with questions answered by the OP in the question instead of in an answer I saw this question:   I don't know what the best option is for dealing with such a question, because I've seen questions like this several times already.  So, what should we do with questions that are:   poorly asked finally answered by the OP as an update to the question itself, not as an answer. I cannot submit my answer to    I am aware that my reputation is low. Also, spam posting is discouraged.  My answer includes a compilation of Android graphing libraries, with links, so fellow hackers do not have to Google each and every one of them.  I believe this answer is superior to the current answers, because it is updated to 03/2012 and covers more than 90% of all Android charting libraries.  How can I post the answer, or how can I increase my reputation without being able to post quality answers? The old school websites included just a bunch of links to other places, I am an old man!  Alternative solution would be to blog it, and just post a link to my blog, which is not optimal. do { ... } while (0) — what is it good for? Possible Duplicate:          I've been seeing that expression for over 10 years now. I've been trying to think what it's good for. Since I see it mostly in #defines, I assume it's good for inner scope variable declaration and for using breaks (instead of gotos.)  Is it good for anything else? Do you use it? Calculationg base-resistor between microcontroller and transistor I'm curious, when connecting my 2N2222 transistor's base to a PWM output pin on my Arduino, I know the Arduino can deliver a maximum of 40mA current. The 2N2222 only requires around 5 to 10 mA on it's base to switch the collector and emitter. Now, when calculating the base-resistor under "normal" conditions where I'm merely switching it directly from Vcc, the following applies:   However, when putting in a 500 ohm or 1K resistor in (1K for 5mA) directly it works great. But putting it in between the Arduino and the transistor, the transistor doesn't switch.  I suspect thus, that the resistance is too high of the base-resistor. Therefore, we may very well not need a base-resistor.  But, according to spec, the Arduino can deliver 40mA. So, am I correct in assuming the folling: 1) I should calculate the perceived resistance that the Arduino is giving, if it goes high to 5Volt and only gives 40mA, and then 2) Subtract that from the 500ohm resistor needed to make the transistor operate optimally.  Example:    So, I'm theorising that I have to then put in a 375 ohm resistor in to make the total resistance between the Arduino and the base resistor 500 ohm.  Somehow this doesn't feel right. Keep in mind, I'm not an electronic engineer, so I might have the cat by the tail here :P I am currently trying to establish a clear picture of pure/mixed/entangled/separable/superposed states. In the following I will always assume a basis of $|1\rangle$ and $|0\rangle$ for my quantum systems. This is what I have so far:   superposed: A superposition of two states which a system $A$ can occupy, so $\frac{1}{\sqrt{2}}(|0\rangle_A+|1\rangle_A)$ seperable: $|1\rangle_A|0\rangle_B$ A state is called separable, if its an element of the (tensor)product basis of system $A$ and $B$ (for all possible choices of bases) entangled: $\frac{1}{\sqrt{2}}(|0\rangle_A|1\rangle_B+|1\rangle_A|0\rangle_B)$ is not a state within the product basis (again for all possible bases). mixed state: Is a statistical mixture, so for instance $|1\rangle$ with probability $1/2$ and $|0\rangle$ with probability $1/2$ pure state: Not a mixed state, no statistical mixture   I hope that the above examples and classifications are correct. If not it would be great if you could correct me. Or add further cases, if this list is incomplete.   On wikipedia I read about      Another way to say this is that while the von Neumann entropy of the whole state is zero (as it is for any pure state), the entropy of the subsystems is greater than zero.   which is perfectly fine. However I also read on wikipedia a criterion for :     Another, equivalent, criterion is that the von Neumann entropy is 0 for a pure state, and strictly positive for a mixed state.   So does this imply that if I look at the subsystems of an entangled state, that they are in a mixed state? Sounds strange... What would be the statistical mixture in that case?  Moreover I also wanted to ask, whether you had further illustrative examples for the different states I tried to describe above. Or any dangerous cases, where one might think a state of one kind to be the other? Texture Channel animated, doesn't appear in viewport postfix fails to send mail with "fatal: unknown service: smtp/tcp" With powershell get exactly the same application list as in Add/Remove programms There are various methods to find installed applications on the system but to my knowledge none returns exactly the same list as control panel item Add Remove Programs. Some of the ways I tried are:   WMI via Win32_Product and Win32Reg_AddRemovePrograms Registry, both x32 and x64 branches   For instance, I have 217 entries in AR and   gwmi  Win32_Product   returns 261 items.  gp HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | ? {![string]::IsNullOrWhiteSpace($_.DisplayName) } | select DisplayName   returns 119 items.   (gwmi Win32Reg_AddRemovePrograms) + (gwmi Win32Reg_AddRemovePrograms64) | sort DisplayName -Unique    returns 107 items.  I tried to nail it down with more complex filter that included InstallLocation, InstallSource, InstallDate etc without success. How to install Android OS and Android Apps on PC ? If possible , android 4.0.3 .