-Wextra how useful is it really?

Question: I'm reading the gcc manual at the moment, especially the part about warning/error flags. After reading the part about the -Wextra flag, I wonder if it is useful at all. It seems that it complains about things which seem to be rather subjective or a matter of taste. I'm not that experienced with gcc, I only use it from time to time for some small projects at university, so to all experienced C/C++ (or for whatever language you use gcc), what's the deal with -Wextra?
Answer: -Wextra, among other stuff implies -Wtype-limits:

Warn if a comparison is always true or
  always false due to the limited range
  of the data type, but do not warn for
  constant expressions. For example,
  warn if an unsigned variable is
  compared against zero with '<' or
  '>='. This warning is also enabled by
  -Wextra.

I find this really useful.
Comment: But it can also cause annoying false positives, e.g. https://stackoverflow.com/questions/46508831/is-the-max-value-of-size-t-size-max-defined-relative-to-the-other-integer-type, when the comparison might be needed on other platforms. There seems to be no way to prohibit this warning other than hiding the comparison using preprocessor conditions, which is somewhat ugly.
Answer: I usually add -Wno-sign-compare and -Wno-unused-parameter to remove noise.
The implied -Wuninitialized (with the -O2 option) has been very helpful to me, but adding it initially to your code base can be a bit daunting. One way to deal with this is to add two macros (which look slightly strange: the equal sign is intentional):
#define ELIMINATE_GCC_WARNING = 0 // used to remove nuisance warnings
#define UNCHECKED_GCC_WARNING = 0 // not yet verified

Then you can quickly eliminate the gcc warnings and get a clean compile by using e.g.:
int foo UNCHECKED_GCC_WARNING;

Then as an optional step go back and check these additions, and change them one-by-one to ELIMINATE_GCC_WARNING. This can be slow. But I would be surprised if you didn't find some existing bugs.
Comment: I find `-Wno-unused-parameter` helpful especially when old source code changes over years, sometimes values end up being passed down nested functions which are not even used. Suggest define UNUSED.

`#define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))`

Then you can wrap arguments like this... `void func(int a, int UNUSED(b)) { ... }`

Its also nice that if the argument needs to be used later on GCC will not let this happen without removing the UNUSED() attribute.
Comment: Thanks, useful advice, but personally I wouldn't disable -Wsign-compare unless the code base had too many of these to deal with. Because many bugs can arise from comparing signed with unsigned, unless you are certain the int will never be negative and the uint will never be greater than MAX_INT
Comment: ideasman42 you can also use "(void) paramName;" in the function body to suppress the warning instead of using attributes
Answer: Please see http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html.
Therefore it is not only useful for 'always true' comparison (-Wsign-compare) but identifying other compilation issues as well. I find it useful often.

-Wextra how useful is it really?


Cruise from Venice to Greece and back - visa requirements

Question: We are landing in Venice and taking a cruise to Greece and back to Venice. Do we need a multiple-entry visa or will a single-entry be enough?
Answer: That depends on the cruise.
Both Italy (where Venice is) and Greece are members of Schengen, and the single/multiple-entry thing goes for the Schengen area, so if you only enter the Schengen area once, you only need a single-entry visa. But if the cruise includes a stop in one of the non-members of Schengen that you'll pass (e.g. Albania), you'll technically enter Schengen multiple times and need a multiple entry visa. Without having done any work to verify it, my guess would be that the companies arranging that kind of cruise would either be quite explicit about leaving Schengen (meaning every passenger would need a multiple entry visa) or (more likely in my mind) would stay inside Schengen.
Answer: It looks like most if not all cruises between Venice and Greece stop at one or more ports outside of the Schengen area (Kotor, Dubrovnik, Split...).
This theoretically means there should be exit/entry checks, and possibly the need for a multiple entry visa, but there are lots of exceptions (mostly based on where passengers can embark/disembark), and only the cruise operator will really know.
There does not seem to be much information on the topic on the relevant websites I checked, so you'll probably have to call them to be sure.
To be on the safe side, I would personally request a multiple-entry visa whatever they tell you. You'll definitely need one if you actually go ashore in one of the non-Schengen ports.
Answer: You probably only need a single entry visa, but it depends on the exact arrangements between the cruise line and the port and immigration authorities. Only your cruise line can give a definitive answer.
Sea ports are in most cases considered external Schengen borders except if you use a regular ferry connection directly between two member states. Private boats going between Italy and Greece are for example always subject to immigration control and cruises are usually not considered as as regular ferry connections. There are however many exceptions in force to simplify cruise tourism, but as I wrote, you must check with your cruise line to see if they apply in your case.
Comment: Why was this downvoted without explanation?


Android JellyBean stock keyboard capitalizes first letter of word before question mark

Question: On my Samsung Galaxy Tab 3 running Android JellyBean 4.1.2, when I add a question mark after a word, the first letter of that word gets capitalized. Do you know why this happens and how it can be Solved? See the last Sentence? It's happened there too.
Comment: Yes. It's lower case. Add the question mark and it's upper case. See the words solved and sentence in my question.
Comment: It happens because that common English syntax... a question mark signals the end of a sentence so the net work will have a capital letter
Comment: Sorry, I meant before the question mark...
Comment: hmmm does it do it after you have entered the question mark then, i.e its lower case to start with?
Answer: All I can see are lower case letters. It might be a bug with  your Samsung keyboard software. You could try updating your os if it is the case or you could try other apps for writing like SwiftKey for example.
Comment: See the words solved and sentence before the question marks...
Comment: Oh, I see, I was looking at the last letter not the first. If it is a bug on your Samsung Keys software then it should work fine with SwiftKey. Try installing the app just for the sake of testing this. It's free and small so it shouldn't take more than a minute or two.


Can you /should you use a roller to apply stain to hardwood floor (parquet in my case)

Question: Can you /should you use a roller to apply a finish to hardwood floor (parquet in my case)?
I am seeing lots of videos with guys using a rag to apply the stain, that looks very tedious and time consuming and I am not sure if it is evenly applied this way
Comment: By "rug", do you mean "rag"? Note that this is the way stains are traditionally applied to everything from door/window trim to large furniture to floors. It has to be wiped on, allowed to soak in until the desired color is reached, then the excess wiped off. An even coat is achieved by an even soak in time and consistent wipe off.
Comment: Again, I'd suggest a tour through the `stain` tag at [woodworking.se] to learn a lot about application and what happens if you don't do things right.
Comment: yes I fixed that, it is rag. Will have a look at woodworking
Comment: Also, remember that wood is a natural product, so the stain _will_ soak into some pieces more than it will others. You won't end up with a perfectly even finish. If you do, frankly, it will look like it was painted (with wood grain added), which probably isn't what you want. Don't sweat it too much - this is one place where perfection isn't perfect.
Comment: I changed the other related question and added a picture -it is not exactly as you say, I think it is worse https://diy.stackexchange.com/questions/249768/how-do-i-fix-this-failed-attempt-to-refinish-the-floor
Answer: Stain is not paint. It's intended to be absorbed into the top layer of the wood, not to form a coating on top of the wood.
So although I guess you could apply it with a roller, you'd still need to rub off the excess which doesn't get absorbed - in which case why not just apply it with the same 'tool' you're already using to rub with?
Note that the way I'm using the term 'stain' refers to a product which is only intended to change the color of the wood. It is not a protective or sealing product like a polyurethane. Sometimes some people do also refer to these protective coatings as a "stain" even when they don't have any color to them - which is IMO incorrect and causes confusion.
Judging by one of your other questions you're comparing outdoor deck "stain" with indoor floor stain and getting caught by this differing use of terminology.
You'll find that if someone is spraying "stain" onto an outdoor deck, then it is almost certainly not really just a "stain" product, but is in fact a protective wood sealing product which may have some degree of color in it (or not, depending on the product).
Comment: Frankly, if you _don't_ wipe off the excess stain, you'll be waiting _weeks_ (if not longer) for it to all dry to the point of being usable. It might not ever dry to a usable state if there's too much left on.


Substitution of root beer concentrate for extract

Question: I'd like to make these root beer float cupcakes. The recipe calls for root beer extract, but I haven't found any locally, and the cost plus shipping on Amazon is a little more than I'd like. I've tried googling this, but haven't come up with a definitive answer: can I substitute root beer concentrate (easily bought locally)? If so, what adjustments have to be made?
Answer: Usually extracts are used for flavoring foods, but in this case root beer extracts and concentrates both are for making root beer at home, so I would suspect that you could use concentrate in this case as long as you get the proportions right and use a non-sweetened concentrate. The products out there vary in concentration and sugar content, you'll probably have to buy one and experiment to get the amounts right.


How can we have spinless fermions?

Question: I've read that the Jordan-Wigner transformation changes qubits into spinless fermions. What, exactly, are spinless fermions? I'm guessing it doesn't mean spin zero which would be a boson, so what does it mean?
Answer: It is only in relativistic quantum field theory that spin and statistics are connected; see http://en.wikipedia.org/wiki/Spin-statistics_theorem
In non-relativistic QFT the two are completely distinct. Spin manifests as local degrees of freedom, and statistics is encoded in the (anti-)commutation relations at equal times.
Comment: You can treat it as spin zero, but only if you don't take that to mean anything more than just a lack of local degrees if freedom. For instance, it says nothing about angular momentum.
Comment: Plea for help: does anyone have a self-contained (online) reference to CCR and CAR? The Wikipedia page on this is needlessly pedantic for a beginner (i.e. considering the exponentiated forms to make them compact --- I doubt the OP much cares for compactness).
Comment: Thanks @genneth, so does that mean spinless does mean spin zero?

How can we have spinless fermions?


Why does paging not have external fragmentation?

Question: I have read that paging does not suffer from external fragmentation as the frames and the pages are all of the equal sizes, but when we store a last level page table in a frame at that time it may not fully occupy the frame. Similarly, if n such page tables are stored, that does not occupy the frames entirely, then there can be a case where all the gaps exceed a page size. Then there should be external fragmentation, right? So why is it said that paging does not have external fragmentation?
Comment: There seems to be some context missing. This makes it difficult to help you.
Answer: The details depend on the processor architecture, but the principle is the same everywhere. All page tables of a given type at a given level have the same size. When all memory blocks have the same size, there is no fragmentation: a memory block is allocated starts at an offset which is a multiple of the block size, so the size of any hole is a multiple of the block size. If a gap opens in the page table, the operating system can use this gap the next time it needs to allocate a page table.
Furthermore the size of a page table pretty much always divides the size of a page — both are powers of two. So a page contains a whole number of page tables with no leftover space. This means that the operating system can allocate pages for page tables and no table spreads over multiple pages, so there's no need for the page tables to be consecutive and therefore there's no fragmentation of the address space for the page tables themselves.
Answer: The collection of internal fragmentation do not contribute to external fragmentation.
External fragmentation is contributed by the empty space which is EXTERNAL to partition(or page). So suppose if there are only two frames in main memory ,say of size 16B, each occupied by only 1B data. The internal fragmentation in each frame is 15B. The total unused space is 30B. Now if you want to load one new page of some process, you will see that you do not have any frame available. You are unable to load a new page eventhough you have 30B unused space. Will you call this as external fragmentation? Answer is no. Because these 15B unused space are INTERNAL to the pages. So in paging, internal fragmentation is possible but not external fragmentation.


Is SSL required for sites hosted behind WAF?

Question: We have a website hosted behind WAF and we will be using HTTPS. The server already has a valid SSL. Do we need to install SSL on WAF servers also?
Answer: A WAF applies filter rules on traffic at an "application" level (e.g. it tries to detect SQL injection attempts). This requires that the WAF sees the traffic, i.e. whatever SSL which may have happened on the client side must stop at the WAF. But you usually want some SSL to protect the traffic between the client and the WAF (in fact, you usually want it more on that link than between the WAF and the server itself, since WAF and server are usually nearby to each other).
There are two ways for a WAF to see SSL-protected traffic:

The WAF has a copy of the private key used by the (SSL-aware) server, and thus can decrypt the data as it flows. (This can imply some restrictions on the cipher suites used by the server; namely, no DHE).
The WAF itself runs a SSL server, and that is the one which the client sees. The WAF decrypt the data, runs its magic on it, and then forwards it to the server over a new connection which may or may not be SSL-protected.

Which one you use depends on what your WAF instance can do and how you configured it.
Comment: Hi , my website requires https connection right from the client ie users browser to the destination server via WAF. I have SSL in destination server. Is it required to install SSL on the WAF layer or I can continue without SSL ?
Comment: If you want to prevent MITM attacks between the WAF and the destination server (you know, as a defense-in-depth strategy just in case the network has been breached somehow), then yes you should. The good news is, you can now use self-signed certificates for this SSL communication, since WAF-destination server communications are supposedly internal network only.
Comment: You will also need to install SSL on the WAF so it can present a valid (ie. signed by a commercial cert authority) cert to the client and inspect the traffic between client and destination server. Basically, see @Tom Leek's second point.
Answer: Yes.
Either way, the SSL certificate will need to be installed on the WAF in order for it to inspect the encrypted traffic.


Why companies appear in several stock exchanges?

Question: Let's say I want to buy stocks of Sinopec which is a Chinese company. I would expect to buy it from HKS and in local currency.
With the Degiro broker which is Dutch, I see "Sinopec Shangai Petrochem-H in the search in HKS but I cannot buy it; there is no price. Instead of that I can buy another one in NSY "Sinopec Shangai Ads" in US dollars.
I can also see other "versions" of the company in the German stock exchange.
Can someone explain to me what is happening? If I buy the one from NSY, is it the "real" Sinopec?
Answer:
If I buy the one from NSY, is it the "real" Sinopec?

No - you are buying an American Depository Receipt. Essentially some American bank or other entity holds a bunch of Sinopec stock and issues certificates to the American exchange that American investors can trade.  This insulates the American investors from the cost of international transactions.
The price of these ADRs should mimic the price of the underlying stock (including changes the currency exchange rate) otherwise an arbitrage opportunity would exist.
Other than that, the main difference between holding the ADR and the actual stock is that ADRs do not have voting rights. So if that is not important to you then for all intents and purposes trading the ADR would be the same as trading the underlying stock.
Comment: Considering I have neither the knowledge or the resources to invest in foreign companies directly, I have no choice but to use ADRs. I would have to look at the historical performance between the two to see if there is a significant difference.
Comment: @D Stanley if you had the option, would you prefer the real one or the one through ADR?
Comment: @Grandmaster This largely depends. If you are in country, buying directly helps. If you are not, buy ADR from exchange in your country or more trusted country. Generally ADR's are bit more expensive then the underlying stock due to various handling costs as well as Fx fluctuations.
Answer: The case you are looking at is rather special, because the Chinese government for the longest time did not allow foreigners to invest in Chinese stocks. The ADRs explained in @DStanley's answer are a way around that restriction; recently there are some limited official ways,
In general, it is perfectly normal for a stock to appear on different exchanges, in different currencies, and it's all the "real" stock. Because remember: a stock exchange is really nothing more than a fancy place for people to buy and sell stocks. There is absolutely no reason why a specific stock should only be traded in one place.
Companies that have decided to be publically tradeable generally want to be traded in as many exchanges as possible, because it makes the stock more liquid, which helps their shareholders. Individual exchanges have different requirements for a stock to be listed for trading there, some may even do it without the company's explicit approval.


concentration of random matrices involving normal random variables

Question: Define the random variable
\begin{align*}
A=|a_1|^2\mathbf{a}\mathbf{a}^*
\end{align*}
where $\mathbf{a}\in\mathbb{c}^n$ is a random vector distributed as $\mathcal{N}(0,\mathbf{I}/2)+i\mathcal{N}(0,\mathbf{I}/2)$ and $a_1$ is the first entry of $\mathbf{a}$. Now let $\mathbf{A}_r$ for $r=1,2,\ldots,m$ be i.i.d. samples from $\mathbf{A}$. I'm interested in showing that
\begin{align*}
\|\frac{1}{m}\sum_{r=1}^m\mathbf{A}_r-\mathbb{E}[\mathbf{A}]\|\le \delta
\end{align*}
with high probability for a small constant $\delta$ as long as $m\ge c(\delta)n$. Here, $\|\cdot\|$ denotes the spectral norm. Note that I am interested in establishing the result for $m\ge c(\delta)n$. I already know how to establish this result for $m\ge c(\delta)n(\log n)^3$ by using a truncation argument.
Comment: I'm also interested in calculating the same quantity when $\mathbf{A}=a_1^2\mathbf{a}\mathbf{a}^*$
Answer: Your question looks very similar to Mark Rudelson's inequality. Rudelson's inequality bounds the deviation of rank-one matrices/operators under the spectral norm.
See Rudelson inequality
For some nice applications of the inequality, see also Sampling from Matrices.
There is a rapidly growing line of research on the field, see Tropp's (beautiful) paper J. Tropp
Comment: Thanks, I am familiar with all of these references. In some sense all of them require that the matrices are bounded. Hence, one has to apply truncation first. This is where I loose the log factors.
Comment: I see. Your bound O(n (log n)^3) is tight up to a (logn)^2 factor for general rank-one samples. What are you shooting for? O(n) number of samples?
Comment: I can now actually do o(n*log^2 n) by truncation I think. I would like o(n) but I would actually be happy with an argument that gives o(n*log n)


Can temporary character banality be lower than permanent?

Question: In Changeling the Dreaming, can a Changeling's temporary Banality be lower than its permanent? Or does it always starts from the permanent one?
Answer: Banality is defined as one of the characters Tempers. Per page 150 of the second edition rulebook: "At character genesis, you assign the character's permanent Temper rating based on her seeming and any freebie points you spend in the Trait. A character is then assumed to have a number of temporary Temper points equal to the number of permanent Temper points." (Emphasis mine.)
On the same page, it mentions that when you reach 10 temporary points of Banality, the temporary points are removed and you gain a permanent point of Banalty.
Comment: Could you check something while you look for page numbers? On my translation it says that temporary banality is what it's used to know how banal is a Changeling, and to calculate the effects of banality, but my logic says it should be permanent banality. If you find something, could you also post that?
Comment: It's page 152 in the second edition, and it's not mistranslated: the book says *temporary* banality causes you to slip into the Mists.  However, permanent Banality affects the difficulty of Enchanting, and cantrips are ambiguous.  (While not a mistranslation, I suspect it *is* an error, because I agree this seems silly.)
Comment: Tynam is right. The book says "The effect of Banality upon a character is measured by her temporary Banality rating." The ramifications of the Mists being based on temporary Banality and the above info about starting temporary Banality really ratchet up the difficulty level if the game. (I always love to find out I've been playing a game wrong for years.)
Answer: I must say that the book is not very clear in that, at least on the spanish translation.
Anyway, I understand that it can of course be lower. In fact, I haven't found a word of it starting at the same level as permanent one. In fact I haven't found a word of a what level it starts. The only reference I have found is the creation example, where again it's not mentioned, but you can see no temporary banality is marked on the character sheet, which would mean that it starts at zero.
If you reach a temporary banality of 10, you gain 1 dot of permanent banality. Again, it's not said, but seems logical that your banality resets to zero.
So, the book doesn't make a good job explaining it, but what I understand is that you can have temporary banality lesser, erqual or greater than permanent one.


True vault huntermode?

Question: How does true vault hunter mode work? Is it free? Can I play through a new game with a new character on true vault hunter mode? I have tried true vault hunter mode so I do not know about it.
Answer: True Vault Hunter Mode is like "New Game+" for Borderlands 2.  It unlocks once you've completed the main quest in "Normal" mode.  Then you can play it, for free, at any time you want, with any character that has completed the main quest in "Normal" mode.  It's part of the base game, no DLC or anything else is required.
There's also "Ultimate Vault Hunter Mode" which is part of the "Ultimate Vault Hunter Upgrade Pack DLC" and included with the Season Pass.  It adds a third playthrough after you complete True Vault Hunter Mode and are at least level 50.
In both cases (True and Ultimate), when you start the game your missions reset to the beginning.  The difficulty and levels of the enemies increase.  You can switch between modes at any time at the main menu.  When you select a character, you'll get a prompt for which mode you wish to play in.  Quest progress is tracked for each mode separately, but your character stays the same regardless of the mode.

True vault huntermode?


Is there a way to remove trailing spaces and convert tabs to spaces in a lot of files at once using command-line?

Question: I am using cygwin and have a lot of files in which I want to convert tabs to spaces (four spaces per tab) and remove all space characters that exist at end of line. Is there a utility for this in Linux?
Comment: You are searching for `sed`
Answer: sed is your friend for that. Comes for free with all Linux distros, as far as I know. It's the "Stream EDitor", and works with regular expressions. To apply it to your example:
sed -E 's/\t/    /g;s/\s*($)/\1/g' infile outfile

Each tab (\t) is replaced by 4 spaces, and trailing spaces (actually, all whitespace characters up to the end of the line ($) are removed. If you don't want the result in a new file, you can tell sed to do the replacements inline (-i):
sed -i -E 's/\t/    /g;s/\s*($)/\1/g' file

In a lot of files? No prob:
sed -i -E 's/\t/    /g;s/\s*($)/\1/g' *

(just pass a "mask", like *.txt or whatever files should be matched).
You can get sed from your distro's package management, e.g. apt install sed.
Comment: What language is 's/\t/    /g;s/\s*($)/\1/g'? Is that a regular expression? I don't see the digit 4 anywhere in the regular expression. What is going on here?
Comment: Yes, it's regular expression. And no, the question wasn't asking for digits – but the replacement part has 4 spaces as requested. Just try it out with some sample files (I did, and it does what you asked for). The trailing `/g` makes sure it's applied Globally, so all tabs are replaced by 4 spaces each.
Comment: I am just curious to know, how did you specify the "4 spaces" part?
Comment: By using 4 spaces? The big gap following the `\t/` are 4 spaces. `sed` syntax is `s///`, basically meaning `s`earch for this `` and replace it according to `` applying ``. You can concatenate multiple operations using a `;`. So taking the first part, it means `s`earch for a `\t`ab, replace it by 4 spaces, `g`lobally. The second part is `s`earch for white-`\s`paces up to the EOL (`$`) and replace that with the EOL (back reference: `\1`  is the first `(match)`).


update distance matrix between n points

Question: I am looking for an efficient algorithm to update a $N*N$ matrix, in which the coefficients represents the distance between $N$ number of points, every time that the coordinates of a point change in a 2D Cartesian plane.
Here an example:
There are 3 points in a Cartesian plane:
$a=(1,3)$
$b=(3,3)$
$c=(4,1)$
to calculate the distance between $a$ and $b$ I would simply apply:
$d_{ab} = \sqrt{(x_b-x_a)^2 + (y_b-y_a)^2}$
the distance matrix would be a $3*3$ diagonal matrix where the coefficients represent the distances between each point:
$\begin{bmatrix}0 & d_{ab} & d_{ac} \\ d_{ba} & 0 & d_{bc} \\ d_{ca} & d_{cb} & 0 \end{bmatrix}$
My algorithm is pretty straight forward: I nest 2 for loops to calculate the distance between each point that are inside the points array every time a coordinate change.
Here an example in python, but I am not interested in a language specific solution:
import math
def distance(a,b):
    x = pow(b[0]-a[0], 2)
    y = pow(b[1]-a[1], 2)
    return math.sqrt(x+y)

points = [[1,3],[3,3],[4,1]]; # cartesian points
distanceMatr = [];
matrixLen = len(points);
for i in range(matrixLen):
    point = points[i]
    row = []
    for j in range(matrixLen):
        d = distance(point, points[j])
        row.append(d)

    distanceMatr.append(row)

print(distanceMatr)

If now $a$ moves to $(2,3)$ points becomes [[2,3],[3,3],[4,1]] and I apply the same algorithm again.
The main problems that I would like to optimise of this algorithm are:

if the coordinates of $a$ change the distance between $b$ and $c$ doesn't
the distance $d_{ab}$ is equal to $d_{ba}$
the distance between $a$ and itself is always $0$

Do you have any advice?
thank you very much!
Answer: If the coordinates of $a$ change, you just need to update one row and one column corresponding to $a$, not the whole matrix. This is done in linear time rather than quadratic time in your algorithm.

update distance matrix between n points


Civievent live page giving error 500

Question: this isn't really an issue, just a quick PSA. I have the latest wordpress and civicrm 5.66.1. When trying to access civievent live/test registration page, I kept getting an error 500. However, I changed my website to php8.0 and everything seems to be working. It was php8.1 before.
Again, just a heads up for anyone running into this issue.
Comment: It would be helpful to know what the error message was exactly. It should be in your log file.
Answer: The 55.6.x version has a bug in pear, see at the post of mine
Illegal argument error

Civievent live page giving error 500


Can someone please provide the method of worship for Manasa Devi?

Question: I have read that Manasa Devi is worshipped using a cactus, tree branch or snake idol. Is this correct? Can someone please provide more information regarding the correct procedure to worship Manasa Devi?
Answer: I've seen quite often the snake idols for Manasa Devi. Then normal aarti/puja is carried out with those.
This article has excerpts from a book on Hindu goddesses and includes some (brief) info on that :
https://hinduaesthetic.medium.com/goddess-m%C4%81nasa-cb84c3ea1222
(It's a site link with published book segments, not sure if this is acceptable for answer on HSE, plz remove/delete if not.)
I'm drawn to the myths and folklore around Goddess Manasa, with her father (alternate stories giving MahaDev or Rishi Kashyp), stepmother Parvati, son Asthik, husband Jaratkaru, the Behula-Lakhinder story. Fighting spirit to prevail against the odds. Great to see some different discussion topics of her here.
Comment: link-only answers, in general, are not accepted as answers on any stack site.
Comment: @hanugm No probs, I understand, plz remove/delete the above if that would be best. I'm looking around for more scripture citations to improve the answer but not coming up with much.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Comment: Replying to the community bot above to say : Hi, pujas and that type of personal experience aren't proper proof here and outside of those, I unfortunately don't have documentation/citations at this time ? So plz feel free to change or erase the answer if shouldn't be up, that is fine with me, no worries. Thx :D
Answer: The method of worshipping Devi Manasa is in Devi Bhagwatam

1-30. Nārāyaṇa said :-- O Nārada! I will now speak of the Dhyānam and the method of worship of Śrī Devī Manasā, as stated in the Sāma Veda. Hear. "I meditate on the Devī Manasā, Whose colour is fair like that of the white champaka flower, whose body is decked all over with jewel ornaments, whose clothing is purified by fire, whose sacred thread is the Nāgas (serpent), who is full of wisdom, who is the foremost of great Jñanins, who is the Presiding deity of the Siddhas, Who Herself is a Siddha and who bestows Siddhis to all." O Muni! Thus meditating on Her, one should present Her, flowers, scents, ornaments, offerings of food and various other articles, pronouncing the principal Seed Mantra.

You can go through the link for complete procedure.


Was Voldemort susceptible to the Imperius Curse?

Question: Could he have devised safeguards against it or been powerful enough to resist the effects? Could the Horcruxes have any bearing on its effect over him?
Answer: I think he would be able to resist it and the Horcruxes will have no effect as they are only used to attain immortality.
According to Harry potter wiki,

Resisting the Imperius Curse is possible, but requires great strength
  of will and character. The fact that it can be resisted makes it
  unique amongst the Unforgivable Curses as it is the only curse that
  has a manner of defence. Harry Potter, Barty Crouch Sr. and Barty
  Crouch Jr. each learned to resist the curse after being subjected to
  its effects, though the latter two took quite a long time before
  building the said resistance, and in Barty Sr.'s case, resistance
  against Voldemort's powerful curse has seemingly caused mental damage.
  Resisting the Imperius Curse is similar to Occlumency, which requires
  a great amount of willpower, though it is unknown if Occlumency would
  actually work against the curse.
Comment: He seems like a good candidate for being able to resist this, especially since he would hate being able to be controlled, so he may have even practiced against it. though again practice requires that he trust someone else.
Comment: who would dare to try and imperious him in the first place?
Comment: Someone arrogant enough to think they could rule through him.
Answer: There is no reason why Voldemort shouldn't be susceptible to the Imperious Curse. The horcrux wouldn't affect it (nor would they be affected by it), because it's his mind that is affected, and not his soul. Also, there is no mention of any kind of magic (or potions, or anything) that would make one immune to the curse. What they do mention is people who learn to resist and not be controlled (Such as Harry). So, once again, there is no reason Voldemort wouldn't be susceptible by the curse.
That being said, he - being the strong wizard he was - would be one to be able to resist it easily. Not to mention how ballsy one would have to be to try and curse him.
Answer: Voldemort would most likely be strong-willed and magically powerful enough to resist it.
The Imperius Curse can be resisted, and it seems likely that Voldemort has the qualities necessary to be capable of resisting it. His Horcruxes would not help him with this, since Horcruxes only tether the soul to life if the body dies, and no known external safeguards for immunity to being Imperiused exist, but he would not necessarily need external aid to resist it. Resisting the Imperius Curse takes a strong will, which undoubtedly Voldemort has.

"The Imperius Curse can be fought, and I'll be teaching you how, but it takes real strength of character, and not everyone's got it. Better avoid being hit with it if you can. CONSTANT VIGILANCE!' he barked, and everyone jumped." - Harry Potter and the Goblet of Fire, Chapter 14 (The Unforgivable Curses)

If strength in magic is also a factor, Voldemort has that as well - even before he learned he was a wizard, he had a very high level of control over his powers.

"His powers, as you heard, were surprisingly well-developed for such a young wizard and – most interestingly and ominously of all – he had already discovered that he had some measure of control over them, and begun to use them consciously. And as you saw, they were not the random experiments typical of young wizards: he was already using magic against other people, to frighten, to punish, to control." - Harry Potter and the Half-Blood Prince, Chapter 13 (The Secret Riddle)

Harry was not that level of skilled in magic, and he was able to somewhat resist the Imperius Curse the very first time it was used on him through the strength of his will, and with practice, became able to throw off the Imperius Curse entirely.

"And then he heard Mad-Eye Moody's voice, echoing in some distant chamber of his empty brain: Jump onto the desk . . . jump onto the desk. . . . Harry bent his knees obediently, preparing to spring.
Jump onto the desk. . . .
Why, though?
Another voice had awoken in the back of his brain. Stupid thing to do, really, said the voice. Jump onto the desk. . . .
No, I don't think I will, thanks, said the other voice, a little more firmly . . . no, I don't really want to . . .
Jump! NOW!
The next thing Harry felt was considerable pain. He had both jumped and tried to prevent himself from jumping — the result was that he'd smashed headlong into the desk, knocking it over, and, by the feeling in his legs, fractured both his kneecaps. - Harry Potter and the Goblet of Fire, Chapter 15 (Beauxbatons and Durmstrang)

If Harry was this able to resist the Imperius Curse at his less-skilled level of magical knowledge, then presumably Voldemort would be able to as well. Additionally, Ron mentioned that they received class reading on resisting the Imperius Curse. So it can be studied and it's likely something Voldemort would have been interested in learning - he certainly would not want anyone controlling him.

"And when are we supposed to read up on resisting the Imperius Curse with everything else we've got to do?" - Harry Potter and the Goblet of Fire, Chapter 15 (Beauxbatons and Durmstrang)

Therefore, Voldemort could have known the theory of how to resist the Imperius Curse, and would have the willpower to do it, so presumably he would be able to resist it fairly quickly. It might be possible to Imperius him but it's highly unlikely that it would work for long before he fought it off.


What ports should be mapped via NAT for Lync client?

Question: I installed gateway with NAT between PC and network. User of PC can chat via Lync client but can't call or join conference. What ports should be mapped via NAT for Lync client to use all Lync facilities?
Updated: the question actually is about NAT port mapping of Lync client.
Comment: Is that an internal or an external user, did you use split DNS or not?
Comment: DNS is OK. User of pc.
Answer: The following table summarizes the ports and protocols used by Skype for Business/Lync clients:
Port    Protocol    Notes
5061    TCP (SIP)  Used for SIP/MTLS authentication of A/V users. Communications flow outbound through the internal firewall
443     TCP (HTTP) Used by Skype for Business clients/Lync connecting from outside the intranet for SIP communications
1024-65535  UDP/TCP    Port range used for inbound and outbound media transfer through the external firewall
6891-6901   TCP    Port range used by Skype for Business/Lync clients for file transfer
If you experience problems with Audio/Video Conferencing, media or file transfer, please verify that corresponding ports are open on your firewall.
Comment: Firewall doesn't block any outbound connection to any remote address, ports. Likely NAT port mapping matters. All inbound connections will fail if there are no port mapping: gateway doesn't know which ip connect to within Lan created by gateway.


Folic acid dose before conception

Question: What is the normal folic acid dosage that should be taken while trying to conceive? The minimum dosage available in my region is 5 mg tablets. Is that an acceptable dose? I read somewhere that the normal dosage is 400 mcg.
Answer: Contact your physician and find out for sure from them. The ranges vary and are different for every women. Below is some answers, but you can't take important medical advice from the internet. Please contact your physician.
How much folic acid should you take?

14 years and up - 400 micrograms/day
Pregnant women - 600 micrograms/day
Breastfeeding women - 500 micrograms/day

How much folic acid should I take while trying to get pregnant?

The recommended daily intake of folic acid for all women of
  childbearing age is at least 400 micrograms (mcg), or 0.4 milligrams
  (mg).
During pregnancy, the recommended dose jumps to 600 to 800 mcg, or 0.6
  to 0.8 mg.

How much folic acid do women need?

Pregnant women need 400 to 800 mcg of folic acid in the very early
  stages of pregnancy often before they know that they are pregnant.

Examples of foods that have a large amount of folic acid are:

grains such as whole-wheat bread. dark green vegetables such as
  spinach and broccoli. meat such as liver. beans such as lentils and
  kidney beans.

Folic acid dose before conception


Private fields and encapsulation

Question: I'm reading the head first c# book and don't quite understand what this means.
"Any class can see private fields in another instances of the same class"
Answer: Consider these classes:
class A
{
    private int foo;

    public A(int f) { this.foo = f; }

    // works
    public int AddTo(A other) { return this.foo + other.foo; }

    // doesn't work: 'B.bar' is inaccessible due to its protection level
    public int AddTo(B other) { return this.foo + other.bar; }
}

class B
{
    public B(int b) { this.bar = b; }

    private int bar;
}

var a1 = new A(123);
var a2 = new A(456);

var result = a1.AddTo(a2);

Here, the a1 instance of A accesses a2's private foo value. result will be 579.
However, the second method, AddTo(B) doesn't work -- it won't even compile -- because A instances don't have access to B instances private members.
var b = new B(789);
var result2 = a1.Add2(b);

Here, a1 tries to access b's private bar member, but because a1 is an instance of A and b is an instance of B, the latter's private bar member is inaccessible.
Comment: I would separate that code block into two examples, to show the one that works vs. the one that doesn't. I was a little confused at first reading this.
Comment: Edited. Hopefully this is more clear.
Comment: BTW, this has an interesting and very important consequence: the defining difference between objects and Abstract Data Types is that objects cannot see each other's privates, whereas ADT instances can see privates of other instances of the same type. Since instances of the same class *can* see each other's privates, they aren't objects, they are ADT instances. OTOH, instances of the same interface can *not* see each other's privates and are thus objects. So, in C♯, classes define ADTs, not objects, interfaces define objects. IOW: it's not classes that make C♯ object-oriented, it's interfaces.
Comment: And a program that uses classes as types (i.e. use a class (or struct) as the type of a local variable, field, property, method return type, method parameter, generic type argument, cast operator, `as` operator, `instanceof` operator, `is` operator, delegate type, etc.) is not object-oriented. Only interfaces can be used as types, classes/structs can only be used as factories, i.e. a class/struct name can only appear directly after the `new` operator. Note: there's nothing wrong with writing and/or using ADTs in C♯, but if you *want* to write OO, you have to follow these rules.
Answer: If class Foo has a private member, such as
public class Foo
{
    private int _bar;
}

Then _bar is accessible from within any instance of Foo.
public class Foo
{
    private int _bar;

    public bool MatchesOtherFoo(Foo other)
    {
        return _bar == other._bar;
    }
}

You couldn't access _bar from another class, but you can access it from other instances of the same class.

Private fields and encapsulation


Who authored the Targum on Kohelet?

Question: Who authored the Targum on Kohelet? I was unable to find an answer online.
Comment: see the end of this article http://shaalvim.co.il/torah/maayan-article.asp?id=150
Answer: The identity of the author remains a mystery, but Pinchas Churgin analyzed the targum in his book תרגום כתובים and wrote that this much could be concluded about the author:
The targum was composed in Eretz Yisrael, sometime after the closing of the Yerushalmi and Bavli Talmuds. The author decries the harshness of the exile and the cruelty of the surrounding nations, which was the situation during the Roman rule over Am Yisrael. There are no hints of Arabic in the targum, but there is a lot of Greek and Latin - therefore, the author lived in Eretz Yisrael shortly before the Arabic conquest of the land in the second half of the 7th century.

Who authored the Targum on Kohelet?


Help in identifying appropriate statistics to analyze repeated measures data with multiple trials

Question: In a repeated measures design with multiple trials, what would be some appropriate statistical techniques used to analyze data when the variable of interest is a continuous variable? For example, let's say participants level of extraversion is measured on a continuous scale, where higher scores reflect extraversion and lower scores reflect intraversion. The same participants are given 15 puzzles to solve. The puzzles are categorized by difficulty (easy, moderate, hard); each participant solves 5 easy, 5 moderate and 5 hard puzzles to solve. The time to solve each puzzle is recorded. What statistical techniques should I consider if I want to assess whether level of extraversion has any bearing on the time to solve puzzles?
Answer: A multilevel regression or one of its extensions sounds suitable. If you are interested in whether Extraversion is related to the time to solve a puzzle differently for different difficulty levels, you'd want to include an interaction between extraversion and the difficulty variable (which would probably be reasonable to include as categorical).
You'd first want to arrange your data in long format with a 3-level difficulty level variable and then you could use a multilevel regression. E.g. in R
model<-lmer(time_to_solve ~ (1|participant) + Extraversion * difficulty, data=data)

#if you just want to know whether extraversion has an effect in general, you'd change the * into a + in the code to get the extraversion main effect on time.

Then you can further explore the simple slopes for Extraversion for different difficulty levels. The (1|participant) term is a random intercept estimating the variance in outcome that is attributable to the participant, and takes care of the non-independence of your observations (i.e., the fact that you have several observations from the same participants). Check out some multilevel regression tutorials for an overview.
However, your outcome variable - time to solve the puzzles - may have a distribution for which the Gaussian (=regular linear multilevel model as above) is not the best, so you may need to consider using a linear model extension (glmer models in R) and some other distribution family.
Edit. so for this analysis your data structure should be like
ID  Diff     Extr.   time
1   Easy     3.2     20
1   Easy     3.2     25
1   Easy     3.2     26
1   Easy     3.2     19
1   Easy     3.2     17
1   Moderat  3.2     26
1   Moderat  3.2     33
etc.
#i.e. each participant gets 15 rows


How do I patch a medium size hole so that I can install a baby gate securely?

Question: Long story short, 2 holes became 1! I'm trying to patch a medium/large hole so that I can put a baby gate up but it's not working with just spackling! I've tried securing a board over it but it's effecting the use of the gate so I now have to remove the board. What else can I use to patch the wall and make the gate secure? HELP!
Comment: This may have happened originally because you tried to attach the gate to the drywall, and not to a stud.  Drywall is not strong -- paint and toilet roll holders are about the limits of what it can support.  If you can move the gate so the receiver screws into a stud, then your wall will be happier.
Answer: Since you're going to fix the drywall anyhow, you could cut out a section of it and install a piece of wood blocking across the inside of the studs to fasten the baby gate hardware to. (The picture you posted looks like you used pocket-hole screws to attach the board to the wall so I'm thinking you could make use of pocket holes to attach the board between the studs.)
Something like this (disregard the notes on the image pertaining to steel studs. The concept is the same for wooden ones):

Then replace the drywall and attach the baby gate to the wood through the drywall patch. This not only gives you something good and strong to attach the baby gate to, it also makes it much easier to patch the drywall because there's something solid behind the patch to hold it. Also, when the baby gate comes down, the screw holes can be filled and nobody will know the blocking board is in the wall.
Answer: You can use a piece of drywall and cut out an area from stud to stud. If you dont know where the studs are, use a stud finder or a strong magnet to find a screw in the stud which holds the drywall.
Cut out the area and fit the replacement (smaller pieces for patchwork like this are available). Then tape the seams with the grid-type drywall tape and mud it up sand and paint it.
There also biggest metal drywall patches available at the home improvement center (I don't like them). Another solution could be to use a bigger piece of wood which is big enough to be drilled into the studs (left and right). That would give you lots of stability and you would not see the damaged area.


What's a CWS button?

Question: I've flown a Piper that has a button labeled CWS on the yoke, right next to the "Push-To-Talk" button.  I never got a chance to push it though.  What does it do?
Comment: "I never got a chance to push it though"; I take it you're not familiar with the famous last words "what does this button do?" :)
Answer: Sounds like that plane has (or once had) an STEC autopilot installed - CWS stands for Control Wheel Steering - basically it allows you to set a pitch attitude / turn rate using the yoke, which the autopilot will then maintain until instructed to do otherwise.
If the autopilot is still installed you also normally use the CWS mode as part of the preflight routine to get the autopilot to activate so you can make sure you can overpower it (details on the preflight as well as using the CWS feature can be found in the autopilot manual, which should be with the POH).
If the autopilot is no longer installed the switch technically should have been removed with the rest of the system and a blanking plate installed in its place.
Comment: Huh. Now I wish I had a chance to try that out.
Answer: CWS is Control Wheel Steering, an early autopilot feature that senses if the pilot presses the flying control, and adjusts the target pitch as a result. Forces over a certain threshold activated the CWS when selected, however the required forces are much below the autopilot override force, so the autopilot stays fully functional.
It is still present in the B737-NG autopilot select panel, the MCP. CWS-R activation played a roll in the crash of Flash Airlines flight 604.

What's a CWS button?


What happens to Unsullied after this death?

Question: In Game of Thrones, after their beloved queen's death, will the Unsullied follow the new king or will they return to their home?
Answer: They are going to Naath, as said by Grey Worm:

We sail for the Isle of Naath.

They are free people and seem to be following Grey Worm and of course, Naath was Missandei's home. It's a throwback to their past conversation where Missandei expressed going back there. So it seems they are going to Naath and might become the protectors of Missandei's people there.
Comment: Actually, they're more likely to catch a fever and die. *"Strangers…do not live long upon the Isle of Butterflies."* (from the books)
Comment: Naath is a land frequently raided by slavers, so it seems reasonable that if they wanted to both fight slavery and honour Missandei, they could do worse than go protect Naath.
Comment: Doesn't Grey Worm explicitly mention fulfilling Dany's wish of a slavery-free world? I'm pretty sure the remaining Unsullied are setting sail to go do that.


blackberry webworks: trackpad scrolling

Question: i have several focusable elements in my app, so when i'm focusing a scrollable div, the focus goes to another focusable element instead of scrolling that div when using the trackpad. how can i prevent this? i want it to scroll that div first, and if it cant scroll anymore then jump to the next element. how can i achieve this?
Answer: Take a look at the Kitchen Sink example for scrolling Divs:
http://blackberry.github.com/WebWorks-Samples/kitchenSink/html/css3/overflow.html
NOTE: Use Firebug/Chrome Developer tool to view the javascript doing all the work.

blackberry webworks: trackpad scrolling


Does the maxim "Expressio Unius Est Exclusio Alterius" apply to the rules for dating my teenage daughter?

Question: Non-lawyer here.  Someone I know who IS a lawyer says that the maxim "Expressio Unius Est Exclusio Alterius" governs conduct everywhere, even in non-legal settings.  I asked if it governs the conduct of teenage boys trying to date my teenage daughter.  He said that absolutely it does, and that ignorance of the law is no excuse.  Frankly, I have no idea what he's talking about.  What would it even mean for this maxim that he called a "canon of construction" even to apply here?
Comment: I'm voting to close this question because it is a question about linguistics in general conversation, not the law.  It may be on-topic elsewhere on the Stack Exchange network.
Comment: Whether something applies in non-legal settings is, by definition, not a question about law, hence off topic here.
Comment: That's what I thought.  Thanks.
Answer: Your lawyer friend is misguided
Casual conversation and writing are not subject to any maxims of interpretation - the words mean what the speaker/writer says and what the listener/reader understands and these may be different things.
In a conversation about restaurants, there is no implication that the places not mentioned are not restaurants or don't exist. Even if I were to write a published magazine article called "The 10 best restaurants in the world", there is no implication that no other restaurant can possibly be better than those 10.
This applies even in business settings. For example, this is the Petbarn logo:

It has images of dogs, fish, cats, and birds. By your friend's argument, it would be unlawful for them to sell products for the care of pet snakes or lizards since they aren't on the sign? Or, for that matter, to operate from a building that is not a "barn"?
Finally, your friend is wrong even in legal interpretation. There are many ways of contract and legislative interpretation that are or have been in use in every jurisdiction.
"Expressio Unius Est Exclusio Alterius" is one maxim of interpretation but it may be in conflict with others. For example, if a regulation on aircraft listed various types of aircraft but didn't mention helicopters but nevertheless had an entire section devoted to rotor maintenance the "Rule against surplusage" would require that helicopters be included.
In any event, modern courts tend to take a more holistic view to interpretation and the use of individual maxims is optional.
Comment: "For example, if a regulation on aircraft listed various types of aircraft but didn't mention helicopters but nevertheless had an entire section devoted to rotor maintenance the "Rule against surplusage" would require that helicopters be included." I suspect that the FAA has specific rules about how their regulations are to be interpreted. Aviation is a *very* heavily regulated field.
Answer: "Expressio Unius Est Exclusio Alterius" is the Latin version of a general rule of communicative interpretation to the effect that when people give a list of things, the list is presumed to be complete (the more detailed the list, the stronger the presumption). This is not a hard and fast rule anywhere, but it is harder and faster in the context of rules (game, bylaws, law)
than elsewhere. For instance, if a host names a choice of 4 kinds of desert, you should assume that is a complete list (therefore don't ask for banana pie if that's not on the list). In non-rule contexts, a list might not be exhaustive so there might be some statement like "We have all sorts of choices" that says "This is not a complete list". Laws use certain expressions like "including but not limited to" that has the same effect. In the context of law, because the stakes are higher than in ordinary voluntary social interaction, the maxim is more strictly enforced.


How to learn about media encoding, decoding, formats, etc

Question: While engaging in some media processing (ripping DVD to .avi to watch on my laptop), I became interested in all the technicalities I encountered regarding the video and audio encoding etc.  What are recommended activities and resources I can engage in and consult to build a good, solid knowledge of modern media technologies?  I am a very technical person, so I don't need "For Dummies" resources, but more something like detailed technical introductions.
Comment: Wiki has some interesting details, btw http://en.wikipedia.org/wiki/JPEG#JPEG_codec_example
Answer: Just a very brief rundown:
For video, the major formats concerning DVDs/AVIs: MPEG-1, MPEG-2 / VOB, MPEG4 / MP4 / H.263, FLV,  WMV, MVK
For audio: AAC, MP2, MP3
MPEG-1 typically isn't used much, unless it's for importing video from a camera, or as a common format for using among a wide range of video editors or players.
MPEG-2 / VOB is what's on a playable DVD, which is paired with MP2 audio
MPEG-4 / MP4 / H.263 is what's typically in use for video files these days. It's often paired with AAC or MP3 audio.
FLV is flash video, which is paired with MP3 audio. Flash video has largely been seen on sites which use flash video players. However, many sites have been migrating over to MPEG-4 / H.263.
WMV used to be in wide use, but not so much anymore.  It's typically limited to live streaming nowadays. The compression rate is impressive.
Answer: A more up-to-date answer:
If you really want to know the fine details I suggest reading a book on the subject (this can be university level stuff). It is easiest to start with image processing, then move on to video and audio encoding.
Wikipedia has a lot of info on the various media formats and containers. The main thing to know is that containers are not formats. They are simply ways of ordering the data/bytes belonging to video/audio/subtitle streams. These streams may be compressed in various ways depending on the encoding format.
Common Video Formats/codecs:
- MPEG-1, MPEG-2, MPEG-4 part 2, VC-1, MPEG-4 part 10,  HEVC.
Note mpeg4 part 2 is also (slightly incorrectly) referred to as h263 or mpeg4 ASP. mpeg4 part 10 is known as h264 or mpeg4 AVC.
Common Video Containers:
- flv(adobe, browser friendly), avi (microsoft), mov(apple), mkv(open spec), mp4(MPEG-4 part 14), m2ts(blu-ray)


Driving with low power steering fluid

Question: Was topping off my windshield wiper fluid this morning and I noticed that the power steering fluid was under the low marking, will anything happen if I continue driving?
Answer: At best you'll damage the power steering pump.
At worst it may fail unexpectedly and you will lose power steering which makes it difficult to steer.  That may cause an accident.
Why don't you just top-off the fluid and save yourself the risk?

Driving with low power steering fluid


"I read your diary" vs. "I have been reading your diary"

Question: If someone says: "I am sorry, but I read your diary", it means that person read the entire diary, right? Wouldn't it be better to say "I have been reading your diary" if they want to express they have read parts of it and not everything?
Answer: Difference Between Diaries and Other Books
If you were talking about a regular book, then you'd have it exactly right:

I read the book you gave me. [I'm done with the book.]
I have been reading the book you gave me. [I'm not done yet. I'm still reading it.]

A diary isn't like a regular book, though. It's a special book people use to write down their most personal and private thoughts, without anyone else reading it. It's also one that people keep writing in, and these distinctions make the implications of your statements slightly different.
Simple Past
If someone told me:

I read your diary.

I would interpret it to mean that, at some point in the past, the person read any part of my diary. They may have read the entire thing, or they may have just read a part of it. Since they're telling me that they read it, they probably read at least one part they weren't supposed to.
The action of reading someone's diary has more to do with violating the person's privacy than the act of reading it as a book. The violation occurs as soon as someone starts reading the diary, not when they finish reading it.
Present Perfect Continuous
If someone said the following unprompted:

I have been reading your diary.

I'd interpret it to mean that the person not only read a part of my diary, but they kept on reading it over multiple sessions. In fact, there's probably an implication that they've been reading my new entries as I've been writing them.
If they said the same thing to answer the question:

Q: What have you been doing?
A: I have been reading your diary.

The implication that the person read my diary multiple times isn't necessarily there, but it probably means that I just caught them doing it.
Answer: Yes, to some extent you are correct.  For example:

I cooked us dinner

means that dinner is ready, whereas:

I have been cooking us dinner

generally implies that the cooking is still in progress.
However, given the context of reading someone's diary (a rude invasion of someone's privacy) the present perfect progressive implies that the act is ongoing and -- more importantly -- you don't intend to stop doing it.
As an example, it would be odd to tell someone:

Hi, I have been tracking mud all through your house, I hope you don't mind if I track some more?

Of course you do see people like this in fiction (and occasionally in real life) but most of us recognize it as atypical behavior.  In the same way, if you did read someone's diary, perhaps by accident, you want to use the past tense (or past perfect tense) to indicate it's a complete action, and not one you intend to repeat.

I'm sorry, I tracked mud through your house.  Let me get a mop to clean it up.
Comment: again I am wondering about the use of the present perfect continuous for actions recently stopped. I think that would apply here. Would anyone else like to comment?


Add Ubuntu to windows domain

Question: I am new to linux. I do not have any knowledge on how to do anything on linux. I just got a new machine and successfully installed ubuntu onto it. The first thing I want to do is join the domain the rest of the computers are on. How do I do that. I tried googling it but all the results assume some sort of linux knowledge and I have none.
Comment: to help answer, it might be helpful to understand *why* you want to join the domain. What's the end goal?
Comment: @Chris_K I want to install apache server and and be able to access it from other computers on the network via http : // linux-server
Answer: I would pay more attention to Chris_K's comment on your original post than to how to configure Samba to join a Windows domain.  You do not need this system to be on a Windows domain, you need it to be in your DNS!  If your DNS is Windows based, then log into your DNS server and add an A record for the service in question (i.e. wiki.mycompany.com -> 192.168.1.200).  Then once you have the web server installed and configured users can connect via https://wiki.mycompany.com/.
Comment: Agreed. No need to have it in the domain. Just add a the DNS record :-)
Answer: It's a bit like asking how to drive a car without the keys. I'm sorry but you won't get far if you're not willing to learn how to do simple things.
Your guide should probably be the official help:
https://help.ubuntu.com/community/ActiveDirectoryWinbindHowto
When it says install something, go to the System menu, Administration, Synaptic Package Manager, search for the package, click the little box on the left, click install. Then click Apply and it'll perform all the changes you've asked for. Alternatively from a terminal, just sudo apt-get install <package-name>.
When it says edit /etc/samba/smb.conf press Alt+F2 to get a run dialogue and bung in gksu gedit /etc/samba/smb.conf and that will launch the default text editor as the root user with that file. Alternatively, from a terminal in text mode, sudo nano /etc/samba/smb.conf.
For any other basics, hop in IRC (server: irc.freenode.net channel: #ubuntu) and one of a thousand people will be able to help you out pretty quickly.
Comment: Thanks! and I am willing to learn, I want to learn, just in the process of learning now.

Add Ubuntu to windows domain


Very stuttery laptop internal display when HDMI is not connected

Question: I'm setting up a new Manjaro install on my laptop (Dell Inspiron 7567) with NVIDIA Optimus, and I've run into an issue with my monitor configuration.
When there is a monitor connected to my laptop's HDMI port, everything works fine. However, if I disable the HDMI port using xrandr --output HDMI-0 --off, or just physically disconnect the HDMI cable, the remaining internal display is unusably laggy.
All of my windows (I'm using Openbox) only update about once every 10 seconds. The mouse cursor remains perfectly smooth though, and the rest of the computer keeps working fine; I can execute commands and they execute immediately (though I can't see the results until the monitor next refreshes) and my Spotify music continues playing.
(Update: The issue only seems to happen on Openbox. i3 works fine when disabling HDMI.)
As soon as I reconnect the HDMI cable or re-enable that output, everything goes back to normal and is usable again.
Since it may well be relevant, my laptop's Optimus graphics are internally connected in such a way that the NVIDIA graphics card is directly wired to the HDMI port.
Why could this be happening?
My /etc/X11/xorg.conf (partially generated by nvidia-xconfig):
Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    Option "AccelMethod" "none"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

I'm using the 430.26 proprietary NVIDIA drivers (acquired by mhwd through the video-nvidia configuration). Note that I am not using Bumblebee or a PRIME switcher.
My NVIDIA X Server Settings monitor configuration (the AOC monitor is my external HDMI one, the PRIME one is the internal monitor):
Answer: It looks like the issue was caused by Compton - disabling this has resolved the issue. (This would also explain why i3 didn't have the issue, as Compton is launched by my Openbox init script.)


$\text{SO}(N)_1$ Chern-Simons theory has no topological order?

Question: According to appendix C5 in this paper, $\text{SO}(N)_1$ Chern-Simons theory has no topological order. On the other hand, in this paper, Prof. Wen showed $\text{SO}(5)_m$ CS theory has the ground state degeneracy (GSD) on torus $= (m+1)(m+2)/2$ and thus $\text{GSD}=3$ for $\text{SO}(5)_1$ theory. This computation is consistent with this post. I wonder how to resolve the contradiction. How do you compute GSD for $\text{SO}(N)_1$ CS theory to show $\text{GSD}=1$?
Comment: Please consider spelling out abbreviations (GSD) and explaining what you mean by the subscript on the $\mathrm{SO}(N)$ to make this post more accessible.
Comment: Minor comment to the post (v3): In the future please link to abstract pages rather than pdf files.
Answer: Many field theories are not well defined. The $SO(N)_1$ CS theory in one paper
may not be the same as the  $SO(N)_1$ CS theory in another paper.
In my paper, the full theory is fermions coupled to $SO(5)$ gauge field.
After integrating out the fermions, we get an effective $SO(5)_1$ CS theory.
Its properties are given here https://www.math.ksu.edu/~gerald/voas/mtc/kmB2_1.html .
Comment: Thank you, Prof. Wen. I am confused about the gauge group of (69) in your paper, where the gauge group is generated by sp4 Lie algebra. At the algebra level, sp4~so(5) but at the group level, SO(5) is not simply connected while Sp4 is. I wonder why the resulting theory after integrating the fermions is SO(5) CS theory instead of Sp4 CS theory.


What are the implications for society if perpetual motion was possible?

Question: Assuming perpetual motion was possible, what influence would that have on society? Would the ready availability of energy help the current third-world? Would that even exist given how history would be different?
Comment: why did you used the tag : warfare ?
Comment: First, someone would weaponize it. Then someone would use it for porn.
Comment: Hey, welcome to the site, James! On this site it can be hard to answer questions without them becoming too broad. This unfortunately is kinda unanswerable, there are too many things it would change. Why don't you narrow it down to say, "Would the ready availability of energy help the current third-world?" That's a much more usable question.
Comment: To clarify - is this perpetual motion (0 loss system) or perpetual motion that can actually produce a net energy output?
Answer: I'm going to modify the premise slightly, because perpetual motion is a real turn-off to a scientist.

If a new, plentiful energy source was found, what effect would it have on the world?

Firstly, a candidate for that plentiful energy source is Fusion. Consider weapons; when we had 'physical' energy storage like gravitational potential energy and elastic potential energy, the best we could do to throw stuff at people was archery, catapults and trebuchet. Guns are based on chemical potential energy instead, and provide a much greater energy density. Fission atomic weapons are many orders of magnitude more energetic, and Fusion weapons are orders of magnitude larger again. So working Fusion reactors could provide more energy than we have ever imagined possible.
Much of human history has been about resource constraints; having enough food, water and shelter without being eaten is the plight of all things, and our capacity to leverage the energy stored around us has led to our dominance, but we still face constraints:
Water: Although there is water on much of the surface of the Earth, we cannot use seawater without expensive desalination plants. The cost is dominated by the power required by the process, so nearly-free energy could permit us to liberate vast quantities of drinking water from seawater across the 3rd world.
Food: At present, our food effectively captured radiant energy from the existing fusion reactor in the Sun. By using intensive hydroponic techniques, we could have vertical farms vastly increasing the food grown per unit area. It is perhaps the only way to meet the food needs of an exponentially growing global population.
The deserts: There is a video somewhere of a 3d-printer making things out of the desert sand using only the sunlight and a massive fresnel lens. With cheap energy, we could construct vast sheltering structures in the desert, and carve out a habitat in which people could live. Beginning at the edges, they could populate some of the most empty regions of the Earth's surface.
Space: The current limitation on all of us getting our trip to space is the cost of accelerating 100kg of human to 7 km/s, and a lot of that is just the cost of the fuel. With electricity we can crack molecules apart and create many of the fuels we would use; water and energy will yield you cryogenically stored liquid hydrogen and oxygen, as used by Shuttle. By decimating the cost of such fuels, travel to space becomes far cheaper, and by extension the possibilities of constructing habitats in space open up.
Oil: Who needs gallons of liquid that have to be shipped about the globe, when you have free or nearly-free electricity? The political landscape of oil-rich nations would be utterly transformed.
So we have fed and watered the world, whose population is perhaps 30 billion people, using our free energy. There is a problem; all that energy goes somewhere. By using electrical energy to power e.g. a refrigerator, all the energy is eventually turned to heat. So all this plentiful energy will go to warming up the planet. Currently, our problem is that the sun is warming the planet and we are destroying the Earth's capacity to keep itself cool. We would eventually reach a point where we had obliterated the Earth's mechanisms to cope. All would not be lost, but we would have to construct our own mechanisms for keeping the Earth cool; raising its albedo by seeding more clouds, constructing vast parasols to shield the Earth as they orbit (creating some sort of light-shade cycle for people on the ground), living ever more shielded and indoor lives as our interventions increasingly mess up the ozone layer. We turn our planet into a space-ship; reliant on the systems we have created to maintain the conditions for life.
The rich would have left by this point. Having fought against the arrival of Fusion as it challenged every status quo and thus their positions atop the piles, some would be kings of the new world, others would have left for the Moon, Mars, Europa and eventually habitats.
The conditions for life down here are thoroughly dependent on the temperature, which is itself dependent on energy absorbed from the sun and from our own activities. We may manage to fix everything for the betterment of mankind, or we may just create new inequalities in which the rich are cool, indoor creatures and the poor are exposed to some unintended consequence.
If you think I'm overstating it by suggesting free energy would change everything, then find something you think wouldn't change and see whether it depends on some limitation of energy supply somewhere along the line. I think the arrival of Fusion is inevitable, the consequences are unimaginable, and the only questions are when it will happen, and what we will do with it.
Comment: I think our ability to cure cancer would not directly be effected by having more energy... or ability to compose music or really any task where the main limiting factor is mental discovery and creativity
Comment: @sdrawkcabdear: Cancer research requires resources for labs and scientists, which could be far cheaper. Bio simulation to try different genes or different chemicals for lab processes would be far cheaper as the machines and energy for running them dropped in cost. There are a billion people or more on the poverty line, whose lives and children's upbringing are centred on that struggle to survive, imagine if they were in education? If just one in a million was an excellent scientist, that's a thousand more excellent scientists. It would accelerate science, the tools for science, the resources.
Answer: If perpetual motion was possible, physics would break. The laws which would be broken would have terrible implications elsewhere. Such violations of these laws could open the door for other, unforeseeable things; like a creature which never needs to eat, photosynthesize, or look for chemicals. A world in which perpetual motion is possible would bear little resemblance to our own. (Such a universe may have never gotten around to making worlds! If the nebula which became our solar system had instances of particles with infinite energy, it may never have settled down to make the solar system.)
Assuming we had a wheel that went in circles no matter how much load we put into it, but it happened because the universe decided that it was time for it to be possible, you could expect everyone to exploit it. What would people do with infinite energy? Everything, I'm sure.
An infinite energy source would make things like railguns much more feasible. We could get things like Alcubierre Drives to easily work. Simply put, many, many more things would be much more possible than they are now. There are some things which may stay the same with our infinitely-turning wheel in existence.
Since the perpetual motion machine makes only mechanical energy, we'd still have to worry about things that require other forms of energy, like feeding ourselves. Power companies would worry more about transferring energy from our wheel to electricity, and then getting that everywhere.
Answer: Probably nothing would change. There are many energy sources like solar batteries or windmills that are not "perpetual motion" physically but could be viewed as such from the social point of view (Sun and winds are free to use). There are many other limiting factors:

The amount of energy produced, as compared with the costs of making and operating the device. As any machine, it would probably run for a limited time only.
The amount of power produced, as compared with size and weight of the device. Can it power a plane? A railway locomotive? You cannot use "free" windmill for that.
Plain energy still cannot be easily converted into bread, mobile phones or shoes humans need. Even with free energy, the manufacturing costs will not drop to zero.

As a result, perpetual motion would be a useful technology comparable to electricity maybe. Same as electricity, it would have huge impact on society but is unlikely to solve the most of problems. Same effects on society are probably possible by discovering new advanced technologies that conform the physical laws.
Answer: Assuming that perpetual motion equals infinite free energy,
  The market for all kinds of fuels (fossil fuel, carbon fuel, wood as fuel, atomic fuel,
   etc.) would basically cease to exist, that is, if all these giant companies were somehow
   unable to hide and/or silence all knowledge about perpetual motion. Everybody could have
   their own perpetual motion machine generating "clean" energy, however, just because you
   are not polluting by way of chemicals and the byproducts of burning fuel, you can't completely overlook thermal pollution, as you will still
   be generating extra heat, because energy conversions are not 100% efficient and what doesn't get used up doing useful work turns into heat.
It is said that with great power comes great responsibility, well in this case, humankind would basically have infinite power at their fingertips, even the common man might accumulate extreme amounts of energy if he found a way to store it over time. Imagine if all that energy were somehow to be released at once...  A person geared towards destruction could easily wreak havoc in the world. Maybe infinite energy is just too dangerous...
Comment: I don't think heat pollution would be an issue. If we have perpetual motion, it's because no energy is being lost in the system, which means that no heat is being generated. If some of the energy of a perpetual motion machine is lost as heat, it's not perpetual, it's just really, really longwinded.


Atmospheric pressure vs. boiling point equation

Question: What is the relationship between the pressure of water and its boiling point? I am aware that a substance boils as soon as its vapor pressure equals that of the surrounding air. I have researched extensively and the best I could come come up with was rearranging the Goff-Gratch or Arden-Buck equations for temperature. While this does give me accurate approximations, I wonder why no clean formula exists that utilises physical constants, as exist for almost all other relationships in physics. Surely some equation like $F=ma$ or $PV=nRT$ must exist also for this relationship, and not just a function matched to experimental data? I appreciate any help.
Answer: $PV=nRT$ is an approximation that is approached by many gases at lower pressures and higher temperatures because the interactions between particles is reduced (and approaches zero).
But liquids exist only because those interactions are significant.  The equations for molecular interaction are much messier and aren't as amenable to simplification.


iOS SDK - How to get the status bar back when using UIImagePickerController?

Question: As soon as I add a UIImagePickerController sub view to my view the status bar disappears and I can't get it back. Is there any way to keep the status bar visible?
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

[self.view addSubview:imagePicker.view];

[imagePicker viewWillAppear:YES];
[imagePicker viewDidAppear:YES];

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

Answer: I had to do the same thing in a camera app as well.  Apparently, in addition to setting the status bar to not be hidden, you also have to reset its style after the camera view makes it disappear.  Try this:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];

Comment: -setStatusBarHidden:animated is deprecated, use -setStatusBarHidden:withAnimation: instead, check alex's answer below.
Comment: Brad, this isn't working for me, I'm doing it in loadView, viewDidLoad and viewDidAppear all to no avail.
Comment: Brad, this worked well for me. In fact, I had to use setStatusBarHidden  when switching between the camera and the photo library sourceType.
Comment: How do I get a handle on this status bar so that I can display some text on it while my application is in the background?
Answer: The accepted answer's solution got deprecated meanwhile.
Use
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

instead of
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

Valid values for the animation parameter are UIStatusBarAnimationNone, UIStatusBarAnimationFade, UIStatusBarAnimationSlide. Details are found in the documentation.
Answer: After reading this and finding none of the answers worked, I managed to get it working by doing the following:
• Setting a delegate for the UIImagePickerController
• In that delegate, hide the status bar in the delegate's navigationController:didShowViewController:animated: function.
E.G:
-(void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}

Answer: Add your UIImagePicker to the root view (i.e. a Navigation Controller or TabbarController)
[self.tabBarController presentModalViewController:imagePickerController animated:YES];

After that you can use
- (void)imagePickerController:(UIImagePickerController *)picker
            didFinishPickingImage:(UIImage *)image
                      editingInfo:(NSDictionary *)editingInfo
{
      // do your stuff
     [picker dismissModalViewControllerAnimated:YES];
}

to close your ImagePicker.
Comment: Hi Henrik, thanks for your reply. I want the status bar visible all the time. Is that possible?
Answer: well, I know you are not supposed to do this, but if you subclass UIImagePickerController, you can put that in your custom class:
-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
}

Answer: None of the solutions worked on iOS 5.1.1
Tim's solution worked on iOS 4.2.1
The only way I was able to fix the problem on iOS 5.1.1 was like that
-(void)viewDidAppear:(BOOL)animated
{
    double delayInSeconds = 0.01;
    dispatch_time_t popTime =
            dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    [[UIApplicationsharedApplication] setStatusBarHidden:NO];
});

which is very hacky and wrong.
I spent half a day looking for a solution and then decided to just use AVFoundation approach and it took me an hour to implement the same basic photo capture that I needed using AVCaptureSession and AVCaptureStillImageOutput. And it works better too - AVCaptureSession starts faster than UIImagePickerController and AVCaptureVideoPreviewLayer has a much better frame rate on modern devices compared to UIImagePicker camera preview.


EWS writing LegacyDN address instead of SMTP to contacts

Question: I'm currently attempting to implement a service which uses EWS to make updates to the outlook contacts of users but I'm having a bit of trouble correctly writing to the email address fields.   Note that I'm not an Exchange developer and I'm a newbie when it comes to EWS.
When using the FindItems() method to search a user's contacts folder, the returned Contact objects have their email address fields as the correct SMTP address (firstname.lastname@example.com).  However, when I update and save the contact, the next I time retrieve that contact, the email address field displays the LegacyDN address (/o=Blah/ou=Exchange Administrative Group/cn=Recipients/cn=Blah).  This occurs even if I write the exact same SMTP address to the contacts field when updating.
Somehow, EWS seems to be internally converting the SMTP address to an ExchangeLDn address.  This is problematic for a number reasons.  In particular, it seems to be breaking some of our other services that read from the exchange server and it makes it impossible to correctly display the email address without doing a very slow ResolveName call.  Is there a way to stop EWS from doing this?  A different service which uses Outlook Redemption has no problem properly writing an SMTP address but we're attempting to retire that service and the use of the Redemption API.  I should also mention that this problem only occurs when updating contacts for internal users.  External users always write the correct SMTP address.
Thanks.
Answer: My experience shows that setting the MailboxType to OneOff during contact creation/update avoids internal address type conversion from SMTP to LegacyDN:
<code>var address = new EmailAddress
{
    Address = "firstname.lastname@example.com",
    MailboxType = MailboxType.OneOff
};
newContact.EmailAddresses[EmailAddressKey.EmailAddress1] = address;
</code>
Answer: did you try to set the MailboxType-property of the EmailAddress?
I had some simular problems with internal users, but in my case I recieved an exception instead of the LegacyDN.
In my case setting the property to MailboxType.Mailbox solved the problem.


Switch Lookup Table

Question:
I was just reading a book called HeadFirst Networking and I'm a bit confused about something. I am attaching an image from the book. The page says that the direction of the frames as maintained in the switch lookup table should be a mapping between MAC address and the ports. But I'm not sure whether the address is that of the source or destination.
Comment: I am not sure we can reproduce and host the image from that book on the site... I need to check
Comment: IANAL but this is fair use.
Answer: It remembers the MAC of the computer attached to that port.
if you have four computers connected to a switch:
PC1 with MAC1 connected to PORT1
PC2 with MAC2 connected to PORT2
PC3 with MAC3 connected to PORT3
PC4 with MAC4 connected to PORT4

Imagine you just turned the switch on, and the MAC table is empty.
When you send a packet from PC1 to PC2, the switch doesnt yet know where the PC with MAC2 is (on which port), but it knows that it recieved a packet from MAC1 on PORT1 (and it adds this entry to the MAC table). Since it doesnt know where PC2 is, it sends the packet to all ports (except PORT1, since the packet came from there.
All three other PCs get the packet, PC3 and PC4 ignore it, but PC2 probably replies. Since the switch just recieved a packet from a PC with MAC2 on PORT2, it adds this entry to the MAC table. Since it also has an entry for MAC1 on PORT1, it sends the packet there (and only there).
After such a packet exchange (eg. ping), the state of the MAC table would be:
a device with MAC1 is located on PORT1
a device with MAC2 is located on PORT2

Answer: The switch maps the device that is connected to that port in its table. It does this when it learns a new MAC for the port automatically.
Take a look at (2min20s):
http://www.youtube.com/watch?v=WqjpBn-0oI4
This explains it a bit more in depth.
When computer 1 sends data to computer 3, the switch analyses the destination and source MAC address and adds it both to the table. (unless it is already known of course)
The source MAC isn't hard to add to the table. However, the destination MAC if not known is first flooded by the switch to all ports. If a response follows, the switch can add this address as well.
Answer: The switch learns from the source address field so future frames that contain that learned address as a destination can be forwarded out the port it learned it from earlier.
If the switch hasn't yet learned the address in the destination address it "floods" the frame out all ports except the port the frame arrived on.
Answer: The mac-address table maintained on the switch is the source mac-address of packets received on that interface.
The destination mac-address has nothing to do with the device attached to that port so the switch has no need to associate that mac-address with the ingress port.
Cisco Press has an online article that covers this topic.
(Late reply due to comment...)

Switch Lookup Table


Windows 8.1 Offline Folder from NAS on home network?

Question: On my home network I have a NAS device. It's an old IOmega StorCenter iX2 that runs SAMBA. I have it configured with mirrored drives. It's old, but it has served me well.
I have a new Windows 8.1 laptop. Here is what I want to do.

On the laptop, set the My Documents folder to point to a shared folder on the NAS
Set this folder so Offline Files are enabled so when the laptop is out of my home, the my documents files are still available.

Now, I'm pretty sure this was straightforward in XP, Vista and Windows 7. But, I am stuck in 8.1.
For #1, I can browse to "This PC", then right click on "Documents", select Properties, go the Location tab and then specify the path to my NAS folder. This seems to work fine.
For #2, I'm stuck. When I view the folder I do not see Sync options or Always Available on the ribbon. If I go to Control Panel->Sync Center, the Manage Offline files link doesn't seem to launch anything and "Set up new Sync partnerships" doesn't seem to let me set up sync to the NAS.
Any suggestions? Can I do this in Windows 8.1 or is my thinking to too old fashioned.
I've seen similar questions posted like http://www.networksteve.com/windows/topic.php/NAS_files,_Offline,_Sync_Centre_and_windows_8.1/?TopicId=61609&Posts=4
Answer: Right click on network folder, select option Always Available Offline. Work on folder on network location.
Answer: Sounds like you are looking for something like called Work Folders. I am not sure if you can set up a host for this using SAMBA.
Kind regards,
Erik


Why does the scikit-learn bootstrap function resample the test set?

Question: When using bootstrapping for model evaluation, I always thought the out-of-bag samples were directly used as a test set. However, this appears not to be the case for the deprecated scikit-learn Bootstrap approach, which seems to build the test set from drawing with replacement from the out-of-bag data subset. What is the statistical reasoning behind this? Are there specific scenarios where this technique is better than just evaluating on the out-of-bag-sample or vice versa?
Comment: cross-validation?  resampling?
Comment: If you're referring to the tag, that was not added by me. I'm bootstrapping as an alternative to CV, actually.
Comment: I think you misunderstand.  In cross validation they are going to repeat the process several times on a subset of the data and look at the variation in outcomes or model parameters.  In that case the parameter variation itself informs quality of fit, and not necessarily the OOB error.  I am not familiar with the particular library so I just left a comment with the idea.
Answer: Perhaps you were onto something. It seems others pulled at that same thread and Bootstrap was deprecated in favor of more intentional use of the resample method with the tried and true sklearn.cross_validation approaches like StratifiedKFold.
Answer: Bootstrap samples are used to evaluate the performance of the algorithm by many iterations. While doing so, the performance on randomly changed sets is evaluated.
In contrast when doing for example 10 Fold Cross Validation you are performing only 10 iterations on different train and test data sets.
Now when your sample size is small, lets say $n=20$ and the number of bootstrap iterations is high, lets choose $i=10,000$, and you do not resample your test data as you do with your train data set you will have situations where your algorithm sees the same or very similar test more than one time. A situation you originally wanted to avoid by using bootstrap.
The link you postet is down, so I added the description of the function in the current (0.14) version of sklearn
Description of  the method

Random sampling with replacement cross-validation iterator
  Provides train/test indices to split data in train test sets while resampling the input n_iter times: each time a new random split of the data is performed and then samples are drawn (with replacement) on each side of the split to build the training and test sets.
  Note: contrary to other cross-validation strategies, bootstrapping will allow some samples to occur several times in each splits. However a sample that occurs in the train split will never occur in the test split and vice-versa.
  If you want each sample to occur at most once you should probably use ShuffleSplit cross validation instead.


How to automatically enable WLAN when an app requests location info?

Question: I currently have WLAN enabled all the time for triangulation,  even when I'm not near an access point I can use.  Is there any way to automatically enable it whenever an app requests location information, like it is done with the GPS?
Comment: I'm interested in this, see also https://code.google.com/p/android/issues/detail?id=26119
Answer: As far as I know this is not possible. IMHO, it contradicts Google's incentive to have an as best as possible geolocation service.
Some background information:

Google maintains a huge database for its geolocation service ("Access coarse location" permission). It consists of:

Wifi access point mappings: Wifi MAC address resolve to a geolocation
Cell tower mapping: Cell tower ID's resolve to a geolocation

This database is "community" crowd-sourced by the huge Android user base, aka. everyone that has Google's location service enabled (see below)
Google is interested to have a high quality database, i.e. convince you to opt in to allowing your phone to be part of the crowd-sourcing
Hence: If you want to use 'coarse location' services from Google you opt in to constant data mining as long as it's enabled

PS:

Disabling Wifi only cuts you off from one of the possible information sources. Having Cell tower ID's will still give you coarse location, but with lower accuracy
Some may recall the Skyhook vs. Google dispute where Google seemingly pressured Motorola and Samsung to prefer Google's own geolocation service over that of Skyhook (out of fear for losing part of the crowdsourcing community if those two big players would have used the 3rd party Skyhook service). Source: TheVerge
Comment: IMHO, I do not see why the **location service** cannot save power and just activate the WiFi antenna when it needs it, exactly as it does with the GPS antenna. Sorry ce4, this has nothing to do with the opt-in on this screen. I mean, "Sure Google, use WiFi networks to determine my location, but kindly turn off the WiFi antenna when you're done."
Comment: it's more subtle, the service polls your location not only when you use it but reports your wifi&cell data constantly. I just wanted to give an impression why someone might wanted  it to *not* turn off when idle and why it's the way it is. It's more speculative than backed, I know, tough
Answer: There is now a feature that turns on WiFi for location purposes. Settings->Wi-Fi->Advanced->"Scanning always available"
You can turn WiFi off to save power, but still have location requests turn WiFi on temporarily.