What is the difference between polyfill and transpiler?

Question: What is the difference between a polyfill and transpiler?
I often read the same term used in similar context.
Comment: A polyfill will emulate certain APIs, whereas a transpiler will convert your code so it can be run with an older system.
Comment: @Sirko this should be an answer.
Answer: Both approaches serve the same purpose: You can write code, that uses some features, which are not yet implemented in your target environment. They do this, however, by using different techniques.
A polyfill will try to emulate certain APIs, so can use them as if they were already implemented.
A transpiler on the other hand will transform your code and replace the respective code section by other code, which can already be executed.
Typically you use a polyfill, if your target browser did not yet implement the latest bleeding edge feature (read browser APIs) you want to use.
A transpiler  on the other hand will let you use language features, the target environment does not support yet, e.g. some ES6 features like fat arrow functions.
Answer: Polyfill

The word polyfill is an invented term (by Remy Sharp) used to refer to taking the definition of a newer feature and producing a piece of code that's equivalent to the behavior, but is able to run in older JS environments.

For example:

ES1 defines a method called isNaN(value) to determines whether a value is an illegal number (Not-a-Number).

ES6 defines a method called Number.isNaN(value) too determines whether a value is NaN (Not-a-Number).

If you notice, Number.isNaN() is not supported in every browser, so for this purpose you can polyfill the method. Not all new features are fully polyfillable. Sometimes most of the behavior can be polyfilled, but there are still small deviations. You should be really, really careful in implementing a polyfill yourself, to make sure you are adhering to the specification as strictly as possible.
Or better yet, use an already vetted set of polyfills that you can trust,
such as those provided by ES5-Shim and ES6-Shim.
// These method is a sample of making polyfill
if (!Number.isNaN) {
    Number.isNaN = function isNaN(x) {
        return x !== x;
    };
}

Transpile
There's no way to polyfill new syntax that has been added to the language. The new syntax would throw an error in the old JS engine as unrecognized/invalid.
So the better option is to use a tool that converts your newer code into older code equivalents. This process is commonly called "transpiling" a term for transforming + compiling.
There are several important reasons you should care about transpiling:

The new syntax added to the language is designed to make your code more readable and maintainable. The older equivalents are often much more convoluted. You should prefer writing newer and cleaner syntax, not only for yourself but for all other members of the development team.
If you transpile only for older browsers, but serve the new syntax to the newest browsers, you get to take advantage of browser performance optimizations with the new syntax. This also lets browser makers have more real-world code to test their implementations and optimizations on.
Using the new syntax earlier allows it to be tested more robustly in the real world, which provides earlier feedback to the Javascript committee (TC39). If issues are found early enough, they can be changed/fixed before those language design mistakes become permanent.

There are quite a few great transpilers for you to choose from. Here are     some good options at the time of this writing:

Babel (formerly 6to5): Transpiles ES6 and above into ES5
Traceur: Transpiles ES6, ES7, and beyond into ES5
Comment: Ah man, you forgot to add the source of some parts of this awesome explanation. https://github.com/getify/You-Dont-Know-JS/blob/master/up%20%26%20going/ch2.md#old--new
Comment: The link is dead.
Comment: This definitely should be the accepted answer!!! I have watched countless number of videos in youtube but I wasn't able to get the clear picture. This text answer is really simple and easy to understand. Please upvote this answer to make it to top. Thanks in advance
Comment: I figured out the link from the dead link url. The dead link says Up and Going(which is 2nd book of YDNJ series) chapter 2 ...
https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/up%20%26%20going/ch2.md
Answer: Both pollyfill and transpilation enable you to use new features in old environments (old vs new browsers for example), the main difference is that a pollyfill do that by implementing the feature in the old environment itself. So if we go by Es6 Es5 terminology, polyfill enable you to use a new feature by implementing it in Es5, however some new features can never be implemented in Es5, think for example about the arrow syntax introduced by Es6 and this is where transpilation is needed.
So an example where transpilation is needed is arrow syntax (() => {}) because u can never implement that in es5, and an example where a pollyfil can be used is for example if u wanted to implement the Array.prototype.includes method, you can easily implement it like this
// taken from mdn
if (!String.prototype.includes) {
  String.prototype.includes = function(search, start) {
    'use strict';

    if (search instanceof RegExp) {
      throw TypeError('first argument must not be a RegExp');
    }
    if (start === undefined) { start = 0; }
    return this.indexOf(search, start) !== -1;
  };
}

Now here are some major differences:

A pollyfill will use the native feature if it exists, however transpilation will not. that leads to the conclusion that Polyfills should be preferred over transpilation, because of security and performance reasons.
Transpilation is about language syntax, while pollyfill is about language syntax and native browser APIs (or other environment APIs).
Transpilation is at compile time, while pollyfill is at runtime, and this is what differentiates one from the other.
Answer: Transpiler:

software that translates code to different code. It can parse (analyse/understand) modern code and rewrite it using older syntax, so that it works in outdated browsers.

Example: "nullish coalescing operator" it's quite new now:
// Before running the transpiler.
a = b ?? 33;

// After running the transpiler - it changes the code with a an older known syntax.
a = (b !== undefined && b !== null) ? b : 33;

Polyfills

a software that "fills" the gap and adds missing implementations of specific built in functions in some older engines.

Example: the startWith function is not supported in older browser
so a polifill will actually implement it globaly so that it's like browser having that function already built in.
if (!String.prototype.startsWith) {
  String.prototype.startsWith = function (searchString, position) {
    position = position || 0;
    return this.substr(position, searchString.length) === searchString;
  };
}

Answer: Polyfilling is like copying a feature so that one can use it. In polyfilling, one write code to get a similar functionality as provided in other JS version.
Transpilling convert code which has new syntax using transpiler so that it can be used in browsers having older Js versions.
Answer:
Polyfills are scripts that offer to emulate a feature that is not implemented in a browser.


Is there any record that Darwin's book, "The Origin of Species ... or the Preservation of Favored Races " has had an effect on racial justice?

Question: Is there any historical record that Darwin's book, The Origin of Species by Natural Selection or the Preservation of Favored Races in the Struggle of Life has instigated actions by men, societies, or governments to treat some races differently, indifferently?  Has Darwin's models influenced any philosopher's theories about man or society?  If so what was the impact or the benefit?
Comment: A scientific work has not to be judged by it's political consequences (real or imagined...) but wether it is supported by the facts or not. I.e. Who cares if people don't like it as long as it's true?
Comment: The Eugenics movement was started by Francis Galton who was inspired by his cousin's book. Apparently Darwin did not approve of that.  https://en.wikipedia.org/wiki/Eugenics  There was no benefit of Eugenics, it was an example of how scientism can lead to unethical action.
Comment: Of course. https://en.wikipedia.org/wiki/Social_Darwinism was widely popular, & only became discredited through association with Nazism. It led to real policies, like a widespread programme of sterilisation of 'immoral women', & those with disabilities, in pre-war USA - a programme which was directly inspired by Social Darwinst thinking, & directly shaped Nazi policy. But this isn't a philisophy question, it's history.
Comment: I'm not sure this question is really on topic, but you may be interested in [this paper](https://psycnet.apa.org/doi/10.1037/pspi0000391) on a study which found that disbelief in evolution is correlated with more racist attitudes.
Comment: @Crig/Crag Applied philosophy is a valid aspect of Philosophy SE.  The effects of science on philosophy, and vice versa, is of great importance to civilized societies.
Comment: @armand - The crux of the matter is not the "judgment of science" but a critique of the "use of science" to justify a philosophy, and apply it to society.
Comment: So you admit evolution is true?
Comment: @armand - The judgment of whether Evolutionary models are true or not, is not relevant to this query.  Rather, it is whether the application of  the scientific model to society is a valid application of science., or a misuse of science by philosophers.
Comment: It is. If evolution is true then its study give us knowledge about reality, which is always useful even in a social context. What misuse was ever done of it is irrelevant. But since you know nothing about biology it's your only available angle of attack. May I suggest, as a bible believer you don't really want play the game of "your book provoked the most atrocities".
Comment: Tell the millions of murdered Europeans and Chinese that "misuse" is irrelevant!  Tell those mutilated by Eugenics that misuse of philosophy is irrelevant. It is noted that just in the 20th century alone more millions were oppressed/killed than in all the alleged "religious wars" of the past 2,000 years! Facts abounding, not ignored.
Answer:
Is there any historical record that Darwin's book, The Origin of Species by Natural Selection or the Preservation of Favored Races in the Struggle of Life has instigated actions by men, societies, or governments to treat some races differently, indifferently

According to Wikipedia Darwin was rather moderate when it comes to the racism (compared to his contemporaries). And "race" in the context of that title apparently just meant "variety" which includes but is not limited to varieties within the human species. You also seem to be reading that prescriptive in the sense of "an obligation to preserve favored races", but from a superficial search it seem to be more descriptive in the sense of "why certain varieties are favored/preserved" with the well known answer: "because they are well enough adjusted to their environment to survive long enough to have offspring, who then inherent traits from their parents".
So if Darwin had a racist agenda and committed to activism for racial discrimination, he hid it well enough for many biographies to not be among the  most noteworthy aspects of his:

Taking taxidermy lessons in 1826 from the freed slave John Edmonstone, whom Darwin long recalled as "a very pleasant and intelligent man", reinforced his belief that black people shared the same feelings, and could be as intelligent as people of other races. He took the same attitude to native people he met on the Beagle voyage. Though commonplace in Britain at the time, Silliman and Bachman noticed the contrast with slave-owning America. Around twenty years later, racism became a feature of British society, but Darwin remained strongly against slavery, against "ranking the so-called races of man as distinct species", and against ill-treatment of native people. (Wiki)

He was still a child of his time though and apparently has a mixed track record on social issues:

Darwin's views on social and political issues reflected his time and social position. He grew up in a family of Whig reformers who, like his uncle Josiah Wedgwood, supported electoral reform and the emancipation of slaves. Darwin was passionately opposed to slavery, while seeing no problem with the working conditions of English factory workers or servants.

So I'd not rule it out entirely that one is able to find controversial statements of his, but as your question seems to hint at whether he himself instigated those tendencies, then probably no.

Has Darwin's models influenced any philosopher's theories about man or society? If so what was the impact or the benefit?

Undoubtedly. I haven't read them entirely but there are articles on SEP both on Darwinism and Evolution and it's pretty obvious that the theory of evolution has major ramifications at least some of which concern topics related to philosophy.
Obviously it drags a lot of questions as to "why humans are the way they are" from the metaphysical and religious to the scientific and empirical domain. Previously they were subject to intense speculation, now they are answerable within the framework of science. And not only answerable with respect to describing the past but also somewhat predictive with respect to the future.
With regards to racism this discovery is somewhat ambivalent. On the one hand it proofed that the concept of race is wrong. Like racists imagined and often still imagine, "race" to be a description of a species, a category, an unaltering, absolute and fixed mold distinguishing people and of major importance. When in reality it's just a minor variation and what counts is whether people can adapt to their environment well enough to survive (fitness ✔) and whether they can procreate with each other (same species ✔).
And even without any "other", a species could change over time due to adaptation to the environment. It would happen whether you want it or not if it needs to and would not if it didn't have to.
On the other hand the idea of species as manipulable also introduced the idea of directed evolution, playing god/nature and introducing "artificial"/social selection such as Eugenics and Social Darwinism. Though despite bearing his name that's apparently not necessarily Darwin's intention or "fault":

While most scholars recognize some historical links between the popularisation of Darwin's theory and forms of social Darwinism, they also maintain that social Darwinism is not a necessary consequence of the principles of biological evolution. Social Darwinism is generally accepted to be a pseudoscience.

So it's less that Darwin asked for that, but rather some form of a dangerous sci-fi gone wrong and or a weak excuse for not addressing societal problems. It also misses the point that "fittest" is not "strongest" or "best" and that it's not really an individual quality of an individual but rather a category of it's own. So whatever trait and trait bearer survives is by definition fit for survival. It's not a directed competition, but whoever survives is a winner as long as they survive.
And with regards to society it faced a whole different problem of it's own, namely that societies are an evolutionary factor. Humans are technically not very good at anything. We can't fly, we can't swim or dive all that well, we can't run fast, and so on. There are tons of species that can do tones of things better than we can. Yet as a collective we managed to cover each others weak spots well enough to survive in large numbers and produce technology that gets us around most of our weaknesses. Which allows us an adaption to our environment that is much faster than any natural evolution.
And which might as well lead to evolution of social skills, ability to bond with other people, empathy, communication skills and so on.
So there are certainly a whole lot of ethical questions that follow from it as well. And given that evolution is now the underlying narrative of biology which also gave as modern medicine, it wasn't all that bad. Not to mention that if it hadn't been Darwin, probably Mendel (the guy who invented modern genetics) or someone else would have discovered it anyway.
It prompts an interesting question though with regards to the ethics of science, as to whether one should publish all knowledge available. And it's difficult because on the one hand you can argue that it can be misused on the other hand, the people who would want to misuse it probably wouldn't have such qualms and if the facts are openly on the table people can at least have an informed discussion and with regards to evolutionary progress, there's also the chance that if you found it there are probably a lot of people in a similar situation than you who would sooner or later find it as well. The idea of a one-in-a-billion genius is most often a wrong narrative.
Comment: Your Answer is off the topic of this question.  It is NOT concerned with the scientific aspect of Biological Evolution in the laboratory, NOR is it a reference to the Biography of Charles D. (Check his 2nd book for his racist attitude to balance out your bio research) RATHER, the question mentioned the BOOK, and its racist TITLE. The purpose of this post is to raise the awareness of the misuse of science to establish philosophies, and awareness of dire consequences historically and socially. (Darwin ought to have consulted Mendel down the road for much needed correcting, by the wat)
Comment: "At some future period...the civilized races of man will almost certainly exterminate and replace the savage races throughout the world.  At the same time the anthropromorphous apes...will no doubt be exterminated.  The break between man and his nearest allies will then be wider, for it will intervene between man in a more civilized state, as we may hope, even than the Caucasian , and some ape as low as a baboon, instead of as now between the negro  or Aust. and the gorilla." ( Darwin, The Descent of Man, 2nd ed.) So does the word in the TITLE only refer to bio species, or to Races?
Comment: @ Haxor789 "The 'religion' of Social Darwinism belongs to the most dangerous elements within the thoughts of the last century.  It aids the propagation of ruthless national and racial egoism by establishing it as a moral norm.  If Hitler believed in anything at all, then it was in the laws of evolution which justifies and sanctioned his actions and especially his cruelties." (Erich Fromm, psychologist)  Here is an example of misuse of science by philosophy!
Answer: The answer to this question seems to be an emphatic yes!  Coming across the writings of Erich Fromm, the noted psychologist, confirms this, and we quote:
The 'religion' of Social Darwinism belongs to the most dangerous elements within the thoughts of the last century.  It aids the propagation of ruthless and racial egoism by establishing it as a moral norm.  If Hitler believed in anything at all, then it was in the laws of evolution which justified and sanctioned his actions and especially his cruelties.
And as another User noted, it influenced the practice of Eugenics, which wished to eliminate inferior peoples.  As he noted, It is an example of how scientism can lead to unethical action. So this question is not only answered in the affirmative, but raises the awareness to philosophers to not take scientific terminology and build inappropriate Applied Philosophies on them.
Comment: Yes, we shouldn't try to apply things beyond their scope, or construct general concepts from specific techniques or practices. Trying to have a general idea of "how the world is" seems like a bad mistake, to me.


Create archive solution on seperate server

Question: We have a custom application that uses a database trigger that updates a separate "Audit" database to track any changes in data.  I'd like to come up with a way to keep another database on separate server (Archive server) that would keep older archive data. Current thought is Prod Server keeps an archive database with changes made that day/week.  Archive database pushes any changes older than a day/week to the historical archive server, then truncates all the data in the archive database (on production server) to keep inserts fast and limits the amount of data.  I'd keep the data on the archive server for a set period.  Is it possible to setup replication to keep inserting on the archive server, but not delete the data when I truncate the tables on the source database?
Answer: If you're planning on using Transactional or Merge Replication, then you won't be allowed to run a TRUNCATE command on any of your published tables in the Publisher Database. Please see the Microsoft BOL Frequently Asked Questions for Replication Administrators - Database Maintenance, specifically the first section called Why can't I run TRUNCATE TABLE on a published table?:

TRUNCATE TABLE is a DDL statement that does not log individual row deletions and does not fire DML triggers. It is not permitted because replication cannot track the changes caused by the operation: transactional replication tracks changes through the transaction log; merge replication tracks changes through DML triggers on published tables.

That being said, you can modify the properties of your published articles such that DELETE statements don't get replicated to the Subscriber Database, as detailed in this article Options to not replicate SQL Server DELETE commands. Or you can follow the second option of that article to modify the underlying stored procedure that would execute the DELETE statement, though I find the first solution cleaner.
Either of these options should help you achieve your goal.


Joint ownership and rent from the person living in the house

Question: My sister and I own a house jointly, 50/50. Her 50% has survivorship to her daughter, mine to my husband. She lives in the house and I do not. She believes that since she is an owner, she does not need to pay any form of rent. How can I counter this with her; what argument should I use that she should be paying something, even if it's only toward upkeep?
Comment: Can you add any background helping us to understand the history to this situation?
Answer: Survivor beneficiaries are irrelevant to the current situation.
At a minimum, you and your  sister are each  responsible for 1/2 of the fixed costs of the house (property taxes, mortgage, acceptable home insurance, necessary repairs, homeowner fees if any, etc.). Utilities are her responsibility because she resides there.  This would be fine if you feel that this is an investment property (your half) with potential for appreciation.
Should you believe that you deserve it, what is fair recompense to you from your sister for living in a house that she only pays only 50% of these maintenance costs is subject to negotiation.  Should you fail to come to an acceptable agreement then your only recourse is to force the sale of the house, either your half to her or to a third party should your sister prefer that route.
The best approach is to talk to your sister and see if you can come to an amiable agreement.
Answer: As I mentioned to another member, I understand your question is not about selling. But, you can use it as a logical point. "If we sell the house, we would each get about $XXX, and I'd be able to invest that money as I wish. Right now, the house isn't giving me any income, just costing me money."
Another approach - "We both own the house, but you are the only one benefitting. We both pay the expenses, but you are getting the benefit of not having to pay any rent. I live elsewhere and have my own cost of rent/mortgage, but am also paying the cost for upkeep on a house you live in."
Another - "You are right, you are an owner, and have every right to live here. The movers are coming next Thursday, and I'll be joining you in our house, for the foreseeable future."
Last - "If we rented the house out, we'd get $2000/mo, and from that money, we'd have all our expenses covered, property tax, insurance, maintenance, etc. And, there would be a bit left over, which we'd split. I'm not asking you to write me a check every month, but with no rent coming in, it's not equitable for me to chip in for these costs, in effect, subsidizing your income. If you are unwilling to pay the expenses for the house you live in, I suggest we sell it, and move on."
Answer: If the first 1/2 owner can't bring forth a buyer or a long-term renter for the house then I think that the second 1/2 owner can live in the house as a care-taker.
It might be expected that the second 1/2 owner pay the property taxes and insurance. In fact if the second 1/2 owner is paying the property taxes and insurance then they do have a strong claim in the situation.
Comment: Where did OP state a desire to sell, or to rent to a third party?
Comment: The point is that if the first 1/2 owner does not want to sell the property then the second 1/2 owner might want to live in the property as caretaker.


What's the difference between Gamma(alpha, lambda) and Gamma(alpha, beta)?

Question: I've found different formulas for the Gamma distribution, one where Gamma(alpha, lambda) has an expected value of alpha/lambda due to the Gamma distribution turning into the following image: https://prnt.sc/lcq5zq. However, in other sites I see Beta being used instead of lambda, where Beta is in the denominator instead (http://prntscr.com/lcq7au), despite being in the same place as lambda in the function. I'd have thought they were merely representative of the numbers used for the Gamma distribution, but these are completely different in representation-- especially since the expected value is now Alpha*beta, instead of alpha/lambda. Can someone explain this for me?
Answer: Both forms are correct as they are just two different parametrizations for the Gamma Distribution. The parameter $\lambda$ wouldn't mean the same thing as the parameter $\beta$.
In fact, make the substitution $\lambda = \frac{1}{\beta}$ in your first formula and you will get the second formula. The means also equal using this substitution.
To illustrate a simple example: If I asked you to draw the parametric curve of the unit circle, would you say that the form $$x(t) = \cos(t)$$
$$y(t) = \sin(t)$$
Is different than saying
$$x(t) = \sin(t + \pi / 2)$$
$$y(t) = \cos(t + \pi / 2)$$
Both produce the unit circle; one way just draws it counterclockwise while the other draws it clockwise. But both equations draw the same thing.
Searching the Gamma Distribution online will be able to explain better why different parametrizations exist. It depends on the contents of different problems and how the Gamma Distribution is brought up.


Liberty and equality have become antagonist?

Question: From French revolution we got equality and liberty concept.in practical life it's seems two opposite pole .How will you satisfy this argument that both can be achieved simultaneously....As liberty leads to inequality and if we transfer some ones gain to poor it will not be accepted by libertarian...                                  Now a days  there is protectionist policy around the world as in usa and eu we witnessed this contradiction very well  and came to  a conclusion that both can't be claimed as equality and liberty are two different  thing like tom and Jerry?
Comment: I don't think liberty leads to the expanding inequality we see in the US. It should lead to something like a normal (in the mathematical sense) distribution of wealth based on a normal distribution of talent and effort. That's not a flat-line equality, but it's a good way to measure whether the amount of inequality is natural or artificially inflated.
Answer: 1 The two can be brought together in the requirement of equal liberty for all, a principle we find in Rawls' Theory of Justice (1972).
2 To the extent that there is economic liberty - a market economy - in which free exchange takes place, there will be winners and losers and economic equality will be a vanishing quantity.
3 The flipside to this is that to the extent that economic equality is introduced and preserved, economic liberty will have to be curtailed since free exchange will produce economic inequalities.
4  Equality has many dimensions : economic equality, 'physical' equality (of age, health strength), political equality and others besides. The same holds for freedom : freedom of expression, freedom of worship, freedom of association, freedom to marry, freedom of movement, freedom from constraint or arbitrary arrest. It is not at all clear that there is any general relation between all the dimensions of equality and all the dimensions of freedom. Freedom of movement can go easily along with economic inequality; 'physical' inequality can  co-exist with political freedom.
5 There are dependencies, however : political freedom can be undermined by economic inequalities. We may all have one vote but institutions with economic power may by means of massive wealth (economic inequality) exert undue political influence and subvert political freedom.
Just some connexions and tensions you might care to consider.
Comment: 2008 market failure and recent banks fraud  in india also shown that there is some problem with liberty ...And it came to a conclusion that liberty alone could not be able to stop clashes in world...Most important thing I understood is that libertarian talk about universal nature of rights so if we want to fulfill freedom of any kind  political and economical we must have equal opportunity so it necessarily taking us toward equality ...And at the same time every human conflicts  has seed  of  inequality which we recognize as Injustice and  ultimate goal is freedom ..
Comment: So there is internal relation betw
Comment: But in reality there is problem as some how govt impose extra tax to rich to compensate poor and it is justifiable because industrial activity eroded there right to land and water ...If it so we  can ask world right to compensate and right to green technology at the same time ...But again neither they are accepted paris agreement nor helping in achieving green development...As trump policy visa and withdrawn from Paris agreement..It's all again taken us to liberty equality problem..
Answer: I agree that they oppose each other, as you can't have liberty with equality, and you can't have equality with liberty.
Equality taken as an ideal leads to communism, which is shown to fail whenever it is tried.
Liberty taken as an ideal leads to anarchy, which is mostly untested but seems unworkable.
Equality of liberty would be what I'd suggest we aim for. The same level of freedom for all, seems to make the most sense.


Storing files in a directory... are there limits?

Question: I am using CentOS 5 with Plesk 9 (64-bit), I am running a site where users will be uploading pictures.  With a 64 bit os, are there any limits to how many files I can store?  All I care about is performance, and serving up the files.  I'd prefer not to have 4 directories deep of scattered files.  However, I am hoping, that at some point I could have 200-300 thousand images.
Comment: What filesystem are you using?
Answer: If you are using ext3, I found this quote (warning: spanish speaking site)

"There is a limit of 32k (32768)
  subdirectories in a single directory,
  a limitation likely of only academic
  interest, as many people don't even
  have that many files (though huge mail
  servers may need to keep that in
  mind).  The ext2 inode specification
  allows for over 100 trillion files to
  reside in a single directory"

Further reading showed that ext3 doesn't have a 32K limitation, which can be empirically proven with
a=0; i=1; while [ $a == 0 ]; do touch $i; a=$?; let i++; done

but it does have a 32K folder limit for folder, which can be tested with
a=0; i=1; while [ $a == 0 ]; do mkdir $i; a=$?; let i++; done

This (unfounded) claim says that

ReiserFS has no trouble at all with
  hundreds of thousands of files in a
  single directory. flabdablet - February 1, 2007

This question from sister site stackoverflow.com could help too.
In general:

There is a limit to the amount of directories,
You should keep your files/directories under 32K, but can go a lot further,
The file system you are using does matter.
Comment: note that even if ReiserFS' structures cope nicely with humongous directories, any program that scans the directory would take ages to finish. (i.e. shell pattern matching.  it really hurts)
Comment: During the search I found some references that accessing a a single, known file had a great (normal) speed, but when ls-ing the directory, it crawled to a halt. Anyway, I guess I wouldn't like to have to manage that amount of files in a single directory...
Answer: This depends greatly on the filesystem you use. Certain older versions of ext3 were attrocious with this, which is how the btrees came about. Reiser is a lot more performant with large numbers of files such as that. In older days I've had a Novell NSS directory on a NetWare server with 250,000, 4kb files in it due to a GroupWise flub and it worked just fine. Enumerating the directory sucked a lot, but accessing a specific file in that directory worked as fast as you'd hope. As this was 8 years ago, I must presume modern Linux filesystems can handle that with aplomb.
Comment: Not just ReiserFS, but also ext4 and btrfs have btree-based indexing.
Answer: It depends on the filesystem you're using, not the 64-bit'ness of the operating system. With every filesystem, there's going to be some point at which the big-O costs of the algorithm used to search the directory are going to get the better of the computer.
If you can break the file hierarchy up into even just a two (2) tier hierarchy you'll see better long-term scalability.
Answer: File systems in Linux store directory in basically two ways:

As a flat list of files.
As a data structure (usually a B+Tree or related data structure).

The former gets progressively slower as files are added. The latter does not. Note that ls might still take forever since it has to lookup the inodes of all those files, the directory entries only contains the filename and inode number.
Ext3 directories are flat lists, with an option for a hashed tree index to speed things up.
XFS uses B+Trees.
But for either of these file systems, if you do an ls -l, it'll need to hit as many inodes as there are files. For name lookups (when opening a file for example) B+Tree and things like that will be much faster for large directories.
A hierarchy of directories makes it easier to manage the files however and so you might want to consider that possibility. Even a single layer of directories with, say, 4000 files limit each, would make things much easier to manage.
Answer: If you're going beyond a few hundred images, definitely consider two things:

Nested hierarchies with hashed filenames;
Not using ext3

I'd recommend using XFS, or, failing that, ReiserFS, with a two- or three-deep directory hierarchy divided up by two-byte pairs. e.g.
11/2f/112f667c786eac323e300632b5b2a78d.jpg
49/2f/49ef6eb6169cc57d95218c842d3dee5c.jpg
0a/26/0a26f9f363f1d05b94ceb14ff5f27284.jpg

This will give you 256 directories in the first few levels, splitting images up over a total of 65535 separate directories (which is more than enough for 100-200k images and beyond). It will make things much faster and much more scalable, and make it a lot easier to maintain later on as well.
Answer: Most default configurations of ext3 have a limit 32K subdirectories per directory (can't rememeber the actual number now but we ran into just that issue a couple of weeks ago System was Debian/Etch at that time).
Might also hit you in some applications that use a lot of caching.
Comment: If had a hard time determining if that subdirectory limit applies to files or only subdirectories.  Since it is derived from the inode limit, I'm thinking it applies to files as well.
Answer: Consider not using ext3, certainly.
http://kernelnewbies.org/Ext4#head-97cbed179e6bcc48e47e645e06b95205ea832a68  (shows new features in ext4)
might be a helpful kicking off point.
Would say have a look at how squid organises its cache too (multiple layers of directories) as many files in one directory may prove tough to maintain. Long lists (generally) suck.
Answer: ext3 filesystems have htrees for big directories by default on most distros.  do a tune2fs -l /dev/sda1 (or whatever blockdevice you're using) and check the "Filesystem features:" line.  if there's a "dir_index" among them, you're golden.
note, however, that even the best directory structures can only make it fast to find one specific file.  doing ls on a huge directory is going to be terrible, as would be any pattern matching, even if you know it matches a single file.
for these reasons, it's usually better to add one or two levels of directories.  usually using some bits of an ID to name the directories.
Answer: Its going to depend somewhat on what filesystem you're using on your Linux server.
Assuming you're using ext3 with dir_index, you should be able to search large directories quite fast so speed shouldn't be much of a problem.  Listings (obviously) will take longer.
As for the max number of files you can put in the directory, I'm pretty sure you can work reliably up to 32,000 files.  I'm not sure I'd want to exceed that (even though you probably can).


Authorize Endpoint URL and Token Endpoint URL in Open ID Connect

Question: I need to create an External Data Source to connect to third party system and I am doing it with OAuth mechanism.I need to create Authentication Provider with type as Open ID Connect before doing it.I have URL with which I can get access token by passing Consumer Key,Consumer Secret,Username and Password.I believe this is Token Endpoint URL.I can make subsequent calls successfully using the token.I don't understand what needs to be passed for Authorize Endpoint URL in Auth Provider screen.Please correct me if I am wrong
Answer: The answer depends on the third party system you are connecting to.  For example, for Google it would be https://accounts.google.com/o/oauth2/auth.  This gives you an authorization code that you can exchange for an access token at https://accounts.google.com/o/oauth2/token.
Comment: Thanks @Lawrence for the reply.Actually it is a java application that I need to connect to and I was given one URL to fetch the token(https://mycompany.com/login/v1.1/token.oauth2) and another URL(http://mycompany.com/si/v3/ppf/PeopleFinderService/peoplefinderservice.svc/) to fetch the data using the token.I believe the URL to fetch token is Token Endpoint URL.Please confirm.Also let me know what should be passed to Authorize Endpoint URL
Comment: It seems some changes need to be done at external system.It is not following standard OAuth flow


Boston DJs Brian and Ivan of Shizm contact info

Question: 20 years ago there were very good house DJs named Brian and Ivan of Shizm. They released excellent mixes on a website which is no longer active. Ten years later, I dug deep and could find that Ivan had a forum on Yahoo: I wrote him an email and he answered openly and friendly. After some time, I deleted all my emails and now I want to follow-up and know more about what happened. Is there any info about these DJs? How I can write a letter to Ivan or Brian?
Answer: Ivan is very friendly indeed, here's his SC account you can message him
https://soundcloud.com/movement-wkkl
Ps: do you own shizm mixes yourself?
Comment: I'll write you there then. I still have the mp3 files
Comment: I downloaded the mp3 files when they were at shizm.com but in 2001 the site was shut down
Comment: @NiklasR. I have around 90 shizm mixes myself, do you mind trading? I'm willing to give you all of mine, if you give me yours, I'm trying to get them all.
soundcloud.com/jc012  <<<< Message me here if you're interested.


How to install window decorations from file?

Question: I got some window decorations from KDE-look.org and I went into settings to change it but it doesn't give me the option to install decorations from file. How do I do so, if it's even possible?
Comment: Are you using Kwin, Compiz, What? IIRC they go into the hidden .kde folder in your home directory.
Comment: @UriHerrera I'm using what ever the default is for Kubuntu 11.10 with KDE 4.8.1 is
Answer: Q:

the option to install decorations from file. How do I do so, if it's
  even possible?

A:
It depends ;)
Engine + decoration files
Example #1- Aurorae - engine included
The Aurorae decoration engine is part of the KDE.
GHNS:
System Settings > Workspace Apperance > Window Decorations > Get New Decorations
Manual from a file:
Unpack the theme to the ~/.kde/share/apps/aurorae/themes/
Example #2- deKorator - external engine
Package: kwin-style-dekorator
<code>Description: Windows decoration engine for KDE 4 using user-supplied PNG files
 With deKorator, easily create your own window decoration for KDE 4!
 deKorator uses your own made images for buttons, borders and so on.
 Go ahead and be creative!
 An example called uglyTheme is provided to show its possibilities.
 .
 Themes can be created by the user with the help of a drawing program or can be
 downloaded from http://www.kde-look.org/index.php?xcontentmode=21
 .
 This is a windows decoration engine, not a style.
Homepage: http://www.kde-look.org/content/show.php/deKorator?content=87921
</code>
After the installation of the engine: System Settings > Workspace Apperance > Window Decorations > deKorator
The deKorator has an option to install the theme from a file.


Help with connection between Eigenvalues and triangles

Question: What is a "triangle" in a graph, and what is the formula for calculating the number of triangles in a graph using the eigenvalues of the adjacency matrix.
Any help will be much appreciated,
Comment: This seems like a relevant post. https://stackoverflow.com/questions/17740081/given-an-nxn-adjacency-matrix-how-can-one-compute-the-number-of-triangles-in-th and use the fact that the trace is equal to the sum of the eigenvalues. Also consider this "computational" approach with an instructional video. https://www.geeksforgeeks.org/number-of-triangles-in-a-undirected-graph/ .
Answer: For a graph $G=(V,E)$, a triangle is a path of length 3, meaning a cycle with 3 nodes (if drawing the graph, it forms a triangle, graphically). Let $A$ be the adjacency matrix, where $[A]_{ij} = a_{ij} = \mathbb{I}[e_{ij}\in E] $. Assume no self-edges.
First, note that $A^k=\prod_{i=1}^k A$ counts the number of length $n$ paths between each pair of nodes.
I.e., $ a_{ij}^k = \#_k(i\rightarrow j)$ is the number of ways to get from vertex $i$ to $j$ in $k$ steps. Why?
Well, by induction, $A$ satisfies this, since the edges are the only length $1$ paths.
Supposing the property is true for some $k$, notice that multiplying $A^k$ by $A$ has components:
$$ [A^k]_{ij} = a^k_{ij} = \sum_{v\in V} \#_k(i\rightarrow v) \#_1(v\rightarrow j) $$
Notice that once you reach $v$ from $i$, all the possible paths from $v$ to $j$ form the complete paths from $i$ and $j$ through $v$. So we multiply the counts. All such paths are length $k+1$ because $i$ to $v$ takes one step and summing over all $v$ covers all length $k+1$ paths (and only length $k+1$ paths).
This gives us all ways from $i$ to $j$ through each $v$, meaning
$ a_{ij}^k = \#_{k+1}(v\rightarrow j) $.
Another way to see it is by considering normalizing it and treating it as the Markov chain transition matrix.
See here as well.
Given this, consider that $a^3_{ii}$ counts the number of length 3 paths from $i$ to $i$: each such one of these is a triangle! So we can get a count of all triangles via:
$$
C_a(G) = \sum_i a^k_{ii} = \text{tr}(A^3)
$$
But this overcounts the triangles, because each triangle will appear $6$ times ($v_i\rightarrow v_j \rightarrow v_\ell$ can be rearranged/permuted in $3\cdot 2\cdot 1=6$ ways). So we should use $$ C(G) = \frac{1}{6}\text{tr}(A^3) $$
Finally, recall that the trace of a matrix is equal to the sum of its eigenvalues.
So let $\lambda_\alpha$ be the $\alpha$th eigenvalue of $A$.
Next, recall that $A$ being symmetric means it has an eigendecomposition and that the eigenvalues of $A^k$ are the $k$th powers of the eigenvalues of $A$ (here and here).
So $\lambda_i^3$ is the $i$th eigenvalue of $A^3$.
Thus we can write the solution in terms of the eigenvalues of the adjacency matrix via
$$
C(G) = \frac{1}{6}\sum_i \lambda_i^3
$$
where we used the fact that $\text{tr}(A^3) = \sum_i \lambda^3_i$.

See also this post as noted by the commentor above.


Why isn't Secure Remote Password protocol being used in REST APIs?

Question: I have seen a few samples of SRP protocol used for web applications and I wonder why nobody ever uses it for RESTful authentication. I have done some research and I couldn't find any single example, not even one. SRP together with password hashing functions such as bcrypt, scrypt or pbkdf2 seems pretty solid to me, but it seems like nobody has tried it before which is odd. Am I missing something here that is conceptually contradictory? Does SRP protocol somehow remove RESTfulness?
Comment: I might recommend re-writing your title a bit so that it attracts more factual, and fewer opinion-based answers.  Maybe something along the lines of "What are the hurdles which would keep an organization from adopting SRP?"
Comment: I tried to narrow down the question to RESTful systems, but actually, as you've said, SRP never made it to the enterprise world. If I generalize the question to a broader category as you've mentioned then it would actually lead to an opinion-based discussion. Let's see if there will be any other answers. If not, then I may change the title.
Answer: Much of the adoption of technology is dependent on economics, and SRP is no exception.  Software shops are generally not going to spend or money on a specific technology which does not provide any sort of novel benefit.  For example, the benefit SRP would provide to an organization would be that they do not have to store passwords in their system.  OpenID already fulfills a similar role.  Choosing SRP means that an organization will have to incur the costs of developing the implementation, accept the risks of not implementing it correctly, and would provide no additional benefit over the cheaper method (OpenID, etc.)
SRP does not violate RESTful practices, as far as I'm aware.
Comment: I am trying to think from a developer's perspective. I did some research on authentication methods in REST and a lot of developers seem to misunderstand the concepts such as OAuth and JWT. The only approach that has been agreed upon is OpenID Connect on top of OAuth 2.0. But I still think that it might be an architectural overkill because either I have to use a third-party identity provider for authentication or implement it by myself (like SRP). If there were some proven frameworks that are ready to use based on SRP, then the organizations wouldn't have to bother implementing it correctly.


Unable to start Windows Phone 8 SDK

Question: I have installed Windows Phone 8 SDK with Visual Studio 2012 Professional with all updates. When I create a sample project and try to run its not showing any emulator to run on

When I am running the XDE file directly from C:\Program Files (x86)\Microsoft XDE\8.0 path its showing me following errors:

then when I am hitting retry its shows me following error

After clean installation over and over again the SDK is not able to create a Virtual machine as shown below

What should I do now???
Answer: Try to execute Visual Studio as Administrator
Answer: As said above, try to execute VS 2012 as administrator and if that doesn't work, re-install VS 2012 and Phone SDK.

Unable to start Windows Phone 8 SDK


Can a MySQL database be used in place of variables?

Question: When I'm writing scripts in PHP to work with MySQL databases with a MEMORY storage engine, is it as fast as PHP variables? Can I consider using such a database in place of some variables for buffers, message queues, etc?
Answer: No, it's not as fast as PHP variables because that is local to the web server. If you are accessing a MySQL MEMORY table it is in memory on the database server so you are accessing an external resource to get the information you need. There is also the additional time it takes to execute the queries against the table rather than execute local PHP code.
Answer: Mysql will never be as fast as PHP variables, even if using a memory storage engine.
You still have the overhead of the mysql client/server connection protocol, etc...
However, it should be fast enough for many cases where you have an advantage of using SQL for some datasets, for example.
Keeping that in mind, use it only when appropriate.
Also, you should look at memcached and (php extension)
It doesn't support SQL, but it's a simple memory caching system with great features, and
all your processes/servers can share the same cache
Answer: No

The protocols involve message passing and possible context switching;  all are rather heavyweight ops.


Detect OSMDroid map loading completed

Question: Is there some way to detect when OSMDroid MapView have completed map loading ? I want to know, when OSMDroid ends drawing tiles and overlays on view.
Greetings.
Answer: I was also looking around for an answer to your question, and stumbled upon this other question:
Detect if the OSM Mapview is still loading or not in android
A less heavy solution could be found probably, without having to define a new class just to check if the OSM MapView map has been loaded, but for now that question is probably what you're looking for.

Detect OSMDroid map loading completed


How does the timeout work in Restlet's client class?

Question: Here's some code:
<code>Client client = new Client(Protocol.HTTP);
client.setConnectTimeout(1); //milliseconds
Response response = client.post(url, paramRepresentation);
System.out.println("timed out");
</code>
What I would expect to happen is that it prints "timed out" before the resource has time to process.  Instead, nothing happens with the timeout and it doesn't print "timed out" until after the resource returns.  Even if I put a Thread.sleep(5000) at the resource that's handling the request, the entire sleep is performed, like the timeout did nothing.
Anyone have experience with this? I'm using Restlet 1.1.1. Thanks.
Answer: A few things to try:

Upgrade to Restlet 1.1.5, the latest version. If this is a bug in the Client class, or in the connector you're using, it might have been fixed. (If your app isn't going to production any time soon, you might want to try the latest preview release of 2.0.)
Try using a different client connector. Especially if you're using the built-in connector — it's really only intended for casual development.
Try asking on the mailing list. The developers are very helpful and responsive there.
Answer: Its open source and the code is pretty clean, I've looked at it before for other things. Why not take a look?


Picking up duplicates of 'unique' legendary items

Question: I see that many legendaries have 'unique on equip'. I understand this means I can't use 2 of them at the same time, but what happens if I have one already (say in stash) and find another one of the same item, can I pick it up?
Answer: Yes, you can pick it up.
The restriction only applies to when it is equipped. If you have one equipped, and another drops, you can grab it but not equip it.
Seems very unlikely this would happen though.
Comment: Considering I haven't found a single one, yes its really unlikely :). Just wanted to know as iirc there were such restrictions in D2
Answer: Yes, I had Kyoshiros Blade equipped and got another from Kadala which actually had better stats.
I then learnt that this was a unique legendary and that I could not dual-wield it! D:
Comment: All of the Legendaries are "unique equipped".


My Macbook Pro Right Speaker Kept Going Broken Even After Replacement

Question: The right speaker of my macbook pro retina 13" kept going broken even after I replaced the speaker. (Ran out of the warranty at this point so had to DIY, also no Apple Store near me, have to fly to one if need be). A while ago the right speaker starts to produce cracking sounds so I ordered a speaker online and replaced it myself. It worked for a while until today it started to produce similar noise again. I can take photos of the inside later today. I wonder if any of you might know how this malfunctioning appeared. I suspect it might be a software + hardware problem (meaning a software malfunction results at the speaker getting broken) but I might be wrong. Could it be overheating? It is really hot lately.
Comment: It's definitely a software issue.
Comment: @Peanut it could be. But how come the new speaker performed normal for about 20 days?
Comment: Here's how to test whether it's hardware or software - http://apple.stackexchange.com/a/191511/85275
Comment: @Tetsujin I've read it 30 days ago. According to this method it was a hardware issue.
Answer: This is a well known issue of macbook pro since 2009 and it effects even the latest model. The reason being the macbook speakers are not designed to resist heat. If it has been working for hours over 100 degree (or 30 some celsius idk) the rubber will melt and tear under high volume. The left speaker will less likely to have such condition since the ventilation is better on the left corner. Why does Apple keep using this type of rubber? I guess they want the rubber to be bouncy enough to make decent sound while keep the cost low. Besides Apple products are never built to last anyways. All you can do is to cool your macbook while using it or you can try to use superglue to cover the rubber, which would make it tougher but the sound will be worse. For a quick fix, you can put gel around the rubber or just the place of the torn mark(s). Take a look at this picture. This is how I did it.
Comment: Man it works the magic. The sound does sound weird after I superglued it.


How can I write this in Vanilla JS: $(function() {...}?

Question: I need to know how to write $(function() {...} in vanilla JS. However, bc it looks like Google doesn't let you search the dollar sign, I can't find it. I do know how to do $(document).ready(function{...}) in vanilla, but how does one do $(function() {...} in vanilla js?
Comment: do you mean getting to select elements like so? `$(element)`? @AviG
Answer: function stuffToDo() { ... }

// If we're already past the "DOM is ready" point, execute immediately:
if (document.readyState === "interactive" || document.readyState === "complete") {
  stuffToDo();
}

// Otherwise, wait for DOMContentLoaded to fire:
document.addEventListener("DOMContentLoaded", stuffToDo, { once: true });

Comment: this question is a dupe
Comment: I don't think that justifies downvoting the answer; if you want to downvote the question, go ahead.


Android Timer schedule vs scheduleAtFixedRate

Question: I'm writing an Android application that records audio every 10 minutes. I am using a Timer to do that. But what is the difference between schedule and scheduleAtFixedRate? Is there any performance benefit in using one over the other?
Comment: it is very well explained in https://stackoverflow.com/a/22487142/5193370 answer.
Answer: The difference is best explained by this non-Android documentation:
Fixed-rate timers (scheduleAtFixedRate()) are based on the starting time (so each iteration will execute at startTime + iterationNumber * delayTime).

In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the initial execution. If an execution is delayed for any reason (such as garbage collection or other background activity), two or more executions will occur in rapid succession to "catch up."

Fixed-delay timers (schedule()) are based on the previous execution (so each iteration will execute at lastExecutionTime + delayTime).

In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well.

Aside from this, there is no difference. You will not find a significance performance difference, either.
If you are using this in a case where you want to stay synchronized with something else, you'll want to use scheduleAtFixedRate(). The delay from schedule() can drift and introduce error.
Comment: Be aware that, when you change the system time to a time in the past (on android this needs root), the timer will NOT execute your tasks for that amount of time in both the described cases.
Answer: A simple schedule() method will execute at once while scheduleAtFixedRate() method takes and extra parameter which is for repetition of the task again & again on specific time interval.
by looking at syntax :
Timer timer = new Timer();
timer.schedule( new performClass(), 30000 );

This is going to perform once after the 30 Second Time Period Interval is over. A kind of timeoput-action.
Timer timer = new Timer();
//timer.schedule(task, delay, period)
//timer.schedule( new performClass(), 1000, 30000 );
// or you can write in another way
//timer.scheduleAtFixedRate(task, delay, period);
timer.scheduleAtFixedRate( new performClass(), 1000, 30000 );

This is going to start after 1 second and will repeat on every 30 seconds time interval.
Comment: Actually, if you specify the 3rd argument, `schedule()` will repeat also.
Comment: You hadn't when I commented! Comment rescinded. ;)
Comment: nopes, i did it before you commented it, then i comment that part in my code and wrote another method scheduleAtFixRate();
Comment: so are these two calls the same? timer.schedule( new performClass(), 0, 30000); and timer.scheduleAtFixedRate( new performClass(), 0, 30000);
Comment: why there is no control for period must be bigger than delay. for example what does it mean. (period is smaller than delay) https://github.com/daimajia/NumberProgressBar/blob/master/demo/src/main/java/com/daimajia/numberprogressbar/example/MainActivity.java#L39
Answer: According to java.util.Timer.TimerImpl.TimerHeap code
// this is a repeating task,
if (task.fixedRate) {
    // task is scheduled at fixed rate
    task.when = task.when + task.period;
} else {
    // task is scheduled at fixed delay
    task.when = System.currentTimeMillis() + task.period;
}

--
java.util.Timer.schedule(TimerTask task, long delay, long period)

will set task.fixedRate = false;
java.util.Timer.scheduleAtFixedRate(TimerTask task, long delay, long period)

will set task.fixedRate = true;
btw Timer doesn't work when screen is off.
You should use AlarmManager.
There is sample:http://developer.android.com/training/scheduling/alarms.html
Answer: In case of schedule it only executes once when the appropriate times came. On the other hand scheduleAtFixedRate has an extra parameter period which contains amount of time in milliseconds between subsequent executions.
More info can be find here
http://developer.android.com/reference/java/util/Timer.html#schedule(java.util.TimerTask, long)
Comment: `schedule()` can also have that `period` argument specified.


Is translation of passport stamps necessary?

Question: I am applying for a visa to the UK, and the application requirement says that documents that are not in English or Welsh must be translated into English. The issuing authority of passport is indicated in my passport as a stamp, which is in Chinese, with no English translation. Since the visa application asks me to state the issuing authority of my passport, I wonder if I should have a translator translate the stamp, so that  people in charge of reviewing my application will know this stamp indicates the issuing authority. Thanks!
Comment: Thanks for the reply. I edited my post to include the picture, which I hope you can see. The stamp is actually placed on the same page as the text "The Ministry of Foreign Affairs of..."
Comment: Sorry to not make it clear..My old passport is actually an older version, not the one shown in your link above. So the picture page actually does not indicate the issuing authority.. (mine looks somehow like this one: http://www.theepochtimes.com/news_images/2005-5-28-wenyi-passport.jpg)
Comment: Doesn't look like translation is necessary: http://en.wikipedia.org/wiki/Chinese_passport#mediaviewer/File:Informatin_Page_of_PRC_Ordinary_Passport_(97-2_Version).jpg
Comment: @Karlson: The complication is that the issuing authority is not the Ministry of Foreign Affairs. Basically the stamp and the text above the stamp show two different authorities. The stamp looks like this one: https://farm6.staticflickr.com/5192/14343407192_5666efe86d_z.jpg
Comment: Image is not accessible for me.  I think you're looking at the wrong page.  Issuing authority is on a picture page.
Comment: I think you're looking at the wrong page.
Answer: Since the issuing authority for all civilian Chinese passports is the Exit & Entry Administration of the Ministry of Public Security (公安部出入境管理局), it hardly seems necessary to translate this -- if you're applying for your visa in China, they will surely already be aware of this.
But then again, if you're already getting your passport professionally translated, surely it's easy enough to translate that single phrase as well?


The Hamiltonian for Josephson Junctions

Question: In the Feynman Lectures on physics, Feynman says the amplitudes across a Josephson Junction should be related by the following, where the subscript denotes the side of the junction that the amplitude or potential belongs to:
$i\hbar \frac{\partial \psi_1}{\partial t} = U_1\psi_1 + K\psi_2 \tag{1}$
$i\hbar \frac{\partial \psi_2}{\partial t} = U_2\psi_2 + K\psi_1 \tag{2}$
Why is this the correct Hamiltonian? Certainly having a term proportional to the potential energy is standard, but why is there a term proportional to the amplitude on the other side? Is this because we expect some of the amplitude to tunnel through, and hence be proportional the amplitude on the other side? While I understand that our Hamiltonian can be any Hermitian operator, I just don't see the full justification for choosing this one.
Answer: In the same spirit as the tight-binding approach for atomic orbitals in a lattice, you assume that the spatial wavefunctions (let's call them $\phi_{1,2}(\mathbf{r})$ here) on either site of the barrier are approximately orthogonal,
$$ \int \phi_1^* \phi_2 \, d\mathbf{r} \simeq 0,$$
whereas the barrier allows particle to tunnel through and lifts this orthogonality
$$\int \phi_1^* V(\mathbf{r}) \phi_2 = K.$$
Integrating out the spatial coordinates from the Schrödinger equation,
$$i \hbar \dot{\Psi} = [\hat{H}_0 + V(\mathbf{r})] \Psi,$$
where the total wavefunction of the system is factorized as $\Psi = \psi_1 \phi_1(\mathbf{r}) + \psi_1 \phi_2(\mathbf{r})$ and $\psi_{1,2}$ are the probability coefficients (or particle coefficients if one considers superconductors or condensates). You then have,
$$ i \hbar \begin{pmatrix} \dot{\psi}_1 \\ \dot{\psi}_2 \end{pmatrix} = \begin{pmatrix} U_1 & K \\ K & U_2 \end{pmatrix} \begin{pmatrix} \psi_1 \\ \psi_2 \end{pmatrix}.$$
Here, $U_{1,2}$ are the bulk energies (or un-perturbed energies) of the wavefunction at each side.
Answer: In the physics of nanostructures one often uses something like:
$$\hat{H} = -E_J \cos\hat{\varphi},$$
where $\hat{\varphi}=\hat{\varphi}_1 - \hat{\varphi}_2$ is the superconductor phase difference, related to the number of particles via the commutation relation
$$[\hat{\varphi}_j, \hat{N}_j] = -i.$$

The Hamiltonian for Josephson Junctions


LinkedIn Import to Careers 2.0 only displaying partial data

Question: I did the import from Careers 2.0 of my LinkedIn data and all went well.  Then I updated a bunch of items in LinkedIn.  Now the import in Careers doesn't seem to be picking up the new data at all.  Is there a time delay between updating LinkedIn and when it becomes available to external services?  Or is it something else?
Answer: It appears that this is just a delay. I just clicked the Import link again from within Careers, and it displayed/imported all the new data.  So roughly 2 hour delay for some reason.


Javascript OO reference this

Question: Short description: I am using OO Javascript with the function declaration, new keyword, and prototype approach (example below). I need a way to reference the "self" object within each method of the object. "this" seems to only work if I am calling the method directly, otherwise "this" seems to refer to whatever called the method instead.
More details: Here is a simplified version of my object.
function Peer(id) {
    this.id = id;
    this.pc = new RTCPeerConnection(SERVER);

    this.pc.onevent1 = this.onEvent1;
    this.pc.onevent2 = this.onEvent2;
}

Peer.prototype.doSomething = function() {
    // create offer takes one param, a callback function
    this.pc.createOffer(this.myCallback);
};

Peer.prototype.onEvent1 = function(evt) {
    // here this refers to the RTCPeerConnection object, so this doesn't work
    this.initSomething(evt.data);
};

Peer.prototype.myCallback = function(data) {
    // here this refers to the window object, so this doesn't work
    this.setSomething = data;
};

Peer.prototype.initSomething = function(data) {
    // use data
};

And here is a sample use of it.
var peer = new Peer(1);
peer.doSomething();
// eventually something triggers event1

I tried to simplify the code as much as possible and explain the problem in comments. I created a workaround for the first scenario (calling this.myCallback) by creating a local copy of this and making the callback param an anonymous function that calls the function I need using my local copy of this. But the second scenario is more troublesome (an event firing).
I was curious if there is a different model for Object Oriented programming in which every method always has a proper reference to the parent object, regardless of how the method was invoked? Or if there is a different way to create an object as a property of a custom object and bind its events to the custom object's method? Sorry if this is confusing language! Note that my question has nothing to do with RTCPeerConnection, that just happened to be the project I'm working on currently.
I found this article: http://www.alistapart.com/articles/getoutbindingsituations but I wasn't totally sure how to use this information?
Answer:
I was curious if there is a different model for Object Oriented programming in which every method always has a proper reference to the parent object, regardless of how the method was invoked?

Yes, there is: it's called Function.bind.
function Peer(id) {
    this.id = id;
    this.pc = new RTCPeerConnection(SERVER);

    this.pc.onevent1 = this.onEvent1.bind(this);
    this.pc.onevent2 = this.onEvent2.bind(this);
}

Likewise, for myCallback's this to always reference the Peer instance:
Peer.prototype.doSomething = function() {
    // create offer takes one param, a callback function
    this.pc.createOffer(this.myCallback.bind(this));
};

Comment: Yes, thank you! For some reason I was only able to find the answer on here from another question after submitting (it showed up on the side, but not in "possibly related questions"). Sorry for the already answered question, but thank you for the answer.
Answer: A method is just a function that's defined as a property on a prototype.  It doesn't have any particular object context by itself and this is for a reason because there can be an infinite number of objects of a given type so the method works when given the context of a particular object.
In javascript (and in other OO languages too), that object context is provided by the caller.  The classic way of doing so is where you call the method on a particular object:
obj.method();

But, you can also cause the this pointer to be set to something else by using .apply() or .call() or .bind().  You can read about all of them on MDN.  .bind() isn't supported on some older browsers so you need to either use a shim or use a different solution (I use the one mentioned below).
So, the caller has to take responsibility for making sure the this ptr is set appropriately.  That's how javascript works.
Another design pattern work-around when trying to pass a method call as a callback is like this:
var self = this;
callMeWhenDone(function() {
    self.myMethod();
});

Here, you save the this ptr in a local variable and use it to invoke a method from an anonymous callback because the this pointer in the callback will be set to something else.
Note: Internally, .bind() is just doing something similar to this workaround.

Javascript OO reference this


Simplest way to record voice on Macbook Air

Question: I'm looking for the simplest way to record voice -- a two people conversation -- with a Macbook Air. The goal is then later to listen to it on the Mac and transcribe it.
Comment: This used to be built in to the MAC OS in the nineties(MAC OS 7). :)
Answer: Scenario 1: You're both in the same room
Open up QuickTime Player. Select File -> New Audio Recording.... Make sure the source is set to Built-in Microphone (see screen shot below). Hit the big red Record button. Talk away.

Scenario 2: You're using Skype or something like it to converse
This is a little trickier but not impossible. You'll need the SoundFlower app from Cycling '74. If you're using Skype you'll set it's audio output to be the SoundFlower input. Then in QuickTime you'll set the audio input to be SoundFlower's 2-channel output. This routes the audio from Skype in to QuickTime. Record as above.
Comment: The SoundFlower app is now hosted at [Google Code](http://code.google.com/p/soundflower/)
Comment: The SoundFlower app is now hosted at [GitHub](https://github.com/RogueAmoeba/Soundflower).
Answer: Open QuickTime Player and select File -> New Audio Recording from the menu. This is a new feature (not sure whether it was in Lion, Snow Leopard, or an independent QuickTime update). Previously your options were:

Get a QuickTime Pro key ($29.99)
Third Party, commercial: Voice Candy ($12.95)
Third Party, open source: Audacity (free)
Answer: The simplest way is to use either Quicktime (simply choose File>New Audio Recording) or a free and open-source app like Audacity. Your MBA has a built in microphone, so all you need to do is click record and then start your conversation.
If you do this regularly, it way be worth investing in a USB mic that has better sound quality than the built-in mic on your Macbook. Something like the Samson Go Mic is fairly well regarded for field recordings, dictation, and interview recordings.
Lastly, transcription can be a huge pain without software that supports easy pause/resume/rewind capabilities. There are a couple free ones out there, like Transcriptions or more expensive commercial solutions. (Hint: Get a foot pedal!)
Sound-to-text technology is getting increasingly more accurate (though not foolproof as anyone who uses Google voicemail transcription knows), so depending on the quality of your source material and the time you spend training, you can also eliminate a large chunk of the manual transcription with something like MacSpeech Scribe
Answer: The simplest manner is to open Photo Booth and record a movie.
I count 4 clicks:

Keyboard command for Launchpad
Click Photo Booth
Click the movie control (lower left)
Clock record

As long as you have space for the video, you can review the recording quite easily and delete it.


Changing fermentation

Question: I just made my first brew and I started the fermentation process in a plastic container. Should I transfer the brew into a glass fermenter? It's only been sitting in the plastic one for 2 days.
Answer: Don't worry about it, it's fine. Plenty of people ferment in plastic, either buckets or better bottles.

Changing fermentation


Minimum feedback resistor Rf for given opamp ex: opa2134

Question: i have a problem that needs solving;
What is the minimum feedback resistor for modern opamps like opa2134 ?
can it be 100 ohm?
Im asking because in lt1028 datasheet its says it cant be <100ohm because it causes distortions ,very heavy by the way.
How can this value be found for any given opamp?
Does it depend on output current ?
The configuration of the setup is DAC I/V with multiple feedback low pass filter with High Voltage output -6VRMS
the stage procceding it is a Voltage follower buffer
Answer: Looking at the LT1028: -
Because the inputs are protected by back-to-back parallel diodes (not all op-amps do this), when fast edges are inputted, the output voltage doesn't change quickly enough to follow the fast input and one of these diodes gets forward biased through the feedback resistor. This "corrupts" the input signal and distorts it. Read the explanation on page 14.
Also, if you look at figure 9 it shows two configurations that are acceptable and one has zero ohms feedback resistance. Again, it is because of the input diodes.
Regarding the opa2134 I couldn't find reference to it having input protection diodes in its data sheet.


Solidity Assembly Code create2 function

Question: I am new to solidity, can you please explain the create2 function?
assembly {
    pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
}

Answer: The create2 is an opcode that takes 4 stack arguments: endowment, memory_start, memory_length, salt. Behaves identically to CREATE (0xf0), except using keccak256( 0xff ++ address ++ salt ++ keccak256(init_code))[12:] instead of the usual sender-and-nonce-hash as the address where the contract is initialized at.
In other words: The CREATE2 opcode gives us the ability predict the address where a contract will be deployed, without ever having to do so.
Answer:
0 is the amount of Ether to be sent to the contract being deployed.

add(bytecode, 0x20) This is the location in memory where the contract bytecode starts. The add opcode adds the two values together to get the starting memory location of the bytecode. The 0x20 offset is used to skip over the first 32 bytes of the bytecode, which contain the length of the bytecode.

mload(bytecode) is to loads the bytecode at the memory location specified previously.

salt is a random 32-byte value used to generate a deterministic address for the deployed contract. The salt value is usually derived from a combination of the deploying contract's address, the contract creation code, and any relevant parameters.

The Factory can have a view function such as this one to get a deployed address:
function computeDestinationAddress(bytes32 salt, bytes memory bytecode) external view returns (address) {
    bytes32 bytecodeHash = keccak256(bytecode);
    bytes32 _data = keccak256(abi.encodePacked(bytes1(0xff), address(this), salt, bytecodeHash));
    return address(bytes20(_data << 96));
}

Comment: Thanks for your answer.

Solidity Assembly Code create2 function


Editing and reopening a closed question

Question: There is a question that was posed back in January that wasn't well formed but which had the bones of a very good question in it. You can see it here, it is closed now. I'm wondering, can/should it be resurrected by editing the question, or would it be better to start a new question?
Answer: Either option is fine. If it's closed but fixable, then editing it and getting it resurrected is good. It's also fine if you just ask your own new question.
Comment: Editing gets it into the "evaluate for reopening" queue.
Comment: Thanks, I like the idea of resurrecting it and preserving the work of the people who have already replied. Is there anything special that needs to be done to get it "un-closed" or is there something automagic that happens?
Comment: Automagic :-) Thanks.

Editing and reopening a closed question


What is the geometric interpretation of this limit :$\lim_{n\to {+\infty}}\zeta(n)+\zeta(\frac1n)=\frac12$?

Question: it is easy to show that $\lim_{n\to {+\infty}}\zeta(n)+\zeta(\frac1n)=\frac12$ , The latter expressed the relationship between $\zeta(n) $ and  $\zeta(\frac1n)$ with $n$ is a positive integer , Then i have two questions here : The first  I want to know here  how i can compute $\zeta(n) $ using $\zeta(\frac1n)$ ?and the second What is the geometric interpretation of this limit :$\lim_{n\to {+\infty}}\zeta(n)+\zeta(\frac1n)=\frac12$ ?
Comment: see this https://math.stackexchange.com/questions/2198448/what-is-the-geometric-interpretation-of-displaystyle-lim-s-to-1-sin%C2%B2-zeta
Answer: There is no deep underlying geometric picture. The fact that $\zeta(n) \to 1$ as $n \to \infty$ is nothing more than the fact that the first term is $1$, and every other term decays. Similarly, $\zeta(x)$ is continuous at $x = 0$, and $\zeta(0) = -1/2$. For two quite simple reasons, we see that $\zeta(n) + \zeta(1/n) \to 1 - \frac{1}{2} = \frac{1}{2}$.
It may be beneficial to ruin some of the artificial symmetry. It is also true that
$$ \lim_{n \to \infty} \zeta(3n) + \zeta(\tfrac{1}{7n}) = \frac{1}{2}.$$
Or instead of $3$ and $7$, you can use any positive real numbers you want. I think the complete freedom in this choice shows how unrelated $\zeta(n)$ and $\zeta(1/m)$ really are.
Answer: I. The Graph of $\zeta(s)$ for only real numbers
 (source)

We see :

$2$ asymptotes to the $x=1$: $y_1=0$ and $y_2=1$
for $x\in[0;1)$ : $\zeta(x)\leq-\frac12$

II. (Intuitive) Let's define the function $g(x)$:
\begin{cases}
 \frac12 & \quad \text{ $x=0$}\\
    \ \zeta(x)+\zeta(\frac1x)      & \quad \ \text{ $x>0 \land x\neq1$}\\
    0 & \quad \text{ $x=1$}
  \end{cases}

For $x\rightarrow \infty:g(x)$ going closer to the asyptote $y=\frac12$ ( which is the center axis between $y_1$ & $y_2$)
Here some points I 'calcule' ( w/ WolframAlpha plus Wikipedia help)


In a legal evidence submission packet, what is common nomenclature for different types of articles?

Question: For example one might have exhibit 1, exhibit 2, and so on, but also various witness statements. Are these statements themselves also exhibits? Where else can one find references of these sorts of organisational and naming conventions? Where do they come from?
Comment: In what jurisdiction? Many legal systems don't even have "legal evidence submission packets".
Answer: When submitting evidence to the court, basically everything is going to be labeled as an "exhibit," including pieces of physical evidence, photographs, videos, audio recordings, affidavits, deposition transcripts, and so on.
Comment: It's just a very informal rule, handed down from centuries of experience. There are certainly going to be some jurisdictions that have it committed to writing, but I don't know of anywhere that uses different names for these different categories of evidence.
Comment: That's quite a lot of jurisdictions. The rules are going to vary between and even among them. Some of them may come down to the individual judge's preferences.
Comment: Where does this convention arise from or where is it defined?
Comment: If there's a specific jurisdiction you're interested in, we may be able to get you a more specific answer.
Comment: I'm interested in American and English jurisdictions.


Chrome print preview

Question: When printing from Chrome (Version 21.0.1180.82 - OSX) I get an inconvenient print dialog, where chrome tries to take control of the printing away from the OS - is there a way to disable this permanently? I've tried using the suggestions at http://productforums.google.com/forum/#!msg/chrome/L8_LF-UCxgU/JtuC1lMUEe4 and http://maketecheasier.com/enable-disable-google-chrome-print-preview/2011/04/13 and didn't get very far... :(
Answer: It says what to do right in the Print dialog:

Either click that link, or press Ctrl+Shift+P to print.
Comment: Apologies - I've edited the question to make it clearer that I'd like to disable the behaviour entirely.

Chrome print preview


Long time ago I bound my right shift key to F3, how can I undo that?

Question: Basically, my shift key is being random. A long time ago, I set it to act like F3 (whatever that's called), and undid it. Now it's doing it again. How can I change it back to just shift? I can't seem to find the correct option in System Preferences>Keyboard>Keyboard shortcuts
Comment: You shouldn't be able to do that from Keyboard.prefPane. Are you sure you didn't use something like KeyRemap4MacBook?
Comment: Sorry for delayed response,
No I didn't use a remapper. However I did revert from lion to snow leopard and I believe the change was made in lion
Answer: I did exactly as you described recently and you are right that there seems to be no trace to go back to that function to undo it. After talking to several Mac users, including store staff, it got resolved by trial and error by an Apple Store senior support person;
he expressed himself that it was an odd solution to the problem and that the key mapping may be faulty but it worked.
None of the people I talked to are aware of this capability to alter the function of the right shift key; if it wasn't for your post, they would have convinced me that there was no such function. Anyway, this is what he did:

go to System Preferences, then Exposé/Spaces.
in Exposé, for the "Application Windows" setting, choose "-"
Answer: On a Mac, Shift functions similarly to Option or Command in that they are modifier keys. You generally cannot assign a shortcut to just one of those keys. They must be used in concert with another (ie. Shift + Option + X).
Regardless of memory on how it was assigned, if it has reverted to incorrect function, and your keyboard is configured properly for QWERTY English, you may have a corrupted preferences file. The easiest way to determine how deep the issue runs is to test this in another User account.


Serializing an array of integers using XmlSerializer

Question: I'm encountering a problem while trying to serialize a multi-dimensioned array of integers via XmlSerializer for an XNA project I'm working on. I'm able to serialize all of my other data (booleans, strings, even Colors, etc) without a hitch. I've also seen plenty of people claim that XmlSerializer will natively handle (single-dimensioned) arrays of integers as well. Is there a limitation regarding multi-dimensioned arrays, or is something else going on here?
Here's the relevant code:
int[,,] scoredata = scores;  // Populated with data elsewhere

filename = Path.Combine(container.Path, "scoredata.sav");
stream = File.Open(filename, FileMode.Create);
serializer = new XmlSerializer(typeof(int[,,]));
serializer.Serialize(stream, scoredata);  // This line throws the exception.
stream.Close();

The exception I receive is

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll. There was an error generating the XML document.

I've also tried using this array as a member variable in a struct (where all of my other player data is stored) but I get the same exception when doing things that way, as well, which leads me to believe that it's not a simple syntax error or anything like that.
Do I need to restructure my code to serialize via a single-dimensioned array, or is there something I'm overlooking?
Thanks in advance!
Answer: Read the inner-exceptions:

There was an error reflecting type 'SomeType'. Cannot serialize member 'SomeType.Data' of type 'System.Int32[,,]', see inner exception for more details.
Cannot serialize object of type System.Int32[,,]. Multidimensional arrays are not supported.

So no: multi-dimensional arrays simply aren't supported. You may have to shim it through as a single-dimension array... you can do this by having a separate property that does the translation:
[XmlIgnore]
public int[, ,] Data { get; set; }

[XmlElement("Data"), Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public int[] DataDto
{
    get { /* flatten from Data */ }
    set { /* expand into Data */ }
}

Comment: That's kind of the answer I was expecting.  Thank you!
Answer: It took me a while to figure out what should go into Marc's get and set braces to flatten and expand multi-dimensional arrays.
Here is my solution for 2D arrays.
In my case, I know at compile time that one of the dimensions is 4 so I did not have to store (somehow) the array dimensions.
    [XmlIgnore]
    public int[,] Readings { get; set; }
    [XmlArray("Readings")]
    public int[] ReadingsDto {
        get { return Flatten(Readings); }
        set { Readings = Expand(value, 4); }
    }

    public static T[] Flatten<T>(T[,] arr)
    {
        int rows0 = arr.GetLength(0);
        int rows1 = arr.GetLength(1);
        T[] arrFlattened = new T[rows0 * rows1];
        for (int j = 0; j < rows1; j++)
        {
            for (int i = 0; i < rows0; i++)
            {
                var test = arr[i, j];
                arrFlattened[i + j * rows0] = arr[i, j];
            }
        }
        return arrFlattened;
    }
    public static T[,] Expand<T>(T[] arr, int rows0)
    {
        int length = arr.GetLength(0);
        int rows1 = length / rows0;
        T[,] arrExpanded = new T[rows0, rows1];
        for (int j = 0; j < rows1; j++)
        {
            for (int i = 0; i < rows0; i++)
            {
                arrExpanded[i, j] = arr[i + j * rows0];
            }
        }
        return arrExpanded;
    }


Which ASIC Bitcoin Miner gets you best bang for you buck as of today?

Question: I'm thinking of purchasing an ASIC miner, but I'm not sure which one to go with as there seem to be multiple options. When they mention 20-60Gh/s, I'm not sure how many bitcoins can that mine in a specific time. I would like to know how to calculate how many BTC is mined with say 40 Gh/s.
Comment: The reliability and availability of the hardware, and the quality of the support are also factors that affect profitability. Even though this is a good question, unfortunately I don't think it's answerable, with the hardware so new to the market.
Answer: ASICminer and Avalon are already deploying, and they will hit over 100Th/s before too long.   Butterfly Labs has 75,000 chips on their way, each at 7.5Gh/s, this will account for another 560Th/s.  Avalon has sold out batch 1 and 2.   ASICminer is in the process of deploying their farm.   BFL has 19500+ orders.   Many of those orders are for multiple units.
Basically, many people have pre-ordered based on the idea that they are going to get rich quick, so they have overbought.   This was part of why BFL has delayed so long I believe, to generate more orders than they would if people knew how far up the difficulty was going to go.   Go ahead and order if you want, but realize that ROI could be much longer than you anticipate.   Safe bet would be to wait a couple months to order, then you will have a much better idea.   Honestly at this point, there are so many orders in front of you, it will only make a few days difference whether you order now or later.
Comment: The difficulty can only increase a maximum amount every two weeks. ASIC mining is the future, but as long as the price stays around $100 a coin, the ASICs will make a lot of money.
Answer: By time you receive an ASIC that you order today, the orders ahead of you will have pushed the network to maybe 700Th/s.   So your 40Gh/s is .04 Th/s.   There are 3600 bitcoins generated each day.   .04/700*3600=.2057 bitcoins per day.   This will generate $6.17 per day, or $185 a month.   Also consider that the network speed will continue to increase.   So maybe after 6 months you are making half that.
Comment: Do you have a citation for the 700Th/s figure? It seems high.


Is it harmful to a laptop to put it near or above a wireless phone charger?

Question: At the coffee shop I go to there is a wireless charging power mat made by Powermat. Is it harmful to my laptop to put it near or above the wireless phone charger?
Answer: No. This should not damage your laptop or any other non-Wireless charging device you place on it.
Wireless charging uses a very low power detection mechanism and only switches to a higher power field for charging once a wireless charging device has been detected and has negotiated with the transmitter.
Your laptop, lacking the charging circuitry, will not negotiate with the charger and so will not trigger the higher power charging phase.
The page Wireless Electricity Transmission from the Wireless Power Consortium explains a lot, though this image in particular shows setup and power negotiation without which the field strength will be far below anything that could damage components.

The penultimate image on that page shows that the transmitter could be working to actively detect a charging coil, but in the example the power is 3 orders of magnitude less (5mW vs 5W) to check for possible receiver coil presence than to actually provide full power.  Your laptop, lacking an inductive coil, will almost certainly still not trigger the resonance (inductive coil) check phase, though it may briefly trigger the initial capacitance check phase.  This will still not be enough power being radiated to do any damage whatsoever and the charger should quickly fall back to its standby and detect mode.

Without these low power active-detection mechanisms we would be radiating away enormous amounts of power from wireless chargers, something that is unacceptable in this day where everything is being geared towards minimising energy footprints.
Answer: No -- Powermats are inductive charging devices with very limited range (the device has to be right on the mat). That field strength should drop off with the square of distance as well.
Answer: No, it's fine.
The susceptibility of hard drives, and of electronics in general, to external magnetic fields is grossly overestimated. See my answer here: Is CRT degaussing really dangerous for nearby laptops? for a description of a relevant experiment. If your laptop has an SSD instead of a hard drive it's even less susceptible, if that's possible.


Sharepoint 2010 / Exchange 2010 Single Sign On issue

Question: I have an Exchange 2010 Hosted environment and now I installed new Sharepoint 2010 Farm. My issue is that Outlook Web Parts won't work with Single Sign On and I have to log in twice. First time to Sharepoint site and second time to OWA. Is there any way to make it working with SSO. All my servers (Exchange and Sharepoint) are connected to the same domain.
Comment: What do you mean by hosted environemnt? Office 365?
Comment: By hosted environment I mean a multi-tenant exchange installation. It gives you an ability to set up multiple organisations on one Exchange system
Answer: The exchange webparts are just using an iframe to display a subset of outlook web application (OWA) functions. Do you have OWA set up? If the user is requested to enter credentials to the OWA url you will get the same for the webpart in SharePoint.
In the first place the user if integrated into the domain (domain joined desktop/laptop) using IE should not get a credential prompt. If it is prompted you have to configure the SharePoint URL into the trusted sites so the logon credentials are send by default. SharePoint "must" be setup using NTLM or even better Kerberos. Otherwise clients from vista or higher are not sending any credentials to basic auth websites. Do the same stuff for owa and you won't see credentials.
OWA Basic Auth:
http://support.microsoft.com/kb/282805/en-us
Browser and Integrated Authentication:
https://confluence.atlassian.com/display/SPCON/Setting+your+Browser+Options+for+Automatic+Login
Comment: What do you mean by "having OWA set up"? OWA is working properly for all users. My problem is that it is not passing through credentials from Sharepoint site to OWA webpart while it is the same user and I'm already logged in to Sharepoint.
Comment: That's what i told you. The OWA webpart is just an iframe. Check the owa web part configuration and the url's used. SharePoint is not passing any credentials to owa. The Client is passing the credentials to owa and SharePoint is just providing the HTML to embed the owa URL. Microsoft took this approach because otherview anybody would have to implement Kerberos with Delegation to get this stuff working. This is no easy part so Microsoft stuck to using just the owa parts using an iframe. You can use IE developer Tools or fiddler to see what the Client is doing on what Server.


ASP.net c# publicly accessible functions in namespace

Question: In my namespace I can have public classes which are accessible to all other pages in my namespace.  How do I go about having public functions?  Do I have to create a class with the functions in it?  Or is there an easier way?
Answer: In C#, all functions (which are actually called methods in C# terminology) are to be declared in a type (a class or a struct).
However, there is the concept of static classes in C#, which are good for the purpose of replacing "global functions" in older programming languages:
public static class MyUtilityFunctions
{
    public static void PrintHello()
    {
        Console.WriteLine("Hello World!");
    }
}

Now you can, anywhere in your program, write:
MyUtilityFunctions.PrintHello();

A static method is a method that doesn't require an object. A static class is a class that contains only static methods (and static fields, static properties etc.).
Comment: Super, exactly what I was after!  Is this considered bad practise?  Or is it OK to use?
Comment: There's nothing wrong with using this per se. Of course, there are ways of using it badly — for example, don't make a method static if it could easily just be a method on the type of the first parameter instead.
Comment: Timwi, yes sure!  Sorry I always get worried who's answer I should accept, I did the other one because my comment indicated I would and he was first in, sorry if I offended anyone
Answer: Functions (Methods) "live" in types, so you need to put them in classes or structs. By default they would be private so you need to specify the public access modifier for them to be accessible:
namespace myNameSpace
{
  public class myClass
  {
    public void MyMethod()
    {
    }
  }
}

See MSDN - Methods section of the C# programming guide.
Comment: Thank you, before I accept could you please tell me if when using a method in myClass if I need to create an instance of it, or can I just reference it?  Do I need to do protected myobj = new myClass; myobj.myMethod() or can I just to myclass.myMethod()?
Comment: @Tom Gullen - It depends on how you declare you method. Most methods will require you to instantiate the class before you can use it. If you create them as static, they are then "class methods" that don't need an instance but are tied to the type - think very carfully before doing this, as there are startup costs to doing so.
Answer: When doing C#, functions can only live in types (classes and structures). You can not declare a function on its own.


Cost of RER/Metro monthly pass in Paris

Question: I'm going to be living in the 18th arrondissement for three months.  What is the cost of an RER & Metro pass monthly? I used to live in Saint Germain En Laye years ago and the pass cost about $90. How much is it now?
Comment: The cost varies depending on the zone covered
Answer: The monthly travel pass is Navigo Mois. You load it onto a Navigo contactless card.
Because french people can't do simple things, there are many different Navigo cards (and they come up with a new one every 3 months these days). You can load a monthly pass only on a standard Navigo card or a Navigo Découverte Card.

The standard Navigo card is in theory reserved to people who live or work in the Paris region (Ile-de-France). You'll need to provide name, address, photo, and IIRC details of a bank account (what is called a "RIB", which shows your bank account number, etc.), even if you're not getting a subscription. It's free. If you lose it, you can get a replacement (including any passes loaded onto it) for 8 euros.
The Navigo Découverte is available to anyone, only requires a photo, but costs 5 euros and if you lose it, any passes loaded onto it are lost.

In RATP stations at least you don't need to bring a picture, they can take it directly at the desk. Not sure about SNCF stations (the RER station at CDG airport is SNCF).
Once you have the card, you can load daily, weekly and monthly passes onto it either at a desk or using the vending machines. You can even do it online, but you need to buy a card reader for that.
If you need to travel inside Paris (zone 1), there's no longer any choice for weekly and monthly passes, you can only buy a pass for all zones (1-5). The cost for a monthly pass is currently 75.20 € (22.80 € for a weekly pass).
Note that monthly passes run for a full calendar month (from the 1st of the month to the last day of the month), you can't get passes starting on arbitrary days. Likewise weekly passes only run Monday to Sunday.
Answer: The price varies depending on the zones covered.
From the Paris Convention and Visitors Bureau fares guide:

You can also choose a Monthly or weekly Navigo Package. These can be purchased from the ticket offices or machine in the stations, their prices vary depending on the travel zones covered (see "Passes and reductions"). You will need a passport-sized photo for these passes, obtainable from the photo booths in some metro stations (make sure you have the correct change).
Comment: I will add extra photos to my package and possibly purchase Navigo Package...Sold at the airport I hope????
Comment: @SharonGraine yes, probably

Cost of RER/Metro monthly pass in Paris