Difference between red-black trees and AVL trees

Question: Can someone please explain what the main differences between these two data structures are?  I've been trying to find a source online that highlights the differences/similarities, but I haven't found anything too informative.  In what cases would one be preferred over the other?  What practical situations make one "better" to use than the other?
Answer: AVL trees maintain a more rigid balance than red-black trees. The path from the root to the deepest leaf in an AVL tree is at most ~1.44 lg(n+2), while in red black trees it's at most ~2 lg (n+1).
As a result, lookup in an AVL tree is typically faster, but this comes at the cost of slower insertion and deletion due to more rotation operations. So use an AVL tree if you expect the number of lookups to dominate the number of updates to the tree.
Comment: Asking to understand concept better. Both avl tree and Red Black tree have atmost two rotations per insertion. So, how can you say AVL trees are slow?

Thanks in advance!
Comment: @larsmans! I mean why do we have the concept of Red-Black tree so famous when we have AVL tree, though there are only slight differences in their insertion, deletion and update performances. Is there anything major which makes Red-Black tree different from AVL tree?
Comment: @larsmans! Is the performance difference so much that a new concept is created?
Comment: @Shashwat I don't get what you mean. New concept?
Comment: The algorithms to maintain them are different, so they get different names. AFAIK, they support the same set of operations with the same big-O time bounds.
Answer: For small data:
insert: RB tree & avl tree has constant number of max rotation but RB tree will be faster because on average RB tree use less rotation.
lookup: AVL tree is faster, because AVL tree has less depth.
delete: RB tree has constant number of max rotation but AVL tree can have O(log N) times of rotation as worst. and on average RB tree also has less number of rotation thus RB tree is faster.
for large data:
insert: AVL tree is faster. because you need to lookup for a particular node before insertion. as you have more data the time difference on looking up the particular node grows proportional to O(log N). but AVL tree & RB tree still only need constant number of rotation at the worst case. Thus the bottle neck will become the time you lookup for that particular node.
lookup: AVL tree is faster. (same as in small data case)
delete: AVL tree is faster on average, but in worst case RB tree is faster. because you also need to lookup for a very deep node to swap before removal (similar to the reason of insertion). on average both trees has constant number of rotation. but RB tree has a constant upper bound for rotation.
Comment: this seems to mean that AVL trees would almost always be preferred with large amounts of data. How come it's used in Java and C++ STL? https://stackoverflow.com/questions/3901182/applications-of-red-black-trees
Comment: As a shortened summary of 'small data', what I took from this was: AVL does more work upfront and is stricter (writes/ rotations), to increase performance later (reads). Reading becomes more important as the data grows, because you would read more than you write (rotation would be insignificant compared to the search). So AVL wins on all counts, because it is optimised for reading.
Comment: You need have certain amount of data (1 million for example) to make AVL tree better than RB tree in the insert/delete case, and it really depends on how you implement it. A smart AVL implementation can beat std::map even with less amount of data. For example, you don't need to check whether the child and grandchild are null if the parent->height is larger than 5.
Comment: This is a great analysis and should be the exemplar of any sort of comparison of data structures. Better than the accepted answer
Answer: Quoting from this: Difference between AVL and Red-Black Trees

RB-Trees are, as well as AVL trees, self-balancing. Both of them provide O(log n) lookup and insertion performance.
  The difference is that RB-Trees guarantee O(1) rotations per insert operation. That is what actually costs performance in real implementations.
  Simplified, RB-Trees gain this advantage from conceptually being 2-3 trees without carrying around the overhead of dynamic node structures. Physically RB-Trees are implemented as binary trees, the red/black-flags simulate 2-3 behaviour.
by definition, every AVL is therefore subsets  of Red-Black. One should be able to color any AVL tree, without restructuring or rotation, to transform it into a Red-Black tree.
Answer: The max height of the trees is the paramount important to keep balance. It almost equals 1.44 * log(n) for AVL, but for RB tree, it is 2 * log(n). So we can get the conclusion that it is better to use the AVL when the problem is search incentive. What matters is another question for AVL and RB tree. RB tree is better than AVL when facing the random insertion at the lower cost of the rotation but the AVL that is good to insert the ascending or descending datas. So if the problem is insertion incentive, we can use RB tree.
Answer:
AVL trees are often compared with red-black trees because both support the same set of operations and take O(log n) time for the basic operations. For lookup-intensive applications, AVL trees are faster than red-black trees because they are more rigidly balanced. Similar to red-black trees, AVL trees are height-balanced. Both are in general not weight-balanced nor μ-balanced for any μ ≤ ½; that is, sibling nodes can have hugely differing numbers of descendants.

From the Wikipedia Article on AVL Trees
Answer: To get an idea of how an AVL Tree works, this interactive visualization helps.
AVL as well as RedBlack Trees are height-balanced Tree Data Structures. They are pretty similar, and the real difference consists in the number of rotation operation done upon any add/remove operation - higher in the case of AVL, to preserve an overall more homogeneous balancing.
Both implementations scale as a O(lg N), where N is the number of leaves, but in practice a AVL Tree is faster on lookup intensive tasks: taking advantage of the better balancing, the Tree traversals are shorter on average. On the other hand, insertion and deletion wise, an AVL Tree is slower: a higher number of rotations are needed to rebalance properly the Data Structure upon modification.
For general purpose implementations (i.e. a-priori it is not clear if lookups are the predominant of operations), RedBlack Trees are preferred: they are easier to implement, and faster on the common cases - wherever the Data Structure is modified as frequently as searched. An example, TreeMap and TreeSet in Java make use of a backing RedBlack Tree.
Answer: The fact that RedBlack trees have less rotations can make them faster on inserts/deletes, however .... . Since they are usually a bit deeper They can also be slower on inserts and deletes. Every time you go from one level in the tree to the next, there is a big change that the information requested is not in the cache and must be retrieved from RAM.
Thus the time gained on less rotations can already be lost since it has to navigate deeper and thus have to update its cache more often. Being able to operate from cache or not makes a big difference. If the relevant information is in cache, then you can do multiple rotations operations, in the time needed to navigate an additional level and the next level information is not in cache.
Thus in cases that RedBlack is in theory faster, looking only at the operations needed, it could be slower in practice, due to cache misses.
Answer: From what I have seen it seems that AVL Trees do as many rotations(recursively up the tree sometimes) as needed to get the desired height of the AVL Tree (Log n).  This makes it more rigidly balanced.
For Red Black Trees there are 5 Sets of rules you need to make sure stay through insertion and removal which you can find here http://en.wikipedia.org/wiki/Red-black_tree.
The main thing that might help you for red black trees is the fact that depending on those five rules you can recursively color the tree up to the root if the uncle is red.  If the uncle is black you going to need to do maximum two rotations to fix whatever issues you have but after those one or two rotations YOU'RE DONE.  Pack it in and say goodnight because that's the end of the manipulation you need to do.
The Big rule is number 5...
    'Every simple path from a given node to any of its descendant leaves contains the same number of black nodes'.
This will cause most of the rotations youll need to make the tree work and that causes the tree not to go too far out of balance.
Answer: In summary: AvlTrees are slightly better balanced than RedBlackTrees. Both trees take O(log n) time overall for lookups, insertions, and deletions, but for insertion and deletion the former requires O(log n) rotations, while the latter takes only O(1) rotations.
Since rotations mean writing to memory, and writing to memory is expensive, RedBlackTrees are in practice faster to update than AvlTrees


Elementary Hera is slow on older Mac, Puppy 8.0 is fast as is Mac OS. Is there something I can do (that is not too technical)?

Question: EOS Hera on Mac Pro 1,1, mostly everthing works except it doesn't save monitor settings and is quite slow compare to Mac OS and Puppy/Linux(which I am posting from)
Comment: I'm also looking for any faster way to use eOS on MacBookAir2,1. So far, I found is to replace window manager with openbox instead of gala.
https://www.youtube.com/watch?v=hrZ9uhTPJkk
Answer: You can install other desktop environment (e.g. JWM, IceWM, or Fluxbox).
Doing so allows you to choose your session before you login by pressing gear icon next to the password text field.
I've tried with fluxbox and this works great so far with about 250Mb memory consumption when idle.


Why are positrons traveling backward in time in Feynman diagrams?

Question: We draw the positron as if it's traveling backward in time. Why? The momentum of the positron is drawn opposite to the time-direction of the diagram. I don't see this having any effect on the calculation. We still arrive at the result $k=p_1+p_2$, and not $k=p_1-p_2$ like the diagram would indicate. So, if anything, the diagram is misleading? $p_1$ and $p_2$ are the momenta of the incoming electron and positron, $k$ is the momentum of the virtual photon.
Comment: Who are we? Which page?
Comment: Both correct. The arrows make it easier to conserve lepton number at each vertex.
Comment: @Qmechanic Diagram of type 1 Bhabha process. The incoming positron is drawn to have a momentum opposite to the time direction
Comment: [Perhaps related](https://physics.stackexchange.com/a/669969/44126); [see also](https://physics.stackexchange.com/a/668720/44126).
Comment: @rob Can we say that the arrows in the Feynman diagrams have no effect on the calculation? They're just there to indicate that electron and positron are similar beasts? Also, if a positron backwards arrow is labelled by a three momentum $\vec{p}$, then I should not conclude that its actual three momentum is $-\vec{p}$, right?
Answer: The arrow direction in a Feynman diagram does not correspond to the time direction. There are conventions in which times flows from left to right, i.e. the time on the left is always earlier than the time on the right, although these are not the most common ones. Regardless of the convention, the arrow direction is just used to distinguish different kind of particles, for examples electrons from positrons or electrons from holes.
The momentum of the particle is also usually independent from the arrow direction, although also this may depend on the convention used. For example in non relativistic many body perturbation theory, the momentum usually refers to the one of the state on the band structure. Then the electron has the same momentum, while the hole has opposite momentum compared to the one written in the diagram.
On the time direction. Real particles never travel backward in time. For virtual particles instead this can happen. For example you can have an initial particles which goes from say $t_0$ to $t_1<t_0$, then interacting with a photon for example, and propagate from $t_1$ to $t_2>t_0$. Indeed $t_1$ would be an integrated variable, and all the possible values of $t_1$ need to be considered. In the convention where time flows from left to right, and for the case $t_2<t_1$, there would be a line from center to the left, and a second line going back from the left to the right. In both lines the direction of the arrow would just depend on the particle kind, and not on the time flow.
However, also in case of virtual particles, one should be careful when saying that something goes back in time. It is a fashinating concept, but also one which generates a lot of confusion.


Why does my ServerFault favicon sometimes turn into SuperUser?

Question: I have links for StackOverflow, ServerFault, SuperUser and Meta next to each other on my Bookmark toolbar in Firefox (windows) 3.5.  Sometimes the favicon for ServerFault turns into the SuperUser icon (though the link is unchanged.  Maybe this belongs on SuperUser, rather than Meta, but it seems StackOverflow related since it doesn't happen to any other icons.
Answer: When I used Firefox in the past I had noticed this would happen occasionally. I never quite isolated down how or why it happened, but I think it was related to failed page loads and going directly from the one favorite to the other. But either way, I believe it is a Firefox issue and not a SO issue.
Answer: I believe this is a firefox issue, not a SO issue. I have a "Google" folder in my bookmarks bar with links to my various Google services, and their icons seem to come and go at will - sometimes the default icon, sometimes a different one...
I also have the SO family linked in my bookmarks bar (Windows Firefox 3.5) and their icons haven't changed at all.


How does linux handles zombie process

Question: Zombie processes are created in Unix/Linux systems.
We can remove them via the kill command.
But is there any in-built clean-up mechanism in Linux to handle zombie processes?
Answer: Zombie processes are already dead. You cannot kill them. The kill command or system call has no effect on a zombie process. (You can make a zombie go away with kill, but you have to shoot the parent, not the zombie, as we'll see in a minute.)
A zombie process is not really a process, it's only an entry in the process table. There are no other resources associated with the zombie process: it doesn't have any memory or any running code, it doesn't hold any files open, etc.
When a process dies, the last thing to go, after all other resources are cleaned up, is the entry in the process table. This entry is kept around, forming a zombie, to allow the parent process to track the exit status of the child. The parent reads the exit status by calling one of the wait family of syscalls; at this point, the zombie disappears. Calling wait is said to reap the child, extending the metaphor of a zombie being dead but in some way still not fully processed into the afterlife. The parent can also indicate that it doesn't care (by ignoring the SIGCHLD signal, or by calling sigaction with the SA_NOCLDWAIT flag), in which case the entry in the process table is deleted immediately when the child dies.
Thus a zombie only exists when a process has died and its parent hasn't called wait yet. This state can only last as long as the parent is still running. If the parent dies before the child or dies without reading the child's status, the zombie's parent process is set to the process with PID 1, which is init. One of the jobs of init is to call wait in a loop and thus reap any zombie process left behind by its parent.
Answer: You don't kill a zombie process, as it's already dead.
Zombie processes have to be waited by their parents, so that their exit status to be collected.
The only "built-in clean-up mechanism" there is in Linux, works for the case that any parent-process dies before it collects its children's exit status. In this case, each child is inherited by the init process, which will wait on the child, collect its exit status and remove its entry in the process table.
Answer: As soon as the parent of a process dies, the process becomes an orphan - disregarding if it's a zombie or not. What happens to orphans? They get a new parent, called init. init will wait on each orphan that it collected, thus reaping the orphan (that may also have been a zombie as well).
Comment: No. Being precise, `init` doesn't kill **any** process. It only `wait`s on its children to collect their status.
Comment: @chrk, Philipp: the usual term is *reap*.
Answer: No, there is no in-built cleaning mechanism for zombies.  Zombies go to zombie heaven once their parent is killed.  Until then, the OS keeps them to return the exit status to parent.
Comment: actually, when the parent of the zombie dies, the `init` process takes over and will call `wait` it
Comment: so.. doesn't this has negative effect of memory etc?
Comment: No, all the resources allocated to the process are released, except for the entry in the process table.

How does linux handles zombie process


Where to find the build number INSIDE an install DVD of Mac OS X

Question: It's not written on the DVD itself and I don't have the DVD sleeve anymore.
Comment: For which OS X version? Snow Leopard (10.6)? or Lion (10.7)?
Comment: This *should* be printed on the physical DVD :-[.
Answer: Check the SystemVersion.plist file that is on the Install Media.
Within the install media is the file containing the Build number, it is located at <code>/System/Library/CoreServices/SystemVersion.plist</code>
The string value for the Key ProductBuildVersion is the information you are looking for.
Note: This tip is useful for getting the Build versions on any OS X bootable disk, regardless of install ability.
Answer: Not exactly through the DVD as you asked, but Apple provides a list will all the build numbers for the Retail installation disks.

Once you've run the Installer, you could always go to the Apple Menu () and choose About this Installer, which should provide the build number.


Using the same Skype number on computer and phone

Question: I have a Skype account on my computer. I have a need to have the same number on my cell phone.  What do I need to do?
Answer:
Install Skype application for your phone
Login using your Skype ID & Password (which you are using on your system).
Answer: Your Skype account information is held on the Skype servers, not your local device, so from Skype installed anywhere you can just login with the same Skype name and password. I agree with the first answer.


Taxonomy description for a custom taxonomy view

Question: I have created a custom taxonomy view. When it is disabled, the taxonomy vocabulary term description shows at the top of the taxonomy page for that term, but when my view is enabled, it does not. How do I include in my taxonomy view the description?
Answer: Edit your taxonomy vocabulary.
Add the field (or fields) that you want. (Hint: The existing field named "Description" doesn't work, so create a new text-area field if that's what you want. I called my replacement field "Definition".)
From the List tab, edit each term's value for the new field.
Create a new view.
Show: Taxonomy terms of type: your_vocabulary, with a page display
Continue & Edit
Configure the view to display only your new field(s).
Use pager: Display a specified number of items | 1 item
Add a Taxonomy Term contextual filter
Edit the existing Taxonomy Term view.
Click on the "add" button in the Header section
Select Global view type header
Select the new view you created above
Check the "Inherit contextual filters" checkbox
Now when you visit the Taxonomy Term view, your new fields view will be included at the top.
Comment: This seems like an excellent answer! I haven't had a chance to try it as my project took me in a different direction but will mark once I've had time to evaluate it. Thank you so much!


How did Extracellular electron Transport evolve?

Question: According to an on-line article at Smithosonian.com "Some microbes can eat and breath electricity". This refers partly to the fact that Shewanella use extracellular electron transfer. Does such a different metabolic process imply a separate origin for this type of life, or, if not, how could it have evolved?
Comment: can you provide the link to the article you are referring to?
Comment: I find the down-votes of this question very negative. The poster is quoting an article in a publication of The Smithsonian Institute, which I had thought was a prestigious publication. The particular bacteria it describes a unusual, and few of the readers of these pages will be familiar with their mode of respiration. This at least makes it question with the potential to invoke educative answers. No prizes for guessing whose answer I am talking about, but I learned something I didn't know in researching it.
Comment: Prestigious publication in the above was unintended. What I meant was establishment. I have edited the question to make the provenance of the report and its specific claims clearer.
Answer: Very interesting how journalists can make something catchy out of scientific evidence. Kudos to that!

supposedly "eat" electricity

Bacteria don't eat electricity. Electricity in it's most basic form is the flow of charge (in this case ions) from a higher gradient (concentration) to a lower gradient (concentration).
So these bacteria, they utilise this flow of charge within their biological processes allowing them to survive and propagate.

if these exotic bacteria really originate from a separate genesis or just an example of how diverse life on Earth can get if given the chance?

These bacteria are not the only ones utilising electrochemical gradients to power their biological processes. Eukaryotic cells contain an organelle called mitochondria. I will not go into details, you can read that here, but eukaryotic life arose as a result of an endosymbiosis event where two organisms developed a symbiotic relationship, and the mitochondria was born, when organism A engulfed organism B. Mitochondria, also called the powerhouse of the cell, contains it's own DNA, which is very dissimilar from the nuclear DNA, which leads many people to believe that originally they came from an integration event between two different organisms. Mitochondria functions, by ways of the ETC to provide energy to the cell.
That is the dominant role for mitochondria, and it also processes an electrochemical gradient. So no, the answer is no these exotic bacteria did not originate from a separate genesis, but rather an example of how diverse life on earth can get. Believe me there are more weirder things nature has come up with, that bacteria processing heavy metal ions in their biological processes.
As stated by David, I may have created a correlation where there was none. My apologies for that. To point you the right way though,
Shewanella belongs to a class of bacteria called Dissimilatory metal-reducing bacteria, which are characterized by their ability to couple metal reduction with metabolism, if you take a look at the link you will find that Shewanella also contain a very high concentration of sigma-factors; factors which are associated with providing transcriptional robustness under environmental stress.
Coming to their origin, which is the topic of discussion here. I would point you towards MRSA here, the analogous question here is was Methicillin resistant staphylococcus aureus born out of nowhere? The answer to this question is no, this relates to the overuse of antibiotics. Here is a link from the NIH which will give you a brief history of the origin of MRSA.
Principally, this same concept can be generalized here, if you put a population (in this case Shewanella) under stress (heavy metal ions), a large number of the population will die off, but a smaller subset will develop a resistance towards the stress.
Please note, that this line of thought contains two possibilities, the first being that individuals developed the resistance with the aid of mutations in their DNA allowing them a survival advantage over the population, a popular example is the presence of the Delta32 mutation in the CCR5 gene which makes a subset of humans resistant to HIV(AIDS) infection. Did this happen in response to the HIV outbreak the world faced in the late 20th century? No, this most probably happened much earlier (In humans a mutation must move to the germline to propagate across generations) and only came to light after a significant amount of resources had been invested into HIV research. Meaning, that the mutant was already present during the diagnosis, but the selective advantages came to light after the stress response had been faced.
Therefore MRSA could have developed from an existing subset of Staph since antibiotic treatments began in the 1940s (please take into consideration that bacterial replication is faster than human, therefore time flows faster and there is no concept of germline and somatic mutations in bacterial fission). But also, it is entirely possible that MRSA existed beforehand, and that continued treatment with antibiotics resulted in the emergence of the same subset.
So no, the answer is no these exotic bacteria did not originate from a separate genesis, but rather an example of how diverse life on earth can get. Believe me there are more weirder things nature has come up with, that bacteria processing heavy metal ions in their biological processes.
The presence of the sigma factor already tells you that they share the same genesis as all other existing microorganisms on earth, and as to how they developed to gain a survival advantage in environments containing high concentration of heavy metal ions, that relates to the stress response of a population outlined above.
Comment: I find your statement that "Bacteria and for that matter all life on earth are gene machines…" as contentious and completely irrelevant to the question. I suggest that you remove it. Likewise superfluous are statements about mitochondria, as this is a question on bacteria, and even more so that they have their own DNA. You would have done better to explain what precisely the electron transfer to the metal oxides achieves in relation to metabolism. As it is, you seem to be confusing electrochemical gradient and terminal electron acceptor.
Answer: Addendum: The shoddy article that provoked this question concerns two completely different bacteria (although you would be forgiven for not knowing)
The article concerns mainly Shewanella, which is one of a number of well-known bacteria that can use metal ions as terminal electron acceptors for the electron transport chain: i.e. they donate electrons to the metal.
However the authors have also done work on completely different — and also well-known — bacteria called chemlithotrophs that obtain electrons, which they can use as a source of reducing power (analogous to electrons from light energy).
Shewanella
The question of whether Shewanella has a separate origin is easily settled by the phylogenetic similarity to other bacteria based on its DNA and its repertoire of proteins, including those involved in energy generation and electron transfer.
So, No, Shewanella oneidensis MR1 is just one of several bacteria that use final electron-acceptors other than oxygen in their respiration.
However, there seems to be a misunderstanding about the role of the extracellular electron transport in the provision of energy for the organism — people seem rather shocked by the electric current — so let me clarify the situation.
The initial source of 'energy' is reduction of carbon metabolites
The metabolism of Shewanella has been reviewed by Fredrickson et al. Like other bacteria it can be grown on carbon compounds which give rise to intermediates that are oxidized by NAD+ — e.g. in the tricarboxylic acid cycle — resulting in NADH. (I'm ignoring FAD/FADH2 for simplicity.) This involves the transfer of two electrons (the second is to H+) — as we remember from chemistry, oxidation is the removal of electrons. It is the NADH that can be thought to embody the 'energy', in so far as the reaction of its reoxidation by an appropriate electron acceptor can result in a large decrease in Gibbs free energy (see, e.g. Berg et al. 18.2).
The electron transport chain allows the free energy changes to produce ATP
Just as with aerobic bacteria such as Escherichia coli, all the potential free energy of oxidation of NADH is not liberated in one step, but in a series of steps, with smaller free energy changes. Some of these result in the extrusion of hydrogen ions into the intermembrane space, producing an electrochemical gradient which drives the production of ATP via the trans-membrane ATP synthase in oxidative phosphorylation. (It's still oxidative phosphorylation even though oxygen is not involved.) The components of the electron transport chain differ partially from the standard one presented in text books for bacteria with a different final electron acceptor (see e.g. review by Haddock and Jones). However it is important to realize that this is where the ATP is generated in Shewanella, before the electrons get to the cell surface and have any involvement with the extracellular space.
The role of the extracellular metal oxide is as final electron acceptor
For the sequence events from the reoxidation of NADH to be completed, the two electrons have finally to be transferred to some external oxidizing agent. For E.coli it is molecular oxygen with cytochrome oxidase catalysing its conversion to water. Other bacteria use different electron acceptors, some use sulphate (which becomes reduced to sulphite) for example, although the free energy changes of these reactions will not be the same as with oxygen. In the case of Shewanella the final electron acceptor is usually Mn(IV), which is reduced to Mn(III), or Fe(III), which is reduced to Fe(II), although other metal electron-acceptors are known (see e.g. Hartshorn et al. 2009).
What about the electricity?
What's clearly different about Shewanella is that the solid metal oxide electron acceptor is extracellular, and therefore not in contact with the multi-cytochrome electron donors in the bacterial outer membrane, unlike the diffusable oxygen or sulphate ions. Furthermore, no enzyme is involved. Hence, rather than the electrons being transfered in a reaction at the active site of an enzyme, they flow through the extracellular milleu as an electric current. The electrochemistry of this may be intriguing, but what is clear is that this is not providing any energy to the bacterium, which is certainly not 'eating' — or in any other way utilizing — electricity.
And evolution?
Shewanella is certainly different, and had to evolve new electron-transport components and transporters to take these components to the outer membrane (see diagram, below). But bacteria with other electron acceptors had to evolve similarly new redox components (Alberts et al. discuss this in The Molecular Biology of the Cell). Whenever bacteria have taken over a new (and often unpromising) niche, new enzymes or protein have evolved to allow them to do so. And electricity certainly isn't foreign to Nature, nor is the interaction of bacteria with their external environment.

Multi-haem cytochromes in the outer membrane of Shewanella and reduction of extracellular Fe(III): from Fredrickson et al. 2008.
Chemlithotrophs: something completely different
The original article actually refers to two types of bacteria. The first is Shewanella, which is well studied and for which the quotation below is entirely in concord with my answer, above

Shewanella consumes electrons from carbohydrates, but it sheds them in
  an unusual way: "It swims up to the metal oxide and respires it."
  Nealson says.

However, the title of the article is based on the following teaser:

One of Nealson's graduate students, Annette Rowe, has found six new
  bacterial strains dredged from the ocean floor that don't need a
  source of carbon at all, reports Powell. They can live off of
  electricity alone.

Now it is clear nonsense that anything can live — in the sense of grow — without a source of carbon (and other elements) to supply the structural components that make up the organism, but it turns out that it has been known for a long time that certain micro-organisms can oxidize metals — i.e. in contrast to Shewanella obtain electrons from metals, rather than donate them to metal ions. These are known as chemlithotrophs and often obtain their carbon from carbon dioxide, and usually use molecular oxygen as the final electron acceptor. The enzymic details of this process obviously differ between chemlithotrophs, and the down-voting of this question makes me reluctant to invest the time into researching and then presenting details of the metabolism.
The latest paper that I can find from Rowe and Nealson, published in Frontiers in Microbiology 2015, makes it clear that they are studying lithotrophs, and what is new is that they are replacing the metals by electrodes as electron donors, partly in order to find new lithotrophs which can utilize different redox potentials. Very different from the smoke and mirrors of the Smithsonian article!
Comment: Updated my answer, having finally realized that the articled quoted is about two different types of bacteria, the metabolism of which is well-known (although not previously by me). The answer is rather unbalanced, but, I hope, clarifies the situation.


Recommend me a quick setup local http/php/mysql server for development (WIndows)

Question: I need a quick and dirty http server to use for local application development, that supports php and mysql. Xampp will not work for me (64 bit Win 7), so Im looking for something similar.
Comment: Yah, cant get it to work either. Apache just wont run.
Answer: I've had good experience with The Uniform Server -- it's portable*, and it includes Apache, PHP, MySQL, and Perl in the box.  Their installation manual also says testing has been successful on 64-bit WinXP Pro.
* It's portable in the put it on your USB-stick and use it on any Windows computer sense.  They also claim to not touch the Windows registry at all.
Answer: Try Wamp server
Answer: I don't know if it includes MySQL, but check out the Microsoft Web Platform Installer 2.0. It does include PHP and a lot of other stuff. All Free.
Answer: pmwikiserv is a wiki that includes a free standalone single executable PHP/http server for windows/Unix
Answer:
Wamp Server
Zend Server CE
Answer: Checkout WebGUI (http://www.plainblack.com/) which comes with a quick install web server, mysql database, and content management system all in one. Works on Windows, Unix, Mac, BSD and Linux. Needs Perl. You can add on PHP and/or Python to make it do what you want. The system is entirely open source (you can pay for support). Under active development by a going commercial concern. Setup in minutes.
Answer: If you have a Windows XP Professional or a Windows Server installation, run it on IIS.  I'm sure it's included on the higher end Vista distribution discs too.  You can check by inserted your disc, going to Add or Remove Programs and on the left menu, select Add Windows Features...something like that anyway.
Answer: Abyss Web Server
http://www.aprelium.com/abyssws/
The setup is trivial. Also, it only takes a couple of minutes to enable cgi (they are recognized by extension).
Also, many frameworks such as django and groovy/grails come with their own simple server.


Do you need a framework to write Ruby or Python code for the web?

Question: Every time I see Ruby or Python discussed in the context of web development, it's always with a framework (Rails for Ruby, Django for Python). Are these frameworks necessary? If not, is there a reason why these languages are often used within a framework, while Perl and PHP are not?
Comment: Wow...so many good answers, it was hard to choose just one to "accept", so I just picked one that was well-rounded enough to answer the question and general enough to address all of the languages I mentioned. Thanks everyone!
Answer: I can only speak towards Ruby - but, no, you don't need a framework to run Ruby based pages on the web. You do need a ruby enabled server, such as Apache running eruby/erb. But, once you do, you can create .rhtml files just like RoR, where it processes the inline ruby code.
Answer: "Need" is a strong word. You can certainly write Python without one, but I wouldn't want to.
Python wasn't designed (like PHP was, for example) as a direct web scripting language, so common web-ish things like connecting to databases isn't native, and frameworks are handy.
EDIT: mod_python exists for Apache, so if you're merely looking to write some scripts, then Python doesn't need a framework. If you want to build an entire site, I'd recommend using one.
Answer: The short answer is no, they are not necessary.  In ruby you have .erb templates that can be used in a similar way as you use PHP pages.  You can write a site in ruby or Python using several technologies (Rails-like frameworks, Templates or even talking directly with the HTTP library and building the page CGI-style).
Web frameworks like Python's Django or Ruby's Rails (there are many) just raise the level of abstraction from the PHP's or ASP's, and automate several process (like login, database interaction, REST API's) which is always a good thing.
Answer: From a Pythonic point of view, you'd absolutely want to use one of the frameworks.  Yes, it might be possible to write a web app without them, but it's not going to be pretty.  Here's a few things you'll (probably) end up writing from scratch:

Templating: unless you're writing a really really quick hack, you don't want to be generating all of your HTML within your Python code -- this is a really poor design that becomes a maintainability nightmare.
URL Processing: splitting a URL and identifying which code to run isn't a trivial task.  Django (for example) provides a fantastic mechanism to map from a set of regular expressions to a set of view functions.
Authentication: rolling your own login/logout/session management code is a pain, especially when there's already pre-written (and tested) code available
Error handling: frameworks already have a good mechanism in place to a) help you debug your app, and b) help redirect to proper 404 and 500 pages.

To add to this, all of the framework libraries are all heavily tested (and fire tested).  Additionally, there are communities of people who are developing using the same code base, so if you have any questions, you can probably find help.
In summary, you don't have to, but unless your project is "a new web framework", you're probably better off using one of the existing ones instead.
Comment: You can of course do all of those tasks using separate, unrelated library modules; you don't necessarily have to use an over-arching framework to control the lot. The lower-level WSGI standard gives us enough to glue these components together.
Answer: Framework? Heck, you don't even need a web server if you're using Python, you can make one in around three lines of code.
Answer: As to the why:
The most plausible thing I can think of is that Perl and PHP were developed before the notion of using frameworks for web apps became popular.   Hence, the "old" way of doing things has stuck around in those cultures.  Ruby and Python became popular after frameworks became popular, hence they developed together.  If your language has a good framework (or more than one) that's well supported by the community, there's not much reason to try to write a Web App without one.
Answer: A framework isn't necessary per se, but it can certainly speed development and help you write "better" code.  In PHP, there are definitely frameworks that get used like CakePHP, and in Perl there are many as well like Mason and Catalyst.
Answer: The frameworks aren't necessary.  However, a lot of developers think frameworks ease development by automating a lot of things.  For example, Django will create a production-ready backend for you based on your database structure.  It also has lets you incorporate various plugins if you choose.  I don't know too much about Rails or Perl frameworks, but PHP frameworks such as Zend, Symfony, Code Igniter, CakePHP, etc are used widely.
Where I work at we rolled our own PHP framework.
Answer:
Are these frameworks necessary?

No. They, like any 'framework', are simply for speeding up development time and making the programmer's job easier.

If not, is there a reason why these languages are often used within a framework, while Perl and PHP are not?

PHP and Perl were popular languages for building web sites well before the idea of using frameworks was. Frameworks like Rails are what gave Ruby it's following. I'm not sure that Python or Ruby were that common as web languages before they were backed by frameworks.
These days, even PHP/Perl web developement should be backed by a framework (of which there are now many).
Answer: By no means are those development frameworks required.  But as with most development environments, your productivity will increase exponentially if you have a supported framework to reference and build your applications on.  It also decreases the training needed to bring others up to speed on your applications if they already have a core understanding of the framework that you use.
Answer: Any language that can "print" can be used to generate web pages, but frameworks handle a lot of the HTML generation for you.  They let you concentrate more on the content and less on the details of coding the raw HTML.
Answer: For python, the answer is No you don't have to.  You can write python directly behind your web server very easily, take a look at mod_python for how to do it.
A lot of people like frameworks because they supply a lot of the boilerplate code in a reliable form so you don't have to write it yourself.  But, like any code project, you should choose the tools and frameworks on their merit for your problem.
Answer: You can certainly write CGI scripts in either language and do things "raw".
The frameworks (ideally) save the trouble of writing a pile of code for things that other people have already handled (session handling, etc.).
The decision probably comes down to what you need to do.  If the framework has the features you need, why not use it.  If the framework is going to require extensive modifications, it might be easier to roll your own stuff.  Or check out a different framework.
The python library has numerous modules for doing cgi, parsing html, cookies, WSGI, etc:
http://docs.python.org/library/index.html
Answer: PHP has a lot of frameworks. Probably more then most. In Ruby most use Rails so thats what you hear, and Django for Python is mentioned more then not.
But with PHP you have many to choose from.
List of web application frameworks


how to use compositer nodes on a render farm?

Question: When i use sheep it it only uses one of my layers, it will not add shadows or background videos. I have done some research and figured out that sheep it does not support using the compositing nodes. So i'm wondering if i have the render of one of the layers. Can i send another one of the layers through the render farm and then combine them somehow? Maybe? Let me know
Answer: At GarageFarm.NET we support compositor nodes in Blender. they should work the same way as on your end. If you have multiple layers to render in the scene, then all of them will render and will ve combined as you set it up in the compositor.
If you wish to save different layers from the compositor for later post-production, then you can use the File Output node to export it. All the File Outputls nodes are correctly saved on our end. You can also use multi-layer EXR for your output which will have all your passes.
I encourage you to test our render farm. We offer trial credits so in this way you can check if everything works as you expected without any costs.
Answer: It all depends on the render farm.
Some will allow you to render your project as you have it on your computers, others don't.
Consult with the particular render farm you are using.


Samba 3.6.12 and NIS

Question: We were able to use Samba and NIS on Samba 3.0.8 on Solaris 10 U5. When we update system to Solaris 10 U11, samba version became 3.6.12. And we are unable to authenticate like old style.
I did not include some parameters on below(create directory mask,etc...)
Old smb.conf
    [global]
    workgroup = WORKGROUPNAME
    server string =  Samba Server
    security = SERVER
    password server = dc6n, dc7n
    username map = /etc/sfw/username.map
    local master = No
    dns proxy = No
    wins server = dc6n, dc7n
    kernel oplocks = No
    host msdfs = No
    map archive = No
    oplocks = No
    level2 oplocks = No

old nsswitch.conf
    passwd files nis
    hosts  files nis

We try to set same configuration to Samba 3.6.12, but it did not work. So I decided to  use security = ADS with Kerberos. This is worked but the way we did not want. Because, only windows domain users were able to login and NIS users not.
New /etc/smb.conf
    workgroup = WORKGROUPNAME
    realm = domain.com
    security = ADS
    password server = dc6n.domain.com
    utmp = Yes
    idmap config *:backend = tdb
    idmap config *:range = 5000-9999
    idmap config NETADM:backend = tdb
    idmap config NETADM:range = 10000-90000
    idmap uid = 100000-500000
    idmap gid = 100000-500000
    template homedir = /home/%U
    template shell = /bin/tcsh
    winbind cache time = 1800
    winbind enum users = No
    winbind enum groups = No
    winbind use default domain = Yes
    winbind separator = /
    create krb5 conf = No
    local master = yes
    domain login = yes
    domain master = yes
    preferred master = yes

New /etc/nsswitch.conf
    passwd files winbind  nis
    hosts  files winbind  nis

New /etc/krb5.conf
    [libdefaults]
        domain.com = domain.com
        dns_lookup_kdc = true

    [realms]
        symantec.local = {
            kdc = dc6n.domain.com
            admin_server = dc6n.domain.com
        }

    [domain_realm]
    .domain.com = domain.com

I am able to get users info from AD and NIS with wbinfo and genent commands.
How can we authenticate like old style again?
Comment: What did you mean old style authentication?Old style auth is samba users sync with Unix users.Is it? I didnt know samba can use NIS for Authentication.Samba can use LDAP/Kerberos for authentication.
Comment: Solaris used NIS server for Authentication.You can sync samba users with unix users.You log in to samba using unix users.
Answer: Make sure you have an entry for winbind sessions in your /etc/pam.d/system-auth-ac file.

Samba 3.6.12 and NIS


Omitting subject in English sentences, what is the logic behind it?

Question: I sometimes see and myself use sentences like. "Reminds me that..." rather than "It reminds me that...". Is it correct use? If so, in which type of sentences can we omit subject (like it)?
Comment: Guess it's a common feature of relaxed conversational contexts that we "delete" an initial subject if it's obvious anyway. And it's obviously ***me*** there (as a deleted ***I***) - I didn't just write an "imperative" sentence  instructing (deleted) ***you*** to make that guess! Bear in mind that the deleted subject before, say, ***reminds me...*** isn't necessarily "it". It could be "this" or "that" or something more exotic, such as "the current circumstances" or "what you just said".
Comment: Speech is not writing. You can often leave things out. You can only say: [That] Reminds me that etc. when speaking with someone, for example.
Comment: The subject is also considered "understood", as in the shortest sentence, "Go!" With perhaps a half-dozen runners waiting at the starting block, it would be inconvenient to say, "Jane, john, Jill, June, Jim and Jonathon, go!", but they all know it's time to start.
Answer: This is called conversational deletion, subject pronoun drop, or informally, "diary drop" because diaries are often written in this style.
It is usually used only in informal conversation and writing.  As the name "subject pronoun drop" suggests, you can delete a pronoun when it is the subject and if it is clear from context.  For example:

What did you do today?
(I) went to the beach.

but not

What did you give him?
I gave (him) the book.

References:

Why is the subject omitted in sentences like "Thought you'd never ask"?

Why Do We Delete the Initial Pronoun From Our Sentences? Glad You Asked.

Subject pronoun drop
in informal English
Comment: "As the name "subject pronoun drop" suggests, you can delete a pronoun when it is the subject and if it is clear from context." - but not always, eg. - *What should I do?* *\*Should go home*. There's some discussion and a link to ELU under [my old question on the topic](https://ell.stackexchange.com/questions/174192/omitting-personal-pronouns-in-informal-conversation).
Answer: This is technically incorrect grammar, as the sentence has no subject.
But in informal speech we use technically incorrect grammar all the time. As long as the listener understands the intended meaning, there's no problem.
Like:
Al: "Did you give Bob something yesterday?"
Charlie: "The travel form."
Charlie's answer is not a complete sentence. But in context, it's pretty obvious that what he means is, "Yes, yesterday I gave Bob the travel form." So the extra words are not really needed.
Reminds me ... When I was in high school, most of the teachers insisted that answers we gave on tests must be complete sentences. So like if a guestion was, whatever, "What is the capital of France?", if a student just wrote "Paris", the teacher would mark it wrong. You had to write, "The capital of France is Paris." My chemistry teacher apparently didn't know that other teachers were demanding this and one day expressed frustration at the wordy answers we gave on his tests. He plaintively said to the class, "If I ask, what reaction occurs when you mix [chemical A] and [chemical B]?" (I forget what the example was now), "Just tell me what chemical is produced. You don't have to write, 'yes indeed, when you mix these two chemicals there is a reaction.'"


How to solve for angles $4\theta = \theta$?

Question: I want to find all the angles in $[0, 2\pi)$ for which $4\theta = \theta$ is true. I can obviously get $\theta = 0$, but the other solutions are $\frac{2\pi}{3}$ and $\frac{4\pi}{3}$. How do I find these particular ones?
Comment: @graydad: He never claimed that those two angles are equal, but that each of them _individually_ satisfies $4\theta\equiv\theta \pmod{2\pi}$.
Comment: @HenningMakholm The $\pmod{2\pi}$ part got left out of the question. I wondered if the problem was it also got left out of the _thinking_ about the question, or whether the problem was dealing with the modulus.
Comment: @DavidK: My immediate interpretation of the question was that the OP understood _that_ $\frac{2\pi}3$ and $\frac{4\pi}3$ are solutions, but couldn't figure out how he would have _arrived_ at them systematically.
Comment: @HenningMakholm That too was certainly possible based on the problem statement.
Answer: Two angles are "the same angle" when they differ by a multiple of $2\pi$. So you want to solve
$$ 4\theta = \theta+2k\pi$$
for all $k$. Solving this, we get
$$ \theta = \frac k3 2\pi $$
from which we see that solutions for $k$s that differ by a multiple of $3$ will be the same. So we get all solutions by taking the ones for $k=0,1,2$.
Answer: You can set up the equations $$4\theta=\theta+2\pi$$ and $$4\theta=\theta+4\pi$$ to get the two other solutions you are after.  You could add $6\pi$ but the solution to that would fall outside your bounds.
Answer: The writing $4\theta = \theta$ is not accurate. I assume that you are solving some equation that takes the form: $\cos(4\theta) = \cos(\theta)$ or $\sin(4\theta) = \sin(\theta)$ or possibly something else.
This boils down to finding the solution of $4\theta \equiv \theta \pmod {2\pi}$
$$4\theta \equiv \theta \pmod {2\pi} \iff \exists \ k \in \mathbb Z \ / \  3\theta = 2k\pi \iff \exists \ k \in \mathbb Z \ / \ \theta = \frac23k\pi$$
Thus, the solutions to this equation are the elements of $\{\frac23k\pi \ ; \ k \in \mathbb Z\}$.
Then, look for those solutions which are in $[0,2\pi)$.


Can polymorph and true polymorph change a PC's race and sex?

Question: Can polymorph and true polymorph alter a PC's race and sex? If a PC can be altered in such a way, can the PC speak and use his or her hands?
Comment: Why are you concerned that changing race or sex would cause inability to speak or use hands?
Comment: Just to make sure I've understood correctly, you're asking if you can use these spells to change a PC's race and/or sex, without changing their form completely?
Comment: I'm voting to reopen because the question, after editing at least, is a valid one: the description of True Polymorph at least, contains guidelines for changing a target into the form of a creature that has a statistics block similar to that of a monster but not one similar to that of a PC; namely, there's a guideline for using the _target's_ level as a comparison to the new form's _challenge,_ but not vice versa. The hands/speech part of the question is clearly answered in the text of the spell, however.
Answer: Rules Stuff
Well, for starters, polymorph can only turn things into beasts. Which is to say, creatures with the beast type - so no humanoids.
As for true polymorph, well...technically, by the rules, you can only use true polymorph to turn a creature into a creature with a Challenge Rating.

If
you
turn
a
creature
into
another
kind
of
creature,
the
new
form
can
be
any
kind
you
choose
whose
challenge
rating
is
equal
to
or
less
than
the
target's
(or
its
level,
if
the
target
doesn't
have
a
challenge
rating).

The target doesn't need a Challenge Rating, it can use its level - so it works on PCs. But the new form has to have a Challenge Rating, so you can't turn a PC into a PC, so to speak.
That means that, for example, turning your buddy the Human Fighter 20 into an Elf Fighter 20 isn't going to work. On the other hand, you could turn him into a Drow Elite Warrior (CR 5). So, changing a creature's race with true polymorph is possible, it's just not simple.
By the same token, you can't turn your buddy the Male Human Fighter 20 into a Female Human Fighter 20. However, (and this is why I picked drow), you could turn him into a Drow Priestess (CR 8). It's a little questionable whether this would actually change his gender, though.

The
target's
game
statistics,
including
mental
ability
scores,
are
replaced
by
the
statistics
of
the
new
form.
It
retains
its
alignment
and
personality.

Again, going by the rules, true polymorph replaces the game statistics of a creature with those of another creature. But there's no clear evidence that gender is a game statistic. The Monster Manual has a very long section on Statistics, and gender isn't mentioned anywhere.
Any transformation along these lines will allow the use of hands and speech.

The
creature
is
limited
in
the
actions
it
can
perform
by
the
nature
of
its
new
form,
and
it
can't
speak,
cast
spells,
or
take
any
other
action
that
requires
hands
or
speech,
unless
its
new
form
is
capable
of
such
actions.

Non-Rules Stuff
You may well have read all that and thought "That's stupid!" every step of the way. True polymorph is a 9th-level spell, up there with wish in terms of cosmos-altering power. It can turn a kraken into a crab, or a dragon into a dog.
That being the case, the easiest solution (as always) is to talk to your DM. If you say "Hey, can I use true polymorph to change race and/or gender?" then you'll get the answer that is true for your game.
Of course, if you are the DM, that doesn't help you all that much. If a player asks you this, and you're wondering what to say, well, it's up to you. I will warn you that allowing true polymorph to turn creatures into forms other than the ones with a CR and a statblock opens it up to some weird abuses and crazy shenanigans. So how you rule on this is up to you, but it might be worth having a think about how much you trust your players, and how okay you are with having this stuff in your game.
Comment: This. As a DM, I think a spell that changes a kraken into a crab can absolutely change your gender. Whether the caster gets to pick between genders is another matter. See https://rpg.stackexchange.com/questions/64576/how-much-control-does-polymorph-true-polymorph-allow-over-aesthetics?rq=1
Answer: https://www.sageadvice.eu/2016/05/25/would-true-polymorph-allow-someone-to-change-their-race/ theres a sage advice on the subject. Seems like it may have just been a bit of a slip in wording to me.
Comment: To the flaggers - Mearls or Crawford tweets, while not "official rules" are perfectly legitimate cites in an answer that carry some weight.  "Not an answer" flags have been declined.
Comment: Welcome to RPG.SE! You should regive the argument made in that tweet. Also note that developer tweets are not official rulings (which Sage Advice is). Take the [tour](https://rpg.stackexchange.com/tour) if you haven't already, and check out the [help center](https://rpg.stackexchange.com/help) for more guidance. Good Luck and Happy Gaming!
Comment: While not "official" it's still certainly a usable citation.  Do please edit in the information to your answer, though, as we prefer not to have link-only posts as links go dead...
Comment: In addition to what the others said, Mike Mearls is not an authority on the rules, and the linked tweets in particular don't reference the rules at all - Mearls simply says "what he'd do" to handle the specified situation.


What can I do if a useless answer is about to receive a bounty?

Question: I have a question with a bounty and a leading answer that's useless and appears not even to have understood the question. Is there anything I can do to prevent the bad answer from receiving the bounty?
Answer: The bounty is spent to get premium attention and nothing more.
You get to choose among any of the answers to award the bounty and you can choose to not award it. The choice is yours.
Do note that if you fail to award the bounty (which it totally separate than voting up or down any answer and also is decoupled from accepting an answer), it may go to the highest voted (but must have +2 or more net votes) answer that came after you added the bounty.
Don't worry if there is no recent answer with enough votes as in this case, no answer will even get the "half share" of bounty if the system can award it according to the process.
More details on this are here:

https://apple.stackexchange.com/privileges/set-bounties

So, by definition - no useless answer can ever get bounty if you award it to another answer and the system will deem a +2 answer useful and award half points if no other answer is better and the points are still unawarded at the end of your 24 hour grace period to award the points once the promotion period ends.
Comment: Also - I find that when I disagree with an answer - keeping my response simple and clear rather than lots of comments makes it easier for other people to vote down bad answers. In the end, it's not really possible to directly affect voting other than being gracious and understanding that there are many points of view and sometimes you'll need to take the feedback and edit the question a month down the road and clarify what you are seeking (or just ask a new question that more clearly sets down your particular use case.)
Comment: Yes, I guess patience is in order (clearly my frantic commenting isn't doing much good).
Comment: It's good to be passionate - but sometimes too much passion can hide the bare facts. There's a lot of chance to using a bounty - but you've also got experience now so you can be more happy with it the next time you want to promote a question.
Answer: You could award the bounty to an answer you find more helpful. Otherwise, no.  Do note that an answer that you find useless might help someone else.
Comment: So other than selecting one of the other answers, I'm stuck with the bad one, correct?
Comment: In this case I'm pretty sure that what's gong in is that people aren't completely testing the answer. I have the same behavior as the answer describes, but over time, the "solution" wears off. If it's "helping", it's actually misleading.


how do I ensure that users in AlwaysOn Availability Group only connect to the secondary, even in a failover

Question: I have an Always On Availability Group with a read-only secondary set up. We're running SQL Server 2016 Enterprise Edition SP1 CU4. Users are supposed to only connect to the secondary using the ReadOnly ApplicationIntent when connecting to the listener. I don't want to remove their logins from the primary since this would prohibit access after a failover. I am looking at perhaps running a SQL Agent job that checks connections and kills sessions if they are running on the primary but it seems like there should be a better way to do that than running a job every minute or so! Do I need to look at creating an audit or is there some other mechanism to accomplish this?
Answer: Logon trigger is what coming to my mind, there may be other better way – https://dba.stackexchange.com/users/42379
I'd agree with the easiest way being a logon trigger. It can check the status of one of the databases in your AG, and if it is the primary prevent logon for that user. – https://dba.stackexchange.com/users/11639
Note that if a logon trigger starts failing for some reason, then nobody gets logged in except the dedicated admin connection. So catch any errors and handle with care. - https://dba.stackexchange.com/users/63284


What are the costs per meter of filament for PLA, ABS and PET?

Question: My Craftbot Plus Craftware slicer estimates cost per job based on filament prices I add as parameters.  What costs per meter would you use?  I created spreadsheets to calculate this for 1.75mm diameter filament and arrived at PLA = 6.6 cents per meter, ABS = 6.1 and PET XT = 18.6 cents per meter.
Edit:  thanks for feedback!  I paid \$22 per kilogram for PLA and ABS.  I paid \$57 for .75 kilogram of Colorfab XT Black.
Comment: A quick note from the economist part of my brain: While the raw material cost (and energy, etc.) is a contributor to product *cost*, the product **price** has to be based on consumer demand.  Craft fairs, and etsy.com, are littered with stuff priced by labor cost and unsold because nobody wants it.
Comment: You might want to specify 1.75mm or 3mm filament. Although it's easy enough to calculate both.
Comment: I pay 36 euro for a spool (2.85 mm) of 90m PLA. That is 0.4 euro/meter. And that's a fact. And it's a lot higher than the numbers you guys are stating here.
Answer: This strongly depends on the cost of the spool in question. Prices are not consistent among materials at all; a spool of ABS can cost anywhere from \$15 to \$60 and the same price range applies to pretty much all other plastic.
For the purpose of this question I am going to assume that a 1 kilogram spool costs \$25 (regardless of material) but you can scale the figures to what is appropriate for your brand of filament.
ToyBuilder Labs lists the density of ABS at 1.04g/ml, whereas PLA is somewhat more dense at 1.25g/ml. As such, a 1kg spool of ABS would be 400 meters (1.75mm filament) or 156 meters (2.85mm filament). PLA would come out to 333 meters (125 meters for 2.85mm filament)
We thus have the following costs (cost per meter for 2.85mm filament in parenthesis):

ABS: 6.25 cents/meter (16)
PLA: 7.5 cents/meter (20)

The density of PETG is roughly the same as PLA, so they have the same cost per meter (for similarly priced spools).
In general, to compute the cost per meter, you would use the following formula:
$$[\text{\$/m}]=[\text{cost of 1 }kg] \times [\text{density in }g/mm^3] \times \frac{[\text{diameter in }mm]^2\ \times \pi }{4000}$$
Comment: Thanks Tom, good info.  I googled PET density and saw 1.38 grams per mm^2 while PLA was listed as 1.25 g/mm^2.  If so, that would make PET around 10% more expensive.  Colorfab XT is much more expensive.  The results from it are excellent.  I'm still a newbie.  :)
Comment: @DennisRose - PET is more expensive **for the same volume of filament**.  In reality though, you may use different materials in different ways.  For example: since PETG is notoriously a tougher material than PLA, you may end up using a lot less material by printing in PETG (say: infill 20% instead of 40%) than using PLA, so you may actually find that using PETG is in certain situations _cheaper_ than using PLA.  Also (unrelated) you may be interested in checking [this](https://www.prusaprinters.org/calculator/) out.
Answer: The simplest method is to divide spool price by its length. That's obvious I think. If PLA 1.75 (1kg net) has about 120m length and it costs 16usd then it looks like 1m costs arount 13c. =price/length
I think everyone can buy different filament at different price from different vendors so there is no good general price to enter into your slicer app. It has to be calculated each time you use new filament.
There are also other parts of the price. Electricity, time, wear, depreciation, know-how even the rent is some part of the ending price of the final product. Of course most of them are incalculable as they are permiles or so. But if you don't plan to sell it you can base on the filament price only.
Comment: +1 For mentioning additional costs. Further more *time* might be a factor to consider: both the time required to print, but also the time you personally spend to prepare, trial and error, and so on.
Comment: The spools I have bought report weight but not length.  How do you get length info for spools you buy?
Comment: @DennisRose If spool doesn't have it specified on the label then you can ask vendor or google it. Rewinding with measuring is definitely bad idea.


Turning point of Adam optimizer for LSTM

Question: I'm training a two-layer LSTM with Adam optimizer for time-series data. I encountered several times that there was a "turning point" of the MAE vs. epochs plot. Is this a normal behavior?
Answer: I have sometimes observed it, sometimes even repeatedly, but by no means always, and also with other types of DNNs. I then assumed that the optimizer, after searching unsuccessfully on a plateau of the loss surface, finally found a local minimum which is then exploited. The layers usually get initialized via He or Glorot (Xavier), i.e. from a distribution with a relatively small standard deviation, and it seems to require some epochs to get to the more favorable weights.


Is particle in 1D box, finite & infinite well same case?

Question: I am very confused when I read about finite potential well. It suggests that infinite well is same, it just have infinite depth but when I first read about infinite well it was introduced as particle in 1D box which has zero potential inside and infinite potential otherwise. First I thought maybe these two are same but I can't understand how they are same, one is infinite potential around the centre and other is opposite of this.
Comment: Nope I meant to ask for infinite well with infinite depth and 1-d box system with infinite potential outside. Are they same case?
Answer:
Is the potential well with infinite depth the same as the 1D box with infinite potential outside?

Yes, are two different names for the same system, namely the free particle$^\dagger$ on the Hilbert space $L^2([-\frac{a}{2},\frac{a}{2}])$.
For a finite well, the potentials
$$V_1(x)=\cases{0 & inside\\V_0 & outside}$$
and
$$V_2(x)=\cases{-V_0 & inside \\ 0 & outside}$$
correspond to precisely the same physics.  In classical mechanics, this corresponds to being able to freely choose the zero point of the potential energy.  In quantum mechanics, this corresponds to being able to multiply all of the energy eigenstates by an overall phase factor, c.f. my answer here.

In reality, the "infinite potential well" is not defined to be a limiting case of either potential.  Instead, it is simply a free particle defined on the Hilbert space $L^2([-\frac{a}{2},\frac{a}{2}])$ rather than $L^2(\mathbb R)$.  However, one can loosely interpret the infinite well as a limiting case of the finite well in the sense that all of the bound eigenstates of the finite well approach the corresponding eigenstate of the infinite potential well in the limit as $V_0\rightarrow \infty$.
Of course, it's possible to poke holes in this interpretation; if we consider the finite well to have potential $V_2$, then the lowest energy eigenvalue goes to $-\infty$ in the limit, which doesn't make sense.  Furthermore, there would always be unbound states with positive energies, no matter how deep the well gets. For this reason, it's a good idea to bear in mind the crystal-clear point that in reality, the "infinite potential well" is just the free particle on $L^2([-\frac{a}{2},\frac{a}{2}])$.

$^\dagger$This is well beyond the scope of this question, but in the interest of completeness this is not quite the whole story.  It turns out that if $I$ is a compact interval, then the Hamiltonian $H:= -\frac{\hbar^2}{2m}\frac{d^2}{dx^2}$ is not self-adjoint on $L^2(I)$ unless one also provides boundary conditions for the states on which it can act.  The choice $\psi(-\frac{a}{2})=\psi(\frac{a}{2})=0$ is one possibility, and we call the corresponding system the particle-in-a-box.  However, we could make many different choices; choosing $\psi(-\frac{a}{2})=\psi(\frac{a}{2})$ (i.e. demanding periodicity) defines the quantum particle-on-a-ring.
Answer: Basic answer is they are not the same
The infinite square well is the limit as the depth of the finite well approaches infinity.
Imagine that you have redefined the finite well such that the base of the well sits on the x axis and the potential everywhere else is a finite value which was earlier the depth of the well. Now imagine yourself taking the limit of this as the "depth" of potential (now obviously the height) approaches infinity. It is easy to observe that this resembles the infinite square well and in fact the quantized energies do line up and match if you do take the limit (try it!)
So basically you are viewing the infinite well from the top!
It has been very clearly given in D.J. Griffiths' "Introduction to Quantum Mechanics" which I highly recommend. Though it lacks rigor and might not give a clear explanation of the usage of linear algebra it is still very useful to build a good intuition.
Comment: Sorry I think I didn't clearly framed my question. I mean is the particle in 1d box which has infinite potential outside the box and the infinite well which has infinite depth same? Bcoz in Griffith the infinite well is shown like former case and in finite well topic it is written that infinite well can be seen as well rather than box.
Comment: Yes they are the same my friend has given a beautiful answer above me please refer to that.


Future perfect or future perfect continuous

Question: In this sentence : "By this time next year,he.......(work) here for 7 years.
Do we say : he will have worked or will have been working?
Answer: This tense is formed with the modal will plus the modal have plus been plus the present participle of the verb (with an -ing ending). So, it is more correct to say:

By this time next year, he will have been working here for 7 years.

Generally, progressive forms occur only with what are called dynamic verbs and not with stative verbs.
Answer: Actually in this case both forms are acceptable but the future perfect continuous would be used if you wish to indicate that it is more likely that he will still be working there and will continue to do so.
If you use the future perfect it indicates that he will have already worked there up until that point in time in the future but it is not really clear whether or not he is still working there or if he is going to continue working there, or is about to quit; maybe retire.
Comment: I agree both work, but I disagree with your conclusion.  He could just be taking stock at some random point in time.


Kentico CMS search results

Question: How do I change the Kentico CMS search settings so as to display a part of text from search results as in Google? Presently it shows only the path in the results.
Answer: It depends on how you have your search setup really.
At the page level if you are using the Portal Engine model, which the majority of people use now, you have to check the Widget that you are using, basically it boils down to a regular search or Smart Search.
If your using the ASPX Template model you may have to open up your source for the page and see which usercontrol file your using from ~/CMSWebParts/Search/ or ~/CMSWebParts/SmartSearch/
Once you figure out which user control you are using it's a matter of inspecting the Transformation that it uses. Most likely you'll be using one of the following:
CMS.Root.SearchResults
CMS.Root.SmartSearchResults
CMS.Root.SmartSearchResultsWithImages
Click on Edit Transformation and check out which field is inside the Call to SearchHighlight, normally, "Content". Then you know it's pulling from the main content of the document. I've also seen this be tied to a different field like "Title" or "Caption". But the default is "Content".
If you still dont see results with part of the text, make sure you have a Smart Search Index setup, found in CMSSiteManager -> Administation -> Smart Search. If you don't see your site in the Index list then you need to add one. Make sure you rebuild it and optimize it (click edit on the row to get to those options). After that is all rebuilt then you should see the text appear under the result.
Answer: One thing to note, is that as @jao has mentioned, this only takes the first 280 characters of the content of the page. If you're matching search text doesn't happen to be in the first 280 characters, then no highlighting will occur.
Answer: try the following in your search result transformation:

<%# SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"),"")),false, " ")), 280, "...")),"","") %>

This will show the first 280 characters from your content, with the search terms highlighted.

Kentico CMS search results


Nested Menus in Mobile Apps

Question: Please take a look below. Is it ok to have nested menus like the ones shown below? The main menu is Activity/Practice and Sub menu for Practice is Me/Everyone. Is this ok to do?
Comment: Not an answer, but important: It's hard to tell from that screenshot if `Practice` or `Activity` is selected; same with `Me` and `Everyone`. Consider changing how those buttons look, for instance by adding an inset shadow to the selected buttons.
Comment: @Quelklef, it is the default look for segmented controls in iOS. While it may not be clear without the context, for users who use iOS, it should be clear, which is selected, because this look is consistent across apps. https://developer.apple.com/ios/human-interface-guidelines/ui-controls/segmented-controls/
Comment: On a sidenote, if you're out of the consistent environment (e.g., web, used on multiple platforms), it might be a problem. I like the solution here (adding a dot to the label): https://www.artlebedev.com/mosgortrans/
Comment: @Quelklef and others Thanks for the awesome comments!
Answer: The screenshot you have shown implies that you two layers of filters to show data, first is Activity and Practice while other is Me and everyone. Since you are using nested tabs for displaying data, I assume that all the information you are showing is related. Because tabs are used for showing chunk data that is logically related, and it is liable for user to switch between the information very quickly. Only in such cases you should use tabs.
Check link for more usage guideline: https://www.nngroup.com/articles/tabs-used-right/
The data you are displaying is related logically, but the style you have used to display data is not right. Instead of using tabs for Me and everyone you can use, cards that will hold category name, and will expand and display data on user click. This will remove the hierarchical nesting which confuses user making it more user friendly. check image for reference.

Also the tab style you have used is quite confusing. Here user will get confuse as in which tab currently he is. That style is valid if you have at least 3 or more tabs. Because then the user will see one tab different from other two or more tabs and it will give him a clear idea where he is currently. In this case you can show the non active tab in black, white and grey as I have shown. This will indicate clearly where the user is.
Also using cards is best solution as you can add more cards in a single tab in future without complexing the UI  to more deeper level.
Answer: I think it's fine, but consider using a different UI / style for the sub menu. It is a bit confusing having the same control at different levels.
Maybe have the sub menu be part of the listing, by giving it the same grey background.

Nested Menus in Mobile Apps


Using Simple Deform to bend multiple objects at the same time?

Question: I want that I can bend/twist etc multiple separate objects using the same Simple Deform Modifier? Is that possible? That will help me organic looking models also when I do Boolean it will also modify the boolean objects too. Any insight on this?
Comment: You can join objects by geo nodes modifier and than use simple bend modifier ... Or you can set bend modifier to all selected objects from contextual menu and than set drivers with specific value in modifier to sync values.
Comment: @vklidu Can you show me how to do it in both the cases? Or direct me to a youtube video where it shows the same? (And would they have different material if joined)
Answer: version Geo Nodes
Probably even better to use Collection Info node (than Join Geometry) so you can affect all objects at once ...
... all objet you want to bend place into collection. Than add any mesh object (I used Plane) but can be anything, this mesh is not going to be a part of the result. The Plane object just has to be out of collection (that you want to bend).

version Copy to Selected
Downside of geo nodes technique is lost of materials. To keep materials you can try use Copy to Selected ...

Ad Empty object
Select all objects you want to affect by bending.
Ad Simple Deform modifier and choose Empty for Origin field.
Now go to modifier header and next to camera icon open expand menu and choose Copy to Selected. This operator ads modifier to each selected object.

If you need to change Angle (with all affected objects still selected) right-click over angle value and choose Copy to Selected there. This operator syncs value for all Angle values in modifier of all selected objects.
This angle value can be synchronized by drivers ... its simple copy paste technique, but has to be set manually for each object. After driver assignment you can set angle and see effect in real time for all objects.
Comment: Do I need to join the separate objects first? Because when i put 2 objects in a collection and apple Geometry node to one of the objects and do exactly the same what you did it only affects the object where i have applied the Simple deform node. (I am getting error "Collection contains current object")
Comment: See edit for more info ...
Comment: Thanks ... for the model.
Comment: Hi, i forgot to ask, how do i add different colours to separate objects? Using set material in geometry node applies the same colour to entire model.
Comment: See edit for more info ...
Answer: Here is one example what vklidu meant:


No halacha to punish Jews for this crime?

Question: I heard there's no halacha that punishes a Jew who kills a non-Jew. Is this true?
Comment: There are many crimes, including various cases of homicide (e.g. someone who murders another person in an indirect manner) that didn't carry a dedicated biblical punishment for a sanhedrin to carry out (even 2000 years ago when a sanhedrin was authorized to judge capital cases). (Nowadays, Jewish courts aren't empowered to preside over murder cases anyway.) Either way, it is absolutely forbidden for a Jew to murder anyone, whether Jew or non-Jew. The Mechilta implies that it is indeed considered murder, and the Ra'avan maintains that it is subsumed under the prohibition of murder.
Comment: @Fred perhaps you might post this as an answer rather than a comment?
Answer: When Saul killed innocent Gibeonites, who were not Israelites, David surrendered seven of Saul's descendants for execution and permitted them to display their bodies as a warning to never molest Gibeonites. When Samson killed Philistines, the bitter enemies of Israel, Judah surrendered him to the Philistines to face the music. The punishment is perhaps not specified by the halacha, but the sanctity of human life requires appropriate punishment for murder of any human.
As God told Noah: 'He who sheds human blood by humans his blood be shed for in Elohim's image did he make humans.'
It should be recalled that halacha does not have an automatic punishment for every conceivable offence. The Torah gives the authorities some wiggle room to allow them to govern in accordance with the needs of the time.
Answer: It is important to understand that the Torah is a book of laws for the Jewish people, therefore many if not all of the halachot bring cases between a Jew and their fellow Jew, or between a Jew and God.
Mishnah Torah codifies that a Beit Din does not issue the death penalty to a Jew who murdered a non-Jew, but this does not mean that such a murder is excused; rather that a Jewish court cannot accurately try such a case as that is beyond the scope of a Beit Din's authority.
The prohibition against murder is contained within the Seven Laws of Noah, which is incumbent upon all humankind. To say that "there is no punishment" is not really accurate; rather such a case should be tried by a non-Jewish court (and there is a mitzvah for non-Jews to set up courts of justice for themselves).
Finally, the murder of anyone is not condoned by God or by Jewish authorities, and even if a Jew cannot be punished by a Beit Din for such an act, a Jew is still accountable to both God and a non-Jewish court, should they pursue to try the Jew for their murder.
Comment: @Shmuel Yes, which is what I said. There is no Jewish, earthly punishment for this sin. That does not mean that it is acceptable or that the Jew will be free from heavenly judgment.
Comment: @Shmuel Under certain circumstances, a court was empowered to carry out punishments outside of normal legal parameters (see, for example, [here](https://dinonline.org/2016/09/06/emergency-powers-for-beth-din/)), and it is conceivable that that authority could have been used to punish a Jew who killed a non-Jew.
Comment: There is an obligation to care for righteous gentiles among us. But no clear halacha to punish Jews who kill non Jews. The Rambam says if a Jew kills a non Jew he gets judged in the afterlife but not on earth, so, no. He is not punished according to halacha.
Comment: I agree with you that if they get away with it on earth they have another thing coming in the heavenly court.
Comment: @Fred Thank you. This is interesting.
Answer: The Mechilta says that killing a non-Jew is punishable by the death penalty in the hands of heaven.
As mentioned above, there are many variations of homicide and other capital crimes, where the punishment is in the hands of heaven, not in the courts.
In fact, even murder of a Jew, if done without witnesses and a warning was punishable only in the hands of heaven.
Remarkably, the Meshech Chochmah (Mishpatim) goes so far as to suggest that the fact that there is no punishment in the courts for killing a gentile, is precisely because it is so bad - even worse than kiling a Jew in a sense because in addition to the murder there is a terrible Chillul Hashem - that he doesn't deserve atonement.
Comment: I liked your answer. Why is killing a gentile worse than a Jew? Aren't they both human beings? If they are equally human the murder of either should be a terrible Chillul Hashem.
Comment: I think there are 2 reasons why there is a bigger Chillul Hashem by kiling a gentile. Firstly, for a Jew to kill another Jew is something which people are more likely to realize is not condoned by the Torah. For a Jew to kill a gentile, though, is something which can mislead people to think that the Torah Chas Veshalom has no respect for the lives of people of other faiths. Secondly, for a Jew to kill a gentile is something which is guaranteed to be broadcasted and talked about by all non-Jews, thus increasing the Chillul Hashem.


How to overcome feelings of incompetence/failure in a PhD programme?

Question: I've recently quit my job as a maths teacher after doing it for 3 years and I have been incredibly lucky to be offered a fully funded doctoral training course at a top university. This is an extraordinary opportunity for me, especially given that I previously withdrew from a PhD, and this time I really want to make it work.
I am quite rusty on some things that many other starting students will not be, not because I can't do them but because it's been a very long time since I needed to apply them. I am currently a bit worried that I may be the weakest in the cohort or that it'll take me a very long time to understand simple things and that I may feel incompetent and like I don't deserve to be there.
What are some good ways to overcome these feelings of idiocy?
Comment: Practice until you brush the rust away and get back up to speed. A PhD is not meant to be easy even for the best, but it is a combined mental training + acquiring research skills. Learning to deal efficiently with self-doubt will do you *extremely good* later in life no matter where you end up and what's expected of you there.
Answer: You have to accept that you are rusty and need to brush up on things. It is what it is, but there are others, myself included, who started a PhD after a few unproductive years.
The number one thing to do is not to take more classes than you're required to. If you are in the US system, there will be tons of homeworks and class work, so you need to make sure you will not fall too far behind. Your first objective is to pass the qualifier exam if your university has one.
But, you will also need to get an adviser, who will want you to do research. You need to pick wisely. Your adviser must be able to support you, especially if you are not allowed to teach. It is better to find someone who is a good planner and doesn't expect a student who takes classes and probably teaches to also do 60+ hours of research work. Not that it wouldn't be beneficial.
If teaching is included in the time balancing act, you have to be careful that your students do not abuse your time. Be strict with office hours, and be hard to find especially when preparing for your own exams.
The part with getting up to speed is harder, but be open and let people help you. If you have questions, do not be shy to ask your younger peers, or the course instructors. Also, participate in group study, especially if you feel it helps you and check homework results and discuss them with colleagues. You will learn a lot, but it will also help you understand more accurately where you stand in terms of knowledge compared to your colleagues. Even if you are more of an introvert and work a lot better alone, you still need the interaction with your peers.
Another thing is to plan alone time far from work. You have to have a more relaxed day, at least, when you don't have any work planned or you will end up burnt out and depressed. Also, if you have a family already, you have to understand that the PhD will take you from them more than a normal job would. Make sure you have a discussion with them where you set the expectations, and also try to leave the work at work as much as you can.
Comment: This is a very US-centric answer and while the OP doesn't state a country I suspect they are in the UK, hence the advice about classes, exams and choosing a supervisor does not apply.
Comment: @astronat I did a PhD in US. I cannot in good faith provide an answer that is fully applicable for UK. But, please provide an answer of your own, if you think you can help OP.
Answer: For starters you aren't an idiot. The evidence is against that hypothesis. However, there is a phenomenon called Imposter Syndrome that is fairly common among even well accomplished people. "I can't possibly be good enough to work with these people."
Well, yes you can.
But being rusty on lots of details is also common, but I'll guess that you know how to deal with that so that it doesn't become an issue. Working groups of like-minded folks is a good way. Just throwing ideas around can help. But so can re-doing old exercises.
From my experience, asking a lot of questions is the best way. I've said similar things here in answer to other questions. Don't be too cautious in asking questions in class, if the class size is reasonable. Very often if you have a question about something in lecture or otherwise, others will have the same or similar issue, but be afraid to ask.
Also, it is ok to start out slow. Don't be concerned that others are faster. That is always the case.
Work with others. Ask questions. Take advantage of office hours or tutors. Solve small problems on the way to bigger ones. Take a lot of notes (by hand). Never. Give. Up.
Comment: The 4-th paragraph is good advise, in my opinion. Sharing an office with 5 other people turned out to be a great advantage for me for exactly that reason, despite the noise and distractions.
Answer:
I am currently a bit worried that I may be the weakest in the cohort
  or that it'll take me a very long time to understand simple things and
  that I may feel incompetent and like I don't deserve to be there.

If this is the mindset you're carrying into the doctoral study you're going to have a very bad time. Because even evidence is not pointing to that direction, you can still be subconsciously looking too hard into clues that match your expectation. I think you may have some introspection to do.
While competitions exist, doctoral study is closer to an individual backpacking than a 5k race. You chart your route, pack your stuff, get onto the track, deal with contingencies, take rest, enjoy, get lost, find new way, and perhaps enjoy again. Your supervisor would be like that shop keeper at a travel gear store giving you different levels of advice/service, or be like your GPS; most of the time, you're responsible for yourself.
But what of those horror stories about adviser pitching their students to fight over resources? About those shaming experiences for those who didn't get student grants? Or corridor gossips about so and so being dumb? Yes, they may happen as well, but these are largely out of your control. What I found useful to deal with most of the adversity are two things: the will to grind and move forward, and a set of internal personal values.
Familiarize yourself with the school/program expectations. Attend workshops and read up about opportunities. Build professional networks. Work with your advisor, lay out plans and milestones, and work towards completing them. If things go wrong, come up with some suggestions and consult the advisor.
Don't outsource all your sense of success or accomplishment to others. Think larger goals: focus on what career you'd like to craft, what kind of students you'd like to produce; not if you're the top pick of the faculty among your peers. Draft and keep working on a personal mission statement, and be very clear to base them on your own values: leave the world a healthier place, make education more equitable, etc. And not "people would think that I am the best this or that..." I can't give a whole introduction here, but do search online on how to craft a personal mission statement. Do that soon if you don't have one; it's super useful as a personal compass.
Up play your strength: e.g. as you have worked as an educator, you may also consider applying for teaching assistantship. Being a TA would allow you a great chance to review the materials, pocketing some money, and enriching your post-graduate teaching portfolio.
There will be stellar candidates, and plenty of people brighter than you (which, is exactly the reason you should be there to begin with.) If they are nice, befriend them and perhaps you just made the first step of a life-long research collaboration; if they are not nice, learn from their strengths and move on. Be aware that the playing field will be unfair: some will have more experience, more resources, more popularity; and that's exactly how the rest of the system works. You worked before, you'd understand.
While I don't want to trivialize your worry, the fact is that this move opens a lot more opportunities to development, expansion, enrichment as it does disappointment, anxiety, and frustration. In other words, you have a lot more important things to plan and be prepared for. Take your head out of the birdbath, stop drowning yourself, because if you turn around, you'll see that you have a sea to chart.
I'd recommend a couple titles that you may find useful:
"The Professor Is In" by Karen Kelsky: This title discusses many things on how to be academically marketable. Kelsky, a seasoned admission director, shares a lot about getting ready to be a professional scholar.
"F*ck Feelings" by Michael Bennett and Sarah Bennett: This, or any other similar title that had recently conquered the Self-help book shelves, sometimes provides useful approach to deal with feelings. While it did not change my life, I did find seeing feelings through a comedic lens soothing.
"The 7 Habits of Highly Effective People" by Stephen Covey: Classic oldies that you can probably get a used one for 25 cents. It serves to give a good framework of seeing what success is. It's also one of the earlier titles (that I know of) which mentions the idea of "personal mission statement".
"Networking for People Who Hate Networking" by Devora Zack: I hate networking or pitching myself. This book puts much of my anxiety into perspective.
I wish you best of luck. Take the dive and really enjoy the time. Move forward.
Answer: Congratulations on your great offer but...
... for starters, you should try to stop using/thinking the bit in bold (quote yours, emphasis mine):

"I have been incredibly lucky to be offered a fully funded doctoral training course at a top university".

Someone (multiple people) looked at your application and chose to offer you a place. Your name was not drawn at random; someone with experience in admitting worthy students thought you would be a good fit for the program and you will have that in common with your fellow students :)

Another thing you can do that might help convince you you belong there is be clear about what you are interested in. Be able to tell people why you picked this program, what you hope to get out of it, what you plan to do research on. There are bound to be brilliant people in your cohort and you don't have to do better than them - that's not really a Ph.D. mentality since your aim is to contribute to knowledge rather than to come top of a course. It may help you to feel like their equal if you can speak with confidence about what your research interests are.
There's no quick-fix for being rusty. I guess you already know that you'll have to put in the necessary hours to brush up on things you've forgotten so certain projects might take a little longer at first. Don't let it isolate you - graduate projects are much more manageable if you talk to other people in your cohort / attend office hours (for courses) and talk to your supervisor frequently (for thesis work). Don't let the fear of appearing silly stop you from asking for help (this advice comes from recent experience in my own Ph.D.)!


Robotframework + Selenium2Library Native Py Keyword Run_on_failure

Question: I'm having some issues with getting selenium2library to trigger run on failure when using a custom robotframework keyword.
I wrote a keyword in python that is working as I expect with the exception that upon failure when I raise an AssertionError, the Run_On_Failure keyword for Selenium2Library isn't being called.
I've also tried wrapping this keyword in a user defined Robotframework keyword and I still can't get Run_On_Failure to trigger.  Yet, when I cause a S2L keyword to fail, the Run_On_Failure kicks in as I would expect.
I need Run_On_Failure to be called when my RFpy keyword fails.  Anyone have any advice?
Here is my keyword
<code>    def compare_text(self, actualString, expectedString):
    """Compares two strings of text, this differs from the Selenium2Library
    text compare routines because we do not require an element locator, just
    the `actual` and `expected` strings.  String matching failure will cause
    the test to Assert an error and the test to fail.
    """
    print("Actual Here: %s") % (actualString)
    print("Expected Here: %s") % (expectedString)
    if actualString != expectedString:
        raise AssertionError("ERROR: Actual and Expected strings don't match!")
</code>
Answer: The solution is a built-in RF keyword called "Run keyword if test failed".


Keylogging host from virtual machine

Question: Can a keylogger in a virtual machine (guest OS) capture keystrokes in host OS? Is there any way to do it?
Answer: No, not unless there were a critical VM-escape vulnerability in the VM hypervisor.
Comment: A shared network does not send keystroke information, so no. You'd have to compromise the host through the shared network (VM escape) like the answer states.
Comment: Not even through the shared network?
Answer: Are there ways to capture host keystrokes from a guest? Sure, but only in the case of a critical vulnerability or perhaps a misconfiguration.
Here's an example: a user running a GNU/Linux host wants to run some untrusted applications in a VM. They want to share files between host and guest, so they decide to pass /tmp to the guest. Problem is, the host is running an X11 display server, which doesn't offer isolation between applications, and has a socket file in /tmp/.X11-unix. Assuming the guest has the ability to write to the file, it can log all keystrokes from the host user's X session using the method outlined here.
While this configuration is unlikely, it does indicate that it is possible to do this given the right circumstances.

Keylogging host from virtual machine