atoms and energy levels

Question: the further electrons are from the nucleus the higher their energy level, but the further they are the less the electrostatic pull from the protons in the nucleus, hence the less the slower they have to move to prevent being sucked into the nucleus. but looking at an innermost orbital electron, its very close to the nucleus, large attractive force so it needs to move much faster to prevent being sucked into the nucleus, hence doesnt it have a greater energy than the outer shell electron? (i mean kinetic energy. one could possibly argue that the outer shell electron has a greater potential energy hence its able to remain there with little kinetic energy. but this still doesnt show clearly why the outer shell electrons are totally more energetic than the inner shell electrons)
Answer: Firstly, I advise against thinking of the electrons as orbiting the nucleus. Rather, your argument should go as follows: lower energy wave-functions have wider Fourier spectrums and thus larger kinetic energies.
And this is true.
However, the energy of an electron in an atom is dominated by its potential rather than kinetic energy. And the potential energy obviously increases when an electron is excited away from the nucleus.
Comment: At least in a hydrogen atom with a single electron, the kinetic and potential energies of the electron are of the same order (to a first approximation). In particular, the kinetic energy is twice as large (when the potential zero is at infinity). This follows from the [virial theorem in quantum mechanics](https://en.wikipedia.org/wiki/Virial_theorem#In_quantum_mechanics). However it may be that the energies are not of the same order when there are multiple electrons.
Answer: I'd try understand this problem in the classical domain [planets] first, and then consider the quantum system [atoms].
Pluto (or Eris, Ixion, Sedna, ...) is in a higher energy orbit than Mercury, yet Mercury is moving much faster. Zero energy is defined as stationary, "at infinity", with positive energy rocks being unbound from the sun. With that, binding energy is negative--getting from Pluto up to "zero" is much easier than getting there from Mercury.

atoms and energy levels


Why trust a PGP signature if it is distributed along with the data being verified?

Question: Many downloads offer an OpenPGP signature, which can be used to verify the file, but if a hacker manages to manipulate the file, then he can also simply change the signature key, or not?
Answer: The signature can be changed, yes, but it won't be valid unless the attacker can get you to download their public key instead of the one you intend to download. This is where checking the PGP fingerprint comes in. The fingerprint can be given to you through another channel, and compromising all possible places one could find the legitimate fingerprint is much more difficult than compromising the signature.
For example, my fingerprint is BCBAE3E9CB8E2FE23F29DC58061D7CAC428DD60B. All you have to do is download my public key and verify the fingerprint once and you'll be able to detect modification of any signatures that were made by me. The worst an attacker with control of the signature and data being signed then is a rollback attack, where the attacker presents an older pair of data and signature. Even this can be prevented by checking the dates on the signature to make sure they're expected. Some signatures, such as Riseup's warrant canary, also provide a link to a current news article to establish that the signature has not been pre-generated. A time stamp authority would also work.
Comment: And, of course, the key and / or fingerprint can usually be found on a secured server that is administered by the developer, and may also be distributed in e.g. mailing list messages as message "signature". After the key is trusted you put it in your local *trust store* (or *key database* in OpenPGP parlance) for the future consumption of signed data.
Comment: The basic problem is, most end users don't actually do this (check that the signature is valid, much less that it is signed by a "plausible" key). Even if they did, HTTPS already offers most of the same guarantees (with the main exception being that the developer *could* keep their PGP key on an airgapped dedicated signing server, whereas the HTTPS key needs to be accessible to the web server, but in practice I suspect a lot of developers don't do that either).
Comment: @Kevin HTTPS doesn't protect you from fake websites, nor does it protect you from compromised websites. All it would help you with is MITM. The fact that most users don't actually check the fingerprint (or check it on the same website that they're downloading the signature from) is an issue, as you pointed out.
Comment: @forest: Neither does PGP, unless you are putting in a lot of secondary verification effort yourself. But if you *are* doing that work, then we need to assume that you're also verifying your URLs, because that's no more difficult than verifying a PGP fingerprint.
Comment: @Kevin With PGP, you can find the fingerprint elsewhere (on Twitter, on mailing lists, IRC, GitHub, web archives, etc.). It's a lot harder to compromise all the results in a search engine than it is to compromise a single website. In an ideal world, WoT would be actually useful and you could verify the fingerprint vicariously through people you mutually trust, but that's less common in reality.
Comment: @forest: That just leads back to the "your PGP key isn't airgapped" problem. If your PGP key is on a development box, it's probably connected to the internet and vulnerable to compromise, because airgapped setups are a massive PITA and nobody bothers.
Comment: @Kevin Oh I get what you mean. Yes, verifying the fingerprint relies on the assumption that the private key is not compromised. All verifying it does is ensure that the public key you are using is the right one and hasn't been replaced. However the security of the private key itself is orthogonal to the problem of verifying its authenticity. The same goes with verifying that the data the author signs was not modified maliciously prior to him signing it (one can certainly sign backdoored code by mistake).
Answer: A lot of downloads will come with something like an unsigned SHA-1 checksum. You might reasonably ask what the benefit of that is, since if that was tampered with the attacker could just recalculate the checksum. The benefit here is that you should get the checksum from a trustworthy source, such as directly from the developer's website. That way you can download from (say) a torrent, or a local mirror that you don't entirely trust and have a means of verifying that the download hasn't been tampered with.
Using a PGP signature takes things to the next level, because whilst you can always tamper with the file and then sign it, you cannot sign it with the developer's signature, unless you know their private key (code signing key compromises do happen from time to time).
So, how do you verify the signer? Usually you have to find somewhere you trust and store the key from there. In principle, you only have to do the verification step once. So if you look at: https://www.kernel.org/signature.html you can see that Linus' key fingerprint is "ABAF 11C6 5A29 70B1 30AB  E3C4 79BE 3E43 0041 1886". You can also see that you absolutely shouldn't trust the key with fingerprint "C75D C40A 11D7 AF88 9981  ED5B C86B A06A 517D 0F0E", so "verify once but check for revocations".
Answer:
if a hacker manages to manipulate the file, then he can also simply change the signature key, or not?

Usually the file is generated on a build system, and this file is most of the time sent to a CDN. The site usually will have an automated process to grab the signature from the backend and create a download page, linking the file and the signature.
So while it's possible to a hacker to compromise both the file and the signature, this is not easily done. The build site is usually more guarded than the website, and the CDN is usually heavy guarded too.
Answer: Verifying Keys Using Fingerprints or the Web-of-Trust
OpenPGP is difficult for many people to use because of the authentication issue you're describing. In general, you should only trust keys that are:

received from a trusted source such as your organization's official public keyring; or
validated out of band, such as by comparing the key's fingerprint over the phone with the person who owns the key; or
signed by a fully-trusted key, or by a sufficient number of partially-trusted keys.

NB: Some newer keyservers such as hkps://keys.openpgp.org now strip out third-party signatures, so the trusted-keys option may or may not be useful to you if you are relying on them for web-of-trust purposes.
When You Don't Have Direct Access to the Key Owner or a Web-of-Trust
As a purely practical matter, many people treat fingerprint information from HTTPS servers or services like Keybase to validate a key for their OS distribution or software packages as "good enough." Whether or not that is sufficient for your unique purposes, policies, or standards is a separate issue, but it is often good enough for users of operating systems like Debian or Ubuntu to validate their OS and keyrings. Your mileage may vary.
See Also

GnuPG Integrity Check
GnuPG Signature Keys
Web of Trust
Building Your Web of Trust
The GPG --fingerprint flag (see man 1 gpg)


JBoss 5 perm size and heap size

Question: Is there any relationship between heap and perm size for JBoss? I'd like to increase max heap size but I'm not sure what sort of impact it will have for perm size. I'm running JDK 6. Currently I don't run into perm gen issues, but if I increase heap size is there an implicit relationship that requires me to increase perm gen space? Is there any rule of thumb essentially is what I'm asking?
Comment: It would be better if you check the differences between both of them and realize which one you need to increase.
Answer: No, you do not necessarily need to increase perm gen size, if you increase the overall heap size. The perm gen space holds the classes loaded by the JVM. If your deployed application does not change, the amount of data to store in the perm gen space also stays the same - even if the overall available heap space is increased.
The relation ship is rather the other way round - if you increase the perm gen size, you will have less heap space available for your application -> in this case, you would probably consider to also increase the overall heap size.
Answer: In order to understand the heap and permgen, maybe the following explanation about what is stored in PermGen (or Metaspace in Java 8) helps to understand both the purpose of permgen and difference from heap:
If you recall, everything in Java is represented as an Object. Also, all objects are instances from a specific Class. Even the Class declarations themselves are ultimately just very specific Objects. But what makes the class declarations interesting is the fact that on most JVMs Class declarations are loaded into a specific memory region, named Permanent Generation (PermGen for short).So – to recap: all Java classes are loaded and stored in the Java PermGen.
This consists of the following:

Names of the classes
Fields of the class
Methods of a class with the bytecode of the methods
Constant pool information
Object arrays and type arrays associated with a class
Just In Time compiler optimizations

That's pretty much it. Some more bits and pieces but it does not impact the actual memory consumption by more than few percent. All of these are allocated to PermGen and stay in PermGen.
As you can see, the PermGen size requirements depend heavily both upon the number of classes loaded as well as the size of such class declarations. So - in general, the more classes in the application you load into the JVM, the bigger the PermGen you are going to need.

JBoss 5 perm size and heap size


GRUB set default entry to the second os

Question: I have dual boot Ubuntu and Arch, and I think there must be a way to set the default boot entry for GRUB to boot second OS, e.g., when I reboot from Arch it will boot to Ubuntu, and vice versa. Maybe it's possible by creating a new grub entry, but I don't know how to check previous boot entry, and so select another one.
Answer: In modern versions of GRUB, there are two commands you could use for this purpose: grub-set-default and grub-reboot.
grub-set-default will persistently change the default boot entry, but it requires having GRUB_DEFAULT=saved in /etc/default/grub (and updating the actual GRUB configuration with the generic grub-mkconfig or its Debian/Ubuntu-specific wrapper update-grub to make the change take effect).
grub-reboot specifies an one-time boot target for the next boot only. Despite the name, it won't actually reboot the system.
Both of these will take either a number, a menu item title, or a menu item identifier as an argument. If the desired menu item is in a submenu, you would specify the name/identifier of the main menu item, the > character, and the name of the sub-menu item.
For example, on Debian the first (and the normal default) menu item is usually named Debian GNU/Linux, and the second menu item is titled Advanced options for Debian GNU/Linux, and it opens a sub-menu of currently installed kernels. For each kernels, there are two entries in the sub-menu: Debian GNU/Linux, with <kernel version> and Debian GNU/Linux, with <kernel version> (recovery mode).
To boot with the previous kernel version in normal mode once, you could do:
grub-reboot 'Advanced options for Debian GNU/Linux>Debian GNU/Linux, with <kernel version>'

You can see if the grub-reboot command has been used in the current boot cycle by running grub-editenv list and seeing if the next_entry= variable has a value or not. If grub-reboot has never been used, the variable might not exist at all.
Likewise, if there is a saved_entry= variable, then the grub-set-default command has been used; but unlike next_entry=, that value won't be automatically removed after one boot attempt.
Answer: You can write a systemd script (a service) which checks what system are you currently on (e.g., by checking if there is a lsb_release command -- it should be in Ubuntu, but not in Arch). Then check the contents of the GRUB configuration file (/boot/grub/grub.cfg see this wiki page on GRUB). Then, based on which system are you on, you switch the entries in the GRUB config. There are several ways to do that. The not recommended way is to "manually" (i.e., with the script/service) edit the main configuration file. Theoretically you should not do that, because it is really easy to make a mistake, which will make it impossible for you to boot to any system. The recommended way to edit GRUB entries is to use custom entries, but handling them from scripts (or command line in general) can be a bit tricky.
There are of course some pitfalls in the script/systemd approach (e.g., you should in fact has two of such scripts: one on Arch and the other on Ubuntu, both implementing the same functionality), but it is as close at is gets to the functionality you want. By the way, you wrote:

I don't know how to check previous boot entry and so select another one

I highly recommend to you reading through the Arch Linux wiki on GRUB -- several times. It helped me a lot to finally understand how GRUB works. I admire people who created this documentation, and I'd say that it is a magnificent piece of instruction, one of the best on the web (as an example of a wiki page).
Just to sum up, there is no simple way to achieve what you wanted in your question, but on the other hand, where is the fun in "simple" solutions? :) Good luck, happy coding, and let me know if you will need some more advice.

GRUB set default entry to the second os


How do you implement ideas from Peopleware in an early startup?

Question: Peopleware suggests that managers should set realistic schedules and should not put overreaching pressures on developers. In an early startup with hired developers, how does one keep the competitive edge with a very fast paced culture without burning out the developers? I've heard stories that people at startups work tirelessly without breaks, but won't that cause burnout eventually? How does one strike the right balance?
Answer: A lot of managers assume that management is about putting right amount of "pressure" on developers. The underlying assumption often seems to be that developers are a bunch of idiots who have no sense of priority and will work based on the amount of pressure managers put on them. If that's the culture you want to build, that's how your developers will react.
What I would recommend instead, is hiring kickass programmers who are smart. Exposing some aspects of the business side to them, being completely open about everything e.g. what do we lose if we do not ship this feature by next month. Most developers sense urgency and react very maturely when you trust them. You will be surprised to see that most developers go out of their way if they sense a need of urgency or firefighting within their projects. The moment you have to "put pressure" on a team you have failed as a startup. Maybe you've failed at recruitment or failed at trusting people, but none the less, you have failed as a startup. My personal experience is that if you teams are awesome and your management is completely transparent the teams will react to the situations pretty much automatically.
You also have to remember that while Peopleware was an awesome book, a lot of other books recommend that you involve the development teams while making the schedules. Honor their opinions and let them pick their own timelines. That way the timelines will be much more realistic and they will be aware of the business importance if these are not met. Plus, they can also suggest workaround and the team (both managers and developers) can collectively drop features which are not hugely important intelligently when they near a timeline and discover that they are not going to meet it.
Remember, you don't get a fast paced vehicle by getting yourself behind a automobile and pushing it really hard. You get fast pace by buying a car with a really fast engine. Culture is no different. You don't need to push to build a fast paced culture. You just need a strong, wiser, competent, strong team of programmers. That and you need the fuel of trust, team work, friendship, understanding and empathy to keep the speed going.
Answer:
overreaching pressures on developers

is a good sign of poor project management. If you try to solve the problem and protect team from the PM you have to restrict PM's rights in some way. That will inevitably lead to even bigger problems in project management.
Instead, I'd suggest to replace the PM or educate him/her.
Answer: If you think about most successful startups these are usually stories about passion and involvement to achieve some kind of big goal, or make big vision come true.
So the trick is to get people who genuinely care about your startup and its success. Of course you still shouldn't expect people would work crazy hours just to push the product ahead but chances are good they will at least run an extra mile. In matters much not only in terms of engagement or staying late on occasions but also in terms of their involvement in product development -- sharing their thoughts and ideas what can be done better, getting them to promote the product among their friends etc.
If you analyze this set of startup failures you can bring many of them to some kind of lack of engagement.
If you happen to base on just average hires to work on your startup finding the right balance will always be hard. In startup it's more valuable to have someone who maybe not that skilled but at least they genuinely care. And that would be what I aimed for in this situation.


when we merge a branch in some other branch, then either local branches are merged or remote branch merged

Question: If I merge branch a in b, after merging i have to push then branch for update the remote branch or merge updates remotes branch?
Answer: You have to push. When you merge, you're only working with branches in your repo. If you want to publish them to your public (GitHub) repo, you have to push them out (just like any change).
Answer: After your merge with your local branches, you have to push the change to your remote branches.


Staff with 15 lines

Question: Why does this staff contain 15 lines and how could I play this on a guitar?
Answer: The top 5 lines (staff) are the vocal melody.  The next two staves are intended to be played on piano - broadly speaking one staff for the right hand, one for the left.  Songs are often published in this format, even when the original version wasn't performed on just voice and piano.
In this case you'll observe the vocal part is duplicated in the top piano staff.  In performance you probably wouldn't want to do this, but part of the convention of 'piano & voice' copies is to include the melody in the piano part.
A guitarist performing this piece would doubtless choose what's in the bottom stave, a specific rhythm using a B5 'power chord'.
It isn't always so easy to decide what to play from a piano/vocal sheet!
Comment: You mean a guitarist would play only on the stave the F clef ?
Comment: In this particular song, yes.  But probably not at that pitch!
Answer: It's going to depend on what you want to do. The guitar part is actually written, of sorts, shown by the B5 chord window on top of the top stave. I expect (hope!) there will be others later in the song. So, the guitar part is there - chords - and an appropriate rhythm can be strummed while someone sings.
That someone will sing the words along to the tune written on the top stave.
As already mentioned, the other two staves are explicitly for piano, l.h. and r.h. The middle stave here is merely showing the melody line, which, if a pianist was accompanying a singer, would probably not be played as such, unless the singer was unsure of the tune! It's more of a plan so that, in the absence of a singer, a piano player can read the bottom two lines, and it'll sound o.k.
However, if you wanted to play the song on guitar, you could just read either the melody line (top) or the middle line, which here is the same - but not always. Forget the bottom line, as on guitar, some of those notes are too low. There's no simple way round it for this song, but for a similar one in a different key, say E, you could tune the A string up to B, and produce something like the 'drone' effect shown in the F clef, while still playing the melody, unencumbered, on higher strings. But then what happens when the harmony changes..?
Answer: It would be impossible to play this music, the way it's notated, on guitar since it's not written for guitar but a piano (bottom 2 staffs) and a singer (top staff).
What you can play on guitar is the top 2 staffs (which are the same) on their own because they use a terble clef.
The bottom staff uses a bass clef and would have to be transposed before you can play it on guitar.
Ideally you should learn guitar music or music arranged for guitar if you're learning guitar.

Staff with 15 lines


How does running a node benefit the network?

Question: If I have the full node on my hard drive and the node daemon running, is there anything else I have to configure to benefit the Monero network? Do I have to configure a domain name for others to connect / sync to it?
Answer:
How does running a node benefit the network?

See the following:
Support the Network Run a Node An easy and effective way to help the Monero network is to run a node. Nodes ensure the network keeps running safe and decentralized. A simple fully synchronized node is enough to help the network, but if you want to go out of your way, you could run an open remote node, to allow other people to connect to it.

Ref: https://www.getmonero.org/get-started/contributing/

Do I have to configure a domain name for others to connect / sync to it?

No you do not need a domain name. However, if you want to allow other nodes to initiate connections to your node you will need to ensure your router / firewall forwards traffic to your host on port 18080. And if you want to allow remote wallets to use your node's RPC interface, you will also need to forward port 18081 to your host.


Does anyone REALLY knows what does Other actually contains on a Mac and how to clear it?

Question: Please, don't mark this post as a duplicate! I already checked all the same posts about this topic on this website and can say that all answers really answer nothing.
I have 256gb SSD, and 85 (!!!) of them are in the Other storage. It is ridiculous. Those files don't exist. I already used OmniDiskSweeper - it does not show those files. It shows only 135gb and that's all, yep. 20gb for MaOS and other 85 are just gone forever. Don't suggest me using CleanMyMac please, I used it, it cleaned 1 Gb of junk files, clearly not 85... It seems that there is no point of buying 256 and for the next Mac I'll have to buy 512
Comment: This post **will most likely** still be downvoted or even closed because you should: give much more detail about your system (as mentioned by @lhf), clarify what posts exactly you have read and most importantly tell us exactly what steps you have done so far. And it is hard to not mark this as a duplicate if you don't even specify what would be different from your question to others, if you basically tell us nothing. -1
Comment: Which Mac and which macOS? Are you running Time Machine? If so, it could be local backups.
Comment: @lhf Hi. No, I don't use Time Machine at all. Macbook Air 2015, the latest Big Sur
Comment: @X_841 I said that all other answers were - use DiskSweeper and CleanMyMac and it doesn't work.
Answer: Other == Miscellaneous.
It isn't a single category, it's everything left after the categorisable data has been accounted for. You will not find it all in one convenient pile in a corner of your drive, waiting patiently for you to consign it to the Trash.
I would still consider the answers to How can I figure out what's slowly eating my HD space? would be your best method to tackle this dilemma.


Number of spanning trees for $K_n-e$

Question: As the title suggests, I want to calculate the number of spanning trees in $K_n - e$ where $K_n$ is the complete graph on $n$ vertices and $e$ is any edge. The answer to this problem is $(n-2)*(n)^{n-3}$ and i know one method to do this. My actual question is regarding one of my approaches which is wrong. So let's pick any vertex of the graph, say $v_1$ and delete any edge for it. now it has $n-2$ edges and through this i can reach any of the vertex. Now all the remaining vertices form a $K_{n-1}$ graph and these would have $(n-1)^{n-3}$ spanning trees so the total spanning trees would be $(n-2)*(n-1)^{n-3}$. Where am i exactly going wrong and is it possible to proceed with this approach? Thank you
Answer: Your method counts only the spanning trees where $v_1$ is a leaf. A spanning tree of $K_n - e$ does not necessarily consist of a spanning tree of $K_n - v_1$ plus an edge to $v_1$ other than $e$.
Comment: Repeating this process for every vertex gives us two problems: (1) if we consider a vertex that's not an endpoint of the deleted edge, then deleting it leaves $K_{n-1}-e$, making us solve the problem recursively; (2) to avoid double-counting, we need to take an inclusion-exclusion type sum over which vertices are leaves at the same time. We could probably get somewhere this way, but it will leave a complicated sum for us to simplify at the end; it is not a good approach.
Comment: so does it mean that if I repeat this process for every vertex will i get an answer? Like could you please clarify if I can proceed counting them in this way? Thank you.
Comment: thank you so much

Number of spanning trees for $K_n-e$


Accepted answers

Question: Just asking out of idle curiosity:
1. What is the longest span of time between asking a question and accepting an answer? All right, that must be the infamous 3:33 question.
2. Between the posting of an answer and acceptance of that answer?
3. Between accepting and unaccepting an answer?
Answer: Unfortunately, because of the way accept and unaccept events are stored in the database, these questions cannot be perfectly answered. The problem is that "acceptance" is a special kind of vote, and unacceptance is equivalent to deleting that vote. Because deleted votes aren't accessible, there's no way to check acceptances other than the currently-accepted answer.
For completeness' sake I've checked on both SEDE and the API, and there's no immediately obvious way of circumventing this problem without an unfeasibly expensive query.
That being said, here's what I can answer:
Longest time between asking a question and accepting an answer
At time of writing, the honour goes to Rodger Cooley and Valorum. Rodger asked Which actors from the original Star Trek pilot "The Cage" appeared in later Star Trek media? on January 19, 2011, and Valorum's answer (posted October 10, 2016) was accepted on october 11, 2016.
The total difference, 2092 days, 4 hours, 15 minutes and 45 seconds.
Runner-up is PearsonArtPhoto/Omegacron for What was Shepherd Book's past in Firefly?, with a net difference of 2077 days, 18 hours and change.
Longest time between posting an answer and that answer being accepted
The winner is NiceOrc for answering A collection of stories about young monsters and vampires. The answer was posted on September 21, 2011, and accepted on April 27, 2017. Total difference: 2044 days, 23 hours, 41 minutes and 28 seconds. A nice, patient orc indeed.
Runner-up is geoffc for answering Who is the Hindmost in the Ringworld sequels?. His answer was posted on April 10, 2011, and accepted on October 7, 2016. Total time difference: 2006 days, 18 hours and change.
Longest time between an answer being accepted and it being unaccepted
Because old acceptances aren't stored either by SEDE or the API, this one is unanswerable. Sorry.
Comment: Can you query whether a question has had two accept events? That won't get you questions where an answer was unaccepted and no answer was ever accepted again, but it should get you questions where an answer was unaccepted and another answer was accepted.
Comment: @Obie2.0 Alas, it appears not. I just tried [a test query](http://data.stackexchange.com/scifi/query/507312), which should have returned at least two results (Himarm's and Slytherincess'), but only returns one; it seems as though SEDE only stores the most recent accept event

Accepted answers


Comparing two groups with unequal sizes?

Question: I'm writing my thesis on people's attitude. The problem is, I have way more female (75%) than male (25%). I wanted to run an analysis on the different attitude between men and women, but I'm not sure which test to use, since T-test would require the 2 groups to be more or less similar sizes and variance. Thank you for your help in advance!
Answer: Assuming that your response variable fulfills the assumptions made for a t-test (normality of sample mean etc.) and your only concern is that your two groups are different in size and/or variance, then you can use Welch's t-test, which takes care of exactly those concerns while addressing the same issue, namely whether the means are statistically different or not.
Answer: Welcome to Cross Validated!
Actually, there is no reason why you shouldn't perform a mean comparison test. Equal sample size and varaince are not a requirement.
You may want to check this to see how it can be done (unknown means and unknown standard deviations)


How to search for specific value in Registry keys

Question: How can I search for specific value in the registry keys?
For example I want to search for XXX in
HKEY_CLASSES_ROOT\Installer\Products

any code sample in C# will be appreciated,
thanks
Answer: In case you don't want to take a dependency on LogParser (as powerful as it is): I would take a look at the Microsoft.Win32.RegistryKey class (MSDN). Use OpenSubKey to open up HKEY_CLASSES_ROOT\Installer\Products, and then call GetSubKeyNames to, well, get the names of the subkeys.
Open up each of those in turn, call GetValue for the value you're interested in (ProductName, I guess) and compare the result to what you're looking for.
Answer: Help here...
Microsoft has a great (but not well known) tool for this - called LogParser
It uses a SQL engine to query all kind of text based data like the Registry,
the Filesystem, the eventlog, AD etc...
To be usable from C#, you need to build an Interop Assembly from the
Logparser.dll COM server using following (adjust LogParser.dll path)
command.
tlbimp "C:\Program Files\Log Parser 2.2\LogParser.dll"
/out:Interop.MSUtil.dll

Following is a small sample, that illustrates how to query for the Value
'VisualStudio' in the \HKLM\SOFTWARE\Microsoft tree.
using System;
using System.Runtime.InteropServices;
using LogQuery = Interop.MSUtil.LogQueryClass;
using RegistryInputFormat = Interop.MSUtil.COMRegistryInputContextClass;
using RegRecordSet = Interop.MSUtil.ILogRecordset;

class Program
{
public static void Main()
{
RegRecordSet rs = null;
try
{
LogQuery qry = new LogQuery();
RegistryInputFormat registryFormat = new RegistryInputFormat();
string query = @"SELECT Path from \HKLM\SOFTWARE\Microsoft where
Value='VisualStudio'";
rs = qry.Execute(query, registryFormat);
for(; !rs.atEnd(); rs.moveNext())
Console.WriteLine(rs.getRecord().toNativeString(","));
}
finally
{
rs.close();
}
}
}

Comment: this only looks into registry values, is there a way to search for registry key as well? i tried replacing `Value` with `KeyName` didn't work. Thanks
Answer: This method will search a specified registry key for the first subkey that contains a specified value. If the key is found then the specified value is returned. Searchign is only one level deep. If you require deeper searching then I suggest modifying this code to make use of recursion. Searching is case-sensitive but again you can modify that if required.
private string SearchKey(string keyname, string data, string valueToFind, string returnValue)
{
    RegistryKey uninstallKey = Registry.LocalMachine.OpenSubKey(keyname);
    var programs = uninstallKey.GetSubKeyNames();

    foreach (var program in programs)
    {
        RegistryKey subkey = uninstallKey.OpenSubKey(program);
        if (string.Equals(valueToFind, subkey.GetValue(data, string.Empty).ToString(), StringComparison.CurrentCulture))
        {
            return subkey.GetValue(returnValue).ToString();
        }
    }

    return string.Empty;
}

Example usage
// This code will find the version of Chrome (32 bit) installed
string version = this.SearchKey("SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall", "DisplayName", "Google Chrome", "DisplayVersion");

Comment: Nice solution.  Although, take care with OpenSubKey as it can return null.  Also, it returns an IDispoaable, so those usages would be good to have wrapped in a using statement.  e.g. using var programs = uninstallKey.GetSubKeyNames();
Answer: @Caltor your solution gave me the answer I was looking for. I welcome improvements or a completely different solution that does not involve the registry. I am working with enterprise applications on Windows 10 with devices joined to Azure AD. I want/need to use Windows Hello for devices and for HoloLens 2 in a UWP app. My problem has been getting the AAD userPrincipal name from Windows 10. After a couple days searching and trying lots of code I searched the Windows Registry for my AAD account in the Current User key and found it. With some research it appears that this information is in a specific key. Because you can be joined to multiple directories there may be more than one entry. I was not trying to solve that issue, that is done with the AAD tenant Id. I just needed the AAD userPrincipal name.
My solution de-dups the return list so that I have a list of unique userPrincipal names. App users may have to select an account, this is tolerable for even HoloLens.
using Microsoft.Win32;
using System.Collections.Generic;
using System.Linq;

namespace WinReg
{
  public class WinRegistryUserFind
  {
    // Windows 10 apparently places Office/Azure AAD in the registry at this location
    // each login gets a unique key in the registry that ends with the aadrm.com and the values
    // are held in a key named Identities and the value we want is the Email data item.
    const string regKeyPath = "SOFTWARE\\Classes\\Local Settings\\Software\\Microsoft\\MSIPC";
    const string matchOnEnd = "aadrm.com";
    const string matchKey = "Identities";
    const string matchData = "Email";

    public static List<string> GetAADuserFromRegistry()
    {
      var usersFound = new List<string>();
      RegistryKey regKey = Registry.CurrentUser.OpenSubKey(regKeyPath);
      var programs = regKey.GetSubKeyNames();
      foreach (var program in programs)
      {
        RegistryKey subkey = regKey.OpenSubKey(program);
        if(subkey.Name.EndsWith(matchOnEnd))
        {
          var value = (subkey.OpenSubKey(matchKey) != null)? (string)subkey.OpenSubKey(matchKey).GetValue(matchData): string.Empty;
          if (string.IsNullOrEmpty(value)) continue;
          if((from user in usersFound where user == value select user).FirstOrDefault() == null)
            usersFound.Add(value) ;
        }
      }

      return usersFound;
    }
  }
}


Are we keeping the old profile page?

Question: I've noticed this is one of my few sites that's still using the "old" profile page. Is that by design or has the change just not happened yet? In case you're seeking opinions, I prefer it over the new one, and hope we let it be!
Comment: I don't know why we don't have it yet but I'm sure we will eventually, but we haven't made a decision not to have it or anything.
Answer: I believe it's going to be rolled out to all sites apart from Area 51 and the only reason the release has been staggered is because of changes needed to upgrade the CSS style sheets. There's a summary here of which sites have been done already and which are planned and that includes Seasoned Advice:
List of communities with base css updates completed
I don't think there's any plans to be able to keep the old profile page, although if you click on the activity tab the view is reasonably similar to the existing profile page.

Are we keeping the old profile page?


monero-wallet-cli connection to remote node - Out of Sync

Question: I found this site (https://www.ditatompel.com/monero/remote-node) which shows the list of some remote Monero nodes. I would like to connect and be able to use my Monero wallet to send transactions over the testnet network.
When I run

monero-wallet-cli --daemon-address

as suggested in this Stack Question and i insert my wallet , the result is:

[wallet  (out of sync)]:

The wallet tells me out_of_sync and I can neither mine nor execute other commands. Can anyone tell me why? Is the node I'm using the problem? Should I create my own node?
Answer: <code>[wallet 9xBEEF]: help refresh
Command usage:
  refresh

Command description:
  Synchronize the transactions and balance.
</code>

Should I create my own node?

Yes.


Finding the multicast IP that a datagram was sent to

Question: In my application I have one MulticastSocket that joins 40 multicast IP addresses (On the same port).
When receiving a datagram, is there a way to find the specific Multicast IP that a it was sent to ?
The same question about the new "DatagramChannel" (in Java 7), that also support multicasting.
Thank you very much !
Answer: In Java 1 through 6 you must create one socket per IP multicast address and then use private data to help determine the incoming address.
In the host CRT you can use IP_PKTINFO and the CMSG_* apis to determine the destination address but these have not been exposed in Java.
Java 7 brings NIO support for multicast along with SSM (RFC3768).


Vim Java code completion?

Question: Is there something equivalent to OmniCppComplete for java in vim ?
I know of eclim but I think it is overkill for such a simple feature.
Answer: See http://www.vim.org/scripts/script.php?script_id=1785
Answer: Also found VJDE - http://www.vim.org/scripts/script.php?script_id=1213 - Need to evaluate which one is better/more up-to-date
Comment: Judging from the amount of downloads, the last updates to the code, and the rating, your script seems to the better choice. FYI, I haven't used either.
Answer: Seems you have some options for code-completion above.
I would recommend also grabbing a copy of TagList, which provides a sidebar displaying the structure of your current file.
The ctags which TagList uses can also be used for fast navigation in Vim.  Ctrl+] over the text "curiousMethod()" should take you to the definition of that method.

Vim Java code completion?


VIM see regular expressions matches as you type

Question: If I type /regex then the cursor temporarily jumps to the first match and all matches are highlighted. This updates as I type. Is it possible to get this behavior when I'm getting ready to make a substitution? For instance, when I'm working on a complicated regular expression :%s/\<regex\>/, I would like to know what is matching before I pull the trigger and change everything. Any way to do it?
Comment: It would be nice if it would work in a way it works with the search: highlighting what currently matches.
Did you find the best way to do it?
Answer: Type your search using / (or ?) to begin with, which will allow you to tweak your regex (since you're using incsearch)
Once you get it all nice, you can use the previous search pattern  (the one you just used) in the substitute command by using two separators for the 'search' item:
/elephant                       " find the next elephant
:%s//rhino/gc                   " make then all rhinos!

Of course, you can use selections and ranges, as normal.
:1,15s,,cougar,g
:'<,'>s::tiger:

Comment: +1 for teaching me about `s//`
Answer: One option is that you can have a confirmation flag c.
:%s;regex;replacement;gc

:h s_flags:
[c] Confirm each substitution.  Vim highlights the matching string.  You can type:
        'y'     to substitute this match
        'l'     to substitute this match and then quit ("last")
        'n'     to skip this match
        <Esc>   to quit substituting
        'a'     to substitute this and all remaining matches
        'q'     to quit substituting

You can also try grep command to see the filtered output and the highlighted original file.
:g/re/p or :g/re/
Comment: I like it, but it still require me to complete the regular expression before I see what if anything was matched.
Answer: Well, the short way to see what your regular expression will match is doing a search with / using your desired regex. It will jump to the first match and mark it up while your're typing it. Try it - vim will not disappoint you.
Comment: True, though that's what I stated in the question. I wish it would update as I'm getting ready to substitute. With your solution I have to try the regex and then copy it (how?) and then use it in a substitution. That's not good enough.


Pybricks on Android Tablet

Question: I have a ZTE Grand View 4 Tablet (K87CA), 8 inch screen, Android 10,  with 2GB RAM, and the screen is blank when I go to https://code.pybricks.com/. Nothing happens.
Comment: What browser are you using? It should be one that is bluetooth compatible like Chrome or Chromium...Also, I'd like to note that using the pybricks webpages from a tablet is rather unorthodox usage, likely not tested very well or at all. You're supposed to write Python code on those webpages, so a device with at least a keyboard seems desirable.,
Comment: Chrome is the automatic choice on Android, so I use it. Bluetooth keyboards are easy enough to use as these have Bluetooth 4.2 Should not be a problem. For Power Functions App 8" screens are great. Don't understand why the web page doesn't load.
Answer: There was a bug in Pybricks that caused an empty page to load for existing users when a new version was released. It should be fixed for new users, but existing users will need to clear the cache for this page:
Windows
CTRL+SHIFT+R
MAC
CMD+SHIFT+R
Android
You can clear the cache for specific pages with these steps:

Go to settings in your browser
Select Site settings
Select All sites
Use the search icon to search for Pybricks
For each entry, click Clear & reset

Pybricks on Android Tablet


Why do atoms need 8 electrons to stabilize?

Question: As the title says. I have surfed all of the net but could never find the answer to this question. Why do atoms need 8 electrons to stabilize? I mean why not 7 or 5 or 10 electrons? Why specifically 8? And what does stabilization of atoms even mean? Are the atoms going to burst without 8? Why do they need 8 electrons?
This is a question which is not often discussed in chemistry and I need an answer which really makes any sense. Not just `it is because the atoms need to fill their octet.
Comment: Unfortunately while this is a very fundamental question, a good answer to this is not easy to write. There are far too many hidden sins in the phrasing that you quote ("8 electrons", "stabilise") and a great deal of elaboration on those points is needed. Perhaps someone will be up to the task.
Comment: Some good pointed questions, like this one, are tricky to answer because it gets just close enough to the philosophy of knowledge to force people to get very precise.  You are looking for what we, in philosophy, call a "justification" for an idea.  It is clear you have already refuted the justification of "we've done this experiment millions of times, and here's what we've seen," so you are asking for an even better justification than that.  Such a justification will invariably stray into the world of quantum physics.
Comment: @orthocresol so this is a very deep and fundamental question that only the professionals can understand?
Answer: The valence orbitals of atoms are composed of suborbitals (s and p)  there is 1 s suborbital which is spherical and can hold 2 electrons (one with up spin and one with down spin). There are 3 p suborbitals which are dumbbell shaped (look like two balloons tied together at the ends) and align along the x,y&z axies and hold a total of 6 electrons (2 per axis, 3 with up spin and 3 with down spin).  Since an atom is energetically satisfied when all of the electrons are paired and 2+6 = 8, an atom must have 8 electrons in its valence shell to pair all of the electrons.
The octet rule does not apply to all atoms though, for transition metals and later elements there is a d suborbital which can hold an addition 10 electrons, meaning that now an atom may have 18 electrons in its valence shell to be satisfied.  This allows for materials such as metal complexes and the sulfate poly-atomic-ion to exist despite having more than eight electrons in the valence shell.
Comment: what do you mean by **energetically satisfied**? How can an atom know if it is satisfied? And what causes this satisfaction? And why is there even a need for satisfaction in atoms?
Comment: @Adi High energy states (tend to) have many ways of becoming lower energy states, but very few ways to remain in a high energy state. Consider a tall tower with improper supports. There are many ways to fall, but only a few ways to stay upright.
Comment: @DraggyWolf And as I said in your question...what does low energy state has to do with stabilization?
Comment: @Adi I'm assuming means a low energy state.
Comment: @Adi see http://physics.stackexchange.com/questions/47253/why-does-the-nature-always-prefer-low-energy-and-maximum-entropy
Comment: @A.K.'s answer is correct. Have a look at an undergraduate level book on atomic spectroscopy or physical chemistry, most any one will do, and will give you details of atomic structure and you will see where these 'rules' come from.
Answer: I think the most important thing here is to point out some details which I don't believe get emphasized enough in chemistry classes, and yet are extremely important in approaching questions like this.

I mean why not 7 or 5 or 10 electrons? Why specifically 8?

I've been in this situation before. The one where I'm asking a question which I believe to be a question about the fundamental nature of matter, but the more I explore it, it just seems to be a meaningless question. The actual number of electrons required to stabilize a system is not a question we should really care about. The question we care about is whether or not our theories can predict that number. After all, in science, we are asking nature the questions, and nature gives us the answers. So in this case, nature has told us 8 electrons, so the answer is 8 electrons. I think that's one thing which is emphasized a lot more in physics than in chemistry. Nature is the arbiter. We simply try to rationalize the arbiter's decisions.

Why do atoms need 8 electrons to stabilize?

Now that's a question which can be answered by a theory! This can be answered in lots of detail or a little detail, but I get the feeling you are going to ask questions about why we don't just keep filling up the orbitals with more electrons? This is basically what you're asking about A.K.'s answer when saying,

what do you mean by energetically satisfied? How can an atom know if it is satisfied?

This leads us to perhaps the greatest disservice done to chemistry students in their classes: the habit of personifying chemical systems. Talking about the "desires" of the system makes it easier to understand when first learning, but this ought to quickly be abandoned (fluorine just loves electrons!). The answer to your question here is that the system doesn't know what it wants, and that is often a very good question to ask! These sorts of questions can be very productive when studying something like quantum entanglement. But, for the matter at hand, something simpler suffices. Chemical systems are dynamic. They are changing in time by colliding with other molecules, vibrating, rotating, absorbing photons and emitting photons, and doing all these things at once! So then, what it means for a system to be "energetically satisfied" is that all these things have found some kind of balance. It is perfectly possible that at any given moment some atom might lose an electron and another one picks it up, but again we must come back to what nature tells us. Nature says that when we have two atoms flying around, and one of them has seven electrons, that atom is going to take an electron from something else.
This need not be reserved for chemical systems though. In all of physics, we observe that systems tend towards their lowest energy state. This isn't dictated absolutely by some law, but rather it is a general rule. After all, we can find systems that aren't at the global minimum of their potential energy surface, but if the activation energy can be ignored, we will almost always find that system in its lowest energy state.
It's almost as if nature is probing these five, seven, and ten electrons states which you suggest, but simply does not stay there because that is not the way the world works. To be technical, systems tend towards equilibrium (you must convince yourself of this because the mathematics to show it can be involved), so when I find an atom with ten electrons, the forces in the system are out of balance. There might be eight positive charges in the nucleus, but ten negatively charged electrons. Thus, when something with seven electrons comes around, it is likely that system will take one of the extra electrons because this balances out the forces (as well as can be done in this example). Some kind of equilibrium has been established. This is obviously a simplistic example, but you could imagine then that if you had an ensemble of Avogadro's number of particles, that all these things would be exchanging their imbalances and staying around the equilibrium. This equilibrium, again, is observed to be the low energy state.
Concluding Remarks:
If and when you ever study quantum mechanics, you'll find that these things all arise quite naturally out of the theoretical framework laid there. When you find that angular momentum is quantized (and that the electron can have zero angular momentum), you naturally ask what this waving electron thing looks like (say 95% of the time). So, you plot this using the equations that you've found from your theory, and you get out the orbitals that we learn all about in chemistry classes. The next question leads into what you're asking here, both about the number of electrons each atom will naturally have around it, and about the relative stability of each of those cases. If you really want to be satisfied about those questions, study quantum mechanics. Otherwise, what we've said here ought to suffice. All in all, there comes a point when you either to need to look deeper, and be willing to grapple with some complicated ideas in quantum mechanics, or you need to give up on asking epistemological questions because the answer to those kinds of questions in science is almost always, "because mother nature says so."
Comment: I agree with jheindel... We observe what happens in nature and we construct sensible explanations to rationalize what we observe. Technically, a pertinent atom doesn't consciously "desire" 8 electrons, because it can't actually think. But for early education purposes, it's easier to think that they have this "desire". In other words, if we wanted, we could consider the $n$, $l$, $m_l$, and $m_s$ quantum numbers to rationalize our own constructed octet rule, but atoms know nothing of our constructed octet rule.
Comment: I think that the more you study science you will understand what I mean. Physics and chemistry are simply the act of doing experiments and explaining those observations. An experiment is just asking nature what is true. So, in that sense, there is definitely a "because mother nature says so." And you're right that nothing just happens, but I never said that...
Comment: thank you for an answer but I believe that everything has a reason behind it..even the most fundamental order of the universe has a **reason**. Nothing **just**  **happens**. There is no **Because mother nature says so**. But for this matter I think that I have to put this question on hold until I learn quantum mechanics as right now I am only a 10th grade student.
Comment: @jheindel i understand.But one day I believe I will find the answer.
Answer: Atoms generally do not need 8 electrons to stabilize.
Using quantum physics and its models of atoms and bonds we can define four quantum numbers. $n$ being principal quantum number describes the electron shell, $l$ being azimuthal number describes the orbital shape, $m$ being magnetic number describe degeneration of the orbital and $s$ being spin number describes the spin. Pauli's principle says that 2 electrons (fermion) cannot exist in the same (energetic) state and quantum numbers describe such energetic states of electron in the atom.
It was also found, that $n=1,\ldots,~ l=0,\ldots ,n-1, ~m=-l,\ldots,l,~s=\pm1/2$.
Another rule claims that electron is preferably in the state with lowest possible energy and therefore the states with lower $n$ are preferred before the others with similar energy.
Al this together we obtain the sequence of occupying the energetic levels as follows:
$$\rm 1s^2, 2s^2, 2p^6, 3s^2, 3p^6, 4s^2, 3d^{10}, 4p^6, 5s^2, 4d^{10}, 5p^6, 6s^2, 4f^{14}, 5d^{10}, 6p^6,\ldots$$
where number is principal quantum number, $\rm s,p,d,f$ stands for $l=0, 1, 2, 3$, respectively, superscript shows the count of available $m$ and $s$ pairs.
The atom is considered stable when all orbitals prior $n\mathrm s$ are fully occupied (noble gasses) and those electrons do not interact in chemical bonds. The electrons with highest $n$ beyond this limit are valence electrons and they can form chemical bonds. Their energies in the atom are highest. For example Lithium electronic configuration can be written as:
\begin{align}_3\ce{Li}&:\mathrm{1s^2\ 2s^1}\\ _3\ce{Li}&: [_2\ce{He}]\ \mathrm{ 2s^1}\end{align}
Now for the question, the most common atoms have valence electrons in $\rm s$ and $\rm p$ orbitals and 8 electrons can fill them up, That's why there is the "magic 8 rule" because only 4 atoms do not stabilise in 8-valence configuration:

Hydrogen stabilises in $_0\ce{H^+}$ or $\ce{_2H^{-}[_2He]}$ configuration;
Helium is stable as $\ce{_2He}$;
Lithium stabilises in $\ce{_3Li^{+}[_2He]}$;
Beryllium stabilises in $\ce{_4Be^{2+}[_2He]}$;
Boron stabilises in $\ce{_5B^{3+}[_2He]}$;
Carbon stabilises in $\ce{_6C^{4+}[_2He]}$ or $\ce{_6C^{4-}[_{10}Ar]}$

According the question in DraggyWolf's comment, why is not 1 electron per atom considered as stable?
Let's consider that energy electron relative to the core is zero when it is not bound. If proton ($\ce{H^+}$) accepts electron they form hydrogen and release $13.6~\rm  eV$ of energy (photon). Energy of electron in hydrogen atom is $-13.6~\rm eV.$ In case of Helium the energies are $-54.4$ and $24.6~\rm eV.$ For Lithium we obtain energy $-30~\rm eV$ for $\rm 1s^2$ state and $\rm -5 eV$ for $\rm 2s^1$.
It is clearly seen how strong the core-electron bond near the core is and that it neglect the electron-electron repulsion - The core with all positive charge is "located" in space 23,000 - 145,000 times smaller that whole electron cloud.
Answer: My 2 cents: as noted by others, the stability is really only there for n = 1, 2 and 3, beyond that the situation becomes complicated (and He has only 2 electrons, so really we are only talking about neon and argon).
That means that the orbitals in question are: 1s, 2s, 2p, 3s and 3p. For each possible occupation of these orbitals by up to 18 electrons, energy levels can be obtained for the system as a whole. It's important to remember that only discrete energy levels exist.
Turns out that energy levels within the two periods are minimal, respectively, for electron configurations $1s^2 2s^2 2p^6$ and $1s^2 2s^2 2p^6 3s^2 3p^6$.
Incidently, that's 8 electrons in the outer shell.
As for the other questions:
And what does stabilization of atoms even mean? - In this context, it means that certain atoms are more likely to give up or take additional electrons, nothing else. It does not describe a switchlike situation - "is it stabilized or not", it only says that some are more stable that others.
Why do atoms need 8 electrons to stabilize? I mean why not 7 or 5 or 10 electrons? Why specifically 8? - This is already answered - different electron configurations have different stability.
Are the atoms going to burst without 8? - No.
Why do they need 8 electrons? - They try to obtain it because in that configuration, they have the maximum possible stability (in other words, minimum energy).
Answer: The octet rule is overcomplicated.
Real answer is - for many organic chemistry-relevant atoms, a shell with 8 electrons is by far the one with low energy state if one performs the quantum mechanical calculations.
However, the octet rule doesn't apply for other types of elements.
Comment: Why aren't atoms on the lowest energy with only 1 electron?And what does being on lowest energy have to do with the stabilization of atoms?
Comment: @Adi Sorry, I cant explain this better.
Comment: this does not answer the question in any meaningful way. You effectively say , its 8 because its 8.
Comment: and so down vote. What are ' organic-chemistry relevant atoms'. Not just C, what about H (1 electron) , S, P and many metals. Are not chlorophyll (with a Mg atom) and vitamin B12 (with Cobalt) not organic molecules?
Answer: Please excuse my rather layman reply, my specialism is not in chemistry or physics, but I felt this question is asking more why than how.
Why do atoms need 8 electrons to stabilize? I mean why not 7 or 5 or 10 electrons? Why specifically 8?
I suspect this more has to do with the fact that force is equalised. Even numbers. An odd number would suggest an unpaired electron which would suggest an unstable state. Think of it like having two cars pushing against each other evenly, or two equally attracted magnets. I don't think anyone knows why it's specifically 8, as opposed to 6 or 4 or 2.
And what does stabilization of atoms even mean?
It means they are in a low energy state. A high energy state is where an atom holds a potential to react. Take for example sodium - when introduced to water it reacts violently and explodes. That is because, in simplistic terms, it transfers electrons between sodium and water. When an atom achieves 8 electrons, there's no more electrons for it to gain or lose (IE if it was less than 8 it would have to gain additional electrons from some other material, and more than 8, it could lose some - essentially a reaction would occur).
So when we say stabilisation has occurred, we are essentially saying that conventionally the atom won't react. It has become stable.
Are the atoms going to burst without 8?
The atom itself won't burst, per se, but like in the example, the sodium will.
Edit: Not sure why the downvotes. No feedback, no correction. Electron transfer produces reactions:
https://en.wikipedia.org/wiki/Electron_transfer
https://en.wikipedia.org/wiki/Redox
Comment: The downvotes (at least mine) is because of the very unscientific answer that simplifies in the wrong direction, states wrong facts etc.
Comment: While I agree that this is not helpful, I do not agree, that it formally does not qualify as an answer. Such answers should be down votes, but not deleted.
Comment: Your centering around eight electrons being stable. It is not as simple as that. In some cases, eight electrons are stable, in others they simply are not. *Stable* in itself is also a highly problematic term implying thermodynamic stability, which is only really true for the most stable state of a given element. On the other hand there are metastable states, which don't react for quite some time, no matter whether they have eight, seven or a different number of electrons per atom. Also, quantum mechanics tell us very clearly why eight is stable and not six, four or ten.
Comment: @Jan I upvoted your honesty, but what facts are wrong or unscientific? Do not chemical reactions result due to electron transfer, which is often due to a difference in the number of electrons in given shells, and thus the energy differential transfers, that is, the reaction occurs as a result of the energy attempting to equalise? And if so, would not a stable set of 8 electrons be a result of an atom reaching it's energy resting point?