Recommended rejection of a paper, but invited to review the paper again

Question: I was recently asked to review a paper, and ended up recommending a rejection of the paper. The journal has, apparently, asked the authors to revise their paper, and the journal has come back to me asking me to review the revised paper. There is, however, no option offered for me to decline. I will likely recommend rejection again as I see that the main problem with the paper is still not addressed. What should I do in this case? Should I write to the journal that I am not willing to review this paper again, or should I go ahead with the review and recommend rejection for the second time? Since I need to provide my comments to the authors again, what should I write while still being constructive? This was my first time recommending a rejection.
Comment: It's probably good that you were re-invited to review the paper. It'd be worse to have someone who doesn't see your objection review the paper on the second round and weaken your confidence in the review process!
Answer: This has happened to me a couple times. As Peter Jansson has pointed out, what probably happened is that, while you recommended rejection, reviewers 2 and 3 said "it's actually publishable if the authors solve such-and-such problems". This is the kind of situation where a sympathetic editor will make a "revise and resubmit" decision.
In this particular case, you have it easy. Just write a very short review along the lines of "in my first review, I recommended rejection of this article because of [problem that made you recommend rejection]. As the authors have not addressed this problem, I'm regrettably forced to maintain my previous evaluation".
[FWIW, one of the times I reviewed a paper like this, the journal actually ended up publishing the paper in question, with the problematic section still exactly as it was  when I reviewed and rejected it. Go figure]
Comment: You can pretty up the comment a little: "In my first review, I wrote the following about the paper ... , which I viewed as grounds for rejection. In this version of the paper in X, Y, and Z, my concerns were not addressed. As such, I cannot recommend this paper for publication." Note that as part of the review process most journals require authors to submit a "response to reviewer comments" letter, so you should also check that to see what their justification for leaving the changes in are. In direct answer to your question, I would not refuse unless you're super busy & can't turn in a review.
Comment: I am actually able to see the other reviewer's recommendation, which was major revision. But yes, I understand that the editor is free to make his decision.
Comment: The suggested comment is helpful, but would you write the same comment to the authors as to the editors? It does sound hard for the authors.
Answer: That the paper was not rejected probably depends on the second (or more) reviewers comments. I would consider it normal to ask if reviewers wish to review the paper again. That you were still asked may be a mistake, most electronic systems would require you to make a decision on that point. There may also be a flaw since a rejected paper would not need a second review and the paper was not rejected based on your suggestion. One can only speculate. I would consider it only fair to write to the editors and state that you are not interested in re-reviewing the manuscript. You could state that your impression is that a similar result would be likely were you to do the job. But, honestly, why you decline the review is no-ones business and you should have been asked before being faced with the task.
Comment: Whether you want to review or not is a personal question. If you have the time and want to provide information to the editors, that is of course gratefully received by the editors. But, there is no better or worse way as see it. Just because you get a request you have no obligation to put more work into it. Most people will, in my experience, provide more than a "No thanks" in a reply.
Comment: OK. It's just that, in this case, the reviewer has already put in enough effort to conclude that the paper should be rejected, so the only work remaining to do is to write the one-sentence review, "I recommend the paper be rejected because the reasons I previously gave for rejecting have not been addressed." That seems to be no more effort than declining to re-review.
Comment: Do you not think that a brief review along the lines suggested by Koldito in his answer (posted a few hours after yours) is a better option than just refusing to re-review?


Can this pixelation effect be achieved using raphael.js?

Question: I would like to progressively pixelate an image on a webpage and animate the pixelation as a transition. The pixelation would begin by using small pixels and the pixels would gradually become larger. Finally, the pixelation would reverse and then reveal a second image.
I'm looking for an effect like the pixelate effect here - you need to select pixelate as the transition and then click the image.
Yes, I could use that library but I already have a raphael canvas and am interested to know whether (and how) this might be possible.
Answer: Raphael is not really made to work with raster graphics, it's a vector library. Implement it in canvas.
Answer: I think the best option is to use another library for pixelation (like the one you linked, if you don't mind the license). Raphael.js is not supporting this effects as it is a vector library. You can convert the Raphael.js SVG into a image and run the effects on it - see this.
Note: This is not direct solution to your problem but it presents an another alternative how to achieve pixelation effect (for other users looking for a solution).
There is a  close-pixelate project. It is a script able to convert an image into a pixelated version using an HTML5 canvas element and is licensed under MIT license.
The GitHub project page is here.
Usage:
<code>document.getElementById('portrait-image').closePixelate([
  { resolution : 24 },
  { shape : 'circle', resolution : 24, size: 16, offset: 12, alpha: 0.5 }
]);
</code>
Answer: For Internet Explorer it's really very simple since pixelation effect is supported by default as an extended CSS property.
IE Only CSS properties for Pixelate Effect:
<code>-ms-filter: "progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=30, Duration=1)";
filter: progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=30, Duration=1);
</code>
For rest of the browsers, you can develop your own solution based on codes like the one below:
http://phrogz.net/tmp/canvas_image_zoom.html


How do I report book royalties for tax purposes?

Question: I'm located in the US and received a 1099-Misc for approximately $125 of royalties I received from a book I wrote. I published the book through a publishing company, and I am not operating as a business. It was a one time project that I have no ongoing involvement with. How do I report this for my tax return? I was thinking Schedule C or Schedule E?
Comment: Royalties go on Schedule E. They are not earned income from self-employment.
Comment: Did you have any other 1099-MISC/Self Employment income besides this in 2016?
Comment: @BenMiller, no my only other income was from being employed and interest on a couple of bank accounts
Answer: (Insert the usual disclaimer that I'm not any sort of tax professional; I'm just a random guy on the Internet who occasionally looks through IRS instructions for fun. Then again, what you're doing here is asking random people on the Internet for help, so here goes.)
The gigantic book of "How to File Your Income Taxes" from the IRS is called Publication 17. That's generally where I start to figure out where to report what. The section on Royalties has this to say:

Royalties from copyrights, patents, and oil, gas, and mineral properties are taxable as ordinary income.
In most cases, you report royalties in Part I of Schedule E (Form 1040). However, if you hold an operating oil, gas, or mineral interest or are in business as a self-employed writer, inventor, artist, etc., report your income and expenses on Schedule C or Schedule C-EZ (Form 1040).

It sounds like you are receiving royalties from a copyright, and not as a self-employed writer. That means that you would report the income on Schedule E, Part I.
I've not used Schedule E before, but looking at the instructions for it, you enter this as "Royalty Property".

For royalty property, enter code "6" on line 1b and leave lines 1a and 2 blank for that property.

So, in Line 1b, part A, enter code 6. (It looks like you'll only use section A here as you only have one royalty property.) Then in column A, Line 4, enter the royalties you have received. The instructions confirm that this should be the amount that you received listed on the 1099-MISC.

Report on line 4 royalties from oil, gas, or mineral properties (not including operating interests); copyrights; and patents. Use a separate column (A, B, or C) for each royalty property.
If you received $10 or more in royalties during 2016, the payer should send you a Form 1099-MISC or similar statement by January 31, 2017, showing the amount you received. Report this amount on line 4.

I don't think that there's any relevant Expenses deductions you could take on the subsequent lines (though like I said, I've not used this form before), but if you had some specific expenses involved in producing this income it might be worth looking into further.
On Line 21 you'd subtract the 0 expenses (or subtract any expenses you do manage to list) and put the total. It looks like there are more totals to accumulate on lines 23 and 24, which presumably would be equally easy as you only have the one property. Put the total again on line 26, which says to enter it on the main Form 1040 on line 17 and it thus gets included in your income.


Delay engagement of the transmission

Question: I use a Nissan pathfinder 2000. Recently it has delay engagement of the transmission from neutral to drive and will not move unless it is changed to gear 1, then it moves perfectly. Then I manually change to gear 2 before I change to drive. At the drive now it moves and changes easily with the torque.
 I took the it to a transmission shop. They did a fluid and filter replacement. But no improvement.
They were suggesting I change the valve body. Kindly assist.
Thanks
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Answer: If they changed the fluid and filter and there is no improvement then they are probably correct - get the valve unit changed.
Trying to clean it and refurbish that valve unit yourself may not be very successful, so having it replaced is likely the best option.
You say the vehicle is from 2000, how many miles has it done? It may be more cost effective to get a refurbished or remanufactured transmission complete with guarantee...

Delay engagement of the transmission


Tea cup residue

Question: Why do I have residue at the bottom of my tea cup?  I've tried bottled water and tap water, and the result is always the same. I've tried many different brand of tea bags and they are all the same.
Comment: What do you mean by "residue"? A bit of tea-dust fallen on the bottom making the last few sips look muddy? White scales, as caused by hard water? Or do you just mean the coloring left on a white cup even after it has been washed?
Comment: Have you always had this problem, as in going back years? Do you have tea at friends' houses or at restaurants and there is no residue in the cup? I don't drink tea, but it seems like I've seen it more often than not in friends' empty cups.
Comment: It's a feature. Buy 3, get one free! Don't rinse the cup between brews. The 4th time, just add hot water. :-)
Comment: MargeGunderson: I've had tea at restaurants and at friends homes with no residue in the cup.  rumtscho: By residue I mean something you can feel in your throat when you swallow the last drop. It leaves a trail in the cup.  Thank you all for your interest.  I really miss a good cup of tea!
Answer: You could try making tea with loose leaf tea and a strainer (rather than tea bags).  I have an inexpensive teapot with an insert. It is big enough to make 2-3 cups.  There is still a little of the tiny tea flecks in the bottom, but if you pour carefully they stay in the pot and you can have a no-residue cup of tea.
Answer: http://www.guardian.co.uk/lifeandstyle/2005/nov/04/foodanddrink.features
That sounds like what your experiencing. But also keep in mind that the grade of tea used in tea bags is pretty poor unless your springing for high quality stuff. I've found that if your water is too hot, too much tannin can be released and this can cause a different mouth feel, sometimes described as "meaty" or "chewy" similar to some of the desired characteristics found in wines (where tannin content is large).
I'd say experiment with different loose leaf teas as described above but to also work with different water temperatures and water sources. If your bottled water is coming from a source up the road from you the mineral content may not be that different then what your getting from the tap.
Answer: Try filling the cup with some vinegar. Just enough to cover all the parts with residues. Let it sit for a few hours. If the residue marks are not too strong, try a mixture of vinegar and water.
This method is well known among Chinese people (from tradition) and it has chemical explanations too.
Try it :)
EDIT: Sorry my English is not good enough and didn't comprehend "residue" well enough. In that case, I suggest you just leave the last sip and don't drink it. Also, some tea doesn't have this problem. But as far as I know, most tea have this problem.
Comment: The OP clarified in a comment that "residue" is the "mud" in the last sip, not the coloring on the cup walls.

Tea cup residue


How do day traders profit with such high tax rates?

Question: I know for holding stocks on the long term, more than a year, there is a lower tax rate. How do day traders profit with tax rates around 30% or higher? Are the profits still worth it with such high rates? Or do they work around the taxes somehow?
Comment: Don't you pay the same tax rate on the income you earn from work? How do you make any income with such high tax rate?
Comment: To the member who flagged @Victor's comment as rude - I rejected the flag. Day traders lose the long term gain rate but pay ordinary income. Victor stated that in the form of a question. If he had more to say, I'd suggest he turn it into an answer. As it stands, it would qualify as a short, accurate response the the question posed.
Answer: I would say it's all relative. Take the following two scenarios:

I'm a daytrader and I can make $1,000,000 a year with my aggressive trading, but I have to pay a 35% tax rate. My remaining profit is $650,000.
I'm a long-term trader and I can make $500,000 a year with less frequent trading. My tax rate is 20%. My remaining profit is $400,000.

If you were facing these options, would you chose #2 just because you pay a lower tax rate, even though you make less money?
These numbers are of course fictional, but the point I'm trying to make is that everyone will seek the method that allows them to make the most money. If they have to pay a higher tax rate, so be it.
One other thought: daytraders will have higher expenses, which are deductible.
Comment: Mostly trading fees. The more you trades you place, the more fees you'll have.
Comment: What would their higher expenses be? @Julian
Answer: As long as the tax rate is below 100%, there is still money to make. You pay taxes on your gain, not on your trading volume.
Taxed income is still income - many people seem to get that wrong.
Comment: Also remember: _marginal_ tax rates.
Answer: Long-term capital gains, as you note, get special tax treatment.  They are lower than regular income tax rates.  Short-term capital gains aren't penalized, they are just treated as regular income under the regular rates.  So, from a tax perspective, the day-trader gets by the same way as the rest of us because they are paying the same rates on the same progressive income tax scale.
Answer: The advantage that a day trader really wants is an opportunity that allows them to buy at the Bid and sell at the Ask. Without that advantage there is really only a 50% probability of profit.
Now someone who holds a position for a day is not a day trader. A day trader only hold positions for a few minutes and is a market-maker.
But someone who makes a lot of short term trades can get 60% of the trades as long-term capital-gain treatment by trading futures.
Or a day trader that makes hundreds of trades per day can choose trader-status with the IRS. Trader-status sets profit at the income tax rate, which does not get the long-term capital-gain rate, but allows any amount of trading loss to be deducted. So the larger loss deduction can flow-through to the overall personal tax liability. Also, expenses can be easily deducted with trader-status, just file a Schedule C.
Otherwise, someone wanting to make their investment activities as a corporation, they would have to form an investment company with the SEC and that is not as easy. A corporation of some purpose other than investment, can have investment activities of 60% Treasures or bank deposits and 40% other investments and do that without forming an investment company.


Collision and gravity problems

Question: So this is an easy question. I need to implement gravity in my game but where I'm stuck is what variables do I need in my Entity object for the calculations and a good algorithm that I can use for gravity and collision. The main reason why I'm stuck here is not just I'm implementing this into a huge program that handles the different states, windows, buttons and plenty of other stuff but all I got it the x, y, width, and height for my Entity and every time I try and calculate collision if the object hits a wall it stops, and I have no acceleration variables as I don't know how to use a algorithm with them so I'm guessing as I go and so my whole program is a mess. To make it clear of what I need someone to help me with is can you show me an example of how I would use my x, y, height, and width and move it around, use jumping, use gravity. I never really saw any of this so if someone knows how to do this, and or you have done this is a game before which you could show me what you did that would be great. I'm new to this so even a link is good. Thanks in advance!
Comment: What is the question? Are you asking us to implement game engine for you? What is "your x, y, height, width" ? What is "your Entity" ?
Comment: The x and y are the position, and the width and height is how big the object is. A entity has x, y, width, height, and is considered a in game object that represents something like a AI or the player.
Answer: Not an entire answer, but a good tip: Add a bit to your entity called "falling" (or, inversely, "supported") which specifies whether or not gravity applies to the object. When an object is sitting on top of a stationary object you don't need to apply gravity effects to it, and you can set and unset that bit on events and collisions.

Collision and gravity problems


Does SENTRI include TSA Pre-Check for Non-US citizens?

Question: Does SENTRI include TSA Pre-Check for Non-US citizens that are not from one of the following: Colombia, the United Kingdom, Germany, India, Panama, Singapore, South Korea, Switzerland, and Mexico?
Answer: No (click "Learn More" under SENTRI), unless they're a US permanent resident:

Access to TSA Pre✓® expedited security lanes at airports within the U.S. and U.S territories for U.S. Citizens and U.S. lawful permanent residents.

However the list of citizenships or nationalities that can get Global Entry (and thus both SENTRI and TSA Pre access) is slightly different than the one in your question. The current list is: Argentina, India, Colombia, UK, Germany, Panama, Singapore, South Korea, Switzerland, Taiwan, Mexico.
Comment: I don't think this is accurate. Foreign non-residents can also use the TSA Pre lanes if they have Global Entry benefits (I was one of those once). [SENTRI members get Global Entry and TSA Pre benefits if their nationality/status is one that would allow them to apply for GE](https://cbpcomplaints.cbp.gov/s/article/Article-969?language=en_US). There is hence a list of nationalities (those allowed to apply for GE) for which SENTRI would include TSA Pre, though I don't think the list in the question is accurate.
Comment: The way I understand the website is that foreign non-residents from the list of nationalities are allowed to apply for Global Entry, and Global Entry can allow SENTRI access with vehicle registration and [TSA Pre access](https://www.cbp.gov/travel/trusted-traveler-programs/global-entry/tsa-precheck). However, the specific language is "Global entry members are eligible to participate in TSA Precheck. U.S. citizens and U.S. lawful permanent residents enrolled in NEXUS or SENTRI are also eligible to participate in TSA Precheck, as well as Canadian citizens who are members of NEXUS."
Comment: @Dennis In other words, Global Entry members (who can be foreign non-residents if they have a nationality on the list) can get TSA Pre. But SENTRI members only get TSA Pre if they're US citizens or permanent residents. I'd be happy to be wrong about this, but everything I've seen on official government sources says that SENTRI doesn't include TSA Pre for non citizens/residents. I agree there's a list of nationalities that can get GE and therefore both SENTRI and TSA Pre at the same time though, and that list is slightly larger than the question. I'll clarify that.
Comment: That conflicts with the link I included, which says "Approved SENTRI members are able to use the Global Entry kiosks when re-entering the United Sates by air and TSA Pre-check, as long as they meet the citizenship requirements for Global Entry", i.e. the GE list is the SENTRI list and is not limited to US citizens and LPRs. I know a Mexican who has SENTRI and uses the GE kiosks when he flies, I emailed him asking about TSA Pre but he hasn't responded yet.
Comment: My friend finally got back to me. He thinks SENTRI membership might actually be limited to US people and Mexican residents (of any nationality?). I've not seen that documented anywhere but there's a logic to it. He says he gets TSA Pre, and thinks that while not all SENTRI members get GE benefits, those that would otherwise qualify for GE directly do. [This document](http://tiny.cc/ro3iuz) confirms that Mexican nationals (at least) do get GE benefits after "a thorough risk assessment by the Mexican goverment", which is what they would require for a GE membership.
Comment: P.S. I don't think the assertion that all GE members get SENTRI access is correct. Using the SENTRI lanes requires an RFID card [but only US people and Mexican national GE members](https://www.cbp.gov/travel/trusted-traveler-programs/global-entry/card) (plus NEXUS members) are provided with one.


Is it possible to use C# LINQ from Mathematica using .NET/Link?

Question: Using Mathematica's .NET/Link (NETLink`) package, is it possible to call out to .NET's LINQ facilities for list manipulation and other operations?
Comment: I think that there are two sides to this question: from the mathematica side and from the c# side. Could you explain which side you are asking for? As far as I can tell, from the c# side the answer is no. But, I am not familiar enough with LINQ to make a definitive answer.
Comment: @rcollyer, Great point. Added a clarification in my question above. Still lacking clarity?
Comment: Perfect. Exactly what I though you were asking.
Answer: Yes, it is, but it's cumbersome (at least as of Mathematica 8). The hardest part is that you have to manually do a lot of the juggling required to work with .NET generics and extension methods.
For example, let's translate a straightforward solution to Project Euler's Problem #1 ("Add all the natural numbers below one thousand that are multiples of 3 or 5.") from LINQ:
Enumerable.Range(1, 999)
.Where(x => x % 5 == 0 || x % 3 == 0)
.Sum();

To .NET/Link:
(* Load stuff. *)
<< NETLink`;
InstallNET[];
LoadNETType["System.Linq.Enumerable"];

(* Create our enumerable list of numbers. *)
numbers = Enumerable`Range[1,999];

(* Create the filter that we're going to apply. *)
enumerableType = GetTypeObject[LoadNETType["System.Linq.Enumerable"]];
meths = enumerableType@GetMethods[];
whereMethod = First[Select[meths, #@Name == "Where" && Length[#@GetParameters[]] == 2&]];
intTypeParams = {GetTypeObject[LoadNETType["System.Int32"]]};
intWhereMethod = whereMethod@MakeGenericMethod[intTypeParams];
divisibleByThreeOrFive[n_] := Or[Mod[n, 3] == 0, Mod[n, 5] == 0];
whereCondition = NETNewDelegate["System.Func`2[System.Int32,System.Boolean]", divisibleByThreeOrFive];

(* Apply the filter to the list. *)
filteredNumbers = intWhereMethod@Invoke[Null, {numbers, whereCondition}];

(* Pump all the results through the filter and Sum. *)
Enumerable`Sum[filteredNumbers]


Linearity of an optimization problem which comprises the product of variables with constant values from a non-linear function

Question: In a mathematical integer optimization problem, if the objective function is represented as $\sum x_k \cdot M_k$, where $M_k$ is a non-linear function whose value is known and just plugged in to the objective function, thus acting as constant coefficients, is the objective function linear, since there are no product of variables are involved? When I try to feed in such a problem to an ILP solver, it doesn't complain of being not linear. What would be the explanation?
Comment: $M_k$ is a nonlinear function of what? As long as it does not depend on any of the variables in the IP model, you're okay.
Comment: What if $M_k$ is a function of the variables in the IP model but can be precomputed and used as a lookup? @prubin
Comment: So it's actually $M_k(x)$. How d you work that into the MIP model?
Comment: No, but I was wondering what would happen in such a scenario
Comment: Your comment about $M_k$ "acting as constant coefficients" does not make any sense to me. If the solver thinks the model is linear, it's probably because what you fed it has constant values of $M_k$ and thus does not actually represent the real problem.
Answer: Yes, $\sum_k M_k x_k$ is linear if each $M_k$ is constant and $x_k$ is a variable.
Answer: As you say:
"If the value of $M_k$ value is known and just plugged in to the objective function, thus acting as constant coefficients"
Then you are summing variables multiplied by constant terms, which is linear.
So all is good.
Answer: What does it mean for a function to be linear?
It is actually short for the function is linear in its variables. One way to define linearity is to say, that the derivative is constant.
For example $F(x)=5x+3$ is linear in $x$ as $F'(x)=5$. Is it linear in $y$? Well you can write it as $F(y) = 0y+5x+3$, then $F'(y)=0$. Because we treat $x$ as a constant.
So how do you know with respect to which variables you have to take the derivative?
Well, the solver (e.g. Cplex) get a list of variables from you. These are your variables. The other term might be computed, but as your solver sees it, are just numbers, no matter how you came up with them.
So think about $M'_k(x)$. Is it constant? I think, this will answer your question.
Good luck and keep on solving problems:)
Answer: Assuming that $M$ depends on $x$, your function is non-linear. If not, it is linear and all is well.
If the dependency does exist, just because a linear solver doesn't support the proper input, that doesn't make the function linear, although sometimes people find that assumption good enough for some specific application.
The correct way to solve a problem like this is to use an MINLP solver that supports callbacks, such as Knitro, our own Octeract Engine (v 1.14 and above), and, if memory serves, BONMIN.
If (part of) the problem is treated as black box, then the solver will keep updating the values of your objective (through the callbacks) and its derivatives and use new constants for $M$ in every iteration, which will most likely result in a different answer.
This is vastly different than classic solver behaviour where the problem is defined in the beginning and can't be changed during the solving process.


Locking a MySQL database so only one person at once can run a query?

Question: I am having a few issues when people are trying to access a MySQL database and they are trying to update tables with the same information.
I have a webpage written using PHP. In this webpage is a query to check if certain data has been entered into the database. If the data hasn't, then i proceed to insert it. The trouble is that if two people try at the same time, the check might say the data has not been entered yet but when the insert takes place it has been by the other person.
What is the best way to handle this scenario? Can i lock the database to only process my queries first then anothers?
Answer: Read up on database transactions. That's probably a better way to handle what you need than running LOCK TABLES.
Answer: Manually locking tables is the worst think you could ever do.  What happens if the code to unlock them never runs (because the PHP fails, or the user next clicks the next step, walks away from the PC, etc).
One way to minimize this in a web app, and a common mistake devs do, is to have a datagrid full of text boxes of data to edit, with a save button per row or on the whole table.  Obviously if the person opens this on Friday and comes back Monday, the data could be wrong and they could be saving over new data.  One easy way to fix this is to instead have EDIT buttons on each row, and clicking the button then loads an editing form, this way they are hopefully loading fresh data and can only submit 1 row change at a time.
But even more importantly, you should include a datetime field as a hidden input box, and when they try to submit the data look at the date and decide how old the data is and make a decision how old is too old and to warn or deny the user about their action.
Answer: You're looking for LOCK.
http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html
This can be run as a simple mysql_query (or MySQLi::query/prepare).
I'd say it's better to lock specific tables (although you can probably try LOCK TABLES *) that need to be locked rather than the whole database - as nothing will be able to be read. I think you're looking for something like:
LOCK TABLES items;
START TRANSACTION;
INSERT INTO items (name, label) VALUES ('foo', 'bar');
UNLOCK TABLES;

Or in PHP:
mysql_query('LOCK TABLES items');
mysql_query("INSERT INTO items (name, label) VALUES ('foo', 'bar')");
mysql_query('UNLOCK TABLES');

Answer: You could check if data has been changed before you edit something. In that case if someone has edited data while other person is doing his edit, he will be informed about it.
Kind of like stackoverflow handles commenting.


What is the difference between restoring and installing an app on an Android device?

Question: Is there any difference between restoring an app and installing an app on an Android device, or are both the same?
Comment: Can you add some more detail? Where are you seeing this verbiage?
Answer: Well, one that comes to mind - if application is removed from market or is not listed as compatible for your device, restoring from Google account is one way of getting those applications. I did it with "FML official" and "Amazon" applications when they were not available on Nexus 7 2013 - "backed" them up on my Samsung S2 and "restored" on Nexus 7.
And, of course, for some applications settings are restored too.
Answer: As David said, you can restore an unsupported app from a previous backup, or you can restore the data of that app ( e.g. saves in a game ).
when you install an app from the play store, you are limited to what's available for your country (unless you're rooted then there some ways to go around it) and even if you install an app that you previously had, the data will not be restored.
google play store just backs up your apps names so when you restore through the play store, the data is not restored.
Comment: no problem, hope I helped you.


cupola based hydrocarbons

Question: My favorite groups of shapes are cupolas. Are there hydrocarbons in the shape of these similar to how cubane is to a cube? If so how stable are they, and could you please give some general information about each one.
Answer: They would be highly unstable due to the inverted tetrahedral geometry of the carbons in the top face. Generally, a polyhedron can form the basis of a stable hydrocarbon if it has at most 3 edges for each corner. A big caveat is that the hydrocarbon will distort the shape if the angle strain is too great. I found that out in my computational research on prismanes.
Comment: So one does exist, the diagonal cupola exists.
Comment: Yes, that would be [prismane](http://en.wikipedia.org/wiki/Prismane)
Answer: If one forgets about the correct mathematical notation for a moment:

a cupola is like a bowl
a bowl is a fragment of a spherical object

Molecules of this shape are found in the field of fullerenes (bucky balls).
One of the most simple bowl-shaped molecules is sumanene. If you like to play a bit with the structure, please fetch sumanene.cml from pastebin and open it in Avogadro.

The shape is more obvious in the following animation.

The structure of two extended bowl-shaped molecules has been published in
J. Am. Chem. Soc., 2011, 133, 16319–16321 (
DOI), and although they are not true cupolas, you might find them interesting anyway.
I've uploaded the structures bowl-01.cml and bowl-02.cml as CML files.

cupola based hydrocarbons


Are API key, Client ID, and/or Signature changes required to Upgrade Google Static Map Version

Question: I need to know if an instance of an Google Static Map API Key, Client ID and/or Signature is tied to a given API Version. If I have been using API V1 (Static Maps) and wish to now use API V2 do I need a new key, Client ID and/or Signature? I make this request from inside java code via a HttpURLConnection.
My current request for V1 is:
https://maps.googleapis.com/maps/api/staticmap?center=25.78939485541877,-80.2033928757234&size=1294x430&zoom=17&maptype=hybrid&sensor=false&format=png&client=***{my gme-* client id}***&signature=***{my signature}***

My new request for V2 is
https://maps.google.com/maps/api/staticmap?center=25.78939485541877,-80.2033928757234&size=1294x430&zoom=17&maptype=hybrid&sensor=false&format=png&client=***{my gme-* client id}***&signature=***{my signature}***

Answer: I was told on another forum that The API Key, Client ID and/or Signature are NOT tied to a given API version.
Also, it turns out both hosts listed in the question will go to API V2.  Google incorrectly informed us we were hitting the API V1 host, they sent us a email latter notifying us of there mistake.


Application to plan optimal route between multiple cities

Question: I have looked at rome2rio and few other sites, but it did not fit what I was looking for. I want an application or site, where in, if I feed it a list of cities it should tell me which city should be my starting point and what cities I need to traverse (with specific order) and what should be my final destination. I am mainly looking for travelling by road. The whole purpose is I need to make sure that I do not travel back and forth and waste time, I should travel optimally.
Comment: In other words, you want to solve the [traveling salesman problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem) (or at least the real-world practical version of the problem).
Comment: For travel by road, I think a map will be enough. Maybe something like ViaMichelin or Google maps, which will also include road connections and some other information like tolls and where you will find ferries.
Comment: Worth a look: http://travel.stackexchange.com/a/22071/32134
Answer: The problem that you state is known in academia as the Traveling Salesman Problem as pointed out by @ZachLipton.
Googling for that expression in combination with app/website/software gives a few good finds.
As apps I could find e.g. Concorde TSP and Route4Me (no affiliation nor experience).
A nice online tool is Optimap which seems to use Google directions. Here is a random route along the US east coast. You can choose between a roundtrip and or ending up in a different city than where you started from.
Comment: Yes, I had studied Travelling Salesman, Shortest path first and other networking problems during my computer science degree :) But I was curious if any of the websites provide a close solution. The above ones are sufficient for me for now.


Buy 3 discount 1

Question: I have some promo rule, (buy x) y free ... but just apply when the quantity of the "same" product are 3, but if i add 3 items  in total but (2 items a and 1 item b) the total are 3, but dont discount for the total amount.
Answer: check this the answer here Click here
You should create custom module or install 3th party module, by default Magento doesn't support. As alternative you can create a fixed amount discount and discount to be the price of the products in your case (19.99$).

Buy 3 discount 1


Does the HMHS Britannic wreck still have a grand staircase or any staterooms?

Question: Does the wreck of HMHS Britannic still have a grand staircase or any staterooms or were they all removed prior to being converted into a hospital ship?
Answer: RMS Britannic was initially requisitioned for use as a hospital ship on 13 November 1915.  She was then renamed as HMHS Britannic and underwent a refit.  From the Wikipedia article:

In the interior, 3,309 beds and several operating rooms were installed. The common areas of the upper decks were transformed into rooms for the wounded. The cabins of B Deck were used to house doctors. The first-class dining room and the first-class reception room on Deck D were transformed into operating rooms. The lower bridge was used to accommodate the lightly wounded. The medical equipment was installed on 12 December 1915.

[Image source, Wikimedia]

On 12 December 1915 HMHS Britannic was declared fit for service, and she then served until 6 June 1916 when she was released from service and returned to Belfast to be refitted once again as a passenger liner. At this point she had completed three voyages to and from the Mediterranean.
In the middle of that refit, on 26 August 1916, she was requisitioned again for service as a hospital ship. She sailed for the Mediterranean less than a month later, on 24 September 1916 and remained in service, completing a further two voyages, until she was sunk on her sixth voyage on 21 November 1916.
Details of her voyages as a hospital ship, and some descriptions of the ship as she was fitted out during her war service can be found on the Hospital Ship Britannic web site.

Also on that site, you will also find a page dedicated to the wreck of HMHS Britannic. It notes that, during the exploration of the wreck by Robert Ballard's team:

The weather cover over the glass dome of the forward Grand Staircase was found nearly intact. The dome was found broken, but there was still evidence of the white glass in some places.

The forward Grand Staircase formed part of the first class entrance to the ship. It was located aft of the first funnel in the picture above, and was designed and built as part of the structure of the ship. As such, it would not have been removed during the refit.  However, much of the staircase itself was built from wood, and so it is unlikely to have survived (although some wooden structures have been found on the wreck).
We do know that the pipe-organ which was intended to form part of the Grand Staircase was, in fact never fitted. Since she was never fully fitted out for her role as a luxury passenger liner before she was requisitioned, it is therefore quite possible that much of the decorative work intended for the Grand Staircase was also never installed.

The staterooms would certainly have remained, although many of the fixtures and fittings would probably have been removed.  Given the short turnaround times of each refit, and the urgency involved, its is likely that only the minimum amount of re-design work required to fit out the ship for her intended function would have been carried out.
Unfortunately, even though the wreck lies in relatively shallow water (about 120m), and is well within range of technical divers, there has been only limited exploration of the interior of the ship.  The wreck has been designated as a war grave, and permission from the governments of both United Kingdom and Greece must be secured ahead of any penetration dives.
Comment: @DevSolar It is unfortunate that we do not have any record of the present state of most the interior of the _Britannic_ due to the restrictions on penetration diving. Most of the expeditions to the wreck have only been licenced to explore and record the exterior of the wreck.
Comment: Why is the declaration of the *Britannic* as a war grave and the resulting ban on unregistered penetrating dives "unfortunate"? (Just a minor nitpick I know, but I stumbed over that.)
Answer: The person who is most likely to know the answer is the author Simon Mills, who 'technically' owns the wreck.
As such, he would doubtlessly be aware / involved in any [official] dives which have explored the section of the wreck where the forward first class 'Grand Staircase was known to have been located. Accordingly, he would be the best person to know whether any of the Grand Staircase is still in 'situ'.
Surprisingly, the wreck is in very good condition (its smokestacks still exist which is rare) and a lot of the visible woodwork remains in place. Also, it should be remembered that the staircase was constructed from mature oak, which is a very dense wood. Oak can resist (for longer than softer woods like pine) the attack from marine boring animals and decay from seawater. Thus, it is possible that some parts of the Grand Staircase still exist.


Software for mood boards?

Question: What software do you use for making moodboards? Is Illustrator the best option? Has anyone got any other methods or ideas about making moodboards? Specifically from found digital images and photography.
Answer: My suggestion would be to go with the program you are the most comfortable, be it Illustrator, Photoshop, Gimp or any graphics software that lets you paste images and add comments.
Illustrator is a really good choice, you'll find it easy to add and modify elements.
This article could be of great help, especially regarding images:

24 pro tips for creating inspirational mood boards

When putting together mood boards, think of yourself as a curator
  rather than a collector, and try to have meaning and threads from one
  image to the next. It makes for easier interpretation.

And:

An offline mood board will generally be looser in style and require
  the extra kick and emotive spark that comes from it being presented to
  a client. An online mood board should be tighter and will generally
  need to work harder to convey a theme or style.
Answer: I think there are 2 distinct steps in designing a mood board:

Form/style of the mood board: freeform or tight pattern, what type of images, soft or bright colors, fonts - these factors are determined by what the mood board is for.
Once you have decided on a style, you need to come up with a way to put everything together - a software to do the mood board.

Since you have asked for software I would focus on that part only. You can use Photoshop, Illustrator, Gimp - they are standards in design process.
If your focus is to quickly setup your mood board then I would highly recommend TurboCollage.
Here's a screenshot:
Answer: If you are simply creating a montage of image grabs and a few typographical and dropped ilustrator design elements I find InDesign is far better as you can drop a vast quantity of items down to multiple pages very quickly then arrange from there, multiple pages are also much simpler in Indesign to export as a PDF document for presentation or to send to print.
If you want a single moodboard with editable design element workings and so on Illustrator is better.

Software for mood boards?


What are the security implications of "Row Hammer" attack?

Question: I just found out about the Row Hammer attack. Based on the description, this sounds extremely dangerous, but I wonder what percentage of devices are actually affected by these. Are there any ways to protect oneself other than replacing RAM with one that supports ECC?
Comment: Would ASLR work? I haven't looked at this attack very thoroughly, but it sounds like it might...
Comment: It might not if in the end the exploit is able to access the flat memory.
Comment: "A system could ensure that, within a given refresh period, it does not activate any given row too many times without also ensuring that neighbouring rows are refreshed?" From your own link... For us mortals this just means change RAM on critical servers/network
Comment: Detecting such reads and then refreshing adjacent memory rows might work. But I'm not sure which piece of hardware wouldn't be responsible for that.
Answer: The basic security implication is that an unprivileged user can elevate their access to root/kernel level.
Google's Project Zero tested 29 different laptops manufactured between 2010-2014 inclusive, and found that 15 were vulnerable and 14 were not. They do warn that this sample size is not enough to be considered representative, but it is still suggestive that this is unlikely to be an isolated problem.
The original Flipping Bits in Memory Without Accessing Them paper suggests that the problem is much wider:

Among 129 DRAM modules we analyzed (comprising 972 DRAM chips), we
  discovered disturbance errors in 110 modules (836 chips). In
  particular, all modules manufactured in the past two years (2012 and
  2013) were vulnerable

The only real way to mitigate the attack is to not run arbitrary binaries on your system, and to not allow anyone else to access your system if they might have hostile intentions. This is obviously a problem for shared computing resources e.g. universities, hosting facilities etc. Cloud providers could potentially be vulnerable (successful memory corruption from inside VMs has been reported, but it remains to be seen how exploitable this is).
Using ECC, whilst not a guarantee of security, might lower the probability of successful exploitation. The full mitigation is to update to a system that employs some defence - either a memory controller or DRAM that actively detects and avoids the exploit. Availability of such controllers or DRAM right now is unknown, but they are known to exist. Memory manufacturers have been aware of this problem for a while, and the specification for LPDDR4 includes mitigations, so future laptops will be protected.
Answer: ECC RAM is not necessarily immune; ECC memory reliably fix one-bit flips and detect most two-bit flips, which makes the attack harder, but not conceptually infeasible.
Non-ECC RAM is not necessarily weak; in fact, as per the definition of how RAM should behave, no single bit flip should ever happen. What we are talking here is RAM with a defect: the RAM does not work like it should. The depressing fact is that such defects are a lot more common than usually assumed, since, under normal conditions, such defects are not triggered often (or at all).
Solution is to get non-defective RAM. The underlying issue then becomes: how will we detect that RAM is defective ? The well-known MemTest86 tool includes a "row hammer" test (since at least v6, available in the free version).

For a software-only solution, one could imagine a "manual refresh" done by the kernel. Some kernel thread would regularly do the following, for all pages in physical RAM:

Lock the page (i.e. mark it non-accessible for userland code).
Flip all the bits in the page, ensuring a cache flush with the relevant opcodes.
Flip all the bits again, again with a cache flush. This restores the original data in the page.
Unlock the page.

If userland accesses the page while it is being refreshed, the trap handler simply waits for the refresh to complete, then jumps back to the process so that it may try again.
The double-flip is meant to ensure that even smart hardware that tries to follow actual modifications will flush the data and thus rewrite the page (which will refill the potential wells in the DRAM chips).
To a large extent, this process would mimic what hardware already does for memory refresh. Then it would be a matter of deciding how often this should be done; refreshing more often means more CPU / RAM bandwidth spent on the refresh, so there is a trade-off. Whether an acceptable trade-off can be achieved depends on how much RAM there is, how fast the RAM is, and how defective the RAM is.
Implementation in any given operating system is left as an exercise to the reader. I presume this may have non-trivial impact on the paging/swap heuristics (when paging or swapping, the kernel tries to evict pages that have not been accessed recently, and this accounting is done by the MMU itself; the "refresh thread" will play havoc with this information gathering).
Comment: That is not how the exploit works. A DDR3 DRAM rank is refreshed every 64ms - the exploit happens within this time period. The problem is that the DRAM is not storing the data stable for 64ms between each refresh as it should. It does not matter if you "manual refresh" once every second - there will still be plenty of 64ms periods when the code can repeatedly attempt to exploit the memory. Every 64ms period is another opportunity to try the exploit. It is not a _"once after 5 minutes"_ distribution, it is a _"many tries averaging 1 success every 5 minutes"_ distribution.
Comment: That solution doesn't make any sense. If you don't schedule the exploit process (which you can't, because its memory is locked), then your "manual refresh" is irrelevant since the exploit process isn't even being run at that time.
Comment: The point of the "manual refresh" is that it runs _all the time_, not just when an attack is expected. The exploit process flips a bit by _repeatedly_ flushing a cache line until it somehow "spills over" adjacent rows. This takes a bit of time (some dozens of seconds -- the linked page indicates an average of 5 minutes on one laptop, 40 minutes with a BIOS update with stricter refresh cycles). If the "manual refresh" processes the target pages more often than that, then the attack should be thwarted. In effect, this really mimics the DRAM refresh normally done by the hardware.
Comment: Mmm... then a manual refresh may be of any good only if it happens more often than once every 64 ms, which looks hard for a machine with gigabytes of RAM (one could refresh a given megabyte or so every 10ms while still leaving most of the RAM bandwidth available, but I doubt that all potential targets in a modern machine all fit within a single megabyte).
Answer: I had been working on DRAM for many years, here is some of my points.
As I know, there are a lot of researches trying to solve this problem and some of them claim have solution. But as what I see, most of them do not have a full protection. So, it might be a big bomb in the computer world if some hacker able to make successfully to trigger this bomb.
It is not only DDR-3 and manufactured between year 2012-2013 are vulnerable. Actually it can be happen on all DDR-3 and even DDR-4. The problem is caused by higher density of today's DRAM chips. The data stored in each cell cause the nearby cells to change its contain when doing a lot read on the same cell.
To increase the Refresh is not going to solve the problem, it just reduce the chance of being hit. But it also increase the system heat and slow down the process power. In fact, when this happen, it becomes more vulnerable to Row Hammer hit. So, increase Refresh Rate is not a good solution.
ECC is not going to solve the problem, it just make it more difficult to make it happen, because ECC only can correct 1 or 2 bits error.
Sorry, I haven't see any good solution yet, but I will post here if I know it.


Can Touch ID on Mac authenticate sudo in Terminal?

Question: Can Touch ID on Mac authenticate sudo in Terminal?
Answer: To allow TouchID on your Mac to authenticate you for sudo access instead of a password you need to do the following.

Open Terminal

Switch to the root user with sudo su -

Edit the /etc/pam.d/sudo file with a command-line editor such as vim or nano

The contents of this file should look like one of the following examples:

# sudo: auth account password session
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

# sudo: auth account password session
auth       sufficient     pam_smartcard.so
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

You need to add an additional auth line to the top so it now looks like this:
# sudo: auth account password session
auth       sufficient     pam_tid.so
auth       sufficient     pam_smartcard.so
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

Save the file. (Note: this file is normally read-only so saving your changes may require you to force the save, e.g. vim will require you to use wq! when saving)

Also note that pam_smartcard.so may not be present on older MacOS versions.

Exit from the root user or start a new terminal session.

Try to use sudo, and you should be prompted to authenticate with TouchID as shown below.

If you click 'Cancel,' you can just enter your password at the terminal prompt. If you click 'Use Password' you can enter your password in the dialog box.

If you SSH into your machine it will fall back to just use your password, since you can't send your TouchID fingerprints over SSH.

Note:
See answer by user Pierz below if you're using iTerm, as there's a setting you need to explicitly change to enable this feature.
Note:
Recent MacOS updates may remove the entry. If TouchID stops working for sudo then check if the entry was removed and add it back in, following these instructions again.
Comment: @Znarkus one potential security implication is that, at least in the US, you cannot be compelled to give up a password by a court (it's considered a violation of the 5th amendment), but your biometrics are not secret, so you can absolutely be forced by a court to biometric auth. i'm not sure that's a concern for most people, but it's a good piece of knowledge to have.
Comment: No need for all the steps of doing `sudo su -`, editing, force-saving with `wq!`, and exiting root. Just use `sudo -e /etc/pam.d/sudo` which opens the file in your default editor and seamlessly does all of the required priviledge escalation for you.
Comment: Seems to work! Are there any security implications with this?
Comment: This worked only after I did https://apple.stackexchange.com/a/355880/158188 (but I did do this first)
Comment: Don't do `wq!`.  Do `w!` first. Test, test, test, _then_ quit vim. If you make a typo you'll be locked out of your account.
Comment: That doesn't seem to "survive" an update of OSX, I had to apply these changes again after an update from 11.5.2 to 11.6. Any idea how to improve the solution to make it more robust?
Comment: It works. Thanks, bro
Answer: If you're using iTerm2 (v3.2.8+) you may have seen Touch ID failing to work with sudo in the terminal despite having made the pam_tid.so modification as above, and it working in previous versions. This is down to an advanced feature that seems to be now enabled by default - this needs to be turned off here: iTerm2->Preferences > Advanced > (Goto the Session heading) > Allow sessions to survive logging out and back in.
Alternatively you can use this pam_reattach module to retain the session feature and TouchID sudo at the same time.
Comment: PSA: __Do not__ typo anything in `/etc/pam.d/sudo`. If you do, you'll have to load up single-user mode to change it back.
Comment: But if you want to keep sessions restoring feature, you can try [this repo](https://github.com/fabianishere/pam_reattach) with a custom pam module.
Comment: The touch ID prompt hides the full-screened hotkey-window. Is there a workaround?
Comment: Just tested: When using `pam_reattach`, one needn't either change the setting or restart iTerm — everything works right away! (I haven't tested if sessions "actually survive" since I have no clue how, but I didn't need change the setting).
Comment: @Michael Alternatively you can enable root via `dsenableroot` which first prompts for your password and then for a new-to-set root password. If you don't have enabled the root user before, that is. ([via](https://superuser.com/a/1233928)) `dsenableroot -d` to deactivate again. ([via](/q/437850))
Comment: @Michael Actually, it is not necessary. The only thing that is needed is to temporarily enable root user on macos and then use 'su' to login in shell as root, and then temporarily `chmod +w /etc/pam.d/sudo`. Now you can fix any typos  and then revert permissions back with `chmod -w /etc/pam.d/sudo`... And then disable root user in macos.
Answer: With macOS Sonoma, there is now a supported option to enable Touch ID for sudo:

Touch ID can be allowed for sudo with a configuration that persists across software updates using /etc/pam.d/sudo_local. See /etc/pam.d/sudo_local.template for details.

What's new for enterprise in macOS Sonoma - Apple Support

sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local

sudo nano /etc/pam.d/sudo_local and follow the instructions inside, uncommenting the last line of the file by removing the # from the start of the line so the file looks like this:
# sudo_local: local config file which survives system update and is included for sudo
# uncomment following line to enable Touch ID for sudo
auth       sufficient     pam_tid.so

This will persist through software updates unlike changes to /etc/pam.d/sudo.
Comment: Works like a charm. Worth noting if you use DisplayLink that it will still prompt you for password unless you also run `defaults write com.apple.security.authorization ignoreArd -bool TRUE`.
Comment: If you'd like to use this with `tmux`, you would have to install https://github.com/fabianishere/pam_reattach and add that to `/etc/pam.d/sudo_local` as well (assuming you trust the author). The link also documents the problem in detail.

For the same reason, you need to change an iTerm option if you want to use this with iTerm, see https://apple.stackexchange.com/a/355880/513181.
Comment: If I could give comments an upvote I would for Samuel Lindblom's comment!
Answer:
TouchID does support elevating privileges, but as of now, it only seems to be supported in Apple's own apps. My guess is that 3rd party apps will have to be updated to support it, unfortunately. I still end up typing in my password a lot.
See @conorgriffin's answer for instructions to enable TouchID for sudo.
Answer: I have created a simple script that enables sudo to use the TouchID PAM module exactly as conorgriffin explains. It does it in a single script that you can copy-paste to a terminal in it's entirety or use the "curl pipe bash" shortcut:
curl -sL https://gist.githubusercontent.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70/raw/touchid_sudo.sh | bash
The complete script:
#!/usr/bin/env bash

# curl -sL https://gist.githubusercontent.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70/raw/touchid_sudo.sh | bash
# This script is ready to copy-paste in whole, or just the line above (without the leading #)

# Use TouchID for sudo on modern MacBook Pro machines
# This script adds a single line to the top of the PAM configuration for sudo
# See: https://apple.stackexchange.com/q/259093/41827 for more info.

touchid_sudo(){
  sudo bash -eu <<'EOF'
  file=/etc/pam.d/sudo
  # A backup file will be created with the pattern /etc/pam.d/.sudo.1
  # (where 1 is the number of backups, so that rerunning this doesn't make you lose your original)
  file_dir="$(dirname "$file")"
  file_name="$(basename "$file")"
  mapfile -t backup_list < <( ls -A "$file_dir"/{,.}"$file_name"* 2>/dev/null )
  backup_count="${#backup_list[@]}"
  backup_ext="$backup_count"
  backup="$file_dir/.$file_name.$backup_ext"
  cp "$file" "$backup" 2>/dev/null || touch "$file" "$backup"

  awk -v is_done='pam_tid' -v rule='auth       sufficient     pam_tid.so' '
  {
    # $1 is the first field
    # !~ means "does not match pattern"
    if($1 !~ /^#.*/){
      line_number_not_counting_comments++
    }
    # $0 is the whole line
    if(line_number_not_counting_comments==1 && $0 !~ is_done){
      print rule
    }
    print
  }' > $file < $backup
EOF
}

touchid_sudo

This script demonstrates a few cool patterns that I love to teach people who are new to bash or DevOps.

Create a backup file that is numbered rather than simply .bak on the end. (It looks gnarly, but that pattern works with whatever is in $file and is reusable.
To make it safe to do curl ... | bash, wrap everything in a function and call it on the last line. That way if the download is interrupted, nothing is (partially) done.
Put a call to sudo bash -eu in your script so that you don't have tell the user to do it. (-eu are short for errexit and nounset and you should be using them!)
Single quoting bash heredoc 'EOF' to prevent premature shell expansion.
Making inline awk more readable.
Comment: The script above erroered for me: `bash: line 6: 0: ambiguous redirect`
Comment: The script assumes a "modern" version of Bash, @JanKatins. You'll need to install a recent version of `bash` from Homebrew or elsewhere.

MacOS comes with Bash 3.2 (the last version under GPL 2) for licensing reasons. Bash 3.2 fails on line 17 for 2 reasons (which is line 6 of the heredoc):
1. For some reason, the `<(` generates 2 file descriptors, which is why it's saying `ambiguous redirect`. This could be fixed by using a single set of double-quotes: `"$file_dir/{,.}$file_name*"`.
2. The `mapfile` builtin wasn't added until Bash 4.0.
Comment: @JanKatins The gist version should work with Bash 3.2.
Comment: @BrunoBronosky This script doesn't work with the builtin MacOS Bash 3.2. I think it could be made to work by removing the `mapfile` line and setting `backup_count` to `"$(( $(ls -A "$file_dir/"{,.}"$file_name"* 2>/dev/null | wc -l) ))""`.
Answer: You can use fingerprint for getting sudo access in the terminal or iTerm, just add auth       sufficient     pam_tid.so to the first line to your /etc/pam.d/sudo file.
Comment: It might be interesting for other to know that the current iTerm version v3.2.8 doesn't allow this when another default option is set. You have to go into Preferences -> Advanced and deactivate `Allow sessions to survive logging out and back in`: https://gitlab.com/gnachman/iterm2/issues/7608#note_153123852
Answer: To wrap up Andy and Glenjamin's solution into one play:
---
- hosts: localhost
  tasks:
  - name: install pam_reattach pam module
    homebrew:
      name: pam-reattach
      state: present
    register: reattach_result

  - name: detect touch id support
    shell: pgrep ControlStrip
    ignore_errors: true
    register: touch_id_result

  - name: enable touch id for sudo commands
    lineinfile:
      path: /etc/pam.d/sudo
      line: 'auth       sufficient     pam_tid.so'
      insertbefore: '^auth       sufficient     pam_smartcard.so$'
    become: yes
    when: touch_id_result.rc == 0 and touch_id_result.stdout != ''

  - name: enable persistent touch id for tmux and iterm
    lineinfile:
      path: /etc/pam.d/sudo
      line: 'auth       optional       pam_reattach.so'
      insertbefore: '^auth       sufficient     pam_tid.so$'
    become: yes
    when: reattach_result == 0

This can be run with just ansible-playbook sudo-touchid.yml, where sudo-touchid.yml is what I named this play.
The first step installs Fabian's pam_reattach, which allows sudo to work in iTerm, tmux, etc.
The second checks to see if this Mac has a touchbar; otherwise we're going to bail out.
Third, we're seeing if we already added pam_tid.so to /etc/pam.d/sudo, and only if there is a touchbar.
Finally, we also add pam_reattach.so as an optional auth method. According to the author, he might have have some unknown bug, and if we used required it could result in a lockout.
Comment: This answer may benefit from an explanation on how to actually use it and why the different parts are necessary.
Comment: really? I have a M1 Max MBP 2021 on macOS 12.6.2 (Monterey, ARM) and there is no ControlStrip process.
Comment: Turns out `pgrep ControlStrip` succeeds also on my M1 Max MBP 2021, even if it has no touchbar any more.
Comment: On my M2 homebrew installs the PAM module to `/opt/homebrew/Cellar/pam-reattach/1.3/lib/pam/pam_reattach.so` so PAM doesn't find it. Then one is logged out.
Comment: This is how I test for the presence of Touch ID: `test $(bioutil -sr | sed -n 's/\([[:space:]]\+\)Biometrics functionality: \([[:digit:]]\+\)$/\2/p') -gt 0`.
Answer: Open /etc/pam.d/sudo_local.template. I used BBEdit.
Uncomment the 3rd line #auth       sufficient     pam_tid.so
Save as /etc/pam.d/sudo_local.
The first line of /etc/pam.d/sudo already includes this _local file:
auth       include        sudo_local
TouchID should now be an authorization method for Terminal.app, and should survive updates etc.
Comment: I think this new for MacOS 14 Sonoma
Comment: I guess that makes this the most current (and correct) answer then :)
Answer: I created the following ansible tasks to enable touch id for sudo commands if your computer supports it:
- name: detect touch id support
  shell: pgrep ControlStrip
  ignore_errors: true
  register: touch_id_result

- name: enable touch id for sudo commands
  lineinfile:
    path: /etc/pam.d/sudo
    line: 'auth       sufficient     pam_tid.so'
    insertbefore: '^auth       sufficient     pam_smartcard.so$'
  become: yes
  when: touch_id_result.rc == 0 and touch_id_result.stdout != ''

Answer: My 1 string answer:
sudo su root -c 'chmod +w /etc/pam.d/sudo && echo "auth       sufficient     pam_tid.so\n$(cat /etc/pam.d/sudo)" > /etc/pam.d/sudo && chmod -w /etc/pam.d/sudo'

What does a command do?

First, I indicate that I want to do everything from root (using
sudo, the trick will not work (more precisely, it will, but more
difficult to implement)
Then I give write permissions to
/etc/pam.d/sudo
Then I add the line auth       sufficient     pam_tid.so to
the beginning of the file. See that post
Then I take away the
granted write permissions /etc/pam.d/sudo , taking
into account Matin ZD remarks

P.S.
While experimenting broke sudo and su in the terminal, it is repaired like this
https://support.apple.com/en-us/HT204012 enable root
su - root
vim /etc/pam.d/sudo

Revert the file to its original state
Comment: The PS just saved my life! But I needed the English link not the Russian one (https://support.apple.com/en-us/HT204012), so I sent an edit.
Answer: This one-liner will insert the auth line described here as the second line of the sudo config file (so that it appears first after the comment line).
sudo sed -i -- '2s/^/auth sufficient pam_tid.so\n/' /etc/pam.d/sudo

Answer: Here's a Gist to make it as simple as possible.
https://gist.github.com/fraune/0831edc01fa89f46ce43b8bbc3761ac7
Comment: Please summarise your Gist into this answer. Link-only answers are not preferred here, as if the link disappears, your answer is worthless.
Answer: One thing to mention is that you should first change the file permission then try to make changes:
sudo su -
chmod u+w /etc/pam.d/sudo

Adding this line at first line:
# sudo: auth account password session
auth       sufficient     pam_tid.so # << Add this here ;)
auth       sufficient     pam_smartcard.so
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

Then revert it back file permissions when you are done with:
chmod u-w /etc/pam.d/sudo
Comment: I've been doing and recommending this change for years and never heard of anyone needing to do this. If this is sometimes necessary, I think explaining when would be useful, otherwise this appears to be completely extraneous.
Comment: I had a focus on permissions, not for that line ;) @grg Also If you want to change the file or write to it by default the file permission is 444 which is not writable by anyone.
Answer: In addition to the top comment of Michael https://apple.stackexchange.com/a/306324/388071 the Touch ID permissions process can be simplied by just opening Terminal (CMD + space: 'Terminal'), and run: echo 'auth       sufficient     pam_tid.so' | sudo tee -a /etc/pam.d/sudo with your admin user password

Note that TouchID also gets automatically disabled after each MacOS update. To automatically re-enable the touch ID running this command you will add an automatic repair check to your bash profile:
echo 'if ! grep -q "pam_tid.so" /etc/pam.d/sudo; then
  echo "Updating /etc/pam.d/sudo to activate Touch ID authentication permissions from Terminal:"
  echo 'auth       sufficient     pam_tid.so' | sudo tee -a /etc/pam.d/sudo
  echo "pam_tid.so permissions updated:\n\n$(cat /etc/pam.d/sudo)"
fi' >> .bashrc # Change this to `>> .zshrc` when using Oh-My-Zsh


Artificially cap bandwidth on XP Pro.... possible?

Question: I'm looking for a way to artificially cap the bandwidth of my net connection on XP home to say, 1MB, temporarily. I've had a look at the QoS Packet Scheduler with little luck. Any ideas?
[Boring story]
I want to do this since I wish to test a theory I have for improving the internet experience of people with slow broadband...ie Rural areas, 3G networks etc.
A while ago, I rented a virtual private server for my web-hosting. It was a Windows server, so I could RDP into it. Whilst RDP'd in, browsing was lightning fast - as in, a much better experience than browsing on my local machine (which had a 5mb connection) - I guess because the server was on a FAT pipe, and the TS-compressed screen data was smaller than all the files used to generate the page locally.
I've heard that RDP is pretty usable even with a ~1mb connection - I just want to see whether that is true.
[/Boring story]
Edit: If latency is a bigger issue than bandwidth - which makes perfect sense now I think about is - is there anyway I can mimic high latency on my connection? Thanks
Comment: latency is the real killer with RDP
Comment: RDP is fine for browing static pages, but when you bring in video and flash you start seeing issues.
Comment: I believe the correct term is "Phat" pipe ;)
Answer: Traffic Shaper XP should do what you want.
RDP will work fine over slow connections (1Mb is plenty) including dial-up speeds.
Comment: not with 16 million colors enabled!


Option key does not work as Meta in Tmux

Question: I am using Mac OSX Lion. I have checked "Use Option key as Meta" in Terminal preferences. Although the Option key seems to work fine as Meta in Bash, when I use it in Tmux (over SSH) it does not work properly. I am trying to use TMUX shortcuts like ^b M-1 b M-2 etc. I can get these with the ESC key but not the Option key.
Comment: `^b Space` with cycle through the various layouts
Answer: For other folks who find their way here via their favorite search engine, I was able to solve this problem by simply going to Preferences -> Profiles -> Keyboard and checking "Use Option as Meta key" for the terminal profile I'm using.
I'm running weechat under tmux, and default key bindings make heavy use of the meta key.
Comment: you save my day!
Comment: Thanks! I was looking for a way to solve this without having to switch to iTerm2.
Comment: The issue with that approach is, you can't use a bunch of characters anymore on some keyboard layouts, like tilde, some brackets and backward slash for example ][{}\
Comment: Tip: You can do the same in iterm2 and also use `ESC+`
Answer: I would suggest using iTerm2 instead of the default Terminal.app, as it is better for many reasons.
Specifically, you would be interested in iTerm2's options to map left/right option as "+Esc", which works much better than trying to have it emulate Meta for every purpose I can think of or have tried.
This setting is located under:

Preferences

Profiles

[select a profile]

Keys
Comment: May I ask why you choose to set option to "+Esc" and not to "Meta" when it sounds like you're trying to use Meta-keys? What is the difference / why is "+Esc" better? Thanks!
Comment: I was looking for a reason to move to iTerm2 and here I have it. Thanks!!
Comment: When you hover over the "Meta" and "+Esc" options in iTerm2, there's a tooltip that says "+Esc is the preferred setting for users who don't need the option key to enter diacritics or other special character."
Answer: I'm also sticking to Terminal.app, and since no other answer solved the issue I'm adding my own that worked for me.
Besides configuring the current Profile in Terminal -> Preferences -> Profiles -> Select the profile to configure -> Keyboard and checking Use Option as Meta key, also look through the default list of bindings in the table just above and make sure that the combinations you want to assign are free. For me there were a few Option + Arrow keys that were interfering with tmux configuration to easily change between panes.
Answer: I had the same problem and none of the answers provided here worked. That is, I too had the iTerm2 [Option] key remapped to [+Esc] (aka. "fallback"-[META]) in my "Preferences -> Profiles -> Keyboard", as described in the other answers, but still could not change my tmux pane layout with [CTRL]-[b], [+Esc/META]-[DIGIT].
Then I found that under "Preferences -> Keys", there is a "Navigation Shortcuts" where [Option] + (any) [DIGIT] is mapped to "switch split panes" (remember [Option] is remapped to [+Esc], so that's a clear collision). Therefore, after un-setting that (to an empty key value), I finally can again comfortably resize my tmux panes with [CTRL]-[b], [+Esc/META]-[DIGIT] (instead of having to use [CTRL]-[b], (the real) [Esc], and then the desired layout [DIGIT]).
Answer: In my .zshrc I usually have the following set:
bindkey '^[[1;9C' forward-word
bindkey '^[[1;9D' backward-word

Within tmux sessions, I had to additionally include
bindkey '^[[1;3C' forward-word
bindkey '^[[1;3D' backward-word

You can figure out these codes by running read in a session, then pressing the keyboard shortcuts, e.g. Alt←.
My keys are set as follows in iTerm2:


Decision on connecting Earth Ground to one of Two GND pins

Question: I'm planning to design a board that is suitable for industry so EMC is so important. I have decided to use two separate power supplies(+5v and +24v) to Isolate the board from outside world. Optocouplers have been used to connect these two areas. I don't want to connect these two GND(power supply) together and I want to keep them separated. About the earth ground I read lots of articles that says it is better to connect the GND in PCB to the Earth Ground(for metal chassis). I wounder to Know if I'm doing right and having two separate GND for designing PCB of the board which one of these should be connect to the Chassis ?
and How about the other one !
I would appreciate if you give me some good references to read.
TNX
Answer: It depends on final equipment ground policy which may differ. In all systems i designed i use GND star connection, which means the following:

All isolated* grounds are connected.
There is only one point of connection, near the power supplies.
Chassis is connected in the same place with a thick wire.

*there are sometimes grounds that somehow depend on other systems and cannot be connected. Most common: minus of diode bridge in AC rectifier. Another possibility- minus of isolated supply for current sensing, which is connected to a motor phase. But since you are not asking about it, we will not discuss it.
Also on each board near each mounting hole there are capacitors that connect the chassis to grounds in AC domain. This is important, because being thick (in relation to PCB copper planes) the case usually has very low inductance and resistance and may be considered perfect ground for noises of all kinds. But on the other hands you don't want any power to pass through the case, so the connection is by caps.
Speaking of ground policy, nice to see that you use optocouplers. Hope you did not forget power filters.
Comment: Thanks  Gregory For your rapid reply
I read some articles about Star Grounding but I'm still confused !. Does it mean connect all GNDs together and finally to Earth Ground? e.g.
connect the GNDs of power supplies together and directly connect them to the earth ground exactly the place that they are.
keep those GNDs separated on the PCB board and the mounting holes (for chasis) don't connect to GND on the board. if so, it is in contrary to
This Post [link](http://electronics.stackexchange.com/questions/19561/should-chassis-ground-be-attached-to-digital-ground)
Comment: It's funny :) The guy says "don't do that", but he forgets to mention "if you did what i recommended first". In his case it's the same connection as i suggest, but which star center on the case. This is a nice alternative, and if you draw it as a diagram and compare to my way you will see that it's the same more or less. The issue with that is that depending on final equipment it may not fit. Because if in any input or output port you send a GND line together with your signals, suddenly ground loop is created. So it kind of rapes you to use more and more isolation. So he is wrong, i am right:)
Comment: Thanks Gregory. and is it right that I keep my mounting hole out of Ground for the sake of preventing loop?
Comment: Yes, mounting holes are the chassis net, connected with capacitors to GND


Can I ask a question about Star Wars/Star Trek fanfiction?

Question: I wanted to ask whether it's okay to post a question asking about classic fanfiction of Star Trek/Star Wars written at the time the movies or original show came out, and specifically about the then unknown future. I have a feeling it might be going against some rule. Thanks
EDITED TO ADD: I mean to say, in the question I would be asking if people have any links to the above mentioned fanfiction.
Comment: There's 2 different questions. One is what the fanfic was called, another where to find it. If you know the name, AND googled and can't find it, and supply your google attempts in the question, should be fine. If you don't know the name, ask the story-ID question without the "where to read" part first.
Comment: that would be more of a request for story recommendation, which is considered off-topic here (since there's no possible "correct" aswer)
Comment: I think I will leave it for now, as it doesn't relate to specific stories, just stories in general. I once read a Star Wars fan story called The Jedi Question that was written after Empire and before Jedi were released, and that's the kinda story I'd be searching for. Or Star Trek stories set in the 24th century but written at a point before TNG had been created, if this makes sense. Thank you for your help anyway.
Answer: This Meta post seems to imply a consensus that requests to find a particularly hard-to-find piece of fiction are allowed, though it's a bit vague.
Comment: `These questions are about what a librarian or bookseller would typically know.` - I don't think it's referring to fanfiction, which AFAIK has been rather vague in general.
Comment: @Izkata One of the questions listed there is "Place to read moderated amateur work?", which seems to recognize fan-fiction as part of the bibliographic universe we accept.
Comment: Although, now that I check, it seems that that question *has* been moderated and removed, though perhaps because it was asking for an archive or list, not for a specific work.


How can I learn more about my father, who was born in Spain and lived in Morocco?

Question: My father was born in La Linea, Spain. He said he played football for Morocco and also was married there. He spent many years in Morocco in the 1940's. How can I learn more about him?
Comment: Hi and welcome to Genealogy.SE! Per the [help center](http://genealogy.stackexchange.com/help/on-topic), if the individual is potentially living, please refrain from including personally identifying details to protect privacy. General questions about research techniques on recent ancestors are OK, though.
Comment: Hi, welcome to Genealogy.SE. Did you lose contact to your father or why are no biographical details known to you? Do you have any records like birth and death certificate, documents concerning the marriage. What sources have you checked so far, e.g. newspapers, are there relatives to contact?
Comment: See my answer to a similar question at http://genealogy.stackexchange.com/questions/3590/how-can-i-access-records-from-morocco/ (which does however focus on the French administered areas, rather than the Spanish).
Answer: You have several ways to investigate.
By the time your father was born, almost all citizens were baptised in Spain. Catholic Church is keeping an strong record of baptism and all related sacraments in the faith.
That means:

If you know the church and the baptism date you will be able to find the church he was baptised. If you get the record of the baptism you will have information about a previous place he lived and some relatives (godfather and godmother)
Not having the date of baptism of the specific church will require to go church by church in la Linea.
If your father kept the catholic faith and married in Marocco in catholic faith you can also contact the church where he married (there are very few!!!), that will have a tracked record towards the baptism place. You will also get another living relatives, witness and another address.

Concerning spanish registries:

When your father moved to the country he has been living, that country should have communicated the change of country to spanish authorities. There should be specific information about birth registry in Spain.
With that information you can request spanish registry to provide you the birth registry information and any related civil information (marriage). Also you will be able to track your granparents.

With that information you will be able to explore descendants and previous living places.
Comment: Morocco annexed many formerly spanish territories, so his father didn't necessarily immigrate from a country to another.
Comment: @bregalad Rif (Spanish Marocco) was a protectorate not an integral part of Spain. They had their own administration. So he should have immigrated to a different administration. However based on the question made, I understood that her father immigrated afterwards to another different country, that will be another immigration data to use


Duplicate email address allowed in member registration?

Question: Does EE allow multiple members to use the same email address when registering? I'm able to register members using the same email address, which is something I don't want to happen. This Allow duplicate emails/no email address on Member Registration seems to suggest that EE does not allow it, though. Is this supposed to be a setting or something?
Answer: Yes, EE doesn't allow duplicate email for registration. I think, you are using "Profile: Edit" module for the registration process. If so go to Extension Settings -> Profile Edit. From here select "No" for "Allow Multiple Profiles".
Comment: I'm using Safecracker Registration. What are my options?
Answer: ExpressionEngine doesn't allow this by default. It's possible another add-on has built this into their product, but Safecracker Registration just combined member registrations with Safecracker to get the benefit of channel entries. So by design, Safecracker Registration is limited by what the native member module can do, at least as far the settings go.


How do I make an object always face my camera in the Game Engine?

Question: I am making a game in the game engine which you can get the original .blend file and runtimes here. I am trying to optimize the game as much as possible. One of the ways that I'm trying to do that is by turning the bullets into a single plane instead of a complex object. I want one side of the bullet to always be facing the player's camera so that the bullet doesn't look flat from the top, as it would if the plane was fixed to the bullet. I am trying to use the "Edit Object" track to option but none of my combinations work. When I use the track to option the bullets will always fly in one direction or spin around endlessly in one direction above the player's head. Sometimes the bullet will just disappear. My problem is that when it tracks it tries to make the whole object face my camera and it rotates on all axis. I want the bullet to track using the X-axis but only rotate on the Y-axis.
Comment: Should be able to select the bullet 1st then the player camera (so that the camera is the active object).  T to track to. You'll need to rotate the bullet for the correct alignment. If you happen to change the bullet to be a plane you will likely have difficulties with collision detection.
Comment: Thanks but my problem is that when it tracks to my camera it rotates the whole bullet which makes it spin out of control. I want it to only track on the X-axis and only rotate on the Y-axis. What happens is the object tracks on the X-axis and rotates on all axis instead of just the Y-axis.
Answer: Use a simple cube (or rectangle, or whatever shape bullet you want) for the physical bullet. Parent a plane to your bullet's physics object. Set the bullet to invisible, and the plane's physics type to no-collision.
To make the plane track the camera, you can use the method you mentioned of edit object > track to. However, there is an easier way. You can set a material so that it will always face the camera. On your no collision plane, add a material. You can add your bullet texture, but the only setting that matters to make it track the camera is under the material's "game settings." Select the drop down for "face orientation" and select "halo" instead of "normal." What does this do? I'm glad you asked! If, for example, you were using a picture of a tree, you could use "billboard" to make the tree track the camera with rotation only along the Z. However, "halo" tracks the camera on the X, Y, and Z. You may need to go into edit mode in your plane, and rotate it so that the plane is facing it's X axis, for the face orientation setting to work.
Here is the entire process:
Comment: Thank you. I am having a problem with this though. Using billboard and halo mode rotate my bullet model up when I press P. I have it set up for billboard mode where the front of my bullet is facing the local Z-axis. When I start the game it rotates my model so that the bullet is facing up.
Comment: Your actual bullet should be nothing more than a cube with whatever physics/logic you use to make it work. It should be invisible, with a no-collision plane parented to it. This plane has no purpose other than to look nice, and should have the material set up to track to the camera.


Indesign: Is it possible to Replace frames those content a specific link with clipboard content?

Question: I have a lot of frames (as icons) linked to one image (link). But now I want a glyph instead them. Is it possible to replace them with a glyph that I copied to clipboard? Any script?
Even is it possible to track down a specific link with its path within InDesign?
Answer: Yes and no. If the existing frames have some object styles applied, you could use the Find/Change Object dialog and use "Contents of clipboard" as a replacing value.
Otherwise, you could simply use the glyph as an external resource and relink the link to that file.
Alternatively, you may want to use a script to do the replacements.


Why is it harder to focus using LiveView?

Question: I have a Canon EOS 650D with 18-135 f/3.5-5.6 IS STM. When shooting in LiveView, I find it harder to achieve focus when it's in the dark, and sometimes it can not lock focus despite my touching the screen to mark the AF point. Why does this happen? What makes the difference between LiveView and through optical viewfinder? Is there any tips to improve this ? (I used LiveView because I needed to hold the camera high above my head, so I could not use the optical viewfinder to see the captured area).
Answer: This is the difference between CDAF (contrast detection) with integrated PDAF hybrid pixels vs full PDAF(phase detection).  When using live view, the camera's imaging sensor is exposed and it tries to focus by using a combination of hunting for focus and checking the image contrast mixed with some hybrid pixels that contain limited phase detect focus capability.  Generally speaking, CDAF should work better in low light, but it also takes longer and doesn't work well if contrast is low.
When in optical view finder mode on the other hand, the full PDAF sensor is exposed to the image and can be used to quickly get pretty accurate readings.  It still requires vertical or horizontal lines, but doesn't require the same hunting for focus.
It is a little bit weird that you couldn't get focus at all with live view but could under the same conditions with the view finder, but it is expected that it would be a bit slower in LiveView since the PDAF functionality is not as complete.
Comment: footnote: CDAF = [contrast detection](http://en.wikipedia.org/wiki/Autofocus#Contrast_detection) AF; PDAF = [phase detection](http://en.wikipedia.org/wiki/Autofocus#Phase_detection) AF. :)
Comment: @inkista - thanks for mentioning that.  I originally had a line about that and then cut it out when I was shortening the answer a bit without noticing I clipped the full names.


How to provide external power supply for 8 servo motors?

Question:

When ever I switch on the power supply there is not enough power supply to servo motors. Voltage across each servo motor is 1.5 Volts only. Should the circuit must be changed?
Is there any better way of circuit design?
Comment: Try just connecting one servo and check the voltage. If it´s ok, then add another etc. When the voltage drops more that 1V or 2V, you´ll know you´ve reached the limit and will need a bigger power supply. Otherwise, you have some other problem.
Answer: The design is ok, the reason is that your power source is not able to provide enough current (as others have mentioned already). You need a 5V 16A power supply (it is a serious stuff, like a PC PSU, not a wall-wart) to provide full power for these servos in all circumstances.
It is a good idea to add 2200uF/16V electrolityte capacitor to the power, or a 470uF/16V at each motor power in if there is a serious wiring distance.
It is also important to consider that you do need thick wires on the PSU rails.
Answer: Could be possible that your source cannot drive a lot of current which the servos usually need.I used 4 servos and they needed about 2 amps current.So check if you are really using a source which can supply the needed current too. If you are using a voltage source from the laboratory then don't limit the current to a less values.
I used this interface to genrate the PWMs https://www.adafruit.com/product/815 for my robotic arm.It works really well and is also easy to generate the needed PWMs with less direct connection between the controller and the motors using the I2c interface.


What's the importance of the "title" tag?

Question: Talking with some other people recently, it came up an interesting topic. The core question at hand is:

What's the real importance and weight of the <title> tag in a web site?

For instance, what are the consequences if a site has the same <title> tag on all the pages, reporting only the site name? Or better (or worse) no title tag at all?
Will that be a little/medium/huge SEO problem? How will the pages appear on search engines? Will fixing it in a later stage be problematic since pages have already been indexed? How does it compromise the overall usability/accessibility/experience? Is that a "feature" that can be omitted, or it can't even be considered a "feature" but a core element?
I have quite my opinion on this topic, but I'd really love to hear what other experts (you) think about it.
Answer:
What are the consequences if a site has the same <title> tag on all the pages, reporting only the site name?

You run the risk of having your pages flagged as duplicate content. The title of a web page is very important for SEO and if all of your pages have the same title you dramatically increase the chances they will be considered duplicate content. You would have to make sure your pages' content is very different prevent this from happening.

Or better (or worse) no title tag at all?

Worse. You definitely want a <title> for all of your pages. It's probably the biggest on-page ranking factor for SEO. When a user bookmark's your page it is the default text for that bookmark. It's what is shown in the title bar and/or tabs of your pages. Basically not having one is bad for SEO and usability.

Will that be a little/medium/huge SEO problem?

Yes!!!

How will the pages appear on search engines?

Hard to say as I have never seen an untitled page in the search results but that's probably because they all rank too poorly to be found. But I suspect Google would put either a snippet found on the page or something along those lines.

Will fixing it in a later stage be problematic since pages have already been indexed?

No. But it may not happen quickly. It could weeks or months for you to see the changes reflected in Google's search results. And all that time your rankings and click-thrus will suffer for it.

How does it compromise the overall usability/accessibility/experience?

No page title means it is more difficult for users to know what page they are on and what the main purpose of that page.

Is that a "feature" that can be omitted, or it can't even be considered a "feature" but a core element?

The <title> tag is a core element.
Comment: Great answer, competent and answering all the points.
Comment: Observe how the `title` tag is used here, on stackoverflow.com and on other stackexchange.com sites. The inclusion of a popular tag at the beginning of the title is not an arbitrary decision.
Comment: Don't get me wrong - I already knew this stuff by myself, but I wanted to have the answer of recognised experts, confirming what I already knew.
Answer: Your title tag should be different on each page for at least two reasons:

This is the text shown when you bookmark a page.  If it is all the same and the user bookmarks several pages, then they see the same text in each bookmark.
Google uses the title to know how the page is distinct from the others on your site.  See Google's Search Engine Optimization Starter Guide (pdf).
Answer: I think it is mandatory to have a good title on every page, for both SEO and usability.
SEO:
I think search engines look at the title tag from left to right in importance. And they only take a couple of words in account. Not sure if this is still the case though.
Usabilty:
It is nice to see what tabs you have opened in your browser. It is nice to see what bookmarks you have. I recommend the form page title - site title
Comment: When there are many tabs open, the space for each title will shrink. Several tabs that say "Site title - ..." can take longer to distinguish.
Comment: @PeeHaa: Why would you have the title components that way around? That's contrary to common sense, I think. In my tab bar, I want to see site title first, to give the page title its proper context... and I read left-to-right.
Comment: Safari is clever about this: it recognizes common prefixes among tab titles and hides them, so you get the unique parts! If only all browsers did that...
Answer: The title tag is not optional. A correct HTML document must have a title tag.
The title tag has quite high significance for SEO. If it contains an short and descriptive title that reflects the content of the page, your pages will definitely rate better in search engines.
Your page should ideally have one h1 tag also, with a text similar to the title. That will help clarifying to the search engine what the page is about.
You can alter the titles later, and search enginges will re-index your pages. It can however take days or weeks before they notice. Also, you will get a slightly better rating if your page has been up for a longer time, so it helps to fix those things early.
Answer: A title is one of most practical ways for a screen reader user to know which page they are on. Not having a title would cause major confusion for a screen reader user and it would be annoying if the screen reader kept repeating the entire URL. So, from an accessibility standpoint, the title should be in there.
Answer: From a user experience point of view I think supplying specific titles is better because it shows more specifically what the user is seeing.  This is also helpful to the user when bookmarking a page as a well formed title saves the user from having to amend the title of their bookmark.  Personally I prefer to use site title - page title.
Answer: Among other things, the title is used to set the title when users bookmark pages.  A clear title makes searching bookmarks much easier.  If the company name is in the title, it works better for me if it is a suffix rather than a prefix. (It may be useful to known the source, but knowing the content is more important.)   Page title is important, site title may be of interest.  My preference is Page title, but Page title - Site title as is used here works for me.
From an SEO perspective, I believe keywords appearing in the title and content get rated higher.
Answer: Many reasons:

SEO - crawlers look at title tag for various things
Accessible - Screen readers can read off it
Proper Bookmarking
Answer: <title> is, obviously, used for the title in the browser's title bar. This is also what is saved in the browser's history and bookmarks sections. As such, having distinct titles can have a significant impact on user experience.
<title> also has semantic value for search engines. Well chosen titles can give a strong indication of the essential about-ness of a page (I'm ignoring attempts to game the SE here). Using good values for <title>,
, etc. tags makes your site fundamentally more "understandable" to the search engine because they indicate author intent about what is important and what is less important.
The Semantic Web that Tim Berners-Lee has been championing for quite some time is all about adding machine-understandable information to web pages, and this is the simplest form of that type of information.
Answer: <title></title> tags are used to show user that, it is Home page or etc... like "Home::xyz.com" in title bar. It is also useful for web owner because, it helps him to find his/her site on search engine (e.g. Google,Yahoo etc) first on rank.