Is it a good practice to store primary key values in form elements for storing data after form submission?  For example if I have a select tag inside my form like this:  &lt;select name="city"&gt;   &lt;option value="3"&gt;Kolkata&lt;/option&gt;   &lt;option value="7"&gt;Bangalore&lt;/option&gt;   &lt;option value="1"&gt;Delhi&lt;/option&gt;   &lt;option value="4"&gt;Mumbai&lt;/option&gt; &lt;/select&gt;   In my City table they are stored like this:  Id  Name --  ---- 1   Delhi 3   Kolkata 4   Mumbai 7   Bangalore   After form submission, extraction of values is pretty simple and we directly get the  foreign key value without looking up the City table.  However, I feel that this could be a major problem since one can easily manipulate the values through developer tools.  If not this approach, what is the general and widely accepted norm?  EDIT  Since this question has been suggested as a duplicate of , I've added my reason against it:  This question deals with the aspect of general practice followed by developers unlike the other with deals with security concerns if a particular practice is followed.
I've heard that exposing database IDs (in URLs, for example) is a security risk, but I'm having trouble understanding why.  Any opinions or links on why it's a risk, or why it isn't?  EDIT: of course the access is scoped, e.g. if you can't see resource foo?id=123 you'll get an error page. Otherwise the URL itself should be secret.  EDIT: if the URL is secret, it will probably contain a generated token that has a limited lifetime, e.g. valid for 1 hour and can only be used once.  EDIT (months later): my current preferred practice for this is to use UUIDS for IDs and expose them. If I'm using sequential numbers (usually for performance on some DBs) as IDs I like generating a UUID token for each entry as an alternate key, and expose that.
Is there a package to secure rendered pdf with a password? Sometimes I need to write text and then pipe that text into another command. My usual workflow goes something like this:   vim # I edit and save my file as file.txt cat file.txt | pandoc -o file.pdf # pandoc is an example  rm file.txt   I find this cumbersome and seeking to learn bash scripting I'd like to make the process much simpler by writing a command which fires open an editor and when the editor closes pipe the output of the editor to stdout.  Then I'd be able to run the command as quickedit | pandoc -o file.pdf.   I'm not sure how this would work. I already wrote a function to automate this by following the exact workflow above plus some additions. It generates a random string to act as a filename and passes that to vim when the function is invoked. When the user exits vim by saving the file, the function prints the file to the console and then deletes the file.   function quickedit {     filename="$(cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 32)"     vim $filename     cat $filename     rm $filename } # The problem: # =&gt; Vim: Warning: Output is not to a terminal   The problem I soon encountered is that when I do something like quickedit | command vim itself can't be used as an editor because all output is constrained to the pipe.   I'm wondering if there are any workarounds to this, so that I could pipe the output of my quickedit function. The suboptimal alternative is to fire up a separate editor, say sublime text, but I really want to stay in the terminal. I have used the websites of SO a lot the past few months because I am busy with a large scale web project. I feel I get better answers here on SO than when I just do a Google search, maybe because I can be more specific here with my problem, and the responses are really fast.  Occasionally when I am not working I try to answer some questions, but the question almost always has an answer which is 'as good as' or 'better' than the answer I would supply.  So my question/answer ratio is about 20/1 something, if not more. When I look at my profile page I see a bucket-load of questions and almost nothing I answered myself.  Is this considered bad behaviour? I can see that this looks a little egoistic.  : One devoted to one's own interests and advancement. How to bond two different internet connections I have two internet connection, each with 4mbps bandwidth. I want to join/merge both of them to get 8mbps speed, both routers have WLAN and LAN capability.    How to Double my speed using two routers? Can I bond two connections in Windows and double my internet connection speed? Any download manager that accepts two internet connection to download? Proving that $f(x) = g(x)$ for some $x \in [a,b]$ if $f,g$ continuous, $f(a)  g(b)$ Suppose $f$ and $g$ are continuous on $[a,b]$ and that $f(a) &lt; g(a)$ but $f(b) &gt; g(b)$.   Prove that $f(x) = g(x)$ for some $x \in [a,b]$.     I did try and actually did get as far as coming up with $f-g$. Would I set $h(x)= f(x)- g(x)$ and say $h(a) &lt;x&lt; h(b)$? How do I report a bug? I found a problem with an application on Ubuntu.   Questions :   How do I best report the issue?  What sort of information should I provide? If string is stretched just by weight, where does the gravitational potential energy goes if only half is converted to elastic potential energy? If a spring is stretched by a weight of mass m, (so the extension is $\Delta x$) then $ k = \frac W{\Delta x} = \frac {mg}{\Delta x}$. So $ k\Delta x= mg $.  When the Spring is stretched by distance $\Delta x$ (by the weight) then it looses gravitational potential enegry. ($ \Delta GPE= mg\Delta x$)  But, when we calculate the change in elastic potential energy, We get  $ U = \frac 12 k(\Delta x)^2 $. Since $ k\Delta x = mg$, $U=\frac 12 mg\Delta x$  At, equilibrium we have no kinetic energy $E_k = 0$  Doesn't that violate Energy Conservation?  Where does the rest of lost GPE goes?  Here's a illustration How to execute file I'm editing in Vi(m) Why ; is called semicolon and what is its history? Semi- is a Latin prefix meaning "half" and colon is another punctuation. Should I therefore say that semicolon is a halved colon? Can I bring a painted Cow skull to the US with me via plane? I bought this traditionally painted cow skull, a typical decoration item for the day of the dead. Since its bone (completely clean though) can I bring it with me on a plane as carry-on or special luggage, without having to declare it or having it confiscated?    [] What are the differences between a pointer variable and a reference variable in C++? A doubt on the definition of limit of a function definition I want to prove the definition of limit of a function from definition (1) to definition (2).  (1) A function $f(x)$ is said to have $f^*$ as the limit as $x$ tends $x^*$ iff for every sequence $\{x_n\}$ with limit $x^*$, the limit $\lim_{n-&gt;\infty}f(x_n)$ exists and is equal to $f^*$. (2) A function is said to have $f^*$ as the limit as $x$ tends $x^*$ iff for each $\epsilon &gt;0$, there exists a $\delta_\epsilon &gt;0$ such that $|f(x)-f^*| &lt;\epsilon \forall |x^*-x|&lt;\delta_\epsilon$  I am confused about the steps. Suppose I am given an $\epsilon &gt; 0$ and $x^*$. I have to show the existence of a $\delta_\epsilon &gt;0$ such that for all $x$ satisfying  $|x^*-x|&lt;\delta_\epsilon$ I can construct a sequence $x_n$ which converges to $x^*$ and $x_n=x$ for some $n \geq N$. Then I can say that $f(x_n)-f^*=f(x)-f^* &lt; \epsilon$. I think I may have made some mistake about the steps.  My main confusion is the following : Suppose I choose $\delta_\epsilon=\epsilon$. Then if a sequence $\{x_n\}$ converges to $x^*$ then $x_n=x$ (where $x$ satisfies $|x-x^*|&lt;\epsilon$) for some $n\geq N$. Now, $\lim_{n-&gt;\infty}f(x_n)$ exists implies there exists an $M$ such that $\forall n\geq M$, $f(x_n)-f^* &lt;\epsilon$. Now, I need to show that for some $n \geq M$ indeed $x_n=x$. How do I show that ? This $M$ and $N$ are different. 'AND' vs '&&' as operator If I were to use the sentence "There are lots of John Smiths" in the world, would that be the correct use for saying that there are a lot of people named John Smith in the world?  I don't think there should be an apostrophe as that would imply ownership of something.  If my first example is correct, then what would you do if the name referenced already ended with an 's'? How to print colored text to the terminal? Deducing $\sin x + \cos x \ge 1$ from $(\sin x + \cos x)^2 = 1 + 2 \sin x \cos x$ So in trig, say I have an acute angle $X$. And one can intuitively conclude that $\sin x + \cos x \ge 1$, but how does the fact that $$(\sin x + \cos x)^2 = 1 + 2 \sin x \cos x$$ tell me that it is true that $\sin x + \cos x \ge 1$? I don't quite see the connection. Thanks For what powers $k$ is the polynomial $n^k-1$ divisible by $(n-1)^2$? How important are headings in SEO I have a website that sells music artists posters. Each artists has a page containing a small bio, and a list of posters we are selling representing the artist.  Currently our HTML looks like that  &lt;h1&gt;{Artist name}&lt;/h1&gt; bio &lt;h2&gt;Posters&lt;/h2&gt; &lt;ul&gt;   &lt;li class="poster"&gt;...&lt;/li&gt;   ... &lt;/ul&gt;   We are redesigning this page, and we have a new template that we really like. Problem is that in this new version the &lt;h2&gt;Posters&lt;/h2&gt; does not appear anywhere on the page.  As you might expect, a significant part of our traffic comes from people typing something like : "{Artist name} poster" on Google.  I fear that, by removing the word "poster" from the page, we will reduce our chances of getting these people to come to the site, since Google might down rank us.  I see several options here :   Give Google a slightly altered page that contains the H2 tags. But I think this falls into the "Black Hat SEO" category. And I don't want that. Put the heading. Hide it with CSS. Everyone wins, including accessibility tools which can determine the structure of the page using the "invisible" heading. But I do not know if this is considered a good practice. Forget about the heading, and find other ways to tell Google that we really are about posters. (via keywords, but do they really have the same "weight" as an H2?) Adapt the design to our SEO need, and find a way to put that heading nicely.   Are there webmasters out there that have been facing the same issue, how did you resolve it? Construction of a right triangle It's a high school level question which we can't seem to solve. Here it is:      Given $2$ lines, one of the length of the hypotenuse and the other with the length of the sum of the $2$ legs, construct with straightedge and compass the corresponding right triangle   I didn't make much progress. It seems that there's a theorem or a few basic facts about right triangles that I'm missing. What path do you suggest I take?  Thanks for your help. Similar to  on the bugs in Minecraft, I would like a complete list of what error codes exist in Minecraft and how they occur, as well as how they can be resolved.