Answer should have been changed to wiki

Question: When the question for my answer here was changed to CW, I think my answer should have been made CW as well.
Answer: It's not retro-active. I'm not sure it should be. If you provide an answer that was thoughtful, constructive, and helpful to many other people, you should be allowed to accept up-votes and in turn receive reputation. This should all happen regardless what the OP does with his question.
Comment: Yeah, it's up to the poster. The only time that I know of that forces a non-wiki answer to a wiki answer is when the post accumulates 30+ answers.
Comment: I see, okay.  I thought it was one CW all CW by rule. :)
Comment: @JP It is if the question is CW'd before any answers.
Answer: Existing answers aren't changed to CW when the question is. It's up to the OPs to change them - though I think the moderators can go in and change them manually too.
Comment: If a Moderator goes in and forces a question to CW, it auto-forces all the answers as well. I think you can actually do a forced-cw on a question that is already CW and it will still auto-force the remaining answers that aren't cw to switch as well (haven't tried)
Comment: I was thinking of the mods changing the old answers - but thanks for the info
Comment: That's not the case anymore. Existing answers are now made CW when the question is. However, this wasn't retroactively added to older posts, so you may see old CW questions with non-CW answers.
Answer: As other noted, the only "wiki-hammer" occurs when a question reaches 30 answers and is not already community wiki. At that point the Q and all As are forced into wiki.
Thus, any poster can opt in to wiki at the time of post, without affecting any other questions or answers.
(it is not possible to opt out of wiki, ever, though.)

Answer should have been changed to wiki


Is the Knight Bus unique?

Question: Just what it says in the title.  Are there any other rival brands of the Knight Bus, or just one?  Is it the only weird bus thingy like that?
Comment: Do you mean specifically in Harry Potter or in any piece of fiction?
Comment: @Towell Specifically in HP
Answer: It probably is unique (at least in Britain).
From Pottermore:

The Knight Bus is a relatively modern invention in wizarding society, which sometimes (though it will rarely admit it) takes ideas from the Muggle world. The need for some form of transportation that could be used safely and discreetly by the underage or the infirm had been felt for a while and many suggestions had been made (sidecars on taxi-style broomsticks, carrying baskets slung under Thestrals) all of them vetoed by the Ministry. Finally, Minister for Magic Dugald McPhail hit upon the idea of imitating the Muggles' relatively new 'bus service' and in 1865, the Knight Bus hit the streets.

Note the singular: only one Knight Bus hit the streets in 1865. However, this doesn't preclude the possibility that more Knight Buses were commissioned in the next 150 years.
Perhaps an even more important piece of evidence is that during Harry's short journey on the Knight Bus in Prisoner of Azkaban, it stops at a lot of different places in quick succession:

"Where are we, Ern? Somewhere in Wales?" [...] "We'll be in Abergavenny in a minute." [...] the bus moved abruptly from Anglesea to Aberdeen

If there was more than one Knight Bus in Britain, one would expect them to be regionally separated. The fact that this one bus travels between Wales, Scotland, and London within a span of minutes suggests that it's the only one in the country.

As usual in the Harry Potter series, though, everything is very UK-centric. It was the British Ministry for Magic that commissioned the Knight Bus, and the bus we see still seems to be confined to Britain. Whether other countries followed suit in developing magical bus services is unknown, but certainly plausible.
Comment: The first motor bus was created in 1895, so they wouldn't have been in the form they are now. Of course, with magic, that doesn't necessarily mean anything.
Comment: I know this is canon, but this early date seems inconsistent (1965 would make more sense). It would mean that the Knight bus would have to be updated to the more modern busses several times through the century. Also, what is a wizards' version of a horse-drawn bus? How's that different from a regular carriage they're already using anyways (many, not just one)? Unless they had an imitation of a motorized bus (self-driving carriage) before muggles did. But that isn't really muggle-inspired then, is it?
Answer: Given a reasonable estimate of the wizarding population of Great Britain being three to ten thousand, the availability of more convenient methods of travel, and the relative efficiency of the Knight Bus compared to Muggle public transport, it seems unlikely that more than one would be needed.
Many Muggle towns of that size (at least in my part of the world) have no public transport whatsoever.
Comment: The UK has a much much better public transport system than your part of the world (NZ, from your profile?). When I was in South Island a couple of years back, I was shocked by how few buses and trains there were. But +1 for a good point which I hadn't thought of.
Comment: @randal'thor: true, and if I use London as the model, on a per-capita basis I estimate there should be 3 to 9 wizarding buses.  But given how much faster the Knight Bus is than a Muggle bus, how unpopular it seems to be relative to other methods of magical transport, and taking economy of scale into account, I'm still of the opinion that one is all they need. :-)

Is the Knight Bus unique?


Is there a fast way to get to the bottom of the Death Star?

Question: In Tiny Death Star, you can get to the top of your tower by tapping on the top of the screen while avoiding the "Add Level" button. However, the only way I can find to go to the bottom of the tower is to wait for someone to want an elevator ride, and tap on the button to give them that ride. Is there any other hot-spot for getting to the bottom of your Death Star?
Answer: Sadly, no.  I wish there were.  At least one does not exist on the iOS version.
Answer: As a workaround, I just keep my Mos Espa Cafe on the 2nd floor vacant. It just doesn't make enough money to be worth staffing. So I have a permanent "!" button which takes me to the lowest non-stocked floor - which will always be Level 2.
Comment: My only problem with this method is that it takes away the function of the ! Button for finding the other levels that need attention.
Comment: RE: Dang Khoa, That's why I've been using all of my upgrading bitizens on "The Catina & Mos Espa Cafe" I mean sure the stock only goes up a bit, but once you have the upgrade rank at 10 it defiantly pays off. Your method is tempting but I'm already rank 7 on both these levels and I quite like fast stocking as I play the game for hours on end.
Answer: Yes. Hold down one finger while tapping another in the direction you want to travel. The screen will move the distance between your fingers, as fast as you can tap. Alternatively, you can tap and hold one finger, tap and hold another finger, release the first, then release the second finger. If done rapidly, the game will scroll the full distance in the direction from first to second tap - all the way up or all the way down.
Comment: I'm not able to repeat your instructions. I'm on an android, and i think it's the latest version as of this comment, but i can't replicate your results.


SQL column containing array of table row values

Question: I'm quite new to databases and SQL. I have an assignment, but I don't know how to solve this.
Let's say I have table named Persons. It has following columns: userId (primary key), userName and tags.
Tags is another table, containing only id and tagName. Person can have multiple tags, for example: "football", "cooking" etc.
Each tag corresponds to Tag table row. But I'm not sure how to achieve this kind of relation. How can I achieve this?
I'm guessing it has to something to do with foreign keys and making persons tag column an array of foreign keys.
Answer: You normally want to have a relation table (this is called a many-to-many relationship, or M:M).
Persons(id int, name varchar(40)...)

Tags(id int, name varchar(40)....)

PersonTags(id int,
           personid FOREIGN KEY References Persons(id),
           TagId FOREIGN KEY references Tags(id))

This way you can have as many or as few tags as you like, but the tag data isn't stored in-row for the person.  You could potentially store a series of values in a single field, but this is a really terrible idea for a variety of reasons.
Comment: What are the reasons that this is a terrible idea?
Comment: just complementing @JNK's answer.
you can create your foreign key to PERSONS with ON DELETE CASCADE option, which means that when a person is deleted, all tags belonging to it (the record on PersonTags), will be deleted too, but nothing will happen to the TAG itself on the Tags table


Are there any bounded linear operators on a Hilbert space such that its spectrum is exactly the unit circle?

Question: It is known that the spectrum of unitary operators is contained within the unit circle, but what are some operators that have the unit circle (not the unit disk) as their spectra? I'm particularly interested in examples in infinite dimensional Hilbert spaces.
Comment: @KaviRamaMurthy how do you understand isometry in this context? An invertible isometric linear map is automatically unitary. But if the map is not invertible, then $0$ is in the spectrum.
Answer: The standard trick to make an operator $T$ on $\ell^2$ (or some other separable Hilbert space) with a given compact subset $S$ of $\mathbb C$ its spectrum is to make an operator with eigenvalues a countable dense subset of $S$.
For unitary operators, the spectrum is, in any case, both discrete and continuous, a subset of the unit circle. One example of a countable dense subset $X$ of the unit circle is to enumerate rational numbers $r_n$ in $[0,2\pi)$, and take $X=\{e^{2\pi ir_n}:n=1,2,\ldots\}$, and $Te_n=e^{2\pi ir_n}$ with standard basis elements $e_n$ of $\ell^2$.
Since the spectrum of $T$ is closed, it contains at least the closure of the set $X$, namely, the unit circle. Since the spectrum of a unitary operator is contained in the unit circle, the spectrum of $T$ is exactly the unit circle.
Answer: Let $H=L^2([0,2\pi])$, and define $T:H\to H$ by $$Tf(t)=e^{it}f(t).$$


Every (general) finite dimensional banach space has compact unit ball

Question: I was trying to prove that the closed unit ball $B$ is compact if and only if the space is finite dimensional. I have already shown that if the space is infinite dimensional, then the closed unit ball is not compact. My trouble is in proving the reverse direction. My idea was to use the fact that if V is the fin-dim Banach space, then there is an isomorphism $T:V\rightarrow \mathbb{R}^{n}$. If I can show that T is a homeomorphism, then I could use the fact that $T$ is bounded to show that $T(B)$ is bounded. $T(B)$ would also necessarily be closed meaning we can use Heine-Borel to say that $T(B)$ is compact. And then $T^{-1}T(B)=B$ must be compact as well. However my trouble lies in showing $T$ is bounded. Most proofs that I saw invoke equivalence of norms but to prove equivalence of norms in an arbitrary fin-dim Banach space I would need to somehow show that the closed unit sphere is compact. I know in $\mathbb{R}^{n}$ the closed unit sphere is compact by Heine-Borel but I'm not sure if that generalizes to arbitrary finite dimensional banach spaces without using the fact that there is an homeomorphism to $\mathbb{R}^{n}$ which is what I am trying to prove in the first place.
Comment: @JulioPuerta I guess in some sense that is what I am trying to prove no?, that in this case T is a homeomorphism. Could you refer to me a proof of the existence of such a topological isomorphism?
Answer: Here are two options. The first option is to prove that if $(V, \|\cdot\|_{V})$ is a real finite-dimensional Banach space of dimension $n$ with a basis $\{v_{1}, \ldots , v_{n}\}$, then $\|\cdot\|_{2}:V\to\mathbb{R}$ defined by
$$\left\| \sum_{i=1}^{n}\alpha_{i}v_{i} \right\|_{2} := \left( \sum_{i=1}^{n}|\alpha_{i}|^{2} \right)^{1/2}$$
is a norm on $V$ equivalent to $\|\cdot \|_{V}$. To show that there is some $C\in (0, \infty )$ such that $\|x\|_{2} \leq C\|x\|_{V}$ for all $x\in V$, this can be done by showing that if $\{e_{1}, \ldots , e_{n}\}$ is the standard basis for $\mathbb{R}^{n}$, the map $\phi :(V, \|\cdot\|_{2})\to (\mathbb{R}^{n}, \|\cdot\|_{\mathbb{R}^{n}})$ given by
$$\phi \left( \sum_{i=1}^{n}\alpha_{i}x_{i} \right) = \sum_{i=1}^{n}\alpha_{i}e_{i}$$
is a vector space isomorphism which is continuous in both directions. You can apply the Heine-Borel theorem in $(\mathbb{R}^{n}, \|\cdot\|_{\mathbb{R}^{n}})$ to continue the proof. This proves that all norms on $V$ are equivalent, and from there you can show that any linear map $T:V\to\mathbb{R}^{n}$ is continuous.
A second option is to first show that all norms on $\mathbb{R}^{n}$ are equivalent in a method similar to the one above. Then if $T: \mathbb{R}^{n} \to V$ is a vector space isomorphism, for any norm $\|\cdot\|_{V}$ on $V$, the map $\rho :\mathbb{R}^{n}\to\mathbb{R}$ defined by $\rho (x) := \|T(x)\|_{V}$ is a norm on $\mathbb{R}^{n}$ which is equivalent to the standard norm on $\mathbb{R}^{n}$. So there are $C_{1}, C_{2} \in (0, \infty )$ such that for all $x\in \mathbb{R}^{n}$,
$$C_{1}\|x\|_{\mathbb{R}^{n}} \leq \|T(x)\|_{V} \leq C_{2}\|x\|_{\mathbb{R}^{n}}.$$
From there, it can be shown that $T$ is a homeomorphism, which allows you to conclude your proof.


White smoke coming from dash when I accelerate above 60 and steams up the windshield when I accelerate it up to 30 or 35 any advice would help thanks!

Question: My 03 Chevrolet s10 extreme 4.3L is sending White smoke through my air vents and from under my dash, also is steaming up the windshield when I accelerate my tuck above 60 but when I'm accelerating to 30 or 35 around town it doesn't smoke it just streams up the windshield the smoke has a burnt rubber smell to it also I don't have my air on when this happens, it's currently running on five cylinders due to a misfire in cylinder three but I wouldn't think that would make smoke come out of the vents and underneath the dash and just today it wanted to bog down and not really accelerate any advice on what it could be would help thanks!
Comment: Welcome to Motor Vehicle Maintenance & Repair! Is this with or without the AC on?
Comment: Not trying to be critical, you have smoke or steam in the cab and a bad misfire, what else may be ready to break? Are your brakes in decent shape? Maybe you should get this thing off the road until you have a chance to look into the safety issues.
Comment: @Paulster2 it's without the A/C on
Answer: Your truck has a leak in the heater core. Engine coolant is circulated through the core to provide heat to the cab. Most vehicle heaters circulate coolant through the heater core even when the heater is turned off.
It's unlikley that the core can be repaired, 'tho a radiator shop would be the place to ask. I am not familiar with the heater and dash design in this vehicle, but it's also likely that the dash will have to be removed in order to access, remove, and replace the heater core.
There are undoubtedly stop-leak products available that promise to take care of the problem. Were it my vehicle, I wouldn't put that sort of product in the motor's cooling system.


How does physics scattering experiments relate to real life? And what does the scientist gain from such experiments?

Question: How does physics scattering experiments relate to real life? And what does the scientist gain from such experiments? I am having a hard time figuring the answer out. Please help.
Comment: They relate to real life in that it is an age-old technique of figuring out how stuff works: You poke it, throw stuff at it and smash it together. :D
Comment: @Lagerbaer You poke it *with a stick*. With a ***stick***, man! Lest you discover that you're really doing biology when the subject tried to bite you arm off or chemistry when you discover that your finger has dissolved.Throwing stuff at it is, of course just fine.
Comment: They make experiments to *validate the theory*, which contains quantities like scattering angles. If experiments and theory agree, then the theorists might be on the right track. In that case, they use the theories to predict novel behavior so they can test new things. At some point, someone gets an idea for an application and in the end you get a better iPod. Do you know how a touch pad works? It's pretty cool.
Answer: Depending on how you define scattering, its not only scientists who do these experiments, it is you, especially your eye.
Most likely you are referring to things like Rutherford backscattering or what is done at CERN, DESY, LHC & Co.?
In the end, the entire world can be seen as particles that are getting scattered by each other. E.g. electrons on atomic nuclei, cosmic radiation (i.e. "weird" particles) on atoms, and sunlight (i.e. photons) on you.
Physicists like those individual scattering experiments because they allow to isolate and study one of those myriads of possible scattering events that happen all the time. In such controlled environments, they can compare theory with reality/experiment.
E.g. suppose you have a theory on what an electron and a proton are, and how they behave. Then you just shoot one on the other (under various angles, with various energies, etc.) and look whether the results are according to theory (which is good) or not (which is likewise good as this will lead to an improved theory or even overthrow fundamental concepts, both are seen as scientific progress).
Without the understanding from such experiments things like a transistor would not have been possible. Without a transistor, you would not have an iPod/Pad, no Mac/PC, no internet, ...
Actually, the physicist Werner Heisenberg, in his later years, even tried to model a theory of everything based on nothing else but scattering (S-Matrix, where "S" stands for ...).
Comment: It's not just Heisenberg--- S-matrix theory is nowadays called string theory. This is one of Heisenberg's great ideas, that the S-matrix is the only true observable in flat space, and all others are reconstructions. It's only a slight generalization to relativistic systems of Heisenberg's energy basis.


Splitting shapefile into separate shapefiles based on feature class using Arcmap 10.3?

Question:
I'm trying to split up this nested watersheds by name.  I want each watershed to be it's own shapefile.  Is there a faster way to do this besides highlighting each watershed and then exporting it?  I'm using Arcmap 10.3.
Answer: Arcpy is excellent for this. What you want is two loops: one to build a list of watersheds from the name field, and then one to select each watershed by turn, and then copy it to a new output shapefile.
Here's some code I wrote to solve this problem. It's intended as a custom script in the Toolbox, but you could modify it for one shot. Or feel free to bring it into the Toolbox if you want to use it for other projects.
I would also recommend looking through the ArcPy documentation - there are a lot of ways to automate the yak-shaving parts of GIS if you do your research.
<code>import arcpy, time, os, traceback
from arcpy import env

#set parameters
# SplitFeat - input features
SplitFeat = arcpy.GetParameterAsText(0)
# SplitField - input field
SplitField = arcpy.GetParameterAsText(1)
# OutLocation - output folder
OutLoc = arcpy.GetParameterAsText(2)
#MaxSplit = Maximum number of files to create
MaxSplit = int(arcpy.GetParameterAsText(3))
# Overwrite output

#try loop
try:

    IndNum = 0

    arcpy.MakeFeatureLayer_management(SplitFeat, "Split_lyr")
    CatList = []
    CodeList = []
    FldList = (SplitField)
    with arcpy.da.SearchCursor("Split_lyr", SplitField) as cursor:
        for row in cursor:
            if row[0] not in CatList and IndNum < MaxSplit:
                AttString = str(row[0])
                print AttString
                CatList.append(AttString)
                CodeString = ''.join(e for e in AttString if e.isalnum())
                CodeList.append(str(CodeString))
                IndNum = IndNum + 1
            elif IndNum == MaxSplit - 1:
                arcpy.AddMessage(
                "{0} classes identified. Proceeding with script.".format(MaxSplit))
                break

    #splitting features
    #new iteration number
    IterNum = 0
    for Cat in CatList:
        CodeName = CodeList[IterNum]
        ClassName = CodeName[0:30]
        ClassFile = os.path.join(OutLoc, ClassName)
        arcpy.AddMessage("Creating file {0}...".format(ClassFile))
        #select by attributes
        SelClause = "{0!s} = '{1!s}'".format(SplitField, Cat)
        arcpy.SelectLayerByAttribute_management("Split_lyr", "NEW_SELECTION", SelClause)
        #Copy features, using CodeList index as key
        arcpy.Select_analysis("Split_lyr", ClassFile)
        #arcpy.CopyFeatures_management("Split_lyr", ClassFile)
        arcpy.AddMessage("{0} has been created.".format(ClassFile))
        IterNum = IterNum + 1

except Exception:
    e = sys.exc_info()[1]
    arcpy.AddError(e.args[0])
    arcpy.AddMessage("ERROR! \n Call Stack: " + traceback.format_exc())
</code>


Mockito verifying method calls

Question: I'm trying to learn how to use Mockito and i'm hung up on how to go about verifying a method on a certain object was called X amount of times.
I have the following test code
verify(record, times(1)).setValue(Mockito.any(String.class),Mockito.any(String.class));

and the following piece of production code i'm trying to test
The string[]'s i'm setting up to iterate through
protected String[] columnNames = {"_id", "created_at", "updated_at", "name"};
protected ColumnType[] columnTypes = {ColumnType.INTEGER, ColumnType.TIMESTAMP, ColumnType.TIMESTAMP, ColumnType.TEXT};

and the production code that's in a loop, iterating through the String[]
for (int i = 0; i < columnCount; i++) {

            if (columnNames[i].equals("_id")) {
                record.setId(cursor.getInt(0));
            } else {

                switch (columnTypes[i]) {
                    case BOOL:
                        record.setValue(columnNames[i], cursor.getInt(i));
                        break;
                    case TEXT:
                        record.setValue(columnNames[i], cursor.getString(i));
                        break;
                    case INTEGER:
                        record.setValue(columnNames[i], cursor.getInt(i));
                        break;
                    case TIMESTAMP:
                        record.setValue(columnNames[i], cursor.getLong(i));
                        break;
                    case LONG:
                        record.setValue(columnNames[i], cursor.getLong(i));
                        break;
                    case DOUBLE:
                        record.setValue(columnNames[i], cursor.getDouble(i));
                        break;
                    default:
                        record.setValue(columnNames[i], "");
                        break;
                }
            }
        }

And this is the error i get

testDataSourceCanFindRecord(com.test.app.DataSourceTest)  Time
  elapsed: 0.081 sec  <<< FAILURE!
  org.mockito.exceptions.verification.TooManyActualInvocations:
  customer.setValue(, ); Wanted 1 time:
  -> at com.test.app.DataSourceTest.testDataSourceCanFindRecord(DataSourceTest.java:141)
  But was 3 times. Undesired invocation:
  -> at com.test.core.DataSource.cursorToRecord(DataSource.java:210)

I'm expecting record.setValue(String key, String value) to be called once because of the "name" field in the String[]. What's happening is Mockito is registering record.setValue(String key, Long value) as the same thing as record.setValue(String key, String value), which is incorrect. Line 210 is the setValue in the TIMESTAMP case. How can i correct this?
Comment: How do you create the `cursor`? I think it would be much easier to use real `record` object without mocking and verify that the values are correct after setting them from cursor.
Comment: I'm mocking the cursor. I'm mocking everything except the DataSource class that's being tested. I'm still trying to figure out what to mock and what not to
Answer: If you look at the source code for InvocationMatcher, it looks like the logic to check method equality is a little more generous than you might think, and could ignore method overloading in some circumstances.
I'm not 100% sure, but try replacing any(String.class) (which accepts any object of any type) with isA(String.class), which will filter out invocations where that parameter is not a String. (anyString only checks its type in Mockito 2.0 and beyond.) Counterintuitively, any(Foo.class) does not mean "anything as long as it's a Foo", it means "anything". This is due to change in Mockito 2.0.
Of course, you could also tighten up your verification so it checks that the key or value is equal to an expected value, but I'm not sure how possible that is in your case.

Mockito verifying method calls


Ways to create a Set in JavaScript?

Question: In Eloquent JavaScript, Chapter 4, a set of values is created by creating an object and storing the values as property names, assigning arbitrary values (e.g. true) as property values. To check if the value is already contained in the set, the in operator is used:
var set = {};

if (!'Tom' in set) {
  set.Tom = true;
}

Is this idiomatic JavaScript? Wouldn't be using an array even better?
var set = [];

if (!'Tom' in set) {
  set.push = 'Tom';
}

Comment: FYI, you need parens: `if(!('Tom' in set))`. Currently it means `false in set` since `!'Tom' === false`.
Comment: How would you expect an array for which `'Tom' in set` is true to look like? It looks a lot like you have wrong assumptions about *something*, and I'm trying to find out *about what*.
Comment: ES6 has sets, see John's answer below
Answer: Sets are now available in ES2015 (aka ES6, i.e. ECMAScript 6). ES6 has been the current standard for JavaScript since June 2015.

ECMAScript 6 has the data structure Set which works for arbitrary
  values, is fast and handles NaN correctly. -Axel Rauschmayer, Exploring ES6

First two examples from Axel Rauschmayer's book Exploring ES6:

Managing single elements:

> let set = new Set();
> set.add('red')

> set.has('red')
true
> set.delete('red')
true
> set.has('red')
false

Determining the size of a Set and clearing it:

> let set = new Set();
> set.add('red')
> set.add('green')

> set.size
2
> set.clear();
> set.size
0

I would check out Exploring ES6 if you want to learn more about Sets in JavaScript. The book is free to read online, but if you would like to support the author Dr. Axel Rauschmayer you can purchase the book for around $30.
If you want to use Sets and ES6 now you can use Babel, the ES6 to ES5 transpiler, and its polyfills.
Edit: As of June 6th, 2017 most of the major browsers have full Set support in their latest versions (except IE 11). This means you may not need babel if you don't care to support older browsers. If you want to see compatibility in different browsers including your current browser check Kangax's ES6 compatibility table.
EDIT:
Just clarification on initialization. Sets can take any synchronous iterable in their constructor. This means they can take not just arrays but also strings, and iterators. Take for example the following array and string initialization of a set:

const set1 = new Set(['a','a','b','b','c','c']);
console.log(...set1);
console.log(set1.size);
const set2 = new Set("aabbcc");
console.log(...set2);
console.log(set2.size);

Both outputs of the array and string are the same. Note that ...set1 is the spread syntax. It appears that each element of the iterable is added one by one to the set, so since both the array and string have the same elements and since the elements are in the same order the set is created the same. Another thing to note about sets is when iterating over them the iteration order follows the order that the elements were inserted into the set. Here's an example of iterating over a set:

const set1 = new Set(['a','a','b','b','c','c']);
for(const element of set1) {
  console.log(element);
}

Since you can use any iterable to initialize a set you could even use a iterator from a generator function. Here is two such examples of iterator initializations that produce the same output:

// a simple generator example
function* getLetters1 () {
  yield 'a';
  yield 'a';
  yield 'b';
  yield 'b';
  yield 'c';
  yield 'c';
}

// a somewhat more commonplace generator example
// with the same output as getLetters1.
function* getLetters2 (letters, repeatTimes) {
  for(const letter of letters) {
    for(let i = 0; i < repeatTimes; ++i) {
      yield letter;
    }
  }
}

console.log("------ getLetters1 ------");
console.log(...getLetters1());
const set3 = new Set(getLetters1());
console.log(...set3);
console.log(set3.size);

console.log("------ getLetters2 ------");
console.log(...getLetters2('abc', 2));
const set4 = new Set(getLetters2('abc', 2));
console.log(...set4);
console.log(set4.size);

These examples' generator functions could just be written to not repeat, but if the generator function is more complicated and as long as the following doesn't impact performance too negatively you could use the Set method to help get only values from a generator that don't repeat.
If you want to know more about sets without reading Dr. Rauschmayer's chapter of his book you can check out the MDN docs on Set. MDN also has more examples of iterating over a set such as using forEach and using the .keys, .values, and .entries methods. MDN also has examples such as set union, set intersection, set difference, symmetric set difference, and set superset checking. Hopefully most of those operations will become available in JavaScript without needing to build your own functions supporting them. In fact, there is this TC39 proposal for new Set methods which should hopefully add the following methods to Set in JavaScript at some future point in time if the proposal reaches stage 4:

Set.prototype.intersection(iterable) - method creates new Set instance by set intersection operation.
Set.prototype.union(iterable) - method creates new Set instance by set union operation.
Set.prototype.difference(iterable) - method creates new Set without elements present in iterable.
Set.prototype.symmetricDifference(iterable) - returns Set of elements found only in either this or in iterable.
Set.prototype.isSubsetOf(iterable)
Set.prototype.isDisjointFrom(iterable)
Set.prototype.isSupersetOf(iterable)
Comment: @LanceKind I added some additional information including showing that you can initialize sets with any iterable not just arrays.
Comment: Also Set's themselves are iterable, so you can initialize sets with other sets to make a copy or do something like new Set([...setA, ...setB]) for a union operation.
Answer: I use dict objects as sets.  This works with strings and numbers, but I suppose would cause problems if you wanted to have a set of objects using custom equality and comparison operators:
Creating a set:
var example_set =
{
    'a':true,
    'b':true,
    'c':true
}

Testing for inclusion in a set
if( example_set['a'] ){
    alert('"a" is in set');
}

Adding an element to a set
example_set['d'] = true;

Removing an element from a set
delete example_set['a'];
Comment: The code I was working on was using an older version of the engine which did not have support for `Set`. This helped.
Comment: If you used TypeScript, what type would you use for `example_set`?
Comment: @PlsWork `Record` is the best way to go I believe
Answer: Sets do not allow duplicate entries and don't typically guarantee predefined ordering.  Arrays do both of these, thus violating what it means to be a set (unless you do additional checks).
Comment: Array doesn't filter duplicate entries... for example arr.push({id:1, name: "Jake"}) like as NSSet in Objective-C :)
Comment: If you take it mot-a-mot, no. But you can just use the id as the array (map) key.

`arr[id] = {"name": "Jake"};`
Answer: The first way is idiomatic JavaScript.
Any time you want to store a key/value pair, you must use a JavaScript object. As for arrays, there are several problems:

The index is a numerical value.
No easy way to check to see if a value is in an array without looping through.
A set doesn't allow duplicates. An array does.
Comment: It is possible to remove duplicate elements from JavaScript arrays. http://stackoverflow.com/a/12166248/975097
Comment: What would be best to assign to the property value?
Answer: If you want to create a set from an array, simply do:
let arr = [1, 1, 2, 1, 3];
let mySet = new Set(arr); // Set { 1, 2, 3 }

This is a sugar syntax that I quite fancied when programming in Python, so glad that ES6 finally made it possible to do the same thing.
NOTE: then I realize what I said didn't directly answer your question. The reason you have this "hack" in ES5 is because lookup time in an object by keys is significantly faster (O(1)) than in an array (O(n)). In performance critical applications, you can sacrifice this bit of readability or intuition for better performance.
But hey, welcome to 2017, where you can use proper Set in all major modern browsers now!
Answer: Sets in ES6/ES2015:
ES6/ES2015 now has built in sets. A set is data structure which allows storage of unique values of any type, whether this are primitive values or object references. A set can be declared using the ES6 built in set constructor in the following manner:
const set = new Set([1, 2, 3, 4, 5]);

When creating a set using the Set constructor our newly created set object inherits from the Set.prototype. This has all sorts of auxiliary methods and properties. This allows you to easily do the following things:
Example:

const set = new Set([1, 2, 3, 4, 5]);

// checkout the size of the set
console.log('size is: ' + set.size);

// has method returns a boolean, true if the item is in the set
console.log(set.has(1));

// add a number
set.add(6);

// delete a number
set.delete(1);

// iterate over each element using a callback
set.forEach((el) => {
  console.log(el);
});

// remove all the entries from the set
set.clear();

Browser compatibility:
All major browser now fully support sets except IE where some features are missing. For exact reference please refer to the mdn docs.
Comment: @Velojet: Ok, fair enough.
Answer: There are two problems with using bare javascript objects to emulate sets: first, an object can have an inherited property which would screw the "in" operator and second, you can only store scalar values in this way, making a set of objects is not possible. Therefore, a realistic implementation of Sets should provide methods add and contains instead of plain in and property assignments.
Comment: @kojiro: objects are converted to strings when used as keys: `set={};set[{x:1}]=123;alert(set[{z:99}])`
Answer: You can try Buckets, is a javascript data structure library and has everything you need to manipulate sets.
Comment: do it provide an addAll(array) method?
Answer: Basic creation and usage of Set object
let mySet = new Set()

mySet.add(2)         // Set {2}
mySet.add(7)         // Set {2, 7}
mySet.add(7)         // Set {2, 7}
mySet.add('my text') // Set {2, 7, 'my text'}
let myObj = { a: 1, b: 2 }
mySet.add(myObj)     // Set {2, 7, 'my text', {...}}
mySet.has(2)         // true
mySet.has(myObj)     // true
mySet.size           // 4

Iteration
for (let item of mySet) console.log(item)  // 2, 7, 'my text', {a:1, b:2}
mySet.forEach(value => console.log(value)) // 2, 7, 'my text', {a:1, b:2}

Convert to array
var myArr = Array.from(mySet)             // [2, 7, 'my text', {a:1, b:2}]

❕ The most distinct feature Set offers is every value in Set object must be
  unique. So you can not add duplicate values.

Ways to create a Set in JavaScript?


Is Stack Overflow really beneficial to beginners in programming?

Question: I find it quite discouraging. So many restrictions. The people are very stern. It helps sometimes but a beginner can't really be a part of the active community.
Please give your thoughts.
Comment: Skill at asking questions or using this site is entirely orthogonal from programming skill.  Just because you're new to programming doesn't mean you don't know how to ask a good SO question.  Just because you have a lot of programming skill doesn't mean you *do* know how to ask a good SO question.
Comment: possible duplicate of [Could we please be a bit nicer to new users?](http://meta.stackexchange.com/questions/9953/could-we-please-be-a-bit-nicer-to-new-users)
Comment: Related: http://meta.stackexchange.com/questions/242536/why-these-annoying-restrictions
Comment: After reading the question, I find your comment a bit ironic.
Comment: @DamanArora if you meant my comment, then SO is beneficial to any programmer, although it is not tutorial site and the linked question gives a lot of thoughts and pros/cons on the subject. And this http://meta.stackoverflow.com/questions/251758/why-is-stack-overflow-so-negative-of-late question somehow explains why it is not a tutorial site and why members don't want it to become one (at least it is how I read both questions)
Answer: Stack Overflow is not a resource to teach people how to program. It is meant for solving programming problems, not for teaching programming. So as far as that's concerned, no, it's not a good resource for that. But that's also not a problem, because that's the point.
And I disagree that beginners can't be a part of the community. You only need one good question or answer, and you can start joining chat rooms or posting comments.
But regardless of that, you have to remember just how many users we're talking about: millions. If we allowed millions of people unlimited access to anything that happens on the site, well, that'd become a mess. So by limiting by reputation, we're able to hold off on some advanced features and reduce the load on servers for only the users who show active benefit to that system.
It's no secret that some users are occasionally a little...impolite, when it comes to very new users who ask relatively elementary questions, but a majority of users tend not to be that way. I'd go so far as to say that most users on Stack Exchange sites are going to be inherently keen to actually help people, whether those people are the first to comment or not, that's just a matter of waiting.
You might want to review "Why these restrictions are necessary," which discusses some of these same points.


Rails always routes an action to show action, and the action it self becomes the id

Question: There's a strange behavior in rails I found recently related to routes and actions, specifically, it's on rails 2.3.5. I have a controller, let's call it Users. In the routes, I declare Users as a resources.
map.resources :users

And within the controller, I have the standard action: index, show, edit, update & destroy. Also, I added other action to fullfil certain requirements.
def generated_pdf_report
    # do something
end

The problem is, when I go to page /users/generated_pdf_report, I get this on the console:
Processing UsersController#show (some timestamps) [GET]
  Parameters: {"action"=>"show", "id"=>"generated_pdf_report", "controller"=>"users"}

As you can see, the server route the request to method show rather than to method generated_pdf_report. What's interesting, is that I have other controllers having similar action and is working fine.
The solution to the above problem is easy enough, make sure the added feed is above the resources:
map.feed 'users/generated_pdf_report', :controller => 'users', :action => 'generated_pdf_report'
map.resources :users

My question is: Anyone knows why rails behaves like that? The above solution is kind of sloppy, what do you think the best practices for such problem like one mentioned above.
Answer: As outlined in the Rails 2 routing guide, you can add collection routes like so:
map.resources :users, :collection => { :generated_pdf_report => :get }

Answer: When rails looks at
/users/generate_report

That is exactly the path it would use to show a user whose id was generate_report, so that is what it does, assuming you haven't told it otherwise.
A shorter alternative to what you wrote is
resources :users, :collection => {:generate_report => :get}

Which tells rails to map a GET to /users/generate_report to your generate_report action


Mirrored object doesn't match it perfectly?

Question: Well I retopologized the object and now I am having trouble with the mirror of it. It keeps mirroring int he wrong area and is not matching up equally. Also my verticies at the end of my mesh that would connect the mirror are not alligned properly. Can someonehelp. I have pictures below.
Comment: this is very similar to [How do I make the Mirror Modifier work right](http://blender.stackexchange.com/questions/353/how-can-i-make-the-mirror-modifier-work-right)?
Answer: It looks like the origin of the mesh is not quite in the correct place.

Select the vertices that you wish to be the centre of your mirror (the vertical line of vertices which run from the nose all the way
back around the head and back up to the nose)
Press Shift+S and choose Cursor to Selected.
Go into object mode and choose Origin> Origin to 3D cursor from the Toolshelf (press T to show the toolshelf).

The mirror modifier should then be moved to be above the subsurf modifier to avoid having a visible seam.
Update: To make the centre line of vertices completely straight, select the centre loop and press S , Y then 0.
Comment: @RayMairlot, you should have said "`S`,`Y`, then `0`", since on the image we can see the mirror is on the Y axis.
Comment: But how do I align all the verticies to the same so that my merging isnt so choppy?
Comment: Yeah you're right, I had meant to do that. You could have edited the answer yourself though :)


Can you cross-pollinate between different families of plants?

Question: I know you can cross-pollinate between species, such as the tangelo tree, but could you do it between different families, such as a cactus and an avocado (that is just an example)? What would I need to do to mix two different plant families to create a new species between families?
Answer: Carnivorous plants specifically? I don't know.
As to plants generally--I've never heard of a cross between plants of the same order but different families, but it's possible at least one might exist.
Crosses between plants of different genera of the same family are fairly common by comparison, but they're still rare: e.g. goji and tomato. They might not be as fertile as the parent species, if they're fertile.
Crosses between different species in the same genus are fairly common, but (as with crosses in different genera of the same family) only some species combinations work. They might not be as fertile as the parents' species, if they're fertile.
Crosses between different breeds of the same species should pretty much always be able to happen, and they should be fertile (except in very rare cases, such as when you cross a diploid watermelon with a tetraploid watermelon--that results in a triploid, and triploids grow seedless fruit).
You need to ensure that the number of chromosomes is compatible. Beyond that, I'm not sure what to recommend beyond trial and error, or checking to see how much of their genome is the same.
Doubling chromosomes with a chemical can sometimes make a kind of plant compatible with another (but the chemical may be extremely dangerous to humans in some cases).
A cactus and an avocado aren't even in the same order (which is a higher rank than family). They're both Angiosperms, though. I wouldn't count on being able to cross them, even if you have a team of heavily funded scientists behind your back, and twenty years to do it. It's like crossing a chicken with a dog.
Answer: Interesting question. A quick google search for "plants", "hybridization" "different families" turned up this ancient reference (see image below) from the 1887 Yearbook of the United States Department of Agriculture. Three families are listed: Amaryllis, Gloxinia and Figwort.
You could try searching for "interfamilial hybrids" and see what turns up.


What to write on index page for "product name"

Question: I'm developing a product and for that I've developed a website but I'm confused about how to present it's name on main page, I've different options in mind like "ABC's product" or "Product of ABC" etc but not sure which will be more suitable. Also, where to and how to place this name ? would a logo be suitable or simply a text ? Thanks
Comment: This may vary from person-to-person and maybe be primarily opinion-based.
Comment: Yes I understand but just trying to figure out more optimal way in term of UX.
Comment: The optimal way can only be determined by asking your users. There isn't an objective answer to your question.
Answer: It's really subjective, there's no 'right' way.
What you would do is make the variants you want, then A/B test to see if conversion shifts for any particular phrase/logo only/text only etc.
Also, there's putting the designs in front of people and asking their thoughts. Tools like usabilityhub.com could help with that.
Also market research, surveys maybe. Or print out the designs, take them to a cafe and ask people - you may find everyone hates your preferred option, or will give you ideas you hadn't thought of.


Is Ohm's law valid for all frequencies?

Question: From continuity equation and Ohm's law it it's possible to say that:
$$ \nabla \cdot (\sigma \mathbf{E}) = -\frac{\partial \rho}{\partial t} \Rightarrow -\frac{\partial \rho}{\partial t} \frac{1}{\sigma} = \nabla \cdot \mathbf{E}$$
and using Gauss's law:
$$ -\frac{\partial \rho}{\partial t} \frac{1}{\sigma} = \frac{\rho}{\epsilon_0}$$
This is a first-order ordinary differential equation, so its solution is given by:
$$ \rho (\mathbf{r},t) = \rho(\mathbf{r},0) e^{-\frac{\sigma t}{\epsilon_0}} $$
From that expression we can say that $\rho \rightarrow 0$ as $ t $ increases, but also will its derivative, so going back to the continuity equation:
$$  \nabla \cdot \mathbf{J}= -\frac{\partial \rho}{\partial t} \rightarrow 0 $$
For good conductors, this seems to mean that in practically no time
$$ \nabla \cdot \mathbf{J} \approx 0 $$
This is one of the assumptions for the quasistatic approximation, but as far as I know, this is not always true, for instance while working at very high frequencies. But all the steps made in the derivation were independent from the frequency of $ E $, so why this doesn't apply for all frequencies?
 My intuition dictates me that the problem would be Ohm's law, that may not be valid for very high frequencies as the conductivity starts to behave differently (imaginary part), nevertheless, I've been told that for almost every practical application the conductivity matches its DC value, so Ohm's law can be applied, isn't this true? and if it is, when is not possible to say that $ \nabla \cdot \mathbf{J} \approx 0 $ ?
Comment: The classical Drude model (https://en.wikipedia.org/wiki/Drude_model ) shows the connection between the electric field and current to have a complex part which which frequency dependent.  (Kudos to DocScience and DanielSank for sending me to my old notes.)  (I see that Thomas has answered more completely than my comment).
Answer: Yes, Ohm's law is valid at finite frequency
$$
 j(\omega)=\sigma(\omega)E(\omega).
$$
This is simply a linear response relation, so the only assumption is that of a sufficiently weak field. A typical approximation for $\sigma(\omega)$ is the Drude form
$$
\sigma(\omega) = \frac{\sigma_0}{1+i\omega\tau}
$$
which is not exact, but valid in kinetic theory. Indeed, in many typical applications you can neglect the frequency dependence, because the time scale
is set by a microscopic collision time $\tau\sim\tau_{coll}$. Note that in real time, the frequency dependent response becomes a convolution integral
$$
j(t) = \int dt'\, G(t-t')E(t').
$$
where $G$ is the retarded (or response) function, the one-sided Fourier transform of $\sigma(\omega)$.
With regard to your manipulations: I think that $\nabla \cdot j=0$ is indeed a good approximation, and that the main correction arises from non-localities in the response that are important for high frequencies and short wavelength (compared to collision frequencies and mean free paths). A typical problem you find discussed in texts book on EM is the skin effect. Indeed, the skin depth $\delta=\sqrt{2/(\mu\omega\sigma)}$ is governed (approximately) by the DC conductivity $\sigma$ ($\mu$ is the permeability).
Comment: I think the main correction does indeed arise from Ohm's law becoming gnon-local in space and time. This is not a surface charge density, but it becomes important in the high frequency regime where the current does not penetrate far (because of the skin effect). In order to estimate these effects you have to go beyond the Maxwell equations, and study the current in a more microscopic theory, like kinetic theory.
Comment: where should I introduce the $ \partial B/ \partial t $ term? I'm just plugging in ohm's relation into the continuity equation in order to find the charge density and relate it to the divergence of the current. My goal is to understand how, at very high frequencies, where we have a propagation effect (i.e. the E fields is not the same for every part of the circuit, and neither is the current density) the volume charge density also goes to 0. where can i find the charge density resulting from the difference of the currents density flux?
Comment: my mistake, I misunderstood what you were trying to do.
Comment: I understand that the title I've chosen for the question can be very misleading. I'm sorry for that.
Regarding my question, I have been pointed out that the charge density I am looking for may be a surface charge density rather than a volume one, is this reasoning correct ?
Answer: If you assume that the only property of the material is that of conductivity, then yes. Ohms law is valid at all frequencies.
But we know real materials have properties of capacitance and inductance as well as conductance and which also depend on the geometry as well as the material itself. So in this case, no, you need to include additional physical models that address these properties.
In general impedance, which encompasses capacitance, inductance as well as conductance will change according to frequency.
Comment: @ZeroTheHero Capacitance depends on $\epsilon$ and geometry of the conductor.
Comment: So is it correct to say that for a material that only has conductivity as property $ \nabla \cdot J \approx 0 $ for all frequencies? if it is, when would the Kirchhoff's current law (KCL) doesn't apply ? I thought that the hypothesis of it was the null divergence of the current density
Comment: @diegobatt without capacitance, inductance, a hypothetical material indeed would allow electrons to travel with unlimited velocity; well not really, no faster than $c$. Do the Maxwell field equations impose that limit in this case? Or do we need Einstein's reformulation? Also without capacitance, inductance no energy 'storing' component in the material. KCL should always apply according to conservation laws.
Comment: I think you are confusing a few things: Conductivity is a local relation between current density and electric field. It is needed (i.e. an input) to solve the Maxwell equations in a material. Capacitance, inductance etc. are global properties of some arrangement of conductors. They are determined by the solution of the Maxwell equations (i.e. an output).

Is Ohm's law valid for all frequencies?


Tenting Vias in PCB

Question: I am making a PCB layout in Altium Designer. I have selected "Force complete tenting on top and bottom" for vias. Does it have a disadvantage or more expensive? Tenting seems better but i wanted to be sure. Thank you so much.
Comment: Full tenting is good for production, it can avoid many quality problems. For the via treatment, our first choice is full tenting.
Answer: Full tenting is normal. You will be fine if you fully tent all vias. It will not have any impact on cost.
Why would anyone ever leave vias untented?
Well, sometimes people leave some vias untented on prototype boards to facilitate probing signals. But vias near pins or pads should always be tented. Vias which are underneath components cannot be probed or visually inspected, and so they should always be tented, too. If you want to leave other vias untented, that is up to you.
Answer: Ask yourself if you need to access that via for reading a signal. If no, tent it. If yes, un-tent it.
About the cost, it can be simply understood as allowing solder mask over the via (tenting), or not allowing it (untenting). The electrical connection on the PCB will be unaffected but your access will be affected depending what you choose to do with the via. Also, this would do nothing to change the cost involved.
PS: I've seen some cases where you can use untenting to provide heatsinking.

Tenting Vias in PCB


Should defects be raised during sprints or just noted in the stories and assigned to developers?

Question: I have heard that when testing stories developed in the current sprint, no issues are raised they are not completed (i.e. definition of done was not fulfilled) and that you should only raise issues when you find another, unrelated issue etc. While it does make sense not to raise issues on something that developers still can work on till the end of the sprint, I fail to find some "best practices". Is that a correct approach?
Comment: Can you make your question more specific, perhaps by providing an example of what you mean?
Comment: I thought it was clear - should defects be raised during sprints or just noted in the stories and asigned to developers?
Comment: It's the phrase "While it does make sense not to raise issues on something that developers still can work on till the end of the sprint" that is confusing me.  Do you actually have free time in a sprint to work on such things?  In our shop, we have a fast-track process for urgent things that need to be done during the same sprint.   I doubt you're going to find canonical advice on this, though; the needs of the business outweigh any notion of "correctness."  Those needs have to be balanced with discipline.
Comment: Well what I meant is - during the sprint, stories are considered done when DoD is fulfilled. Also during the sprint, developer can stll fix the issues as part of development and therefore raising issues does not make sense to me, if related to functionality being implemented.
Comment: Seems to me like *you should raise an issue if your sprint task is going to be blocked in some way, and you are going to be unable to complete the task during the sprint.*
Comment: It should probably be noted that in Scrum,nothing should ever be "assigned to" developers.  If there is work to be done during a sprint, a team member should volunteer to take it on.  That is, it is a bottom-up, team driven process.
Answer: It depends on your process. In my world, a defect is something that escapes your quality practices. But its up for you to define exactly what those are.
Some processes have a clear separation between the development team and the test / quality team. This is the world that I live in now. The development team is responsible for unit and integration tests and the quality team is responsible for deliverable-level (application and system level) regression and acceptance tests. In this environment, any issue that was not found by the development team in their testing would be recorded as a defect as it escaped the development team's quality activities - code reviews and tests.
The agile methods promote a highly integrated cross-functional team. In this environment, the quality activities also also integrated. Different people may be leading different activities, but everyone's involved every step of the way. Because of that, there's not always a clear hand-off from a development team to a quality team. As such, I would consider a defect to be something that makes it through to the end of the iteration and into the release.
However, something to consider is communication. In my first example, I may note an issue that I find in testing that is minor, but don't have the necessary path to fix in the development cycle. I may log a defect to communicate that I found an issue and allow it to be dispositioned. The project lead or quality team may say that it's actually a big deal (to the customer or from a product quality perspective) and demand it get fixed in the development cycle, or it may be planned for a later release.
In the end, you do need to do the right thing to enable you to understand your product quality and communicate the current state of the development effort to the appropriate stakeholders.
Answer: One of the key values of agile development is that you want to deliver working software, which means that it has been verified that the features you are delivering have been verified to be working correctly (according to your team's understanding of the feature).
If you find a problem while testing, then there are a few possibilities:

The problem is related to one of the features/stories you are currently developing and is severe enough that you would not be able to deliver the story according to your quality standards if the problem isn't fixed.
The problem is related to one of the features/stories you are currently developing and is not so severe that you are still able to deliver the story according to your quality standards if the problem isn't fixed.
The problem is unrelated to the stories you are currently developing and doesn't impact them.

In case of #1, you should, as a team, try to fix the problem before the end of the sprint. Otherwise, you won't be able to say that you have finished the work. Whether or not a ticket in the bug-tracking system is needed depends on your local conventions and requirements for traceability.
In case of #2 or #3, the problem should be reported to the Product Owner, so that it can be put on the product backlog and prioritized. Whether or not a ticket in the bug-tracking system is needed again depends on your local conventions and how your product backlog is being managed.
(Be prepared that especially items under #2 might get the priority "do when hell freezes over" aka never.)
Answer: The Scrum Guide provides some guidance on this

The Increment is the sum of all the Product Backlog items completed
  during a Sprint and the value of the increments of all previous
  Sprints. At the end of a Sprint, the new Increment must be "Done,"
  which means it must be in useable condition and meet the Scrum Team's
  definition of "Done."

Therefore, a team practicing Scrum should not knowingly allow the product to suffer unexpected regression of functionality. They should also disallow known defects in new functionality unless the Increment is in a "useable condition and meets the Scrum Team's definition of "Done."
Also

As Scrum Teams mature, it is expected that their definitions of "Done"
  will expand to include more stringent criteria for higher quality. Any
  one product or system should have a definition of "Done" that is a
  standard for any work done on it.

Scrum allows leeway for Scrum Teams to create their own processes for managing work in progress and bugs in production code. This is because there is no "best practice" in a complex domain like most software development. Successful practices emerge as the result of performing experiments and choosing the ones that tend to succeed. More on complexity here.
Enough beating around the bush...HERE'S YOUR ANSWER
Pick a process e.g. log and fix all bugs regardless of when and where they are found and start measuring and retrospecting on the effect of that new process. The team will see pros and cons and will eventually settle on a proven method that works for them within the Scrum framework.
Most importantly, the Scrum Team will have made its decision empirically and in a self-organization manner.


Scrollviewer + Stackpanel in WPF application

Question: I have a Scrollviewer inside of Stackpanel. It works well if I'm trying to scroll down with a scroll on the mouse but if I use the scroll on the scroll bar it's being decreased and the page doesn't go down. Moreover, assume there's a radio group of 5 radio buttons(2 of them are on the bottom of the screen and 3 are lower). If I try to select one of two accessible radio buttons the page is scrolled down until all five are seen and no button is checked. How can I solve this problem?
Comment: can you post some code? preferably the XAML you are using
Comment: I can picture a ScrollViewer _around_ a StackPanel, not _inside_.
Answer: The ScrollViewer should hold the StackPanel as Content, and you have to set MaxWidth/MaxHeight on the ScrollViewer beyond which the ScrollBar will show.
This is because StackPanel doesn't play well with scrolling since it is made to take just the space needed for its content.


Could someone recommend a db management tool that supports SQLite, MySQL, PostgreSQL, and is web-based?

Question: Could someone recommend a db management tool that supports SQLite, MySQL, PostgreSQL, and is web-based? By 'web-based' I just mean it can be run in a browser locally or remotely.
Comment: This is a curious question. Browsers can't interact with databases directly, so the so that would need to be done on the server-side (like phpPgAdmin etc), but that wouldn't make much sense for SQLite which is not client-server. Can you explain your situation a bit more: why you need the tool and why it needs to run in a browser?
Comment: I suppose you want "free" as well?
Comment: I think this would be considered a shopping question if it weren't for the fact that so few of these (if any) exist.
Comment: Not necessarily free. I have these databases in the above 3 flavors and would like to use one tool to manage them.
Answer: If a remote desktop is an acceptable web-based solution, you could have Navicat Premium on a remote server that way you don't need the tool locally (premium is the cross-databases edition of the tool: it has MySQL, PostgreSQL, SQL Lite and even SQL Server) .
But you would find cheaper/free if you simply install a tool per database type (e.g. phpMyAdmin, Chive, phpPgAdmin, SQLiteManager).
Answer: While not truly web based, you can start the dbWatch interface from a java webstart session. You can test this on our webpage (http://www.dbwatch.com/). It supports Oracle, SQL Server, MySQL, Sybase, PostgreSQL and Ingres. Other platforms will be supported in the future.
I work there, so you know :-)
-Chris
Comment: We appreciate you looking for appropriate questions on which to promote your product as well as you disclosing your affiliation with it.  However, if this is the ONLY reason you came to the site you should probably re-evaluate your reason for being here.


Small photos c. 1919 1.75 X 2.75 prints

Question: I have found unique photos of the landing in 1919 of the R34 in New York.  The photos are very small format black and white print:  about 1.75" X 2.75"...they expand out very nicely into 8 X 10 photos when scanned.  What format is this and what camera?  Look amateurish...Thanks
Comment: As they say, a picture is worth a thousand words. Why not upload an image of one or two of them?
Comment: Please post some photos!
Comment: Please confirm the dimensions.  There is a somewhat standard 1.75 × 2.5, which better fits the description "expand out very nicely into 8 X 10" than 1.75 × 2.75.
Answer: The format 1.75" x 2.75" sounds like the wallet print format.
I believe it is still being used for small pictures in key rings etc.
I don't think that it is necessarily a format used by a camera. It is most likely a scaled down (or even cropped) print of a more common format like 2 x 3 or 3 x 4.
Answer: Most amateur and "consumer" photographs from the pre-1920 era were contact prints.  The size you cite is what you'd expect (with allowance for a slight crop by the printing frame) for size 129 roll film (produced 1912-1951), which would have fit a Houghton Ensignette #E2.  Like most of the "off size" roll film formats, this one didn't catch on the way 120 and 127 did.
It's also possible (if your measurement included a white print border) that it might originate from 121 film, 1902-1941, or 127, which originated in 1912 -- the "full frame" format of 127 is 4x6 cm, or about 1 5/8 x 2 3/8 inches (actual image area), while 121 appears to be the same width, but (like 120) may not have originally had framing numbers for multiple formats (127 had "full frame", square, and "half frame" just as 120 did).  I don't have a reference to what cameras used 121, but it seems the difference from 127 may have been only the location of the ruby window.  For 127, on the other hand, there were dozens of choices (some very good) early enough to travel with troops serving in the Great War (aka WWI).
Houghton made many very good cameras, ranging from view cameras starting in the 1890s through various folding roll film cameras (Ensign Commando, 1945-1951, was one of only two models ever offered, anywhere, of folding roll film cameras with film plane movement for focusing rather than lens movement or change in focal length of the lens).

Small photos c. 1919 1.75 X 2.75 prints


What does Gandalf mean by "Secret Fire", "Flame of Anor" and "Flame of Udûn"?

Question: In Moria, when Gandalf confronts the Balrog on the bridge of Khazad-dûm, Gandalf says the following:

I am a servant of the Secret Fire, wielder of the flame of Anor. You cannot pass! The dark fire will not avail you, flame of Udûn. Go back to the Shadow! You cannot pass!

I cannot find any reference to "flame of Anor" or "flame of Udûn" anywhere else in The Lord of the Rings, not in the appendices. As Gandalf possesses Narya (the ring of fire) at this point in time, I am wondering if he is referring to this in some way? Is this correct? If not, what is he referring to?
Comment: Anor is a name for the Sun in Middle Earth, whereas Udûn (which translates to hell) is the name of **one of the first lairs of Morgoth. I think Gandalf is just distinguishing here that, "I have the power of good on my side, you have the power of evil".
Answer: Gandalf is making three very specific references as both warning and challenge to the Balrog.
By identifying himself as a servant of the Secret Fire (or Flame Imperishable), Gandalf is identifying himself as a Maia, an embodied angelic servant of the Valar protecting the light of Creation that Eru Ilúvatar (or God) has set to burn at the centre of Arda (Earth).
Wielder of the flame of Anor is a reference to his ability to draw on the power of the sun possibly through the Ring of Fire, Narya, but maybe also through his own divine origins.
Finally as he refers to the Balrog as the Flame of Udûn, he informs the Balrog that he knows it to be a corrupted Maia in the service of Morgoth from the earliest time when he resided as Melkor in his dark fortress of Utumno broken by the Valar at the awakening of the Elves. He orders it to retreat ("go back to the shadows") or face the consequences of divine conflict and final judgement before the Vala Mandos, the fate of all slain creatures.
Comment: +1 for Gandalf identifying himself; a translation might be something like: "Yo!  Maiar dude.  I'm a Maiar dude too.  You've had your fun but now you're up against someone your own size.  Back off or you might get hurt."
Comment: @JimmyShelter Your command of Tolkien's writing style is brilliant.
Comment: "You best check yo-self before you wreck yo-self."
Comment: Quick, someone contact Epic Rap Battles of History and have them do a Gandalf v Balrog.
Comment: now i want to see a rap battle on the bridge
Comment: Slight error, the secret fire burns at the centre of Eä (the universe) not Arda (the earth)
Comment: @DarthMelkor "Back off or I might pile-drive you from 5,000 feet up"
Comment: Honestly, for a wise wizard, Gandalf chose the wrong way to ask a pissed-off war-loving rival Maia to sod off.  I'd probably translate this more like "Hey @#$%head, guess who came to visit.  Let's get this over with."
Comment: Isn't "Udûn" specifically another name for Utumno... more or less a synonym for Hell?
Comment: I'd like to see an Ezekiel v Tony meme for Gandalf and the Balrog.
"
Gandalf : You know what I did last night?
Balrog :   You better not bring my mother into this!"
Answer: Secret Fire
In The Silmarillion, the creation of the world is described.  The Gods sing a vision of the World.  Then the One God, Ilúvatar, makes their song reality:

Therefore Ilúvatar gave to their vision Being, and set it amid the
Void, and the Secret Fire was sent to burn at the heart of the World;
and it was called Eä.

Flame of Anor
"Anor" is the Sindarin name for the Sun.  Also seen in the name Minas Anor, the Tower of the Sun, which was later renamed to Minas Tirith, the Tower of Guard.
Flame of Udûn
Udûn (Sindarin: "hell") was the first fortress of Melkor in the far north of Middle-earth.  This marks the Balrog as an ancient foe.  As Tolkien's world is in a perpetual state of decline, being ancient makes the Balrog a very powerful foe.  And indeed the Balrog turned out to be an equal of Gandalf, a Maia, or a lesser god.
Comment: Balrog was ALSO a Maia.
Comment: @MathiasOse - actually, when Tolkien wrote his stories he used the word "gods" consistently until quite a late stage; it's even in LotR: "*he was borne up on Snowmane **like a god of old**, even as Orome the Great in the battle of the Valar*".  Note the lowercase 'g', however.
Comment: Good answer, but you shouldn't call the Ainur "Gods". When Tolkien wrote his stories, he wanted them to be "compatible" with his Catholic beliefs, so he tried to avoid creating a "pagan" mythos. There is only one God in Tolkien's legendarium, and that is supposed to be the same one as in the Bible. The Ainur (Valar, Maiar, and those that never entered Eä) are like angels. And the Flame Imperishable (Secret Fire) is similar to the Holy Spirit.
Comment: @DVK The sentence structure jars a bit, but I think that's what the answerer meant.
Comment: @Jim2B: After his death, Gandalf went beyond the space and time of Arda, see Letters, #156, pp 202–3.  He was sent back by [the Creator](http://en.wikipedia.org/wiki/Eru_Il%C3%BAvatar#cite_note-4).
Comment: And all Maia (Gandalf and Balrog alike) have souls bound to Arda.  Upon death of their fleshly body, their spirits remain and are eligible for reincarnation.  In Gandalf's case, he's judged to not have completed his work and is sent back.  In the Balrog's case, he never returns.  It's been a long time since I read the Silmarillion so I don't recall who makes the judgement of whether to reincarnate a spirit.
Comment: @AnthonyArnold: The sentence structure is not jarring; it would be fine, were it not ambiguous, as it unfortunately is: one can read it three ways. The attribute _"a Maia, or a lesser god"_ can apply (1) to both of them, because of _"equal"_, (2) just to Gandalf or (3) just to the Balrog. I feel confident that (1) was intended.
Answer: Above answers including explanations for "Secret Fire" and "Flame of Udûn" are satisfactory and correct as far as I know, but the treatment of "Flame of Anor" is massively speculative with no acceptable evidence, and thus woefully lacking. I will attempt to answer what Gandalf quite obviously meant by "Flame of Anor," using a style of exaggerated introduction to an enemy that Tolkien uses when Bilbo met Smaug that everyone seems to have missed.
The Flame of Anor is simply the Sun, and nothing else. More specifically, it is the Dawn. Gandalf meant quite literally that he wields the Sun, and we know this from his history to be true, from The Hobbit:

'Dawn take you all, and be stone to you!' said a voice that sounded like William's. But it wasn't. For just at that moment the light came over the hill, and there was a mighty twitter in the branches. William never spoke for he stood turned to stone as he stooped; and Bert and Tom were stuck like rocks as they looked at him. And there they stand to this day, all alone, unless the birds perch on them; for trolls... must be underground before dawn, or they go back to the stuff of the mountains they are made of, and never move again....
'Excellent!' said Gandalf, as he stepped from behind a tree, and helped Bilbo to climb down out of a thorn-bush. Then Bilbo understood. It was the wizard's voice that had kept the trolls bickering and quarrelling, until the light came and made an end of them.

Gandalf wields the Sun often subsequent to his battle with the Balrog. When reunited with Aragorn, Legolas and Gimli in Fangorn, he chooses to do so while bathed in the sun, from The Two Towers:

They all gazed at him. His hair was white as snow in the sunshine, and gleaming white was his robe; the eyes under his deep brows were bright, piercing as the rays of the sun; power was in his hand.

Arriving at Helm's Deep with reinforcements, we read the enemy is driven mad by Gandalf's approach from the East at sunrise, from The Two Towers:

There suddenly upon a ridge appeared a rider, clad in white, shining in the rising sun. [...] The White Rider was upon them, and the terror of his coming filled the enemy with madness.

Gandalf's use of sunrise is hardly isolated, and there are quite a few passages with him arriving at his destination at first light, from The Return of the King:

So Gandalf and Peregrin rode to the Great Gate of the Men of Gondor at the rising of the sun, and its iron doors rolled back before them.

In fact, Gandalf never reveals Narya until the very end of the story after Aragorn has been crowned, keeping it secret from the Enemy as instructed by Círdan, so its highly unlikely he would tell the Balrog anything of Narya. What Tolkien didn't reveal to us he never intended, such as Gandalf referring to Narya as "The Sun," which he would never do. Narya has no connection to the Sun other than the coincidence that Gandalf wields the sun, as he says, which is always a white light, and he also happens to secretly posses Narya, the red ring, giving him some influence over fire and the ability to kindle hearts. The Sun and the powers of Narya are not related. Narya is not a weapon nor does Gandalf use it as one, like he uses the Sun.
Comment: These are all examples of Gandalf taking advantage of the sun, and the timing of dawn, but I don't see any evidence of him "wielding" it. It's not like he caused the sun to come up and petrify the trolls, he just distracted them until it happened.
Comment: I'd always thought that "It seemed to Pippin that [Gandalf] raised his hand, and from it a shaft of white light stabbed upwards. The Nazgûl gave a long wailing cry and swerved away… " referred to an effect from Narya, as well as the fireworks on Weathertop, "... such light and flame cannot have been seen on Weathertop since the war beacons of old."
Comment: @DCShannon I see no evidence of Narya providing his aptitude for fire. The claims made by the users are all as valid as the next
Answer: Tolkien has said that the "secret fire" (when used elsewhere), referred to the Holy Spirit.
Professor Clyde S Kilby spent a summer in 1966 with Tolkien during which he read and provided feedback on the then unpublished Silmarillion. A decade later, he published the book Tolkien and the Silmarillion, with a memoir of his visit, and a few critical essays of his on Tolkien, (e.g. exploring Tolkien as a Christian writer, or as a member of the Inklings).
One of the anecdotes he shares was about the usage of the word "Secret Fire" in the beginning of the Silmarillion.

Professor Tolkien talked to me at some length about the use of the word "holy" in The Silmarillion. Very specifically he told me that the "Secret Fire sent to burn at the heart of the World" in the beginning was the Holy Spirit.
Tolkien and the Silmarillion - "Tolkien as Christian Writer"

The passage being referred to is one from The Silmarillion, not from The Lord of the Rings:

Therefore Ilúvatar gave to their vision Being, and set it amid the Void, and the Secret Fire was sent to burn at the heart of the World; and it was called Eä.
The Silmarillion - "Valaquenta"

However Kilby cites Gandalf's line to the Balrog in a footnote, implying that he had interpreted Tolkien's words as also applying to when Gandalf said it.
Answer: Anor or Anar. Eru gave a special light to Varda (Elbereth) (whom the Noldor especially revered) when she entered Eä at the beginning of time. This light she shared with Arien (the Maia of the Sun) and it was to possess this light that Morgoth 'ravished' Arien; thereby burning and diminishing himself irrevocably. I believe that Gandalf is referring to this very special and holy light, given by Eru as something deadly to Morgoth and his servants. Udûn is Sindarin for Utumno, Morgoth's great first underground realm - the underworld.
Comment: er - the sun came from the last flower of Laurelin, the golden tree after Morgoth destroyed it, Varda hallowed this flower and gave it to arien to travel through the heavens, Telperion also bore a last flower which was given to Tilion, who was in love with Arien and attempted to get closer to her, thus burning himself. Morgoth Assailed Tilion when he first ascended into the heavens but he was mortally afraid of the sun and hid himself and his servants from it by use of smoke, which is why the servants of evil cannot abide the sun. So you are partly correct but not fully correct I am afraid
Answer: Secret Fire and Flame of Anor are two different names for the same thing... the Light of Creation... the power of Eru (God) to bring things into actual existence, to Create.  Tolkien wrote in his letters several times about this concept of Creation and Sub-creation (refashioning something new out of what Eru has already Created).  Only Eru could truly create, all others could only sub-create. (The Valar accept their limited powers as stewardship; Melkor/Morgoth envies and lusts after Eru's true creative power... but to no avail.)  It is very, very closely associated with Life and bringing things "to life."  The medieval word for life was "quick"... which was the same as the part of a candle which hosts the flame... now we say the "wick", but quick and wick were once the same word.  Back then, the idea of soul or having life was deeply associated with light and flame.  Tolkien knew this, and based his mythos on it.
The Flame of Udûn... the "dark fire" is Morgoth's attempt to "Create" his own version of the "light of creation"...an envious perversion of what has already been created.
Anor being in the Sun and yet also at the center of the world explains a lot about Tolkien's fascination with vulcanism.  Smaug is essentially a volcano personified, and the One Ring could only be created or destroyed in the heart of a volcano... by tapping into Anor.
Comment: To add to David Neuschulz's answer, the term 'wick' was used in the show "The Secret Garden" by the Welsh gardener and 'wizard' Dickon. The term was used in one of the songs in the play. Here's a link to the youtube video. https://www.youtube.com/watch?v=QUsSh6S4Pvg
Comment: For those reading Harold's comment, but not wanting or having time to watch a video, in "The Secret Garden" 'wick' is used to mean the plants still have life in them (despite being long neglected).
Answer: I think what he is basically saying is: "I wield the fire of the sun through Narya. You wield the dark fire of hell. My fire is stronger than yours."
I'm pretty sure that he isn't speaking of wielding the power of the Valar, as there are no other instances in all of LotR legendarium that I am aware of where a character wields the power of another. None of the other Maiar are shown to have extraordinary powers (Except Melion, to a degree). Conversely, we see similar power over the elements by Elrond who, wielding the sapphire ring, controls the water of Bruinen to drown the Nazgûl. Besides, if Gandalf had been granted amazing powers by Manwë, Círdan would have had no reason to give him Narya in the first place.
Comment: "None of the other maiar are shown to have extraordinary powers (Except Melion, to a degree)." I think you are forgetting that Sauron was also a Maia.
Answer: In The War of the Jewels, Christopher Tolkien has a brief section, page 397 through 407, on "The language of the Valar".  There are several lists of Valarin words.  These are not Elvish, though the Elves copied many of them.  In those word lists, Anar and uruš appear on page 401.  The first means "the sun" or "appointed heat" and the second means "fire".  Given the linguistic similarity between r and d, I think it not unlikely that Gandalf used very ancient vocabulary indeed — words that preceded the awakening of the Elves to refer to his fire and that of the Balrog.  The only connection in LotR or The Silmarillion between "Udûn" and "Utumno" comes on the very last page of The Silmarillion where "Udûn" is given as the Sindarin version of "Utumno". The word Udûn, as far as I can tell, does not appear in the 13 volume set of The History of Middle-earth and the closest that I can find is uruš.  So take it as speculation that Gandalf was deliberately using some very ancient vocabulary and not Elvish words.
It also occurred to me that this speech was not for the Balrog's benefit.  Assuming that the Balrog spoke the language of Morgoth which predated Elvish and then the Balrog had been buried underground for ages and then had only interacted with Orcs or a few tortured Dwarves, he likely wouldn't have spoken common or Sindarin, so the communication between Gandalf and the Balrog was likely telepathic like all the Valar and Maiar were capable of.  The speech was primarily for the benefit of the hearers or to help Gandalf formulate his thought-communication.
Comment: Isn't Anor also "The Sun" in Sindarin? Although I guess it would be appropriate for Mithrandir to use Valarin against another Maia, it's unclear whether he still recalled Valarin or whether anyone in the company knew enough of it to translate it for Frodo to transcribe.
Comment: Well, Sindarin was the everyday Elvish language as it were, so I wouldn't be surprised if Gandalf was using the Sindarin name for Utumno.
Answer: What about the possibility of a typo? Perhaps it was wrong in the text when printed, and what was meant was not "Anor" but "Arnor", in which case the flame of Arnor would definitely be the red ring, first carried by Cirdan and later Gandalf and it was at first in the land of Arnor, the northern kingdom.
Comment: Speculation is only useful if it's backed up by evidence. The top answer seems very reasonable based on the known meanings of Anor and Udun. But if you're suggesting that there's a typo in *Lord of the Rings* ... extraordinary claims require extraordinary evidence to support them.
Comment: Do you have any evidence to show this to be more true than the accepted answer?
Comment: This is a question for speculation not a statement of fact. As far as "accepted answers", I don't think they have much value as the true answers are in Tolkien's head and he is now dead. In Essence, this blog is en exercise in speculation.


Relationship between Data Size and Arima Prediction Interval Width?

Question: When we use Arima model to acquire Interval Predictions, will the width of prediction intervals decrease if we use more data (longer history) to fit the model?
Answer: Take an ARIMA(1,0,1) for simplicity:
\begin{equation}
   y_t = \phi_0 + \phi_1 y_{t-1} + \theta_1 \epsilon_{t-1} + \epsilon_t.
\end{equation}
Typically, this is estimated by maximimum likelihood which requires us to make an assumption about the distribution of $\epsilon_t$. Most of the time, people pick a Gaussian distribution and impose homoskedasticity, i.e., they say $\epsilon_t \sim N(0,\sigma)$.
For simplicity, we'll do the one-step ahead prediction interval, conditional on $(y_T, \epsilon_T)$:
\begin{align}
   y_{T+1} | (y_T, \epsilon_T) &\sim N(\mu_T, \Sigma_T) \\
   \mu_T &= E_T(y_{T+1}) = \phi_0 + \phi_1 y_T +\theta_1 \epsilon_T \\
   \Sigma_T &= var_T(y_{T+1}) = \sigma^2.
\end{align}
In practice, you will substitute the MLE estimates for the parameter values. Given the known distribution, you can build prediction interval. In other words, you will neglect the uncertainty due to the fact that parameters are estimated and not known. In other words, the prediction interval isn't a function of sample size, although in practice the fact that you rely on an asymptotic argument to replace parameter values with their MLE estimates does mean that it would bounce around if you added or subtracted observations from your sample.
Comment: Nice answer.  Also, note that,  assuming the model was correct ( the underlying DGP was ARIMA(1, 0, 1)), then the variance estimate of the error term should converge to its true value as the estimation length gets longer and longer.  Using Stephane's example, the error variance estimate should converge to $\sigma^2$.  Of course, you never know what the true underlying DGP is, so it's not a terribly useful statement.
Comment: While it is true that there is a model selection problem involved, you are obligated to make some assumptions to resolve the problem of characterizing forecast uncertainty. The approach I proposed is the simplest way to answer the question, as well as the most common way to do it in practice. It clearly isn't the most robust way to do it. Moreover, if $|\phi_1|$ is close to 1, we'd need to have a discussion about the pesky prior implicit in the frequentist approach with regards to initial conditions.
Comment: I totally agree that your example was good for illustration and that estimating these things can be quite messy for sure.


Add an attribute to Orders and Invoices alongside SKU

Question: I would like to add an attribute "Product Code" to show alongside SKU on my orders and invoices. How can I achieve this? The extensions I find seem to be centered around changing your checkout, which I don't want to touch. And any other explanations of this seem very complicated. Is there a solution for my problem? Thanks in advance
Answer: The best way to accomplish this would be to add a field to the sales_flat_order table (Adding custom fields to sales_flat_order) (so your order data wont change as product change overtime). Then using a observer you store this info to the file your created.
To add the fields to your email, go to system transactional email then edit/import those template.
Then add the following code where you want it to show.
<code>{{var order.field_name_here}}
</code>
To add these field to your pdf see Add custom attribute to Magento's PDF invoice


How to install PAPI on Ubuntu 16.04 and access performace monitoring counters?

Question: I need to count L2 cache misses (my cpu is i5-3550), so I downloaded last PAPI version. I followed instructions contained in the archive to install it (./configure, make and make install) and it worked. The only problem is that it seems it cannot access performace monitoring counters,in fact in the INSTALL.txt it says: "Kernel needs some modifications to provide PAPI access to the performance monitoring counters."
Is it really necessary? If so, can you guide me step by step?
Comment: More generic howto: https://askubuntu.com/questions/821439/papi-installation-on-ubuntu-16-04
Answer: To install PAPI
Step 1: sudo apt-get update
Step 2: sudo apt-get install papi-tools
To Remove PAPI
Step 1: sudo apt-get remove  papi-tools
To Completely removing papi-tools with all configuration files
Step 1 : sudo apt-get purge papi-tools
Comment: So don't I need to download any archive or recall any lib folder while compiling my C program?
Comment: @Generoso You are not compiling. APT downloads and installs a .deb package from the repositories.


Export Token Holders list of a token to csv

Question: I'm trying to do some distribution calculations on a couple of tokens and could use an export of the token holders list that I can find in Etherscan when I search for a specific token. Since Etherscan is showing the list I was hoping the API would have a function for this, but it looks to me like it doesn't. Please bear with me as I am totally new to this and am not able to really build anything. I know how to fiddle with some APIs and that's about it.
Answer: I have created a standalone tool which does the same.

Take a token contract address
Iterate over all Transfer events for token using eth_getLogs JSON-RPC API
Build a local database of these events
Allow you to use SQL to query any account balance on any point of time (block num)

You can find the command line application execution example how to build the token holder database here
The core Python logic is here.
You can also trivially export this list from SQLite database to CSV file.
There are some quirks here and there: for example detecting mint / creation event for some tokens is not straightforward. Thus, you will may negative balance on the account receiving initial total supply if you rely on Transfer event only.
Answer: Try this: [https://etherscan.io/exportData?type=tokens&contract=0xa02e3bb9cebc03952601b3724b4940e0845bebcf
Replace Contract with your token contract address
Comment: Can we export all token holders addresses into a smart contract?
Comment: @FarihaAbbasi you need to insert them into the smart contract. Costing loads of gas


What's the difference between d, and x?

Question: What's the difference between d and x?
As per my cheatsheet, the definition says
x  Delete characters after cursor
d  Cut but remain in normal mode

I dont know because i'm new to vim
Comment: Try using `:help` and let us know if there's something still confusing. `:help x` and `:help d` will show you what's different.
Answer: First, let's take a look at the actual documentation for each command instead of your dubious cheatsheet.
:help c:
["x]c{motion}    Delete {motion} text [into register x] and start
                 insert. […]

:help d:
["x]d{motion}    Delete text that {motion} moves over [into register
                 x]. […]

:help x:
["x]x            Delete [count] characters under and after the cursor
                 [into register x] (not |linewise|).  Does the same as
                 "dl".

From which we can make a few observations:

All three commands delete text in one way or another.
All three commands take an optional register in which to delete said text. "x is used as example but it can be any other alphabetic register. The default one is ". See :help registers.
c and d also take an obligatory motion, which makes them operators (see :help operator), but x doesn't, so it is not an operator. That is the first difference.
d only deletes the given text while c also enters insert mode, that is another difference.

That's a lot of ways to delete text (and there are others), so when to use one or the other? Well… as everything in Vim, it depends on context and on what you want to do next.
If all you want is to delete a single character, then use x:
My username is romainnl
                    ^      " position of the cursor
My username is romainl     " after pressing x

If you want to delete a few characters that you counted, then use [count]x:
// I couldn't come up with a better example
^                                              " position of the cursor
I couldn't come up with a better example       " after pressing 3x

If you know your motions well and the text you want to delete is covered by an existing motion (possibly with a count), then use d{motion}:
Vim is great but antiquated.
            ^                   " position of the cursor
Vim is great.                   " after pressing dt.

If you want to delete some text and then insert some new text, then use c{motion} (for "change"):
Vim is the ideal Python IDE.
       ^                        " position of the cursor
Vim is just a text editor.      " after pressing ct. and typing just a text editor<Esc>

Now, Vim is kind of infamous for its many commands. On one hand that's quite a lot to learn compared to regular editors, which might seem silly, but on the other hand that is the cost of expressiveness: the more words you know, the easier it is to accurately express your thoughts.

Since you are new to Vim, I strongly recommend that you:

Go through $ vimtutor a few times until you really get the basics.
Take as much time as necessary to go through chapters 1-12 and 20-32 of :help user-manual.

Don't ever rely on random videos, tweets, posts, answers, and threads.

What's the difference between d, and x?


Where is the complete list of GitHub achievements?

Question: GitHub seems to have updated the achievements feature, so what other achievements are there? Is there a list of achievements and their unlock requirements? Didn't find any documentation and post about this.
Answer: TL;DR: https://github.com/Schweinepriester/github-profile-achievements#achievements

While the answer by Smitop is currently correct, there is official documentation including specifics on how the achievements were/are earned, which presumably will be updated with future additions: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/personalizing-your-profile#displaying-badges-on-your-profile
Also I've created a mirror: https://github.com/Schweinepriester/github-profile-achievements
Update 2022-06-11:
Seems like I was wrong with this assumption

which presumably will be updated with future additions

as they even removed the previous three achievements from the documentation when they announced new achievements on 2022-06-09. Hence currently primarily my repo fulfills listing the achievements, including new ones.
Answer: Actually, there is a third achievement:
Answer: According to a GitHub blog post, there are currently three:

Right now, Achievements include the Mars 2020 Helicopter Mission badge, the Arctic Code Vault badge, and a badge for sponsoring open source work via GitHub Sponsors. Watch this space!
Answer: There is another achievement available:

It's name is Pull Shark:

There is 6 types of achievements, But earnables, there is only 4 of them:

Galaxy Brain (2 accepted answers)
Pull Shark (2 pull requests merged)
YOLO (Merged pull request without code review)
Public Sponsor (Sponsoring open source work via GitHub Sponsors)

And for the Galaxy Brain and the Pull Shark achievements, there is also tiers:

Everything is described here.


Stair Illumination: Location of light

Question: Before I close this up, is this legit location for light at bottom of stairs? Yes, switch at top and bottom, and light at top as well. Through some quirk of symmetry, this can light (of 12 total), ended up HERE, and lines up with the other cans in a row (not pictured. And yes, that is an emergency light, not required per local code but I be losing power in ice storms. I see a lot about how many candle feet, etc...the stairway has to be illuminated, but nothing about how many inches/feet the light source has to be positioned in relation to the top and bottom. The top one is almost directly over the top step. Bottom one, it does the job. I'd hate to add another can there, it will look odd, but I got final coming up soon else have to pull a new permit under 2017, and I'll take an odd-placed can versus re-permitting as a new build.

Comment: i don't see any problem.
Answer: The only thing that worries me is odd placements of the lights and switches requires more wires than a typical /3 cable includes, and that invites bad wiring, e.g. using two 12/2 cables where you need a 12/4 cable.
Also, in this day and age, remember the light switches need real neutral at the switch.  2-wire switch loops (3-wire if 3-way) are outlawed in 2011 NEC.
Comment: This was wired under 2011 and passed rough in. If I *had* to move that can to directly in front of the stair well, I'd just have to shorten the wire from the wall switch to the can, then add another can for the rest of the downstairs circuit to keep my room lights at 12, at the end of the circuit, if that makes sense. I'm more interested in the bottom of stairs placement though.
Comment: FYI, the "top" can is directly above the dog, whom, despite being not my dog, sat long enough for the photo. Good Boy!
Answer: Don't know about code.  But the top light seems to cast a shadow.  The actual step is in partial shadow from the step above it.  I would like to see another picture with the stair light on, all other lights off, and it dark outside.
If it was my stair I would try to put a light in the ceiling above the 2-4th step from the bottom.  This is unpleasant ladder work install.  I presently have one on above the 7th form the bottom, and in an otherwise dark house, it can make for misperceptions where the edge of the step is.
Another way to light the stair would be those rope lights.  Run a strand along each side on the stringers just behind the treads.  You could also incorporate rope lights into the currently non-existent railing.
Comment: There is no ceiling above stair, just another stair going to 3rd floor.

Stair Illumination: Location of light