Javascript/jquery in windows applications

Question: This might be a stupid question but is it possible to use javascript/jQuery in windows applications?
Im making this application in vb.net, just for personal use and im just making it to practice and to learn more about vb.net programming.
I know javascript is ment for web applications but maybe there are ways to use them in windows applications aswell.
Any response or comment is welcome.
Thanks in advance :)
Comment: What do you want to do with JQuery in windows forms?
Answer: You may be able to find some success with something like Jint to run JavaScript code, but JQuery relies heavily on the presence of the DOM, so using JQuery to work with a VB.net UI isn't going to be possible.
Answer: cscript, wscript and the Windows Scripting Host objects allow you to do things that you can't do from within a browser, but these are very much limited to scripting tasks, and won't allow you to create a GUI.
It is possible to create a VB application that does little more than host a browser window.  You could use such a browser window to create a rich jquery UI.
By setting the window.external property from your VB app (see this question and this HOWTO), you can give the embedded browser access to things outside the browser environment, thereby enabling it to interact with the local machine in a manner normally forbidden by a browser.
Answer: I have to disappoint you, this is not possible. Unless there is some browser-emulator tool or some js-engine under the hood in your application, there is obviously no way to link those worlds.
However, if you like the javascript syntax, you can use node.js also on windows platforms. But there again, it is not possible to access the windows API. But there might be a plugin which allows for that.
Answer: Write a Metro application?

You write Metro style apps using familiar technologies like HTML5,
  JavaScript, and CSS3, or XAML, with
  C++, C#, or VB.Net code-behind.
Answer: HTML applications (HTA) may give you what you're looking for. They don't seem to get much attention these days but try changing our .htm suffix to .hta and then run it from the command line. I haven't figured out how to debug it, but hey.
Answer: You might want to look at Real Oop with AutoIt and Smuggling Autoit into IE Embedded
There is also JScript.NET.


Topological space which is homeomorphic to its square

Question: If $X$ is an infinite set, we can consider it as a topological space with the discrete topology, and it has the property that $X$ and $X\times X$ are homeomorphic. Does the property that $X$ is homeomorphic to $X\times X$ imply that $X$ has the discrete topology? Or are there other examples of spaces that satisfy this?
Comment: What about the trivial topology $\{ \emptyset, X \}$?
Comment: See also: [Homeomorphism between Space and Product: $X \cong X \times X$](https://math.stackexchange.com/q/677574), [Can a space $X$ be homeomorphic to its twofold product with itself, $X \times X$?](https://math.stackexchange.com/q/1384455), [Homeomorphism between topological space and product space](https://math.stackexchange.com/q/722412).
Comment: Right, I really did not think this question through enough. Anyway, good to now that there are a lot of spaces (not only those with discrete or trivial topology) that have this property.
Answer: For arbitrary separable infinite-dimensional Hilbert space $H$ you have a linear (even unitary) homeomorphism $H \sim H \times H$, which can be built using any countable orthonormal base in $H$.
Answer: Let $Z$ be any space and $A$ any infinite set. Then $X = \prod_{\alpha \in A} Z_\alpha$, where $Z_\alpha = Z$, has the property $X \times X \approx X$.
Answer: The Cantor space $C = \{0,1\}^\mathbb{N}$ clearly also has this property, but its topology isn't discrete.
Answer: Spaces like that are often $0$ dimensional (base of clopen sets): many standard spaces are like that:
$X=\mathbb{Q}$ in the usual topology obeys $X^2\simeq X$, as both are countable metrisable spaces without isolated points.
$X=\mathbb{P}$ (the irrationals in the usual topology) likewise, but now because they both are separable, completely metrisable, zero-dimensional, nowhere locally compact spaces. (Or because maybe you know that $P \simeq \mathbb{N}^\mathbb{N}$)
$X=C$, the Cantor set, because $C^2$ and $C$ are both compact zero-dimensional metric spaces without isolated points.
$X=C\setminus \{p\}$ (for $p \in C$) as well, as this $X$ is the unique (up to homeomorphism) zero-dimensional crowded (no isolated points) metric space that is not compact, but is locally compact.
Many infinite-dimensional spaces from analysis: $\ell^p$ for all $p$, and $\ell^\infty$ as well and $c_0$ and $c$ (all basically topologically the same example $\Bbb R^\mathbb{N}$, except $\ell^\infty$ which is not separable).
Ugly spaces like any infinite space in the indiscrete (trivial) topology you forgot to mention.
The space can be metric and one-dimensional too: Erdős space is such a space, the irrational variant is even completely metrisable.


What is TypeScript and why would I use it in place of JavaScript?

Question: What is the TypeScript language? What can it do that JavaScript or available libraries cannot do, that would give me reason to consider it?
Comment: Some notes here : https://basarat.gitbooks.io/typescript/content/docs/why-typescript.html
Comment: Here are some thought on this: http://blog.priceandcost.com/development/why-you-should-use-typescript-for-your-next-project/
Comment: ufff "Closed. This question needs to be more focused. It is not currently accepting answers." WHY?? its perfectly reasonable question. JUST BECAUSE YOU HAVE MADE UP YOUR MIND DOSENT MEAN EVERYONE ELSE HAS TOO! This is the first link you get when you ask about typescript and for 6 years now it has been locked .... thats a shame!
Answer:
I originally wrote this answer when TypeScript was still
  hot-off-the-presses. Five years later, this is an OK overview, but look
  at Lodewijk's answer below for more depth

1000ft view...
TypeScript is a superset of JavaScript which primarily provides optional static typing, classes and interfaces. One of the big benefits is to enable IDEs to provide a richer environment for spotting common errors as you type the code.
To get an idea of what I mean, watch Microsoft's introductory video on the language.
For a large JavaScript project, adopting TypeScript might result in more robust software, while still being deployable where a regular JavaScript application would run.
It is open source, but you only get the clever Intellisense as you type if you use a supported IDE. Initially, this was only Microsoft's Visual Studio (also noted in blog post from Miguel de Icaza). These days, other IDEs offer TypeScript support too.
Are there other technologies like it?
There's CoffeeScript, but that really serves a different purpose. IMHO, CoffeeScript provides readability for humans, but TypeScript also provides deep readability for tools through its optional static typing (see this recent blog post for a little more critique). There's also Dart but that's a full on replacement for JavaScript (though it can produce JavaScript code)
Example
As an example, here's some TypeScript (you can play with this in the TypeScript Playground)
class Greeter {
    greeting: string;
    constructor (message: string) {
        this.greeting = message;
    }
    greet() {
        return "Hello, " + this.greeting;
    }
}

And here's the JavaScript it would produce
var Greeter = (function () {
    function Greeter(message) {
        this.greeting = message;
    }
    Greeter.prototype.greet = function () {
        return "Hello, " + this.greeting;
    };
    return Greeter;
})();

Notice how the TypeScript defines the type of member variables and class method parameters. This is removed when translating to JavaScript, but used by the IDE and compiler to spot errors, like passing a numeric type to the constructor.
It's also capable of inferring types which aren't explicitly declared, for example, it would determine the greet() method returns a string.
Debugging TypeScript
Many browsers and IDEs offer direct debugging support through sourcemaps. See this Stack Overflow question for more details: Debugging TypeScript code with Visual Studio
Want to know more?
I originally wrote this answer when TypeScript was still hot-off-the-presses. Check out Lodewijk's answer to this question for some more current detail.
Comment: WebStorm offers nice IntelliSense on TypeScript now and is multiplatform.
Comment: @Erwinus The point of TypeScript is to provide compile time type checking. If you don't see the value in that, that's perfectly fine. TypeScript has been refereed to as "your first unit test". There are many resources that discuss whether or not optional type checking has value, and are more detail than what we can do here. I'm not trying to convince you of anything, just correcting a misconception.
Comment: @Erwinus You're making assumptions about how TypeScript works. You can write plain JavaScript as TypeScript and have the compiler only do compile time type checking. There's no performance loss by doing that.
Comment: No, @Erwinus, that code is optional. You can just as easily write the plain JavaScript version in TypeScript.
Comment: @Erwinus: Did you see analogy here? You can also program sometimes with javascript, in all other cases use typescript: it will help you check for types, will provide some intellisense. Why not? ;-)
Comment: VS Code has now become an excellent lightweight (and free) alternative to WebStorm as an editor for TypeScript, with full intellisense, and convenient project configuration via tsconfig.json.
Comment: Douglas Crockford has this to say about TypeScript: "I think that JavaScript's loose typing is one of its best features and that type checking is way overrated. TypeScript adds sweetness, but at a price. It is not a price I am willing to pay." The whole post is here. (He does say nice things, too.)

    https://plus.google.com/u/0/+DouglasCrockfordEsq/posts/MgzNUSTwjRt
Comment: what about JSDoc annotations and closure compiler? You can get strict type checking in JavaScript itself. I use it for long projects and am really happy with it. Besides, IDEs like WebStorm have intellisense integrated with such annotations.
Comment: It also allows you to write ES6 code and have it transpiled for ES5 for use in today's browsers.
Comment: don't forget http://livescript.net/
Comment: @PaulDixon You are making it sound like TypeScript provides good readability for humans and tools when comparing it to CoffeeScript. Considering that TypeScript only adds a "class" or "module" concept and not for example nice array looping, destructuring assignment, I think CS has it beat there.
Comment: That's not the only case @mallison. Read back.
Comment: @mallison Okay, but if you write javascript with use of TypeScript, what's the benefit to use TypeScript anyway? Why do you want to use TypeScript if you want to write javascript. That's really make no sense. If you want to 'compile' it you can use Google Enclosure Compiler, also to get some hints about your code or find errors. Besides, to find errors you can use the embedded debugger in the browser. To write javascript only this tool has no benefits.
Answer: TypeScript's relation to JavaScript

TypeScript is a typed superset of JavaScript that compiles to plain
JavaScript - typescriptlang.org.

JavaScript is a programming language that is developed by ECMA's Technical Committee 39, which is a group of people composed of many different stakeholders. TC39 is a committee hosted by ECMA: an internal standards organization. JavaScript has many different implementations by many different vendors (e.g. Google, Microsoft, Oracle, etc.). The goal of JavaScript is to be the lingua franca of the web.
TypeScript is a superset of the JavaScript language that has a single open-source compiler and is developed mainly by a single vendor: Microsoft. The goal of TypeScript is to help catch mistakes early through a type system and to make  JavaScript development more efficient.
Essentially TypeScript achieves its goals in three ways:

Support for modern JavaScript features - The JavaScript language (not the runtime) is standardized through the ECMAScript standards. Not all browsers and JavaScript runtimes support all features of all ECMAScript standards (see this overview). TypeScript allows for the use of many of the latest ECMAScript features and translates them to older ECMAScript targets of your choosing (see the list of compile targets under the --target compiler option). This means that you can safely use new features, like modules, lambda functions, classes, the spread operator and destructuring, while remaining backwards compatible with older browsers and JavaScript runtimes.

Advanced type system - The type support is not part of the ECMAScript standard and will likely never be due to the interpreted nature instead of compiled nature of JavaScript. The type system of TypeScript is incredibly rich and includes: interfaces, enums, hybrid types, generics, union/intersection types, access modifiers and much more. The official website of TypeScript gives an overview of these features. Typescript's type system is on-par with most other typed languages and in some cases arguably more powerful.

Developer tooling support - TypeScript's compiler can run as a background process to support both incremental compilation and IDE integration such that you can more easily navigate, identify problems, inspect possibilities and refactor your codebase.

TypeScript's relation to other JavaScript targeting languages
TypeScript has a unique philosophy compared to other languages that compile to JavaScript. JavaScript code is valid TypeScript code; TypeScript is a superset of JavaScript. You can almost rename your .js files to .ts files and start using TypeScript (see "JavaScript interoperability" below). TypeScript files are compiled to readable JavaScript, so that migration back is possible and understanding the compiled TypeScript is not hard at all. TypeScript builds on the successes of JavaScript while improving on its weaknesses.
On the one hand, you have future proof tools that take modern ECMAScript standards and compile it down to older JavaScript versions with Babel being the most popular one. On the other hand, you have languages that may totally differ from JavaScript which target JavaScript, like CoffeeScript, Clojure, Dart, Elm, Haxe, Scala.js, and a whole host more (see this list). These languages, though they might be better than where JavaScript's future might ever lead, run a greater risk of not finding enough adoption for their futures to be guaranteed. You might also have more trouble finding experienced developers for some of these languages, though the ones you will find can often be more enthusiastic. Interoperability with JavaScript can also be a bit more involved, since they are farther removed from what JavaScript actually is.
TypeScript sits in between these two extremes, thus balancing the risk. TypeScript is not a risky choice by any standard. It takes very little effort to get used to if you are familiar with JavaScript, since it is not a completely different language, has excellent JavaScript interoperability support and it has seen a lot of adoption recently.
Optionally static typing and type inference
JavaScript is dynamically typed. This means JavaScript does not know what type a variable is until it is actually instantiated at run-time. This also means that it may be too late. TypeScript adds type support to JavaScript and catches type errors during compilation to JavaScript. Bugs that are caused by false assumptions of some variable being of a certain type can be completely eradicated if you play your cards right (how strict you type your code or if you type your code at all is up to you).
TypeScript makes typing a bit easier and a lot less explicit by the usage of type inference. For example: var x = "hello" in TypeScript is the same as var x : string = "hello". The type is simply inferred from its use. Even it you don't explicitly type the types, they are still there to save you from doing something which otherwise would result in a run-time error.
TypeScript is optionally typed by default. For example function divideByTwo(x) { return  x / 2 } is a valid function in TypeScript which can be called with any kind of parameter, even though calling it with a string will obviously result in a runtime error. Just like you are used to in JavaScript. This works, because when no type was explicitly assigned and the type could not be inferred, like in the divideByTwo example, TypeScript will implicitly assign the type any. This means the divideByTwo function's type signature automatically becomes function divideByTwo(x : any) : any.  There is a compiler flag to disallow this behavior: --noImplicitAny. Enabling this flag gives you a greater degree of safety, but also means you will have to do more typing.
Types have a cost associated with them. First of all, there is a learning curve, and second of all, of course, it will cost you a bit more time to set up a codebase using proper strict typing too. In my experience, these costs are totally worth it on any serious codebase you are sharing with others. A Large Scale Study of Programming Languages and Code Quality in Github suggests that "statically typed languages, in general, are less defect prone than the dynamic types, and that strong typing is better than weak typing in the same regard".
It is interesting to note that this very same paper finds that TypeScript is less error-prone than JavaScript:

For those with positive coefficients we can expect that the language
is associated with, ceteris paribus, a greater number of defect fixes.
These languages include C, C++, JavaScript, Objective-C, Php, and
Python. The languages Clojure, Haskell, Ruby, Scala, and TypeScript,
all have negative coefficients implying that these languages are less
likely than the average to result in defect fixing commits.

Enhanced IDE support
The development experience with TypeScript is a great improvement over JavaScript. The IDE is informed in real-time by the TypeScript compiler on its rich type information. This gives a couple of major advantages. For example, with TypeScript, you can safely do refactorings like renames across your entire codebase. Through code completion, you can get inline help on whatever functions a library might offer. No more need to remember them or look them up in online references. Compilation errors are reported directly in the IDE with a red squiggly line while you are busy coding. All in all, this allows for a significant gain in productivity compared to working with JavaScript. One can spend more time coding and less time debugging.
There is a wide range of IDEs that have excellent support for TypeScript, like Visual Studio Code, WebStorm, Atom and Sublime.
Strict null checks
Runtime errors of the form cannot read property 'x' of undefined or undefined is not a function are very commonly caused by bugs in JavaScript code. Out of the box TypeScript already reduces the probability of these kinds of errors occurring, since one cannot use a variable that is not known to the TypeScript compiler (with the exception of properties of any typed variables). It is still possible though to mistakenly utilize a variable that is set to undefined. However, with the 2.0 version of TypeScript you can eliminate these kinds of errors all together through the usage of non-nullable types. This works as follows:
With strict null checks enabled (--strictNullChecks compiler flag) the TypeScript compiler will not allow undefined to be assigned to a variable unless you explicitly declare it to be of nullable type. For example, let x : number = undefined will result in a compile error. This fits perfectly with type theory since undefined is not a number. One can define x to be a sum type of number and undefined to correct this: let x : number | undefined = undefined.
Once a type is known to be nullable, meaning it is of a type that can also be of the value null or undefined, the TypeScript compiler can determine through control flow based type analysis whether or not your code can safely use a variable or not. In other words when you check a variable is undefined through for example an if statement the TypeScript compiler will infer that the type in that branch of your code's control flow is not anymore nullable and therefore can safely be used. Here is a simple example:
let x: number | undefined;
if (x !== undefined) x += 1; // this line will compile, because x is checked.
x += 1; // this line will fail compilation, because x might be undefined.

During the build, 2016 conference co-designer of TypeScript Anders Hejlsberg gave a detailed explanation and demonstration of this feature: video (from 44:30 to 56:30).
Compilation
To use TypeScript you need a build process to compile to JavaScript code. The build process generally takes only a couple of seconds depending of course on the size of your project. The TypeScript compiler supports incremental compilation (--watch compiler flag) so that all subsequent changes can be compiled at greater speed.
The TypeScript compiler can inline source map information in the generated .js files or create separate .map files. Source map information can be used by debugging utilities like the Chrome DevTools and other IDE's to relate the lines in the JavaScript to the ones that generated them in the TypeScript. This makes it possible for you to set breakpoints and inspect variables during runtime directly on your TypeScript code. Source map information works pretty well, it was around long before TypeScript, but debugging TypeScript is generally not as great as when using JavaScript directly. Take the  this keyword for example. Due to the changed semantics of the this keyword around closures since ES2015, this may actually exists during runtime as a variable called _this (see this answer). This may confuse you during debugging but generally is not a problem if you know about it or inspect the JavaScript code. It should be noted that Babel suffers the exact same kind of issue.
There are a few other tricks the TypeScript compiler can do, like generating intercepting code based on decorators, generating module loading code for different module systems and parsing JSX. However, you will likely require a build tool besides the Typescript compiler. For example, if you want to compress your code you will have to add other tools to your build process to do so.
There are TypeScript compilation plugins available for Webpack, Gulp, Grunt and pretty much any other JavaScript build tool out there. The TypeScript documentation has a section on integrating with build tools covering them all. A linter is also available in case you would like even more build time checking. There are also a great number of seed projects out there that will get you started with TypeScript in combination with a bunch of other technologies like Angular 2, React, Ember, SystemJS, Webpack, Gulp, etc.
JavaScript interoperability
Since TypeScript is so closely related to JavaScript it has great interoperability capabilities, but some extra work is required to work with JavaScript libraries in TypeScript. TypeScript definitions are needed so that the TypeScript compiler understands that function calls like _.groupBy or angular.copy or $.fadeOut are not in fact illegal statements. The definitions for these functions are placed in .d.ts files.
The simplest form a definition can take is to allow an identifier to be used in any way. For example, when using Lodash, a single line definition file declare var _ : any will allow you to call any function you want on _, but then, of course, you are also still able to make mistakes: _.foobar() would be a legal TypeScript call, but is, of course, an illegal call at run-time. If you want proper type support and code completion your definition file needs to to be more exact (see lodash definitions for an example).
Npm modules that come pre-packaged with their own type definitions are automatically understood by the TypeScript compiler (see documentation). For pretty much any other semi-popular JavaScript library that does not include its own definitions somebody out there has already made type definitions available through another npm module. These modules are prefixed with "@types/" and come from a Github repository called DefinitelyTyped.
There is one caveat: the type definitions must match the version of the library you are using at run-time. If they do not, TypeScript might disallow you from calling a function or dereferencing a variable that exists or allow you to call a function or dereference a variable that does not exist, simply because the types do not match the run-time at compile-time. So make sure you load the right version of the type definitions for the right version of the library you are using.
To be honest, there is a slight hassle to this and it may be one of the reasons you do not choose TypeScript, but instead go for something like Babel that does not suffer from having to get type definitions at all. On the other hand, if you know what you are doing you can easily overcome any kind of issues caused by incorrect or missing definition files.
Converting from JavaScript to TypeScript
Any .js file can be renamed to a .ts file and ran through the TypeScript compiler to get syntactically the same JavaScript code as an output (if it was syntactically correct in the first place). Even when the TypeScript compiler gets compilation errors it will still produce a .js file. It can even accept .js files as input with the --allowJs flag. This allows you to start with TypeScript right away. Unfortunately, compilation errors are likely to occur in the beginning. One does need to remember that these are not show-stopping errors like you may be used to with other compilers.
The compilation errors one gets in the beginning when converting a JavaScript project to a TypeScript project are unavoidable by TypeScript's nature. TypeScript checks all code for validity and thus it needs to know about all functions and variables that are used. Thus type definitions need to be in place for all of them otherwise compilation errors are bound to occur. As mentioned in the chapter above, for pretty much any JavaScript framework there are .d.ts files that can easily be acquired with the installation of DefinitelyTyped packages. It might, however, be that you've used some obscure library for which no TypeScript definitions are available or that you've polyfilled some JavaScript primitives. In that case, you must supply type definitions for these bits for the compilation errors to disappear. Just create a .d.ts file and include it in the tsconfig.json's files array, so that it is always considered by the TypeScript compiler. In it declare those bits that TypeScript does not know about as type any. Once you've eliminated all errors you can gradually introduce typing to those parts according to your needs.
Some work on (re)configuring your build pipeline will also be needed to get TypeScript into the build pipeline. As mentioned in the chapter on compilation there are plenty of good resources out there and I encourage you to look for seed projects that use the combination of tools you want to be working with.
The biggest hurdle is the learning curve. I encourage you to play around with a small project at first. Look how it works, how it builds, which files it uses, how it is configured, how it functions in your IDE, how it is structured, which tools it uses, etc. Converting a large JavaScript codebase to TypeScript is doable when you know what you are doing. Read this blog for example on converting 600k lines to typescript in 72 hours). Just make sure you have a good grasp of the language before you make the jump.
Adoption
TypeScript is open-source (Apache 2 licensed, see GitHub) and backed by Microsoft. Anders Hejlsberg, the lead architect of C# is spearheading the project. It's a very active project; the TypeScript team has been releasing a lot of new features in the last few years and a lot of great ones are still planned to come (see the roadmap).
Some facts about adoption and popularity:

In the 2017 StackOverflow developer survey TypeScript was the most popular JavaScript transpiler (9th place overall) and won third place in the most loved programming language category.
In the 2018 state of js survey TypeScript was declared as one of the two big winners in the JavaScript flavors category (with ES6 being the other).
In the 2019 StackOverflow developer survey TypeScript rose to the 9th place of most popular languages amongst professional developers, overtaking both C and C++. It again took third place amongst most the most loved languages.
In the 2020 StackOverflow developer survey TypeScript was the second most loved technology.
Comment: "JavaScript code is valid TypeScript code" - this is actually not always true. I mean code like if(1 === '1') {} gives you an error in TS and in JS don't. But most of the time, if JS code is well-written it's true.
Comment: @MaciejBukowski Even if TypeScript actually complains in this case, you still get a valid JS output (which will be the JS code that you compiled/transpiled with TypeScript). So it's a "compile with error", and **not** invalid TypeScript. It's written down in TypeScript specification that any valid JS code must be valid TS code.
Comment: If you have lost your precious productive time fretting over a missing semi colon, writing in Typescript would be a life saver.
Comment: Typings has been deprecated, and the current best practice is to just `npm` (or `yarn`) `install @types/foo`. Can you update your answer?
Comment: @Maciej Bukowski if(1 === '1') {}  does not give you an error but it does give you a notice that your statement is always false (This condition will always return 'false' since the types '1' and '"1"' have no overlap.) I mean if a JavaScript dev writes code like that they should return back to basics, funny thing is I work with senior developers that write if statements like if(1+1) or if(true) and this people make a ton of money...
Comment: `let x : number? = undefined` is a syntax error. You can use the `?` for optional parameters and properties but not for variables. Also the '?' goes after the parameter or property name, not the type.
Comment: "f you have lost your precious productive time fretting over a missing semi colon"

If you were once a Cobol programmer this doesn't happen :-)
Answer: TypeScript does something similar to what less or sass does for CSS. They are super sets of it, which means that every JS code you write is valid TypeScript code. Plus you can use the other goodies that it adds to the language, and the transpiled code will be valid js. You can even set the JS version that you want your resulting code on.
Currently TypeScript is a super set of ES2015, so might be a good choice to start learning the new js features and transpile to the needed standard for your project.
Comment: Best TL;DR is TS's page: "TypeScript is a typed superset of JavaScript that compiles to plain JavaScript."
Comment: It doesn't answer the "why should I use it" though. Here the tl;dr would be: 1) To add optional static types to JavaScript. Types can help to catch bugs at compile time and better document your program. 2) You can write the **new** JavaScript (ES6 / ES7 / ESnext) and compile it back to ES5, which is necessary to support older browsers; I've elaborated a bit more at https://www.tsmean.com/articles/vs/typescript-vs-javascript/ for those interested in more than a tl;dr
Comment: "The transpiled code will be valid JS" - and that's TypeScript's Achilles heel if you ask me.  It means they can't add several very useful features to JS; most notably *runtime* type checking.  It's a bit annoying to have compiler-time type safety only to lose it for any runtime data that is read in from I/O, or any time your transpiled code is called unsafely from other JS.
Answer: "TypeScript Fundamentals"  -- a Pluralsight video-course by Dan Wahlin and John Papa is a really good, presently (March 25, 2016) updated to reflect TypeScript 1.8, introduction to Typescript.
For me the really good features, beside the nice possibilities for intellisense, are the classes, interfaces, modules, the ease of implementing AMD, and the possibility to use the Visual Studio Typescript debugger when invoked with IE.
To summarize: If used as intended, Typescript can make JavaScript programming more reliable, and easier. It can increase the productivity of the JavaScript programmer significantly over the full SDLC.
Comment: @Oooogi, SDLC == Software Development Life Cycle. AMD == Asynchronous Module Definition. The latter is specific to JavaScript, while the former is rather generic in scope.
Comment: what are SDLC? AMD?
Comment: @confusedpunter More precisely: increase in **developer's** productivity. This is not only my personal impression, based on experience. Many thousands of experienced developers have started using Typescript since its creation. One example is the Angular developers team -- for what other reason would you think a leading Google team would completely rewrite their codebase in Typescript? And thousands of types for almost any JS framework have been created at https://github.com/DefinitelyTyped/DefinitelyTyped
Comment: Thanks I'll read it
Answer: Ecma script 5 (ES5) which all browser support and precompiled. ES6/ES2015 and ES/2016 came this year with lots of changes so to pop up these changes there is something in between which should take cares about so TypeScript.
• TypeScript is Types -> Means we have to define datatype of each property and methods. If you know C# then Typescript is easy to understand.
• Big advantage of TypeScript is we identify Type related issues early before going to production. This allows unit tests to fail if there is any type mismatch.
Comment: It's not every year buddy !.. they have changed the spec after very long wait
Comment: @SubhamTripathi It very much *is* every year. ES2015, ES2016, ES2017, and on from now until the language dies. It *wasn't* every year, before 2015, but it is now. Go search for "TC39 process" to learn more.


Book recommendations on cellular automata?

Question: I have been looking for books on cellular automata, and I really can't afford more than one book right now, so I really need to make the right choice. What would be the right book for someone with a Computer Science Masters degree and also feels comfortable with Mathematical Logic and basic Abstract Algebra? (Or, to make the question more useful to others, what are the target readers of the most recent books on cellular automata?)
Comment: The OP sounds like someone looking to start in this subject. For that I would have to recommend Sipser's *Introduction to the Theory of Computation* because it covers this topic nicely (for a first course on it) and because it covers so much else. If one likes cellular automata then Sipser's book allows you to study many other similar things. Link: http://www.amazon.com/Introduction-Theory-Computation-Michael-Sipser/dp/053494728X
Answer: First, there is an unannotated list of books on cellular automata here.
Second, if you are going to get just one book, then I think it has to be Wolfram's A New Kind of Science, which, despite its flaws, is the source of so much of the research in cellular automata
that it must be confronted first.  [I see I am concuring with Kevin O'Bryant's just-posted recommendation.] You might read the review by Lawrence Gray in the Notices of the American Mathematical Society (February 2003) to make
yourself aware of the controversies surrounding this book.  If you can overlook its flaws, it is a remarkable book, and quite fun to work through.
Comment: +1 for the nice list of books.
Comment: I also agree, ANKOS is a good reference, if you're looking for a book.
Answer: There's a Cellular Automata and Groups by Ceccherini-Silberstein in Springer Monographs in Mathematics. It's self-contained and introduce the CA with group theory.
Comment: Personally I found this book very useful, it could be the perfect choice if you prefer an algebraic perspective
Answer: I know the flames are coming, but I can't stop myself. You might enjoy "A new kind of science", by Stephen Wolfram. It's available free online, and has quite a bit of code and quite a few fun experiments inside.
Comment: I really want to flame you, but I'm not sure about what I can get away with =D!
Comment: How many pictures of the Sierpinski gasket can you stand? A much better and more interesting book about the connection with physics is Chopard and Droz: http://books.google.com/books?id=x5t9c_F_rZAC
Comment: In all seriousness, I really don't like the amount of "woo" (controversial scientific claims without sufficient support) in this book.
Comment: @Harry: agreed. But even so, it has much to recommend it.
Comment: See also "Cellular automata and lattice Boltzmann techniques: An approach to model and simulate complex systems" by Chopard et al., which will be downloadable if you look on Google Scholar.
Answer: There's also "Cellular Automata Machines: A New Environment for Modeling" by  Toffoli and Margolus.
Comment: @Steve "the very best way to simulate complex fluids" stands in need of justification. Good ol' fashioned advection/pressure projection is also very well suited to CUDA. If LBGK is provably better (according to some reasonable metric for some reasonable problem domain) I'd really really love to see details.
Comment: By complex I mean stuff like emulsions, porous geometries, etc. The boundary conditions for non-lattice techniques are much worse than they are for the lattice techniques (which have the same set of problems irrespective of the detailed geometry). There is a reason why the geologists are using this stuff.
Comment: @Steve Thanks. Sadly my work is full of 'simple' rather than 'complex' fluids :-)
Comment: I see -- I suppose then that it's not dated?
Comment: It is. See my comments to Kevin O'Bryant's answer. Lattice Boltzmann (esp. LBGK) models (http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods) are the very best way to simulate complex fluids, not least because they're well suited to GPUs (see NVIDIA's CUDA app page). The word "Boltzmann" does not even occur in here. This book is barely new enough to cover FHP lattice gases, to say nothing of 13-velocity models.
Answer: While Wolfram's A New Kind of Science (2002) is a beautifully-produced book and is lovely to look at, I find Wolfram's papers collected in Cellular Automata and Complexity (1994) much more informative. Because the papers were written for research publications they provide many of the technical details omitted from A New Kind of Science, which appears to have been written with a more general audience in mind.
You might also want to read Melanie Mitchell's review of A New Kind of Science. It appeared in the journal Science 298: 65-68. The review and Mitchell's insightful "Computation in Cellular Automata: A Selected Review" are available on her web page under "Publications."
Answer: I can't improve on the list in Joseph O'Rourke's answer, but I'd like to mention that
Winning Ways gets on the list because of its discussion of Conway's "Life" cellular
automaton. In particular Winning Ways outlines a proof that "Life" harbors a
universal Turing machine. For more news on "Life" try this article, describing the
recent discovery of a self-replicating pattern. The pattern is a little disappointing
because it is destroyed in the process of making a copy of itself, but this leaves some
interesting open problems:
"Another milestone might be a self-replicating pattern that creates increasing copies of itself,
or a space-filling replicator that can make multiple copies to eventually fill an arbitrarily
large area of the Life plane,"
Comment: The pattern deliberately destroys itself, separately from the process of making a copy; its destruction is not just a side effect, but an intended part of the pattern.

For even more news about Life and related automata, there's another book Game of Life Cellular Automata (edited by Andrew Adamatzky) coming out this summer. Disclaimer: I have one of the chapters in it, also online at http://arxiv.org/abs/0911.2890
Answer: This is a research list on evolving cellular automata - mostly stuff about finding CA rules with genetic algorithms but also CA only references.
Hope it helps.
Answer: Adamatzky's Game of Life Cellular Automata gives a fairly broad overview.
Answer: Aladjev V.Z.  Classical Cellular Automata: Mathematical Theory and Applications.[Dash] Germany: Saarbrucken, Scholar`s Press, 2014, ISBN  9783639713459, 517 p.


Test Automation tool for Data Analytics Software

Question: I have been using Selenium for web application testing and need to switch to desktop automation testing which has process improvement functionalities like data analytics algorithms, etc. What could be the best tool to use for desktop software built using java?
Comment: 1 - There is no "best" tool, it will depend on your context. 2 - What have you tried so far? What were the positive and negative points you felt so far?
Answer: If you are familiar with Selenium, there is Winium that might be interesting:

Winium is a Selenium based tool for testing and automating desktop applications on the Windows desktop. It is easy to use for those who are familiar with Selenium.

It is practically Selenium for Windows.
Comment: The questioner didn't say it was on Windows.
Comment: So? This answer might not answer questioners' particular need (we don't know that yet) but it might be helpful for those who wish to test Windows apps.
Comment: I understand your point, but Stack Exchange is meant to be precise in both questions and answers. Otherwise I could answer Java questions with the equivalent in Python, Ruby, etc, "to be helpful to those who wish to" use these languages. You could have commented the questions, asking for more info about which environment we are talking about.
Comment: I don't think your Java question analogy is valid. It would be if the asker asked for let's say Linux automation and I gave them Windows answer, but they didn't specify.
Comment: I thought about Winium but the desktop is implemented on java Swing and Winium doesn't support this framework. :(


headphone or earphone that can completely block any noise

Question: Are there any device that exist that can completely block any loud noise in public places? I intend to use it in public places (i.e. coffee shop, park, bar) so I can work with little or without any distraction. Noise can range from people talking, cars driving by to jackhammer that is used in a nearby construction. I've considered anti noise ear plugs, noise isolation earphones and noise cancelling headphones but just seem to just lessen the noise but not completely block it. Are there any viable solution that exist?
Comment: Completely block the sound of a jackhammer?  Have you considered building yourself an anechoic chamber?
Comment: Bose QuietComfort 35's should do the trick for the acoustic levels, but you're likely feeling the impact of the jackhammer as well as/rather than hearing it.
Comment: The jackhammer would be a rare occasion and might be the most extreme cases. I only mentioned it as a reference to what kind of noise will be considered.

@spikey_richie will the noise cancelling feature also work to just isolate the background noise even when you're not listening to any audio?

Thank you!
Comment: I believe so, yes
Answer: You could also consider custom-molded in-ears. As they're precisely fitted for your ears alone, not only they block out noise more effectively, they can also be extremely comfortable.
If you're okay with deep insertion in-ears, you could check out the Etymotic ER4 as well. Or, consider foam eartips for your earphones.
Comment: Thank you for your suggestion. I'll find a review about them and see if this will suffice to what i'm looking for. Thank you1
Comment: @Pennf0lio I would suggest looking at JH Audio, Flipears, Lear, Rooth, ACS, and Westone. They do custom molded in-ears. They sound extremely good as well, better and more accurate than the Bose QuietComforts.


Is there a way to sum up the series give below??

Question: Is there a way to sum up the series with nth term $$ x_n=1/n^2$$ I am high school student and I tried my level best to find a method to sum it up but failed.If there is a way to find this sum can this be generalised to find the sum of other series.
Comment: The value is $\frac{\pi^2}{6}$. See here:
https://en.wikipedia.org/wiki/Basel_problem
for a (somewhat) elementary proof.
Answer: This is not a proof. But this demonstrates how Euler thought about it.
$$1+\frac14+\frac19+\frac1{16}+\frac1{25}+\cdots=\frac{\pi^2}{6}$$
Euler discovered the above identity while thinking about polynomials.
Bear in mind that any polynomial can be express as either a sum or a product:
$$2x^3+3x^2-11x-6=2(x-2)(x+3)(x+1/2).$$ Given the form on the left, you need only find the zeros of the polynomial to obtain the form on the right. Euler wondered whether this might work with the following infinite polynomial:
$$\sin x=x-\dfrac{x^3}{3!}+\dfrac{x^5}{5!}-\dfrac{x^7}{7!}+\cdots$$
The zeros of this function are just $0,\pm\pi,\pm 2\pi,\cdots.$ so (Euler argue that) perhaps there is a product for sine of the form
$$\sin x=Ax(x-\pi)(x+\pi)(x-2\pi)(x+2\pi)\cdots$$
The tricky part is finding the constant $A$. usually $A$ is the coefficient of the highest-order term, but the power series for sine has no highest-order term. Indeed, since the coefficients of $x^n$ are approaching zero, there is a good argument that $A$ should be infinitesimal. After a bit of thought, Euler spotted a solution to this problem. We know that:
$$\lim_{x\to 0}\dfrac{\sin x}{x}=1.$$
But clearly:
$\lim_{x\to 0}\dfrac{x(x-\pi)(x+\pi)(x-2\pi)(x+2\pi)\cdots}{x}=(-\pi)(\pi)(-2\pi)(2\pi)\cdots$
So $A$ should be the reciprocal of the infinite product of the right. This leads to the following guess:
$$\sin x=x\left(1-\frac x{\pi}\right)\left(1+\frac x{\pi}\right)\left(1-\frac x{2\pi}\right)\left(1+\frac x{2\pi}\right)⋯=x\prod_{n=1}^{\infty}\left(1-\dfrac{x^2}{n^2\pi^2}\right)$$
The amazing thing is that this infinite product formula actually works!
It's called the Euler-Wallis formula for sine, Wallis presumably being the first to prove it rigorously. Today it is known as a corollary of the Weierstrass factorization theorem.
Euler, however, was more interested in the relationship between the infinite product and the Taylor series. Consider the equation:
$$x\left(1-\frac{x^2}{\pi^2}\right)\left(1-\frac{x^2}{4\pi^2}\right)\left(\frac{x^2}{9\pi^2}\right)\cdots=x-\dfrac{x^3}{3!}+\dfrac{x^5}{5!}-\dfrac{x^7}{7!}+\cdots$$
Presumably the infinite product on the right should multiply out to give the infinite sum on the left. Equating the coefficients of $x^3$ gives the following remarkable identity: $$\sum_{n=1}^{\infty}\dfrac{1}{n^2}=\dfrac{\pi^2}{6}.$$
(PS: I found this argument from someone's blog. But I forget the exact person. Sorry for that.)
Comment: I enjoyed reading this as it hints at the motivation behind the series. Thank you.
Comment: [See this.](http://math.stackexchange.com/questions/1009922/what-are-the-theorems-in-mathematics-which-can-be-proved-using-completely-differ) You will find more proofs for this fact.
Answer: I'm sure this has already been said. But what you have there is known as the Basel Problem.
This is basically the sum:
$${1}+ {1\over 2^2} + {1\over 3^2} + {1\over 4^2}+...$$
It can also be written as:
$$\sum_{n=1}^{\infty} {1\over n^2}$$
This is known as the Zeta Function evaluated at $\space 2$. Which is written using the greek letter Zeta, which is $\zeta$.
Mathematician $\space$Leonhard Euler $\space$ gave a proof for this which shows that:
$$\zeta (2)=\sum_{n=1}^{\infty} {1\over n^2}={1}+ {1\over 2^2} + {1\over 3^2} + {1\over 4^2}+...={\pi^2 \over 6}$$
Here are some links which talk about this proof:
Link 1
Link 2
Link 3 (Video)
It's great to see young minds have this curious view on mathematics rather than the common "When is Math class going to end?" attitude. This is how the greats think.
Keep it up and always question things. You never know what you may discover.
Answer: You can also consider that the sum corresponds to generalized harmonic numbers; so $$S_n=\sum_{i=1}^n \frac 1 {i^2}=H_n^{(2)}$$ For large values of $n$, the asymptotic expansion is $$S_n=\frac{\pi ^2}{6}-\frac{1}{n}+\frac{1}{2 n^2}-\frac{1}{6
   n^3}+O\left(\frac{1}{n^4}\right)$$
Let us try using $n=10$ which is not a large number. The exact summation would lead to $\frac{1968329}{1270080}\approx 1.549767731$ while the formula would give $\frac{\pi ^2}{6}-\frac{571}{6000}\approx 1.549767400$.
This can be generalized to $$\sum_{i=1}^n \frac 1 {i^k}=H_n^{(k)}$$ for which nice formulae are obtained when $k$ is even (for odd values of $k$, this would involve $\zeta(k)$ you will learn sooner or later).


Can my school track my laptop?

Question: I do a distance education program in Australia. My distance ed school sends out laptops to all students on loan until they leave school/the program. The laptop is specifically a Lenovo Thinkpad Yoga 11e (5th Gen) if that makes a difference. My worry is that one of the head teachers had informed us they can tell if you install games and such on the laptops, which makes me think about what they could see on there. Is this just 'scaring' the kids into not installing stuff they shouldn't have or could this be real. I have reset Windows twice, so all files were removed.
Comment: Note that when being given the laptop, you likely agreed to a policy that allowed them to track the laptop. Also, keep in mind that it is not **your** laptop, as you don't hold ownership over it. You are lent the laptop under certain conditions for a certain period of time.
Comment: Ok thank you guys for your help. I did go through and read all the agreements I signed and there is a clause that says they can hand it over to law enforcement and they can give all of my details to them, but other than that there is nothing other than that apart from pretty much be safe online and don't view or send pornographic content.

Also, just for clarity, no I'm not breaking the law on a laptop given to me by school. That is pretty dumb.
Answer: I work in an enterprise and have access to reports that show me every program installed on any laptop we manage.  So, yes it is real.  Whether your school has such management tools in place is the question.  I would assume they do if I were you.
Answer: Yes, that's completely possible - however, it depends on what is your understanding of "tracking". There's an entire sector of security products generally called Mobile Device Management and created for the task of remotely managing devices. What the software does exactly varies from vendor to vendor but normally the software preserves the user's privacy while allowing the organization that deployed it to keep control of the machine.
Generally, they might be able to know your location, the name of the Wi-Fi network you're connected to, installed programs and applications and other general information but they shouldn't be able to peek into your conversations for example (even though they could prevent you from accessing social media).
Generally, however, I wouldn't use the computer for personal business or entertainment which is also advisable in your case.
Edit: As @MechMK1 mentioned above, the device isn't in your ownership so reinstalling the OS is most likely against the terms and conditions of the university, the actual owner of the laptop. They'll be able to see that there is something wrong with the computer which they might contact you about.
Comment: I wouldn't assume they can't peek into his conversations - not sure what the rules are in Australia but many companies install their own root certificates, enabling them to bypass the encryption that would normally protect his conversations.  Pretty extreme measures but not unheard of.   (see https://news.ycombinator.com/item?id=11873212 )
Answer: Beyond software installed, it is quite possible they can track OP's every movement if they wanted.  Traffic may be routed through a VPN and heavily monitored as a matter of course.  This seems quite possible/likely (though I am not familar with Australian law, which may restrict what they "should" be doing).  They probably have remote control software installed for support, which could monitor what is seen and done (e.g., typed).  Do they monitor every move as a matter of course?  Unlikely.  Could they?  Yes, easily.
If OP is (or were) concerned with hiding traces of illegal activity, it is rather certain law enforcement would have the cooperation of the school and full access to any and all possible monitoring tools already installed and which could be installed remotely.

Can my school track my laptop?


Editing Theme and Moving Servers

Question: Ok, So I have a wordpress installed on a test server. I just edited the default theme to get my desired result. My question is could I just install a new version of wordpress on another server and copy/paste my theme - simple as that?
Answer: If you haven't added a bunch of content and widgets on the local server, yes, it can be as easy as that.
If you want to move everything - all your settings and content and such - you can follow these instructions: http://www.billerickson.net/how-to-move-your-wordpress-website/
G'luck!
Comment: Bad link! Bad! No cookie! :) Plain text replacement on database potentially breaks serialized data!
Comment: I've never considered that and now it's come up three times this morning! Funny. @Rarst would you recommend a tool like this? http://interconnectit.com/124/search-and-replace-for-wordpress-databases/
Comment: Absolutely! Interconnect/it folks have been offering that tool for a long time. Myself I use BackupBuddy a lot for migrations lately, but that one is paid.
Comment: Great, I've got it bookmarked. My next WordPress move will be fully and gloriously serialized-data-friendly. Thanks again!
Answer: If the only thing you want to move is theme, than it is indeed straight copy/paste.
But I want to note that default theme gets updated and overwritten with WP updates, as well as by its own separate updates. If you want to tweak it you should create child theme for it and implement tweaks in it.
If you want to move content as well things get a little more complicated. In basic case you can use native export/import feature, for more complex cases there are plugins around for moving installation around, adjusting URL changes and such.
Comment: @Howdy_McGee ouch... :) You should really, really, **really** update WordPress. Security and such. Getting hacked sucks. And so on.
Comment: Not a problem, I don't update wordpress for this reason exactly!

Editing Theme and Moving Servers


Deleting Songs off your ipod

Question: How do I delete songs of my iPod using iTunes?
Answer: This may vary slightly depending on what type of iPod you have, but generally if you want to delete arbitrary songs on the iPod (without having to modify any playlists etc. in iTunes itself that you are syncing from), you need to have the device set to "manually manage music" on the device Summary tab. Then, you select the device from the top bar when it is connected, and open the "Music" tab, and you can select and delete songs from the list.
Comment: works for me :) (+)
Comment: @Ariel , did this answer your question?
Answer: When your iPod touch runs low on memory, problems like slow speed, crashing of the device, etc. are very common. Deleting content, like songs, from your iPod touch can be an excellent way to tackle these problems. You can delete songs directly from iPod device, or remove tracks via iTunes or other iTunes alternative.

Deleting Songs off your ipod


What is the purpose of the process RelayUploader in macOS?

Question: There is a running process called "RelayUploader" on a Mac machine. The user associated with that process is "nobody". What is the purpose of this process? Is it something legit or should this process be a security concern?
Answer: This isn't a proper answer, just some things you may want to try:

RelayUploader (aka Relay.Uploader) seems to be associated with a company called TechSmith... do you have any of their apps?
If you have a malware of virus scanner, you should run a scan on it.
Have you looked at the info available in Activity Monitor? (If not, open Activity Monitor, select the process from the list, then click the i icon in the Activity Monitor dialog). What does it say in the Open Files and Ports tab? Do you recognize any of these files?
Comment: thank you for your response. It is helpful! The computer does indeed have an app by TechSmith and when looking at the process info in the ActivityMonitor, the path of the RelayUploader process points to the TechSmith directory. I believe I am all set, but just for the sake of completeness, I will address your points 2 and 3. I should have mentioned it in the original post, a virus scan does not find any issues with this process. There is no "Open Files and Ports" tab in ActivityMonitor, which, I believe, means that the process is currently not using any files or ports. Thanks again!


GUI for retrieving pdf documents

Question: I have many pdf documents in my computer and I need an easy to use GUI for retrieving those that contain certain terms / phrases. So, my question is if there is any such application for ubuntu 12.04 LTS?
Answer: There is a command-line tool pdfgrep which can perform your task.You can install it by
sudo apt-get install pdfgrep
To search for a regular expression:
find /path -iname '*.pdf' -exec pdfgrep -H 'pattern' {} \;

where path is location for your pdf files.
There is also a GUI tool called recoll which can search documents by indexing them.
Reference
Comment: Thanks for you answer, but the main problem here is that it is very slow since it doesn't index the pdfs (in the background) as I would expect, so that the next time be quicker. In addition, I would prefer something more user friendly. Any idea?
Comment: I have added another GUI tool in my answer which might serve your purpose.

GUI for retrieving pdf documents


How do I quit being a moderator?

Question: Due to life, etc, I don't feel that I can be an effective moderator anymore.   I don't see any obvious method within the system of quitting, though (barring just not responding to moderator flags, etc.).   What's the correct procedure to resign?
Comment: I thought moderators just had to email the (community) team to ask for a holiday etc, presumably the same would go for resignation.
Comment: @AndrewC: Yep, moderation is purely voluntary, so it's quite hassle free to step out/take a vacation.
Comment: That's what I ultimately did, but I didn't hear back from the person that I emailed.   I didn't know if he had moved on or what, and I couldn't find anything in the mod tools relating to resignations.   I also couldn't find anything with a search, but I may have been using the "wrong" keywords.
Answer: The correct procedure is to email us at firstname.lastname@example.com. Or one of us, but that email  goes to the entire team and is therefore more reliable.

We got your request already. I'm sorry we didn't get back to you right away.
What's going to happen now is that we're going to line up a replacement for you. If you could stick around till then, that'd be fantastic. But if you'd rather not, no worries, please let me know and I'll take care of things sooner.
Comment: I can continue contributing as much as I have been over the last couple of months, without much problem.   I just feel like my community needs a higher level of involvement than what I can provide.
Comment: @baka Cool, thanks. We'll line something up as soon as possible.
Comment: Is this still valid answer? I tried to send an email to the email, but it bounced back.
Comment: @KamilSJaron Probably not. Lemme check with the CM team and see what the current process is.
Comment: @KamilSJaron The team's gonna figure out what they want to update this answer to, but for now - just use the "contact" form linked at the bottom of the site and it'll get to the right place internally.
Answer: Please email the Community team (community[at]stackoverflow.com) and let them know (cc your co mods as well if you wish).
I have already let a community team member know (though I think that you still may have to send the email) in the Teacher's Lounge.
Note that it may be better to just go on a mod holiday (again, email the comm team for this) if you feel that you may be able to resume contributing in the future.
I'll be sad to see you go, you seem to have been a good mod.
Comment: There's [a new form they use for contact now](http://meta.stackoverflow.com/help/other) but I don't know if that's the preferred way to contact them about this. I do know that emailing them works though.
Comment: @BenBrocka: Well, that's a bit more mainstream, and is probably for less priority things. Email is smoother, and IIRC the community@ email is basically for mod-related things only.

How do I quit being a moderator?


Disadvantages of wire cut cnc edm

Question: Before purchasing Wire cut cnc edm I just wants to know about disadvantages of it over using mechanical lathe machine.
Comment: Surely the disadvantages will be particular to the use or parts you wish to make? Others making different things may not see or suffer the same disadvantages : for them they may be conveniences. You may wish to elaborate what you are wanting to achieve.
Answer: Wire EDM and a lathe aren't really directly comparable. Wire EDM is typically used for profile cutting of very hard materials such as hardened tool steel with good dimensional accuracy and may also be useful for producing very small holes or slots.
As a result it tends to be quite a specialist process and compared to conventional machining processes on materials with good machinability it will tend to have a low rate of material removal and may be less versatile.
I'm tempted to suggest that if you don't already know why you need an EDM machine you probably don't need one.

Disadvantages of wire cut cnc edm


ultrasurf is not working in ubuntu

Question: I would like to use "Ultrasurf" software for ubuntu12.04..I installed wine, and when i'm trying to open ultrasurf with wine,some of versions of ultrasurf's saying some .dll files are missing. I replaced that files correctly in correct place. But still i have same problem. Some of versions are not happennig anything...I searched and did everthing i can.
Is there a way to run ultrasurf in ubuntu however correctly?
Answer: Yes, it is possible to run Ultrasurf in ubuntu. I followed the approach given in Running Ultrasurf in Ubuntu. It is a recent blog post on this topic... This blog also has few other articles related to Ultrasurf.
Answer: Step 1:
Install Wine in your System from the website winehq.org . Generally it comes pre installed but in case  you don't have it then do it quickly.
Step 2:
Download the latest Ultrasurf file from the website http://ultrasurf.us/  . Unzip the downloaded file and you will get a .exe file.
Step 3:
Once you are done with step 1 and step 2, you just need to download two more file and you are done.
<code>   -> mfc42.dll

   -> msvcp60.dll
</code>
Step 4:
Pretty much done. Now you just have to copy both the files at two places. Go to your Home folder and press Ctrl+H. This shows up the hidden files. Locate .wine. Inside the folder follow the path
         drive_c/windows/system
         drive_c/windows/system32
 Paste both the files in both the location. Now you are done.
Step 5:
Now open the .exe file with the help of wine. It takes a while for Ultrasurf to load in Ubuntu, so be patient. Once the software loads change the settings just as you do in Windows.
Thats it !! All set to go ....

ultrasurf is not working in ubuntu


Differentiating the gravitational redshift and the cosmological redshift?

Question: If general relativity accounts for a redshift, independent of inflation, how can we still know that inflation is viable? Moreover, how do we differentiate the the gravitational redshift and the cosmological redshift observationally?
Comment: I once happened to ask this same question in [APOD](http://asterisk.apod.com/viewtopic.php?f=9&t=15194). The answers given by astronomers/physicists there may add something worthwhile to the discussion here.
Answer: The cosmologial redshift only requires expansion, not inflation.
There is no way to distinguish just from observing the light of a single object how much of the shift is cosmological, gravitational or Doppler (peculiar motion).
However, given that in all directions the red shift is increasing rather uniformly with distance, expansion seems like the only explanation.  To be all gravitational, the objects would need to be uniformly at lower gravitation potential as distance from Earth increases.
See this Stanford link for more infomation:
http://einstein.stanford.edu/content/relativity/a11859.html
Answer: Back of the envelope calculation for others to check:
z= ∆U/c^2 (https://en.wikipedia.org/wiki/Gravitational_redshift), U is the gravitational potential energy. Since ∆U=gh, where h is the distance/height from a massive body, we get; z = (g/c^2) h. To translate to the Hubble form, use Fizu-Doppler formula; z=v/c, and get the recession-phase shift(due to gravity) relation; v = (g/c) h; giving a Hubble constant; H0=g/c. That is the phase shift due to gravity is proportional to the distance away from a mass- to first approximation and similar to what Hubble found.
Using the universe values of M=1.5e53 kg, and r=4.4e26 m; we have g=5.168e-11 m/s^2. Divide by c as in the formula and get; H0=1.7239e-19 /s- the same order as the experimental value of the constant. That is to say; a more travelling distance causes more energy loss due to the potential climbing against the pull of all the masses in the universe.
I am treating massless photons like normal massive particles in the present case. This can be concluded from Galileo Pisa tower experiment showing that acceleration is independent of mass which is in effect the equivalence principle. This can then be extended down to massless particles. So that photons bend when passing the sun, and get red shifter when leaving earth and blue shifted when the come down. This is also the basis used by Newton to calculate light beam bending by massive objects.


Double-Slit experiment and the role of observation in the distribution

Question: so I am still having difficulty understanding the role of measuring/observing the wave function. Many of the videos I have watched says that when we are not looking at the wave function it makes an interference pattern but when we are looking it makes a normal pattern as we would expect. What I don't get is how do we know there is an interference pattern if it has never been observed (if we would, it would then make the wave function collapse and we would see a normal distribution.). Alsp many people says that observing the wave function doesn't affects the distribution so it is very confusing...
Answer: The double slit experiment one electron at a time shows the scattering probability distribution in space for the $Ψ^*Ψ$,  the measurable footprint of a wavefunction, and the interference arising from the sinusoidal solution for "electron of specific energy scattering off specific double slits".

so the interference pattern has been measured , contrary to your statement.
You have to realize that the wavefunction is the solution of specific boundary conditions, i.e. constants that have to be introduced to pick up the specific quantum mechanical solution. Any new detection implements entering the measurement, will introduce new boundary conditions changing the constants and the solutions. A careful experiment showed how the detection destroys/changes the conditions of a simle double slit experiment, and the complexity introduced by the detecting method has to be addressed.

Overall, the results suggest that the type of scattering an electron undergoes determines the mark it leaves on the back wall, and that a detector at one of the slits can change the type of scattering. The physicists concluded that, while elastically scattered electrons can cause an interference pattern, the inelastically scattered electrons do not contribute to the interference process.
Answer: Your wording is rather imprecise and that leads to problems in understanding here.
You can't "look at" a wave function in any classical sense like you look at your computer screen.
What you can "look at" (i.e., detect) is through which slit each electron goes if you put suitable detectors there (see anna's answer for details). Experiment now shows the following: if you don't put detectors there, you'll get interference with single electrons. If you put detectors there, you don't get interference but the result that is expected by classical, straight propagation of electrons.
The distribution of electrons is influenced by whether or not you look at the slits. The same is true for light. You can either know the path (which-way-information) or get interference, but not both at the same time.
Answer: Observing the wave function at the screen, where the interference pattern is, does not destroy the interference pattern. If you observe it earlier, perhaps in an attempt to see which slit the particles went through, that destroys the pattern and that's what these videos are talking about.


How do you force the wordpress dashboard to be 1 coulmn by default?

Question: How do you force the wordpress dashboard to be 1 coulmn by default? I want to show the dashboard as a single column for all users.
Answer: I found a promising looking answer to this question in the following post:
http://wordpress.org/support/topic/customizing-admin-area-using-functionsphp-2-questions
It recommends using this code in the functions.php file:
<code>function so_screen_layout_columns( $columns ) {
    $columns['dashboard'] = 1;
    return $columns;
}
add_filter( 'screen_layout_columns', 'so_screen_layout_columns' );

function so_screen_layout_dashboard() {
    return 1;
}
add_filter( 'get_user_option_screen_layout_dashboard', 'so_screen_layout_dashboard' );
</code>
Hope that helps!
Comment: Is there a way to force 3 column dashboard for a certain browser width?
Comment: Wow, great question @Amjad! I've moved away from WP over the years, but I would think that you'd need to capture the width using .js upon window resize and re-query the WP back end when the browser reached the desired width. Sorry I don't have a better answer, perhaps someone else will comment more specifically.


ASP.NET Master Page in separate assembly

Question: I have some ASP.NET Master Pages located in one assembly. I need to use these Master Pages with my WebForm pages located in other assemblies that have a reference to the first assembly. I cannot seem to figure out a way to do this.
Is there a nice way that I can do this?
If no pretty solution exists I would also like to hear about possible hacks?
Answer: Master Pages are based upon Usercontrols, therefore they cannot be shared across applications.
That said, Dan Wahlin has a way around that particular limitation listed on his blog.
Answer: Sharing Master Pages Across IIS Applications by Dan Wahlin will give you some ideas..
Also, check this excellent article by Scott Allen. You can check the last section at the end on sharing master pages.
Answer: There are no pretty solutions to this problem.
What you can do is put it into a separate web application project and pre-compile it.  Then take the precompiled dlls and ILMerge them into a single dll that you can reference in your app.
The actual master page that you reference will have a class name like this:  MyMasterPage_aweknk so look it up in reflector.  The class that looks like "MyMasterPage" is really just the code-behind.
It's really disgusting, but it's what we've done to reuse user controls in multiple applications.


Must a group of order $12$ have a normal $2$-Sylow subgroup?

Question: Is it true or false that a group of order $12$ always has a normal $2$-Sylow subgroup?
I have a hunch it is false.
Comment: Dear Gargle, Write down a 2-Sylow subgroup in your example, and start conjugating it.  (There are only 12 elements to conjugate by!)  If you have trouble "seeing" things, then just compute.  (This is an advantage of algebra --- one can always just start computing and see what happens.)
Comment: Do you know examples of nonabelian groups of order 12?
Comment: Hint: Try to find a non-abelian group of order 12 with a normal 3-Sylow.  To do this it will be helpful to understand the semidirect product construction (see http://en.wikipedia.org/wiki/Semidirect_product).
Comment: I do not know how to classify them, but I know there is either a normal 3-subgroup or a normal 2-subgroup.
Comment: You don't need to classify them, just an example.  One way to get them is to take products or semidirect products of smaller groups (whose orders multiply to 12).
Comment: say $Z_3\rtimes Z_4$?
Comment: @Gargle: Yes, so long as the action is nontrivial, that should do.
Comment: I think I have constructed a counter example, but why is that? I cannot see that this is a counter example. (I am terrible at 'seeing' things in algebra)
Answer: Hint : Use the second of the Sylow theorems. All the $p$-Sylow subgroups are conjugate to each other and a group is normal iff it is equal to each of its conjugates.
Some semidirect product would give you an explicit example.
Answer: The 5 groups of order 12 are
$C_{12}$, $C_6 \times C_2$ in the abelian case, and
$A_4$ (group of all even permutations of length 4),
$D_6$ (group of all symmetries of the regular hexagon),
$C_3 \rtimes C_4$ in the nonabelian case.
Answer: $D_{12}$, the dihedral group of order 12, which can also be described as the direct product of the symmetric group $S_3$ and the cyclic group of order 2, has a non-normal 2-Sylow subgroup.
This follows from the fact that $S_3$ itself has a non-normal 2-Sylow subgroup.
You can check this page for more references. See also here


Where do I find the python standard library code?

Question: I wanted to try and look up the source of some of the modules in the Python standard library, but wasn't able to find them. I tried looking in the modules directory after downloading the python tarball, but it has mainly .c files. I also tried looking at the directory where the python that already comes with the OS (mac osx) has it's modules, and there it seems to have mainly .pyc and .pyo files. Would really appreciate it if someone can help me out.
(I tried what was suggested in the question How do I find the location of Python module sources? with no luck)
Comment: oh haha, I read somewhere that a good way to learn how good python code is written is to read up on the standard library code. I guess I misunderstood. It's all in C?
Comment: Performance critical parts? Sure, we want performance after all. It's not bad C code though ;) Still enough python written stuff in cpython.
Answer: In cpython, many modules are implemented in C, and not in Python. You can find those in Modules/, whereas the pure Python ones reside in Lib/.
In some cases (for example the json module), the Python source code provides the module on its own and only uses the C module if it's available (to improve performance). For the remaining modules, you can have a look at PyPy's implementations.
Comment: Ah, there it is. I should have looked around more before asking the question. Thanks! Will accept the answer once the time limitation lets me.
Comment: Why do you mention PyPy? Unless the questioner is actually on PyPy, they're not going to be using the PyPy implementations.
Comment: @user2357112 Unless is questioner is actually on cpython, they're not going to be using the cpython implementations either.
And even if they are on cpython: As written in the answer, some modules in the cpython standard library implementation are written in C, not Python. The questioner explicitly asked about that (`I tried looking in the modules directory after downloading the python tarball, but it has mainly .c file`). Not everybody can program in C; some people start learning programming in Python.
Answer: The canonical repository for CPython is this Mercurial repository. There is also a git mirror on GitHub.
Comment: GitHub is now the source of truth (see [PEP 512](https://www.python.org/dev/peps/pep-0512/)).
Comment: I'm not sure whether this answers the OP's question. @iman453 already has a tarball; their question is about which *files* in that tarball are interesting. I'm also a little bit puzzled about this answer since I believe I have already pointed to the Mercurial repository in [my accepted answer](http://stackoverflow.com/a/11385592/35070), although I did not mention the GitHub mirror.
Answer: That would depend on what you define as Standard Library.
The Python Documentations says:

...this library reference manual describes the standard library that is
distributed with Python. It also describes some of the optional
components that are commonly included in Python distributions.
Python's standard library is very extensive, offering a wide range of
facilities as indicated by the long table of contents listed below.
The library contains built-in modules (written in C) that provide
access to system functionality such as file I/O that would otherwise
be inaccessible to Python programmers, as well as modules written in
Python that provide standardized solutions for many problems that
occur in everyday programming. Some of these modules are explicitly
designed to encourage and enhance the portability of Python programs
by abstracting away platform-specifics into platform-neutral APIs.

If you take an extensive criteria, the Python Documentation explicitly answers what you're asking for, and I quote:
Exploring CPython's Internals.
CPython Source Code Layout.
This guide gives an overview of CPython's code structure. It serves as a summary of file locations for modules and builtins.
For Python modules, the typical layout is:
Lib/<module>.py
Modules/_<module>.c
Lib/test/test_<module>.py
Doc/library/<module>.rst

For extension-only modules, the typical layout is:
Modules/<module>module.c
Lib/test/test_<module>.py
Doc/library/<module>.rst

For builtin types, the typical layout is:
Objects/<builtin>object.c
Lib/test/test_<builtin>.py
Doc/library/stdtypes.rst

For builtin functions, the typical layout is:
Python/bltinmodule.c
Lib/test/test_builtin.py
Doc/library/functions.rst

Some exceptions:
builtin type int is at Objects/longobject.c
builtin type str is at Objects/unicodeobject.c
builtin module sys is at Python/sysmodule.c
builtin module marshal is at Python/marshal.c
Windows-only module winreg is at PC/winreg.c

Answer: You can get the source code of pure python modules that are part of the
standard library from the location where Python is installed.
For example at : C:\Python27\Lib (on windows) if you have
used Windows Installer for Python Installation.
Answer: Look it up under the Lib sub-directory of the Python installation directory.
Answer: The source code for many standard library packages is linked at the top of the package's documentation page in the library documentation, for example, the docs for the random module.
The original commit message for adding these links states

Provide links to Python source where the code is short, readable and
informative adjunct to the docs.


Do you need a terminal state when using double deep q networks?

Question: I just got my agent training, and I'm wondering if the terminal flags are necessary when sampling from the replay buffer. The game I'm implementing the agent in has two different ways the game can end, and so far my agent seems to be learning without terminal flags. I was wondering how important this feature is, as it's in all the pseudocode but doesn't seem to be necessary in my implementation.
Answer: It's an important feature, and you drop it at the risk of the agent failing to learn successfully.
The difference between the TD target without the terminal flag
$$G_t = R_{t+1} + \gamma \text{max}_{a'} Q(S_{t+1}, a')$$
and with the terminal flag applied to $S_{t+1} = S_T$
$$G_t = R_{t+1}$$
is important whenever $Q(S_{T}, a')$ might be evaluated as non-zero. The true action value of the terminal state is always defined as zero.
In some cicumstances, values based on a function approximator estimate could be far from zero - if at any point the estimator moves significantly away from zero then this could lead to value estimates diverging. This can be a problem at any time, because the estimator is usually not trained on actions taken from the terminal state - due to them never being observed. In principle you could add training data to keep the function approximator in line with this estimate, but as it is an absolute value it is far more common (when using approximators such as neural networks) to change the TD target as above.
Double Q learning improves estimates of bootstrap values by removing some of the maximisation bias from the next action value. This may help in your case, if the expected future rewards from the terminal state remain close to zero.
I would expect Double Q learning to work OK without using terminal state informaton, and without adding "mitigating" training to keep terminal state estimates close to zero, if rewards are not sparse, and do not increase close to the terminal states. That would mean the estimator should recognise expected future reward becomes closer to zero as the agent approaches a terminal state, thus would not take much extrapolation to predict close to zero for the terminal state - close enough that it does not create runaway feedback or influence the optimal policy much.
With sparse rewards, or with significantly high rewards close to the terminal state (e.g. a goal state which the agent must reach to gain all the reward), then using the terminal flag in the normal way becomes more important. It is unlikely that double Q learning would help much in that case. However, it may still be possible to find the optimal policy but with highly inaccurate action values (e.g. action values could all be double what they should be).


Hack's law for river basins

Question: The hacks law relates the longest stream length with the catchment area of the basin. How can one construct a hack's distribution for a basin and upto what scale the sub basins have to be taken as each stream will have it's own catchment area, using GIS?
Comment: I am not sure if you can find a tool to assign Hack stream order in QGIS and its plugins. You may want to look at [WhiteBox-GAT](http://www.uoguelph.ca/~hydrogeo/Whitebox/download.shtml). The tool is also accompanied by `help` page how to define the main stream, which I think you meant by `scale`.
Comment: @Kazuhito Actually, you can assign Hack stream order in QGIS using the [Whitebox for Processing plugin](https://plugins.bruy.me/processing-whitebox.html) and the **HackStreamOrder** tool in the *Stream Network Analysis* toolbox..
Comment: Oh what a surprise, you really got me, Dr Lindsay! (sorry,... aka @WhiteboxDev ). yes, and yes. Hope you can post answer here, I cannot find much information about this theory.
Comment: No idea, really, have you checked [R.stream.*_modules](https://grasswiki.osgeo.org/wiki/R.stream.*_modules)? Whithin qgis 2.18 I see you can use only [r.stream.extract](https://grass.osgeo.org/grass74/manuals/r.stream.extract.html)
Comment: "Grateful if", not "Hope"... my apologies for poor vocabulary.
Answer: Hack's law, for a set of sub-basins, relates the length of the longest stream in each basin to the basin catchment areas. We effectively need to measure the longest upstream channel and the catchment area for all sub-basins.
First, to answer your question about the 'scale' of analysis, the stream network that you use determines the scale, since each confluence in the network corresponds to a basin. You can therefore control the scale of the analysis based on the extent of the modeled stream network. If you'd like to account for smaller basins, extract a more extensive stream network (more on this below).
Now, how do you get information on longest stream length and basin size? In my answer below, I'm going to list several tool names (in bold) that correspond to tools that you can find in the WhiteboxTools library. If you are using QGIS, you may access these same tools using the WhiteboxTools plugin for QGIS. Admittedly, the plugin (which someone else maintains) is not the most up-to-date compared to the functionality currently available in WhiteboxTools; however, I believe that all of the tools you need for the following analysis are available.

First, you will need a DEM for which you have removed all depressions (use the BreachDepressions or FillDepressions tool). Then use the use the D8Pointer tool and the D8FlowAccumulation tool to extract a flow pointer and upslope area rasters from your depressionless DEM. You may threshold (ExtractNetwork) the upslope area (flow accumulation) raster to extract a stream network. Here, you determine the extent of the network, and therefore the number and size of sub-basins, by adjusting this threshold value. I would suggest using the RemoveShortStreams tool to remove the shortest streams, as they may be problematic for your subsequent Hack law analysis.
Now you must extract a stream-link identifier raster for your streams using the StreamLinkIdentifier tool. This will assign a unique ID value for each link in your stream network (see below).

Use the FarthestChannelHead tool, specifying your D8 pointer (flow direction) and stream network rasters as inputs. For each raster cell, the output image will contain the length (in km) of the furthest upstream channel head. The output will look something like this:

Now you have everything you need for the analysis including the 1) basin size (the D8 flow accumulation raster), 2) the furthest upstream channel length, and 3) the basin information contained in the stream link identifier raster. For each stream link in the network, you want to measure the maximum values of the flow accumulation (i.e. the basin area at the outlet) and the longest upstream distance to a channel head (i.e. the longest channel measured from basin outlets). To do this, you will need to run the ExtractRasterStatistics tool, contained in the WhiteboxTools Math and Statistical Analysis toolbox twice, the first time to get the maximum flow accumulation for each stream link and the second time to get the maximum channel length.

For both runs of this tool, the feature definition file is your stream link identifier raster. The input data file will be the flow accumulation (basin area) raster for the first run and is the farthest distance to channel head raster for the second run. In each case, you really only care about the HTML table file output. Each link in the stream network will correspond to one row in the table (row 0 is likely the background non-stream area and can be ignored). Copy the resulting two tables and paste them into an Excel spreadsheet. Then it's fairly easy to graph the relation between basin channel length and area, as below:

Note, WhiteboxTools also provides a HackStreamOrder tool, although I don't think that this does what you are looking to do. It applies Hack's stream ordering system to a raster stream network, which is not the length-area relation defined in Hack's 'Law'.
Comment: I will download and try the procedure, however I have a query regarding the application for very large basins. I will try it for them and update.
Comment: @vbj Sounds good, just send me an email if you have any specific questions. Also, while the example that I gave above was of a small area and few basins for demonstration purposes, in reality the library works quite well on large datasets.

Hack's law for river basins


Wicket keeper move after bowl reach to him

Question: Can a wicket keeper move after bowl reach to him for stumping? Will it be a fair delivery?
Comment: What do you mean by the "bowl reach to him"?  All the fielders can move, that is what they are there for.
Comment: After or before? After, yes. Why not?
Answer: I think the rules relevant to your question are under 27.3 and 27.4 of the MCC rules here.
What I take from those is that:

the wicketkeeper must remain behind the stumps until the ball strikes the striker or bat, passes the stumps, or the striker attempts to run. If this rule is broken, a no ball is called.
in the time between a ball being bowled, and any of those 3 events occuring, the wicketkeeper cannot significantly alter their position. If they do, a dead ball is called. Exemptions to this rule are where the wicketkeeper is:

taking a few steps forwards to respond to a slower ball, providing this does not bring them within reach of the wickets
responding to lateral movement of the ball
responding an action from the striker suggesting the shot they will play

I think the first exemption there is most relevant to your question. If a wicketkeeper was standing back, and then moves up to the stumps as the ball is bowled to effect a stumping - I believe the umpire should call a dead ball. Otherwise, if umpire considers the keepers movement to be legitimate, the stumping should stand.


Why is the Archimedean property a necessary condition, together with completeness for the Least Upper Bound property of a totally ordered field?

Question: I am taking an introductory Analysis class in university as part of a Mathematics Minor (my major is Physics). In his course notes, our professor mentions that the supremum property of the totally ordered field ($\mathbb{R}$, +, $\cdot$, $\leq$) has as a consequence that $\mathbb{R}$ is complete, that is to say, every Cauchy sequence in $\mathbb{R}$ converges to some limit in $\mathbb{R}$. But he also mentions that the opposite is not true. The field must be an Archimedean for completeness to imply the supremum property. But I can't seem to figure out why this is the case. What am I missing here?
Answer: Because there are other complete ordered fields other than $\Bbb R$, which are non-archimedian; you will find an example here. In such a field, the least upper bound property does not hold.
Answer: If the supremum property holds, then the field is Archimedean.
Indeed, suppose that the field is not Archimedean; then there exists $t$ such that $t>n$, for every positive integer $n$ (the rationals can always be uniquely embedded in an ordered fields, so we can identify rationals with elements of the field).
Since the supremum property holds and the set of positive integers is bounded, it has a supremum $s$. Clearly $1<s$ (because $2\le s$), so $s-1>0$. By definition of supremum there exists a positive integer $m$ such that $m>s-1$; therefore $m+1>s$: a contradiction.


Does the magnetic flux change for a finite square loop?

Question: If i have a square loop of a finite length (say 1 meter) and I move it perpendicularly(to the B field) through a uniform magnetic field of infinite extent, would the flux through it change and consequently would an emf be induced in it?
My guess is that no flux change would occur, as the area of the loop through which the magnetic flux passes wont change and neither would the no of field lines through the loop would not change as the field is uniform.
any explanations
?
Answer: You are correct. There is no magnetic flux change when you move your square coil in a plane perpendicular to the field B.
Answer:
uniform magnetic field of infinite extent.

B does not change.
A of the square loop does not change.
The loop does not rotate.
So the flux remains constant.


"Non-exclusive categorical organization" (of files, database entries, etc.)

Question: Hopefully this question fits here. I had it posted on another stackexchange site and it was deleted for being off topic--but the problem is this doesn't fit neatly into a topic. It lies on the border of software/algorithms, math/logic, possibly data structures, but since the main utility is in terms of the mental model of the human user it seems to fit here.
We are all familiar with tree/"folder"-based organization schemes, in which items are grouped in progressively more specific categories, with each single item or sub-category belonging to ONE larger category. However, there are quite some instances where it would be useful to allow each category to have MULTIPLE "parents". For instance, one might want to categorize a paper about an image processing algorithm under both a "photography" category and a "programming" category, or a photo of a bird taken on vacation in Africa to be categorized under both "Africa vacation" and "wildlife", and have it be equally findable browsing either of these categories. The tree model necessarily requires prioritizing one classification over the other, or keeping multiple copies of path nodes or even files themselves.
This problem seems obvious enough that I'd think someone would have already come up with a name, standard logical scheme, and implementation(s) for such a "non-exclusive classification". What I mean is, some kind of application layer that sits "on top of" the tree structure of the native file system and provides a "multiple overlapping category" metaphor to the user, allowing navigation to a sub-item from any of its parents, as well as displaying all parents of a node besides only the one on the path that was used to browse there. There are a few limited cases where I know such a thing DOES exist, like in photo apps where tags are assigned to images non-exclusively.
I'm wondering, though, if there is an accepted name for this type of organization scheme so that I can search for software that implements it. If not, I may choose to implement one as this seems too useful not to exist, but I don't want to re-invent something that's already out there. To give a concrete example, this idea was prompted for me by the specific case of Chrome bookmarks, but there are many other use cases I can think of.
Answer: We're deep into the mathematics here, which I'm no expert in, but for your use case a Directed acyclic graph (or perhaps more generally: Any directed graph) sounds useful. It's how Wikipedia and its sister project organize stuff in in practice.
UX-wise, the two edit options for this kind of structure I've seen are node editors, and free-text editing. The latter is how it's done on Wikipedia, you just have users decide "this is now a subcategory of this other one" and hope nobody runs into cycles - and if they do, have someone clean up after them.
In the context of a browser bookmark manager or similar, a node editor probably is way, way overkill.


How is time affected by the bending of space-time?

Question: By Newton's Laws, we can calculate the effect of gravity, but he didn't give the actual reason for gravity. I searched the internet for it, but all the answers have this "bending of space-time" stuff. If the space is bent by the mass of the body, how does it affect the time around it, If the body bends both space and time
Comment: Are you asking specifically about gravitational time dilation, or are you asking how spacetime curvature causes gravity?
Comment: Gravitational time dilation
Comment: Not only how space-time curvature causes gravity, but what is curvature and how does mass bend it?
Answer: Before we get to gravitational time dilation, let's introduce some general relativistic notation:

$\tau$ is proper time between two events $A$ and $A'$ for a slow-ticking clock within a gravitational field.
$t$ is the time between two events $A$ and $A'$ for a fast-ticking clock infinitely far away from the mass creating the gravitational well.

These are related thusly for a spherically-symmetric non-rotating mass (see Schwarzschild solution):
\begin{equation}
\tau = t \sqrt{1 - \frac{2GM}{rc^{2}}},
\end{equation}
where $M$ is the mass, $G$ is Newton's gravitational constant, $c$ is the speed of light, $r$ is the radial coordinate of the observer, essentially the distance from the observer to the center of $M$. You can play around with this equation by plugging in the mass of the Sun and our distance from its center.
Moreover, if you actually want to know where this equation comes from, look up the Schwarzschild metric:
\begin{equation}
ds^2 = c^{2} d\tau^{2}  = \left ( 1 - \frac{2GM}{rc^{2}} \right )c^2 dt^2 - \left (1 - \frac{2GM}{rc^{2}} \right )^{-1} dr^2 - r^2 (d\theta^2 + \sin^2 \theta d\varphi^2).
\end{equation}
In simple terms, the Schwarzschild metric allows you to calculate distances in the curved spacetime around $M$ analogous to how the pythagorean theorem $ds^2 = dx^2 + dy^2$ allows you to calculate distances in Euclidean space. Finally, the fundamental equations of General Relativity are the Einstein field equations (EFEs):
\begin{equation}
R_{\mu \nu} - \frac{1}{2}Rg_{\mu \nu} = \frac{8 \pi G}{c^4}T_{\mu \nu},
\end{equation}
where the left-hand side describes the curvature of spacetime, given that $R$, $R_{\mu \nu}$, $g_{\mu \nu}$ are parameters in differential geometry, and the right-hand side describes the density of energy and momentum in spacetime. The solutions of the EFEs are metrics $g_{\mu \nu}$. In sum, the solutions of the EFEs, which allow us to calculate distances in various spacetimes, can be used to derive a relationship between $\tau$ and $t$.
Answer: Bending/curving should not be taken literally. It is sometimes used for demonstration purposes. It also fits very well with mathematics of general relativity. It also has been demonstrated practically via gravitational lensing and solar eclipse experiments. Still no one knows what it actually is. It is "something" that changes property of spacetime in that region which causes all the observations that we have made. These observations include time dilation in the vicinity of mass/energy.
If we apply the gravitational acceleration on light (which Newton did not think of), the accumulated effect over path of the light would probably give similar results as gravitational lensing caused by curving.
There are things like "Precession of the Perihelion of Mercury" can only be explained via GR, i.e. via mathematics of curving of spacetime.
We do not know what exactly that curving is and why it causes time dilation or other effects.
Physics does not answer "why" or even "how", it does answer "how much".
Answer: In this case space and time is the same thing. Like a slimy/rubbery gue filling the universe. If u bend it the distance from one point to another becomes further or closer (depending how u bent it) this will change the time u need from point A to B