I'm a PHP novice, trying to validate HTML form submission via PHP learned in a tutorial.   Code uses mysql_real_escape_string which PHP.net  is deprecated.  Here's an excerpt of that entire section:  /*Cleans an array to protect against injection attacks.*/ function f_clean($array) {     return array_map('mysql_real_escape_string', $array); }   What, if anything, should I add or change in the PHP in order maintain this security measure?
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?
`apt update` failed on Debian Linux Attempting to upgrade testing/stretch Debian Linux:  $ sudo apt update  Ign:1 http://dl.google.com/linux/talkplugin/deb stable InRelease Hit:2 http://dl.google.com/linux/talkplugin/deb stable Release                                                                    ... Get:25 http://mirror.vorboss.net/debian unstable/main i386 Packages 2016-03-25-1456.28.pdiff [15.0 kB]              Fetched 686 kB in 7s (89.5 kB/s)                                                                                                                                                         Reading package lists... Done W: gpgv:/var/lib/apt/lists/dl.google.com_linux_talkplugin_deb_dists_stable_Release.gpg: The repository is insufficiently signed by key 4CCA1EAF950CEE4AB83976DCA040830F7FAC5991 (weak digest) W: gpgv:/var/lib/apt/lists/deb.opera.com_opera_dists_stable_InRelease: The repository is insufficiently signed by key 419D0ACF314E8E993F7F92E563F7D4AFF6D61D45 (weak digest) W: Failed to fetch http://dl.google.com/linux/talkplugin/deb/dists/stable/Release  No Hash entry in Release file /var/lib/apt/lists/dl.google.com_linux_talkplugin_deb_dists_stable_Release, which is considered strong enough for security purposes E: Some index files failed to download. They have been ignored, or old ones used instead.  What's wrong? How to fix it? Asymptotic behavior of a trigonometric series Consider the following series $$S_N = \sum_{k=1}^N \frac{\sin[k\pi/(N+1)]}{k}.$$ What is the asymptotic behavior of this series for $N \to \infty$?  If we replace the sine function with the factor $1$, we get the standard harmonic series which diverges $\sim \ln N$. However, if we replace the sine function with $(-1)^k$, we get a convergent series with the result $\ln 2$. Therefore, I think that $S_N$, defined above, should diverge, but more slowly than the logarithm. Am I correct? First of all, I swear this is not homework, it's a question I was asked in an interview. I think I made a mess of it (though I did realise the solution requires recursion). Here is the question:  Implement the count() method which returns the number of nodes in a tree. If a node doesn't have either a left or right child, the relevant getXXChild() method will return null  class Tree {    Tree getRightChild() {     // Assume this is already implemented   }    Tree getLeftChild() {     // Assume this is already implemented   }    int count() {     // Implement me   } }   My reason for asking the question is simply curious to see the correct solution, and thereby measure how bad mine was.  Cheers, Tony How do I draw the graph of inequalities in the coordinate plane? I want to graph the following inequalities (done in desmos) in latex. I need the code. $\zeta_{15}$ is $15$th primitive $n$th root of unity.   Question: Find the structure of the group $Gal(\mathbb{Q}(\zeta_{15})/\mathbb{Q})$  I know that if $p$ is prime then $G=Gal(\mathbb{Q}(\zeta_{p})/\mathbb{Q})=\mathbb{Z_{p}}^*$ but when $p$ is not prime, I am not show how to solve this if not prime.  Does my required group have any relation to some cyclic group $\mathbb{Z_n}$, i.e. abelian  Would really appreciate your guidance as I have not got my head around these concepts of cyclotomic fields and Galois structure. Thanks $f$ is surjective iff it has a right inverse: using the axiom of choice and errors in ProofWiki Meaning of 'const' last in a function declaration of a class? I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to the browser window. Custom toolbar location XP A few years ago Umber Ferrule wrote that the toolbars in the taskbar are defined in   HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams.   This looks very plausible but cannot be the entire story.  Deleting this key will in no way affect the taskbar and on rebooting the system the key magically reappears.  Why do I want to know?  Simple.  I would like to export the key to a reg. file as a convenient backup. This story had a researcher landing on an uncharted planet to see if it was any good for mining some type of mineral/metal.  Whilst there he encounters this type of ball that chases him all over the planet. He ends up finding this ball’s collection of other things it has caught including animals all the way back to the dinosaurs.  On the ball it has the writing '+/-7.  In the end it chases him for so long that he weighs too little for the balls 'collection'.  Any ideas greatly appreciated. Find the center of the symmetry group $S_n$. Find the center of the symmetry group $S_n$.   Attempt:  By definition, the center is $Z(S_n) = \{ a \in S_n : ag = ga \forall\  g \in S_n\}$. Then we know the identity $e$ is in $S_n$ since there is always the trivial permutation. Suppose $a$ is in $S_n$, but not equal to identity. Now we can imagine the permutation as bijective function that maps from $\{1,2,\dotsc,n\}$ to $\{1,2,\dotsc,n\}$.  So suppose $p$ is a permutation map. Then $p$ maps from a location $i$ to a location $j$. Take $p(i) = j$ where $i\neq j$. Let $k$ be in $\{1,2,\dotsc,n\}$, where $k$, $i$ and $j$ are all different elements. The cycle $r = (jk)$, then we will see if this commutes.  $rp(i) = rj$    Can someone please help me, I am stuck?  Thank you. How to encode the filename parameter of Content-Disposition header in HTTP? Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form:  Content-Disposition: attachment; filename=FILENAME  The filename parameter can be used to suggest a name for the file into which the resource is downloaded by the browser.  (Content-Disposition), however, states in  (The Filename Parameter) that the file name can only use US-ASCII characters:     Current [RFC 2045] grammar restricts   parameter values (and hence   Content-Disposition filenames) to   US-ASCII.  We recognize the great   desirability of allowing arbitrary   character sets in filenames, but it is   beyond the scope of this document to   define the necessary mechanisms.   There is empirical evidence, nevertheless, that most popular Web browsers today seem to permit non-US-ASCII characters yet (for the lack of a standard) disagree on the encoding scheme and character set specification of the file name. Question is then, what are the various schemes and encodings employed by the popular browsers if the file name “naïvefile” (without quotes and where the third letter is U+00EF) needed to be encoded into the Content-Disposition header?  For the purpose of this question, popular browsers being:   Firefox  Internet Explorer  Safari Google Chrome  Opera what is the difference between kind, type and sort I would like to create a table with some columns' width specified, while the text in those columns should be centered both horizontally and vertically. I found out that  \usepackage{array} \begin{tabular}{| c | c | m{5cm} |}   vertically centers the text in the last column, but justifies it horizontally (like text in normal paragraphs).  Update: With Jake's method, it seems both \\ and \hline cause an error. How to fix it? What bizarrities lurk within the decimal expansion of an irrational number? i.e. can we write  $\pi = 3.14159\dots X\dots$  where $X$ consists of (say) $10^{100}$ consecutive zeroes?  [Originally asked on reddit without response :-( ] Convert shapely polygon coordinates I am trying to work with a shapefile using shapely, fiona and python. The original coordinate system is in latitude and longitude that I am trying to convert to state plane system. So I want an updated shapefile with coordinates as statePlane. I converted the json object:  fc = fiona.open("sample.shp")    geoJsonObj = shapefile_record['geometry'] array_coordinates = np.array(geoJsonObj['coordinates']) array_newCoordinates = copy.deepcopy(array_coordinates) for counter in range(0,len(array_coordinates[0])):     long,lat = p1(array_coordinates[0][counter][0],array_coordinates[0][counter][1])     #where p1 is a function to do the conversion     array_newCoordinates[0][counter][0] = long     array_newCoordinates[0][counter][1] = lat  geoJsonObj['coordinates'] = array_newCoordinates.tolist()   when i check the coordinates, i get state plane coordinates according to the transformation.  n. However, when i open the individual shapes/polygons within the shapefile, the coordinates are still latitude and longitude. why does this happen?  ----EDIT 1-----  from pyproj import Proj, transform import fiona from fiona.crs import from_epsg  dest_crs = from_epsg(4269) shape = fiona.open("Sample.shp") original = Proj(shape.crs) # EPSG:4326 in your case destination = Proj('+proj=lcc +lat_1=36.41666666666666 +lat_2=35.25      +lat_0=34.33333333333334 +lon_0=-86 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83  +no_defs') with fiona.open('new.shp', 'w', 'ESRI Shapefile',shape.schema.copy(),crs = dest_crs) as output:     for feat in shape:                print feat['geometry']['coordinates']         for counter in range(0,len(feat['geometry']['coordinates'][0])):             long,lat =  feat['geometry']['coordinates'][0][counter]             x,y = transform(original, destination,long,lat)             feat['geometry']['coordinates'][0][counter] = (x,y)         output.write(feat) Limit $\lim_{n\to\infty}\left(1-\frac{1}{3}\right)^2\left(1-\frac{1}{6}\right)^2\cdots\left(1-\frac{1}{\frac{n(n+1)}{2}}\right)^2$ How can I find the following limit :$$\lim_{n\to\infty}\left(1-\frac{1}{3}\right)^2\left(1-\frac{1}{6}\right)^2\left(1-\frac{1}{10}\right)^2\cdots\left(1-\frac{1}{\frac{n(n+1)}{2}}\right)^2$$There are four options $(a)\frac1{3}(b)\frac1{9}(c)\frac1{81}(d)0$ Thanks! The function auto.arima in the forecast package of R is a powerful tool to identify the best ARIMA(p,d,q) model for a given data series. In the   of the function, they report the following:  auto.arima(y, d=NA, max.p=5, max.q=5, max.order=5, max.d=2, start.p=2, start.q=2, ...)   According to the above function it seems that, by default, auto.arima tries to find the best model among all the combination having:   p equal or lower than 5 q equal or lower than 5 d equal or lower than 2 order equal or lower to 5, i.e. p + q + d  ≤ 5.   However, why does the default code stops at these conditions? Is there any particular reason why p, q and d should be equal or lower than 5, 5 and 2 and their sum lower than 5? Include prior knowledge in regression model I've a classical dataset with real attributes and I want to perform a regression.  But, not all the entries in the training dataset are trustworthy; there is an attribute that I can turn into a confidence value (between 0 and 1) to say how much I can trust the label value. For example, if the confidence value is 0, I mustn't take the entry into consideration.  Is there a way to do this? How do I free up more space in /boot? My /boot partition is nearly full and I get a warning every time I reboot my system. I already deleted old kernel packages (linux-headers...), actually I did that to install a newer kernel version that came with the automatic updates.  After installing that new version, the partition is nearly full again. So what else can I delete? Are there some other files associated to the old kernel images?  Here is a list of files that are on my /boot partition:  :~$ ls /boot/ abi-2.6.31-21-generic         lost+found abi-2.6.32-25-generic         memtest86+.bin abi-2.6.38-10-generic         memtest86+_multiboot.bin abi-2.6.38-11-generic         System.map-2.6.31-21-generic abi-2.6.38-12-generic         System.map-2.6.32-25-generic abi-2.6.38-8-generic          System.map-2.6.38-10-generic abi-3.0.0-12-generic          System.map-2.6.38-11-generic abi-3.0.0-13-generic          System.map-2.6.38-12-generic abi-3.0.0-14-generic          System.map-2.6.38-8-generic boot                          System.map-3.0.0-12-generic config-2.6.31-21-generic      System.map-3.0.0-13-generic config-2.6.32-25-generic      System.map-3.0.0-14-generic config-2.6.38-10-generic      vmcoreinfo-2.6.31-21-generic config-2.6.38-11-generic      vmcoreinfo-2.6.32-25-generic config-2.6.38-12-generic      vmcoreinfo-2.6.38-10-generic config-2.6.38-8-generic       vmcoreinfo-2.6.38-11-generic config-3.0.0-12-generic       vmcoreinfo-2.6.38-12-generic config-3.0.0-13-generic       vmcoreinfo-2.6.38-8-generic config-3.0.0-14-generic       vmcoreinfo-3.0.0-12-generic extlinux                      vmcoreinfo-3.0.0-13-generic grub                          vmcoreinfo-3.0.0-14-generic initrd.img-2.6.31-21-generic  vmlinuz-2.6.31-21-generic initrd.img-2.6.32-25-generic  vmlinuz-2.6.32-25-generic initrd.img-2.6.38-10-generic  vmlinuz-2.6.38-10-generic initrd.img-2.6.38-11-generic  vmlinuz-2.6.38-11-generic initrd.img-2.6.38-12-generic  vmlinuz-2.6.38-12-generic initrd.img-2.6.38-8-generic   vmlinuz-2.6.38-8-generic initrd.img-3.0.0-12-generic   vmlinuz-3.0.0-12-generic initrd.img-3.0.0-13-generic   vmlinuz-3.0.0-13-generic initrd.img-3.0.0-14-generic   vmlinuz-3.0.0-14-generic   Currently, I'm using the 3.0.0-14-generic kernel.