What is the most efficient way to lock a specific row for within a mysql transaction. I am currently using for update using select is there another method that im unaware of?  if not are mysql locks only released when committed or rolled back?  for example i run the following transaction: begin select for update insert.. insert.. update(locked table) select another table commit does the commit release the lock or the update?
I have a financial transaction that looks something like this (pseudo):  begin     select record for update     update record(same record as selected)     insert another record into another table commit   If I call SELECT ... FOR UPDATE within the transaction, will the lock be released for the specific rows only when the transaction is committed ?
Why do we age? or Do we have a theory of senescence? There seem to be a number of ideas about why we age. Hypotheses include the gradual accumulation of cell metabolic products affecting organism function and the reduction of  during cell division. My hand-wavey idea would be "wear and tear".  Are we anywhere near a consensus theory of senescence? It is quite easy to show that (by using residue theorem) $$\int_0^{\infty} \frac{1}{1+x^n}dx = \frac{2 \pi i^{1+2/n}}{n(e^{2 \pi i / n} - 1)} $$ for $$n \ge 2$$  Is there any possibility to simplify $$\frac{2 \pi i^{1+2/n}}{n(e^{2 \pi i / n} - 1)}$$ or it is best result?  Thanks in advance! Short story (+radio play?) in which astronauts outside their ship slowly drift apart in space Looking for a short story in which the crew of a spaceship for some reason find themselves outside the ship, drifting apart in outer space. They can communicate via their radios but are individually drifting apart.  One by one, they lose communication as they drift further away from each other.  Might have also been adapted into a radio play? One thing I've noticed about the relatively new sitewide layout is that I can't find a quick way to get back to www.stackexchange.com without finding StackExchange in the sites list. As a result, I am typing stackexchange in my toolbar a whole lot more often now. In particular, I tend to enjoy browsing the hot questions list and my own personal feed quite often so visit these pages on a daily basis. Is there an easy link to them that I'm missing?  (On the android app, there is a feed in the menu that I really appreciate, something like that on the desktop would be ideal!) How can angular velocity be constant even when there is a torque by friction? A cylinder at rest lying on a rough ground is given an impulse which imparts a translational velocity (no angular velocity) to it. The question goes ahead with finding time after which rolling starts etc. etc.  But I have another question: The friction from the ground will decrease the translational velocity but increase the angular velocity (as the torque of friction will be in the direction of rolling). After some time, the translational velocity will become equal to angular velocity and hence pure rolling will start.  After this time work done by friction will be 0 as the point of contact is not moving and hence translational velocity will be constant. Now my doubt is that, when translational velocity is constant, it implies angular velocity will also be constant (as translational velocity is a multiple of angular velocity). But the torque from friction (about the centre of mass) will not be zero which means angular velocity will not be constant. In some book where there was the same problem it was written friction will vanish. How can friction vanish? How can anguluar velocity be constant even when there is a torque by friction? How can I get the Ubuntu shell on Windows 10 to recognize a connected android device? I'm trying to connect adb to my Android device in the Windows 10 Ubuntu shell, but it doesn't seem to be working:    adb does work normally on Windows, so it's not a problem with the phone or the connection.  Do I have to do something like mount the port in the Ubuntu shell?  How?  (The goal is to pass logcat to grep, which would obviously work better in Ubuntu.) Using Android as network server I want to use my Android device as a network server. In the same kind of way you would make it a Wi-Fi hotspot, but I don't want to allow connected computers to access the internet, I would like them to be able to communicate together.  Possible uses:   Playing games via LAN (e.g., Quake) Allow computers to share files Bonjour (Macs) etc...   Is there any way to achieve this? Any apps out there that will set up a wireless network server? Is division of matrices possible? Is it possible to divide a matrix by another? If yes, What will be the result of $\dfrac AB$ if $$         A = \begin{pmatrix}         a &amp; b \\         c &amp; d \\         \end{pmatrix},         B = \begin{pmatrix}         w &amp; x \\         y &amp; z \\         \end{pmatrix}? $$ This dreaded issue started at some time after upgrade to OS X (Yosemite) 10.10.3. accountsd uses about 60% CPU constantly, making the laptop hot and noisy.  I'm not using iCloud at all.  Killing it doesn't help, because it starts again quickly.  Probably related question, but it's about iOS: Singular verb after two noun phrases joined by "and" that can be thought of as a single thing Does this polynomial evaluate to prime number whenever $x$ is a natural number? Add a legend in an ArcGIS Javascript API I am quite new to Javascript. I have made a html script that includes services I published to ArcGIS for server. It all does exactly what I want and I made it by copying working scripts together and getting help from more experienced scripters. I want to finetune my service by adding a legend. Unfortunately I am not able to create a working script. I have added the parts of my script I assume that are necessary to create my legend. Does anybody see what I am doing wrong?        &lt;script&gt;         var map;         var wmsLayer;         var URL;         var legend;         require(["dojo/query", "esri/map", "esri/layers/WMSLayer", "esri/dijit/Legend", "esri/config", "dojo/domReady!"],         function (query, Map, WMSLayer, Legend, esriConfig) {          esriConfig.defaults.io.proxyUrl = "/proxy/proxy_gcx.php";            map = new Map("map", {               basemap: "topo",               center: [5.5, 52.485],               minZoom: 8,               maxZoom: 13,               zoom: 8,               slider: true           });            wmsLayer = new WMSLayer("URL", {               format: "png",               visibleLayers: ["31", "30", "29", "28"]           });            map.on("layer-add", function (results) {               //add the legend               legend = new Legend({                   map: map,                   layerInfos: [{                       layer: results,                       title: "test"                   }]               }, "legendDiv");               legend.startup();           });             map.addLayer(wmsLayer);       });     &lt;/script&gt; &lt;/head&gt;  &lt;body&gt;     &lt;div id="map"&gt;     &lt;/div&gt;     &lt;div id="legendDiv"&gt;     &lt;/div&gt; &lt;/body&gt;   EDIT: I have edited the code. I am still not done. It does give me a legend on my browser but it says there is no content in there. On my arcgis server manager there is a legend. Where does Google Chrome automatically save pages? I opened the following page:   When disconnecting WiFi and even after rebooting the mobile phone, the page can still be read due to being saved automatically.  Left to the URL bar, an indicator looks like this:  This also shows up when opening manually saved pages, which are saved as MHTML files in the default download folder.  However, an automatically saved page can not be re-downloaded manually to get to the download folder, because the arrow is greyed out.I wish to copy some automatically saved pages into the download folder.  Where are the files of automatically saved pages stored? How to repair a broken .EXE file association After (hopefully) scrubbing viruses out of a Windows 7 installation (after deciding not to simply run over the laptop repeatedly with my car), I've got everything almost back to normal. The only lingering issue I have is that for my non-admin users, the ".exe" file extension doesn't work. That is, clicking on the various desktop application links results in a "How do you want to open this?" dialog.  I've been through the alleged registry fixing from "winhelponline" and that had absolutely no effect.  I've tried running "assoc" for the affected users, but it reports the .exe association to be "exefile" even though it persistently does not work.  Right-clicking on a desktop icon and then choosing "start" does successfully open an application, but that's clearly a terrible situation.  For my admin user, things seem to work fine.  What do I need to do to get things working? How to change the color of symbols (mobile, email, homepage, etc) in moderncv? One of the most common security best practices these days seems to be . I've never really found a good explanation for that, but I'm assuming it's to minimize the risk of a  malicious or infected script within the webroot from reading the database password.  But, you still have to let WordPress access it, so you need to expand open_basedir to include the directory above the document root. Doesn't that just defeat the entire purpose, and also potentially expose server logs, backups, etc to attackers?  Or is the technique only trying to prevent a situation where wp-config.php would be shown as plain-text to anyone requesting http://example.com/wp-config.php, instead of being parsed by the PHP engine? That seems like a very rare occurance, and it wouldn't outweigh the downsides of exposing logs/backups/etc to HTTP requests.  Maybe it's possible to move it outside the document root in some hosting setups without exposing other files, but not in other setups?    Conclusion:  After a lot of back-and-forth on this issue, two answers have emerged that I think should be considered the authoritative ones. Aaron Adams makes a good case in  wp-config, and chrisguitarguymakes a good . Those are the two answers you should read if you're new to the thread and don't want to read the entire thing. The other answers are either redundant or inaccurate. "There is no point in" or "There is not a point in" I was thinking about these negations. Do these mean the same thing?     There is no point in ...   There is not a point in ...   or:     I have no clue   I do not have any clue     etc. Which sort algorithm works best on mostly sorted data? How prove this $\prod_{1\le i<j\le n}\frac{a_{j}-a_{i}}{j-i}$ is integer I'm having trouble with a question from an introductory Linear Algebra book. It goes: "Show that the Only Subspaces of $R^2$ are the zero subspace, $R^2$ itself, and the lines through the origin." I'm thinking the easiest way to do this is to show that if $W$ is a subspace of $R^2$ containing $2$ different lines through the origin then $W$ is all of $R^2$. Is this a good way to go about it? and how could I show this?