There seems to be a lot of information about this issue all over the internet with no real clarity on required steps.  I am trying to create a 'catch-all' function to prepare strings prior to storage to DB.  function sanitiseThis($string) {    $string = trim($string);    $string = htmlentities($string);    $string = mysqli_real_escape_string($string);    return $string; }   is the trim()/htmlentities() necessary?
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?
How can I manually create a pixel perfect image sprite? How to intuitively understand eigenvalue and eigenvector? I'm learning multivariate analysis and I have learnt linear algebra for two semester when I was a freshman.  Eigenvalue and eigenvector is easy to calculate and the concept is not difficult to understand.I found that there are many application of eigenvalue and eigenvector in multivariate analysis. For example     In principal components, proportion of total population variance due   to kth principal component equal    $$\frac{\lambda_k}{\lambda_1+\lambda_2+...\lambda_k}$$   I think eigenvalue product corresponding eigenvector has same effect as the matrix product eigenvector geometrically.   I think my former understanding may be too naive so that I cannot find the link between eigenvalue and its application in principal components and others.   I know how to induce almost every step form the assumption to the result mathematically. I'd like to know how to intuitively or geometrically understand eigenvalue and eigenvector in the context of multivariate analysis(in linear algebra is also good).  Thank you! Is "gift" accepted as a verb? I have always argued adamantly, as long as the issue has been around, that gift should never be used as a verb. However, someone whose English knowledge I quite respect disagrees.  I’ve done some searching and I haven’t found a consensus; should gifting be shunned? I just attempted to fix a typo on a question on cooking.stackexchange.com and saw this     Oops! Your edit couldn't be submitted because:         Your edit summary must be at least 10 characters   This edit is less than 6 characters; surely more can be improved with your edit?      So, misspelled words have to just be left misspelled?  That could prevent the post from being found in a search. When and where does Attack on Titan take place? Is the setting of "Attack on Titan" (Shingeki no kyojin) supposed to be Earth in the distant future and Titans suddenly appeared out of nowhere and devolved society to medieval level of technology? Or is this just a completely fictional setting? How can I unlock a password locked rar file without knowing the password? I have .rar file that is password protected, but I accidentally have forgotten the password. The file extremely important to me.  How can I get my file back? In windows, there was many programs that could remove the password of such a file. Is there one for Ubuntu? Can you help me with my capacity planning? This is a  about  Related:      I have a question regarding capacity planning. Can the Server Fault community please help with the following:   What kind of server do I need to handle some number of users? How many users can a server with some specifications handle? Will some server configuration be fast enough for my use case? I'm building a social networking site: what kind of hardware do I need? How much bandwidth do I need for some project? How much bandwidth will some number of users use in some application? Young adult book about a boy(?) who gets sent through a portal to another world which is really the distant future set session - custom variable to store user id I want to store user id in custom session variable and use it (read) in trigger procedures to authorize user actions. I found something like this:  set session "myapp.user" = '12345'; ... SELECT current_setting('myapp.user');   and it seems to work - I thought that "myapp.user" should be declared in .conf file but it seems that I can create session variables on the fly (I didn't change .conf file at all).  Is there any disadvantage of doing like this? I'm trying to find a story for my father, from the 70s or earlier  Earth is at war with aliens (possibly Martians) and was unable to effectively fight back as the aliens had planetary (or at least city-protecting) force fields through which no bombardment was possible.  Earth eventually wins through invention of a device that allows them to teleport weapons (nukes?) under the force fields.  originally believed to be one of Harry Harrison's 'One step from earth' shorts, but this is not the case.  Thanks in advance for any help here! Why do I have to specify runat="server" on all my ASP.NET controls when it is a mandatory attribute and server is the only option available in my limited knowledge of ASP.NET, and I get an error if I don't use it?  I do understand that I can optionally use it on my HTML tags, and I do understand the client/server paradigm and what it is actually specifying.  Is it a redundant tag that could just be implied by the control being an ASP.NET control, or is there an underlying reason? Test to see if the title length requirement can be circumvented by appending lots of dots. I am trying to create a directory that will house all and only my PDFs compiled from LaTeX. I like keeping each project in a separate folder, all housed in a big folder called LaTeX. So I tried running:  rsync -avn *.pdf ~/LaTeX/ ~/Output/   which should find all the pdfs in ~/LaTeX/ and transfer them to the output folder. This doesn't work. It tells me it's found no matches for "*.pdf". If I leave out this filter, the command lists all the files in all the project folders under LaTeX. So it's a problem with the *.pdf filter. I tried replacing ~/ with the full path to my home directory, but that didn't have an effect.  I'm, using zsh. I tried doing the same thing in bash and even with the filter that listed every single file in every subdirectory... What's going on here?  Why isn't rsync understanding my pdf only filter?    OK. So update: No I'm trying  rsync -avn --include="*/" --include="*.pdf" LaTeX/ Output/   And this gives me the whole file list. I guess because everything matches the first pattern... su command + authentication failure How to make a field NULL using MySQL GUI Tools? I'm using the MySQL Query Browser (part of the ) and need to change a field to NULL, but I can't figure out how to do it - if I delete the value it tries to update it to ''. Typing "NULL" makes it try to update to 'NULL' (a string).  I know I could just write a query to do it, but that defeats the entire purpose of the tool, no? How to best encapsulate monetary values in a database How do they express the time, in American and British English? I just discovered an incredibly annoying "feature" of Windows 7 tonight.  If you click on your optical drive in Explorer, and there is no disc in the drive, Windows 7 is kind enough to open the tray for you.  I'm finding it hard to contain my rage over this idiotic design decision.  WTF?  According to , this behavior was apparently introduced in Vista.  The author posted a workaround, but I don't want a workaround.  I want it to stop doing this.  Like he, I have a case with a door that covers the drive bays.  If it's closed, and I accidentally click on that optical drive, it knocks on that door 10 or 12 times before giving up.  Can this behavior be turned off in Windows 7? How do you Programmatically Download a Webpage in Java If $a_{ij}=\max(i,j)$, calculate the determinant of $A$ If $A$ is an $n \times n$ real matrix and       $$a_{ij}=\max(i,j)$$       for $i,j = 1,2,\dots,n$, calculate the determinant of $A$.   So, we know that   $$A=\begin{pmatrix} 1 &amp; 2 &amp; 3 &amp; \dots &amp; n\\  2 &amp; 2 &amp; 3 &amp; \dots &amp; n\\  3 &amp; 3 &amp; 3 &amp; \dots &amp; n\\  \vdots &amp; \vdots &amp; \vdots &amp; \ddots  &amp; \vdots\\   n&amp; n &amp; n &amp; \dots &amp; n \end{pmatrix}$$  but what do I do after?