Finding exact row in Clustered index leaf page

Question: When traversing through Clustered index in Sql Server, the engine will start from Root page and traverse over non leaf nodes until it reaches leaf level page (data page).
Every data page has row offset array where every slot is ordered by clustered key (physical order of data may not be ordered). Slots only have 2byte offset of the row (doesn't contain key value).
My question is:
If I have say table with two int columns (8 byte) i would have around 1000 entries per data page. How does engine locate exact row with index 500 (if that page contains rows with indexes from 1 to 1000). Does it traverse through slot sequentially examining every row or is there any more efficient algorithm which sql server use?
Answer: The specifics of how SQL Server does it is not public.
But I recommend you read the vast research material on the subject which is public. Modern B-Tree Techniques is a good start. Many more papers from Goetz Graefe talk about this area, he is well known in the industry.
Interpolation search is a well known technique in B-Trees and there is plenty of material detailing possible approaches (bear in mind that none of the papers describe explicitly how SQL Server does it and there are many ways to skin a cat).
Comment: @user1659786 - [An interesting post on the subject](https://www.sql.kiwi/2011/08/sql-server-seeks-and-binary-search.html)
Comment: @Martin Smith Thanks Martin. It's just what I needed.


Can't select full long text document in mongoDB

Question: I have a mongo DB entry that has a really long text field. I need to get its entire contents but the mongo terminal truncates it. The PHP script loads the full document but i need to be able to get it from the mongo terminal so that I can look at the data while the site is not running. I'm hoping there is a command I can pass somewhere to enable it?
I see a few comments that this might be because of a null character and not because of the content length. The data is encoded with serialize if that helps. Is there still a way to view it?
thanks
Comment: What have you tried? How is it "truncating it"? The value or just the display of the value (if you check the value's length, is it correct)? You could probably just use a string `slice` command to print it out in chunks. `for(var i=0,l=s.length;i<l;i+=80) { print(s.slice(i,i+80)); }` assuming s contained the long string for example.
Answer: This was a bug (SERVER-6646) in MongoDB shell and fixed in 2.4.5.
NUL will now show up in the shell as "\u0000", along with the rest of string


Why is the absolute value of this Gauss sum obvious?

Question: I came across the Gauss sum discussed in the following post in a problem from my Galois theory course: https://mathoverflow.net/a/71282. Why exactly is the square of its norm obvious?
Comment: Please ask a selfcontained question.
Comment: It does not say that it's obvious, but that it's easy, meaning that the computation does not require any specific insight, it's just a computation.
Comment: Mathematicians use "easy" or "obvious" as code for "I don't feel like proving this".
Comment: I don't see how the computation proceeds, though.
Answer: Let $G=\sum_{a}\Big(\frac{a}{p}\Big)\zeta_p^a$. Here's a proof that $G^2=\Big(\frac{-1}{p}\Big)p$, which in particular shows that $|G|^2=p$.
As $a$ runs over $(\mathbb{Z}/p\mathbb{Z})^{\times}$, so does $ab$ for fixed $b\neq0$, so we have:
$$ G^2=\sum_{a,b}\left(\frac{a}{p}\right)\left(\frac{b}{p}\right)\zeta_p^{a+b}=\sum_{a,b}\left(\frac{ab}{p}\right)\zeta_p^{a+b}=\sum_{a,b}\left(\frac{ab^2}{p}\right)\zeta_p^{b(a+1)}=\sum_{a,b}\left(\frac{a}{p}\right)\zeta_p^{b(a+1)} $$
$$=\sum_{b}\left(\frac{-1}{p}\right)+\sum_{a\neq-1}\left(\frac{a}{p}\right)\sum_{b}\zeta_p^{b(a+1)} $$
Moreover, $1+\zeta_p+\dots+\zeta_p^{p-1}=0$, so $\displaystyle\sum_{b}\zeta_p^{b(a+1)}=-1$, and
$$ G^2=(p-1)\left(\frac{-1}{p}\right)-\sum_{a\neq-1}\left(\frac{a}{p}\right)=p\left(\frac{-1}{p}\right)-\sum_{a}\left(\frac{a}{p}\right)=p\left(\frac{-1}{p}\right) $$
since there are as many quadratic residues as non-residues mod $p$.
Comment: Thank you. That makes sense. I have never taken a number theory course, so I'm not as familiar with the Legendre symbol as I could be and couldn't work it out myself.
Comment: You may want to check out Ireland and Rosen's undergrad number theory book, they do a lot with characters and it's relatively easy to pick up on.


How do I get myself to think about every shot using modern digital equipment?

Question: In today's age of fully automated digital cameras, I find it difficult to seriously think about every picture I take before I press the shutter button.  The experience is, from what I can tell, completely different with equipment like a manual film camera or rangefinder camera: I have used an all-manual film SLR and it forced me to think about every picture I took.  How do I replicate this using my digital SLR equipment?
Comment: Use VERY SMALL memory cards, an only bring a few with you. Part of the deal with film is that once you expose there isn't any taking it back...if you limit your memory card space (and use RAW), you'll have a similar limitation. You'll just have to discipline ourself not to delete a photo once its taken...
Answer: You need discipline and a goal.
Most digital camera users take hundreds of shots without thinking much. Tons of shots are almost the same and most are unmemorable. I also know pros who shoot thousands of photos per day. That's a huge number! The great thing about digital photography which I tell my students on the first day of classes is that experimentation is free. However, shooting without thinking does not teach anything, its more like playing the lottery. You're going to eventually get a few good shots but you wont be able to repeat it or control it.
Most people are surprised how few photos I take and I actually plan to take fewer because I gave myself a goal of not shooting the ones that would get culled. I used delete 9 our of every 10  photos I shot and have been striving to reduce that number of trying to recognize in advance photos without merit. It's tough but I am down to deleting 7 out of 8 now. The strategy to do this takes discipline:

Previsualize
Position carefully
Inspect every edge and the content of the frame.
Search for highlights and shadows, decide where to meter.
Set exposure parameters depending on the mode.
Don't forget White-Balance. Take a reading if using custom. Even with RAW for a better preview.
Watch motion in your frame and focus.
Shoot and review.
Analyze what could have been better.
Repeat as needed.

Obviously this needs to be adjusted for different situations and things with rapid motion generally take more shots. Even using burst mode you must anticipate motion not to run out of buffer before the height of the action.
Comment: +1 but I've a question. What do you mean by _Previsualize_? Let's say that I want to shoot a specific scene and I know it, do you mean to previsualize it at home before even going there? or when I go there I stand in front of it previsualizing how should I shoot it?
Comment: Both are possible but you have to at least do it on the spot. You have to look at the scene decide what you want *in* the frame, what you want *out* of the frame, the proportion and perspective, what kind of contrast, etc. This will come over time as you learn the your shots.
Answer: Putting your camera in Manual will certainly cause you to think about shots more, just as it did with film. Of course with film, you had 36 chances, with digital you have 400+.
This factor alone reduces the 'risk' of each shot, but also brings with it the freedom of experimentation: no longer must you strive for the 'perfect' shot each time, but you can easily try different approaches, compositions, lighting, etc. I for one prefer the digital realm over film for this very reason.
I personally leave my camera in Av, which forces me to consider composition and depth of field with each shot. I must also pay attention to shutter speed, based on subject. I find I am considering the mechanics of each shot more, and I have the freedom to try multiple compositions in each session as well.
Answer: In addition to Itai's excellent advice - you're going to have to force yourself to some limit imposed by yourself and not the equipment.  It will require some measure of self control.  When shooting for practice and yourself, consider imposing a shot limit "I'm only going to shoot 36 shots today and then I'm done."  Also, film was not limited by just the size of roll of film, but the cost of developing - impose the limit that you're going to get every single shot printed.  Then you'll start seeing dollar signs when you click the button and think more carefully.
Answer: I should imagine that changing your settings to manual would do it; once you have made some serious mistakes, you will soon learn to put your brain in gear before firing!
Answer: When I first bought my Rebel XS I didn't know anything about photography and so I ran around shooting in full auto and it resulted in nothing interesting whatsoever.
However, now that I want to learn more about photography I tend to take pictures with a goal in mind, usually attempting to recreate an interesting shot that I've seen online. So my process is "read about new thing online" and then go out and take pictures until I get the shot I like. That way I'm always thinking about something when I'm taking the shots and as I experiment trying to get the shot I like,  I learn how the different elements of exposure and composition change the shot (I'll have many nearly identical shots with only minor variances)
Answer: I fully agree with all the advise above, particularly previsualizing and having a goal in mind beforehand, as well as forcing yourself into good habits by setting your camera to manual mode.
However, that advise also implies that it is bad practice at all times to shoot lots. I think this advise is not to be used in all occassions. If you have a static landscape or a scene that you can stage, do make it a learning moment for your photography.
As for uncontrollable events, wildlife, sports or in situations where you have little time, do both: prepare AND shoot lots. One does not exclude the other. I'm mostly into wildlife photography and as such an opportunistic photographer. Capturing the subject sharply before its gone takes precedence over maximizing the learning moment in photography. My girlfriend does think before he shoots wildlife. Yet often the subject itself is long gone, but when its not, her photos are better. I need to be more like her and she needs to be more like me :)
Answer: Gaffer Tape Time Machine
Put a bit over the display on the back of your camera.
It'll be like travelling back to the 1980s!
Answer: Using LiveView and a loupe like the Hoodman Hood Loupe helps me slow down when composing.


Why must a conservative force be able to be written as a derivative of the potential function?

Question:
Why must a conservative force be able to be written as a derivative of the potential function?
Furthermore, what exactly is a potential function?
Answer: A force is conservative if $\oint_C \vec F\cdot d\vec\ell=0$, where the integral is taken around an arbitrary contour.  In words, this means you will do the same work $\int \vec F\cdot d\vec \ell$ in going from $A\to B$ irrespective of the path taken from $A\to B$, since coming back from $B\to A$ must always produce $0$ for a closed path.
By Stoke's theorem of vector calculus,
$$
\oint_C \vec F\cdot d\vec \ell= \int_S (\vec\nabla\times \vec F)\cdot d\vec S
$$
so that, if the left-hand side is $0$ always, irrespective of the contour, the right-hand side must always be $0$, irrespective of the surface $S$ bounding this contour.  This in turn implies that $\vec\nabla \times \vec F$, i.e. the curl of $\vec F=0$.
If the curl of $\vec F$, i.e. $\vec\nabla\times \vec F=0$, one can then use the vector calculus identity $\vec\nabla\times (\vec \nabla v)=0$ to deduce that $F=\vec \nabla v$, i.e. that $\vec F$ is the gradient of a scalar function $v$.  From physical arguments one shows that $v=-V$, i.e. $v$ is the negative of the potential.   In this way, the work done $W =\int dV$ (in 1d) is just $- \int F dx$ as per the usual definition and is just the difference in potential between the initial and finial points.
The potential function is the energy of the system due to the interaction of its components.  Hence, a particle near the surface of the Earth, in the gravitational field of the Earth, has potential energy $V=mgh$ where $h$ is the height above some reference height (often the surface of the Earth).  If two particles are connected by (and so interact via) a spring, the potential energy is $\frac{1}{2}k(x_1-x_2)^2$ where $k$ is the spring constant.   Likewise the potential energy of an electron interacting with a proton is $-q^2/(4\pi \epsilon_0 r^2$ where $r$ is the distance between the two particles.
All of the above are conservative.  Friction is an example of a non-conservative force: obviously going from $A\to B$ along a complicated and long path will cause more energy to be dissipated by friction than if one takes the shortest possible path (assuming the coefficient of friction is constant everywhere).  Thus the work done would depend on the path, making this force by definition non-conservative.
Comment: Remark: an irrotational field is conservative only if the domain is simply connected. On the other hand, a conservative vector field is always irrotational.
Comment: I'd only add that the "vector calculus identity" $\boldsymbol{\nabla}\times(\boldsymbol{\nabla}\phi)=0$ does not - by itself - imply that any irrotational vector field is a gradient. That one is *locally* guatanteed by Poincaré's lemma, but that's a highly nontrivial and deep result.
Comment: @Uldreth Good point.
Comment: @valerio yes I think however it's reasonable to suppose the OP was not concerned with this level of subtlety.
Answer:
Firstly, potential energy is a term we only use for conservative forces. A spring can be compressed, and we know that it will jump back. This gives a sense of energy being stored until released. Thus the term potential energy has been invented.

If the spring force was not conservative, meaning that the energy added to cause the compression was just dissipated as heat or absorbed by the material, then no energy would be stored. The "spring" would stay in the new deformed shape. (Think of the difference between compressing a spring and compressing a sheet of aluminium foil.)
In other words, potential energies are only associated with conservative forces - if the force isn't conservative, then there isn't any stored energy to call potential.

Secondly, as the next step, we must realize that the potential energy stored is exactly equal to the energy needed to fight against the conservative force.

Work must be done to fight against the spring force and compress a spring. Were there no spring force, then no work was needed to compress it. This work done is the energy that is being stored as potential energy that can be released again later.

Thirdly and lastly, now that we have realized that potential energy $U$ equals the work $W$ done, we can simply set up the mathematical formula:
$$W=\int \vec F\; d\vec x \quad\Leftrightarrow\\
U=\int \vec F\; d\vec x\quad\Leftrightarrow\\
\vec F=\frac{dU}{d\vec x}$$
Regarding your second question, don't think too much about the word "function". It is just a mathematical term for $U$ and makes no physical difference.

$U$ in the formula above might be different for different displacements $d\vec x$ (in a spring, the more you compress it, the more energy is stored). Since $U$ varies over values of $\vec x$, we could - if we wanted to - mathematically call $U$ a function of $\vec x$. And write it with the typical function-notation $U(\vec x)$.
The formula is no different; $U(\vec x)$ just emphasizes that the potential energy is not necessarily constant over the displacement:
$$\vec F=\frac{d\,U(\vec x)}{d\vec x}$$
Answer: (I will talk about vector fields in general, but you can just replace the words "vector field" with the word "force")
A vector field $\mathbf F$ is conservative if it's path independent, i.e. for any path  $\mathcal P$ connecting the points $A$ and $B$ we have
$$\int_\mathcal{P} \mathbf F \cdot d \mathbf x = U(B)-U(A)\tag{1}\label{1}$$
In physics, $U$ is what you call the potential function. An equivalent formulation is that the integral of $\mathbf F$ over a closed path, denoted by $\oint$, is always zero:
$$\oint \mathbf F \cdot d \mathbf x = 0\tag{2}\label{2}$$
Starting from \ref{1}, it is fairly straight-forward (but a bit boring) to prove that $\mathbf F$ can be written as
$$\mathbf F = \nabla U \tag{3}\label{3}$$
See here for a proof. Proving the converse is quicker:
$$\int_{\mathcal P} \nabla U \cdot d \mathbf x =\\
\int_A^B\nabla U (\mathbf x(t)) \cdot \mathbf x'(t) dt =\\
\int_A^B U'(\mathbf x(t)) dt = U(B)-U(A)$$
where $\mathbf x(t)$ is a parametrization of the path $\mathcal P$.
We have therefore
$$\int_\mathcal{P} \mathbf F \cdot d \mathbf x = U(B)-U(A) \iff \mathbf F = \nabla U$$
Other related results:

A conservative field is irrotational (its curl is zero)

Proof
Trivial: it follows from the vector identity
$$\nabla \times (\nabla U) = \mathbf 0 $$
valid $\forall U \in C^1$

An irrotational field over a simply connected domain is conservative

Proof
It relies on Stokes' theorem.
A famous example of a vector field that is irrotational but not conservative, because its domain of definition is not simply connected, is the magnetic field of a wire (see here).


Sufficient conditions for positive semidefinite matrices

Question:
Is a symmetric matrix with positive terms (i.e., $a_{ij} > 0$) and positive determinant positive semidefinite?
Is a symmetric matrix with positive terms, positive determinant, and
terms that satisfy $a_{ij}^2 \leq a_{ii} a_{jj}$ positive semidefinite?
Answer: The answer to your first question is negative. Consider$$A=\begin{pmatrix}1&2&2\\2&2&2\\2&2&1\end{pmatrix}.$$Each entry is greater than $0$ and the determinant is $2$. However$$\begin{pmatrix}-1&0&1\end{pmatrix}A\begin{pmatrix}-1\\0\\1\end{pmatrix}=-2.$$
Answer: b) The following statements are equivalent:

The symmetric matrix $A$ is positive semidefinite
All eigenvalues are non negative
All the principal minors of $A$ are non negative.
There exists a $B$ such that $A = B^{T}B$ where $B$ can be thought of as a square root of a positive operator.

[1] Kreyszig, Erwin. Introductory functional analysis with applications. Vol. 1. New York: wiley, 1989.
Comment: Can you provide the specific page? Thank you.
Answer: a) The answer is no. Look at the matrix
$$
A = \begin{pmatrix}
1&2&1&1\\
2&1&1&1\\
1&1&1&2\\
1&1&2&1
\end{pmatrix}
$$
All its entries are positive. Its determinant is 5, and thus positive. But one of its eigenvalues is $-1$, and thus it is not positive semidefinite.
b) I could not find a counter-example at this stage.


Templating library in node.js similar to Jinja2 in Python?

Question: What would be a node.js templating library that is similar to Jinja2 in Python?
Comment: I would prefer [nunjucks](https://www.npmjs.com/package/nunjucks), as it was even *referred* by jinja2
Answer: https://mozilla.github.io/nunjucks
Nunjucks is basically a JS port of Jinja2
Comment: https://mozilla.github.io/nunjucks - they moved webpage here
Answer: Maybe a list of template engines for node.js can help here too.
List of template engines

Pug: Haml-inspired template engine (formerly Jade).
Haml.js: Haml implementation.
EJS: Embedded JavaScript template engine.
hbs: Adapter for Handlebars.js, an extension of Mustache.js template engine.
Squirrelly: Blazing-fast template engine that supports partials, helpers, custom tags, filters, and caching. Not white-space sensitive, works with any language.
Eta: Super-fast lightweight embedded JS template engine. Supports custom delimiters, async, whitespace control, partials, caching, plugins.
React: Renders React components on the server. It renders static markup and does not support mounting those views on the client.
combyne.js: A template engine that hopefully works the way you'd expect.
Nunjucks: Inspired by jinja/twig.
marko: A fast and lightweight HTML-based templating engine that compiles templates to CommonJS modules and supports streaming, async rendering and custom tags. (Renders directly to the HTTP response stream).
whiskers: Small, fast, mustachioed.
Blade: HTML Template Compiler, inspired by Jade & Haml.
Haml-Coffee: Haml templates where you can write inline CoffeeScript.
express-hbs: Handlebars with layouts, partials and blocks for express 3 from Barc.
express-handlebars: A Handlebars view engine for Express which doesn't suck.
express-views-dom: A DOM view engine for Express.
rivets-server: Render Rivets.js templates on the server.
LiquidJS: A simple, expressive and safe template engine.
express-tl: A template-literal engine implementation for Express.
Twing: First-class Twig engine for Node.js.
Sprightly: A very light-weight JS template engine (45 lines of code), that consists of all the bare-bones features that you want to see in a template engine.

(Some of these libs may be outdated or unmaintained.)
Source expressjs
Answer: jinja-js aims to fe a feature complete reimplementation of the jinja2 template engine in Javascript. To my understanding the other options mentioned here some of the many, many templating engine options available for Javascript.
Comment: Recommendation requests for off-site resources or tools are off-topic on Stack Overflow. If you answer them, you specifically reinforce the belief that Stack Overflow is a good place to answer those questions. It is not. Please don't answer these questions even if you know a good answer as most answers will be highly opinionated ("I personally like..."). You can open the flag dialogue on the question and see the close reason in full under the **off-topic** category, or in the [help/on-topic]. You should also not even answer in a comment, as the effect is similar to an actual answer.
Answer: Nunjucks & Swig
This 2 are similar Django, Jinja2, and Twig template engines.
Comment: Swig is no longer maintained according to its github page https://github.com/paularmstrong/swig
Answer: The ejs is the npm module which you are looking for.

This is the name written in my package.json file --> "ejs": "^3.1.3"

EJS is a simple templating language that lets you generate HTML markup with plain JavaScript.(Credits: Ejs website)


non-homogeneous constant co-efficient 2nd order linear differential equation

Question: I am doing a perturbation theory question and am having trouble with the (seemingly simple!) differential equation method of undetermined coefficients... I have reduced my given system so that now I need to find the solution of this non homogeneous differential equation:
$$\ddot x+x=-cos(t) $$ with initial conditions:$$x(0)=1$$$$\dot x(0)=0$$
I'm so confused by this... I know that the solution is a combination of the general solution of the homogeneous equation plus a particular solution of the non homogeneous equation. I know the general solution is $$x_c=Acos(t)+Bsin(t)$$ but then I have to assume the particular solution for the homogenous equation is of the same form, $x_p=Ccos(t)+Dsin(t)$, since the right hand side of the original equation is in terms of cos. And when I find the second derivative of this and put it back into the equation, the terms cancel out until I am left with $0=-cos(t)$ which obviously doesn't help with finding the particular solution, and makes sense intuitively since I have just found out that this would be the general solution when it equals 0. Am I going about this all wrong or just missing something really obvious? Is 0 a particular solution to the non homogeneous equation? Any help would be greatly appreciated.
Answer: We are given:
$$\ddot x+x=-\cos(t) , ~x(0)=1, ~\dot x(0)=0 $$
For the homogeneous part of the system, we can write:
$$m^2 + 1 = 0 \implies m_{1,2} = \pm ~ i$$
The general solution is thus given by:
$$x_h(t) = c_1 \cos t + c_2 \sin t$$
Using the IC's, we find $c_1 = 1, c_2 = 0$, hence:
$$x_h(t) = \cos t $$
For the particular, since we have the solution equal to $\cos t$ and this is what we have for the complementary solution, we would choose:
$$\tag 1 x_p(t) = t(a \cos t + b \sin t)$$
If we did not have the particular solution coincident with the homogeneous, we would have chosen $x_p(t) = a \cos t + b \sin t$.
Taking derivatives of $(1)$ and subbing back into ODE yields:
$$-2 a \sin t + 2 b \cos t = - \cos t$$
This gives us:
$$a = 0, b = -\dfrac{1}{2}$$
The final solution is:
$$x(t) = x_h(t) + x_p(t) = \cos t - \dfrac{1}{2}~t~ \sin t$$
Comment: ohh, makes perfect sense now, thanks!
Comment: I am very happy I could help! Regards
Comment: I always enjoy your posts, Amzoti! Thanks!


Versioned View vs Database View in enterprise databases

Question: While researching database views related to enterprise geodatabases I was trying to distinguish the difference between the database and versioned views. Is it just the fact that database views with versioned data are considered versioned views? Or are versioned views only considered the fact when a different version other than the root is being used?
Answer: The documentation (What is a versioned view) covers this in detail:

A versioned view incorporates a database view, stored procedures, triggers, and functions to allow you to use Structured Query Language (SQL) to read or edit data in a geodatabase that has been registered to use traditional versioning. When you query a versioned view, you can see the data in the base (business) table and the edits that are stored in the delta tables. The triggers used by the versioned views update the delta tables when you edit the versioned view using SQL.
Unlike database or spatial views, versioned views are not used to change the table's schema or limit access to it; rather, they are used to facilitate access to a certain version of a table or feature class. Therefore, you do not specify a where clause when creating a versioned view. As a result, versioned views contain the same columns and rows as the base table they represent.

Database views are "plain old views" as supported by the RDBMS.  The documentation also addresses how views interact with the geodatabase:

Database views are stored queries that select data from specified tables. You can define views on database or enterprise geodatabase tables that are not registered as versioned. When used with an enterprise geodatabase, database views can be defined for a single nonversioned table or between two nonversioned tables. Or you can create more complex views that contain subqueries.

This same document also provides a list of reasons to use views and limitations of views when integrating with the geodatabase.


Can a Witch or Wizard pick up an abandoned wand and identify its owner?

Question: Could Dumbledore and the rest of the Hogwarts Professors pick up another Wizard's wand and identify its owner without having seen the wand before?
Answer: Ollivander was able to identify the owner of a given wand by touching it, but of course he had seen the wand before and presumably the person it was purchased for ("The wand chooses the wizard" -- I don't think the wand chooses the wizard by long distance). Perhaps Gregorovitch was able to do this as well. As it is, I personally cannot think of a canon example where someone identified the owner of a wand solely through touch, without knowing the owner previously.
Comment: Didn't Ollivander simply never forget a wand? ""I remember every wand I've ever sold, Mr. Potter. Every single
wand." *Harry Potter and the Philospher's Stone - Diagon Alley*. So he identifies the owner by touching the wand, because he remembers selling it!
Answer: In the Shrieking Shack in Prisoner of Azkaban Lupin identified Harry's, Ron's, and Hermione's wands:

He separated Harry's Ron's and Hermione's wands and threw each back to its owner; Harry caught his, stunned.

Identifying Harry's might have been simple because when he originally disarmed them, Harry's was separate. However, Ron's and Hermione's were both disarmed from Hermione:

"Expelliarmus!" Lupin shouted.
Harry's wand flew once more out of his hand; so did the two Hermione was holding. Lupin caught them all deftly, then moved into the room, staring at Black, who still had Crookshanks lying protectively across his chest.

This could thus be an example of a wizard being able to identify a wand's owner.
It is, of course. possible that Lupin simply carefully observed his students and memorized their wands, but there doesn't seem to be any reason why a teacher would do that, especially when they have several hundred students.)
Answer: There's no canon evidence I know of for the teachers to do so, but the Ministry can identify a spell caster in some cases - such as casting Prior Spell on the wand (assuming they know what spells the wizard did last).
Also, Arthur Weasley in his job went after wizards who bewitched Muggle things - meaning they likely had SOME way of identifying just who bewitched the things.
Comment: I could be mistaken, but I thought I remembered something in one of the later books about a wand being 'registered'; I'd take it to mean that it's unique signature or characteristics had somehow been logged... But I might be crossing HP and some other stories.
Comment: In 'Fantastic Beasts' movie, any foreigner witch or wizard visiting U.S. is subject to 'wand permit' registration, which, like weapon registration IRW, allows MACUSA to identify a wand owner.
Comment: @TimSparrow - and, just as in IRW, that didn't seem to work where it actually mattered (catching Gellert G) :)
Answer: Probably no.  The evidence is in Harry Potter and the Order of the Phoenix chapter 7.  When Harry enters the building of the Ministry of Magic, a security wizard records identifying information of his wand.  Chapter 34 then confirms that this is standard procedure for all visitors of the Ministry.  If it were easy to identify the wizard from a wand without recording this information, the Ministry would probably not bother with that step.


Period time is too long

Question: This time my period is not going , 15 days are completed but the blood is still there, normally it is for 6 or 7 days , should I offer salah or should I just wait?
Comment: When you ask a question stackexchange already show you choices for similar ones this question already has answers on the site. We are not looking for question duplicates. In fact one of these questions is your own and the answer came from the same person.
Answer: Normally, the period should be finished by the 15th day or before that so anything that exceeds 15 days would count as Istihadah. Istihadah is non-menstrual or irregular bleeding and basically if you suffer from this you can do ghusl and then pray or fast as usual.  You would still need to do wudhu before each prayer. If you need more information:
https://youtu.be/LjYy4azvDcU
Allah knows best.
Comment: Btw thanks jazakallah ☺
Comment: But it is never happened to me before, so will it count as istihadah?
Comment: Yes it would still count

Period time is too long


How effective are arbitrage bots?

Question: I hear many good reviews about cryptobots. But they all work according to the pattern. Explain to me how to use them correctly?
Answer: Arbitrage is a race: a good arbitrage bot will take advantage of differences in price, before anyone else is able to. By performing the arbitrage trading, the difference in price will disappear, so only the fastest traders will be able to profit.
So with this in mind, I am extremely skeptical of any arbitrage bot that is being publicly sold, as the user that purchases the bot will be directly competing with all other users that purchased that bot, and probably other people that have their own methods as well.
And so I think it is likely that the only person who is sure to profit, is the person who sold the bot!
Answer: Bots really work according to the given algorithm, but this is their advantage. For example, they can collect information about exchange rates on different exchanges and offer you an exchange. But almost all of these programs are paid and subscription is available for several months at a time. Some, for example a BibitBot, have free versions for several days.

How effective are arbitrage bots?


Wheel and tire clearance to trailer chassis

Question: I have a trailer with a rubber-torsion axle (axle is fixed to chassis, hubs are mounted to swing arms that are embedded in the ends of the rubber-filled tube axle).  Since the swing arms move only in the vertical plane, and cannot move side-to-side, I assume I can fit wheels/tires that have minimal clearance from the trailer chassis. What is a reasonable minimum clearance between the inner side of the wheel/tire assembly and the nearest part of the trailer chassis?
Answer: This would depend a great deal on the load carried and the tyre pressure.
The tyres will Flex and bulge somewhat and can fail if allowed to rub against the chassis.
My trailer has a couple of inches clearance.


Is there a well-defined notion of an "R/poly" complexity class?

Question: This would be the complexity class of all problems that are decidable in finite time with a polynomial length advice string that can be arbitrarily hard to compute. But potentially undecidable without this advice string. I think you might be able to just iterate through all possible advice strings, but it could be undecidable if a given advice string is the correct one, as a TM could act unpredictably and undecidably with the wrong one. Also, I presume that if R/poly is well defined and distinct, we could also define an "R/subexp" class. And, more broadly, the space complexity of the advice string could perhaps be a good measure of "how undecidable" an undecidable problem is. If R/poly is well defined and distinct, what is known about it if anything? Does it contain RE?
Comment: Note that R/poly, like P/poly, contains a unary representative from every Turing degree. (For P/poly, this is maybe less interesting, b/c the relevant notion of reduction there is FP or FP/poly, but for R/poly, it seems more interesting.) It is interesting that R/poly seems to really separate out the question of the power of advice from the question of the power of circuits.
Answer: There is nothing stopping you from defining the class, though I don't recall seeing it studied.
Actually, I can see two reasonable definitions for this class. The first one, which follows more literally the notation, is that $L\in\mathrm{R/poly}$ iff there is a recursive predicate $P(x,y)$ and an advice function $a\colon\mathbb N\to\{0,1\}^*$ such that $|a(n)|\le n^{O(1)}$ and $x\in L\iff P(x,a(|x|))$. I can't say anything about this class (I don't even know if it includes RE).
The second possibility is that $L\in\mathrm{R/poly}$ iff there is a TM $M(x,y)$ and an advice function $a\colon\mathbb N\to\{0,1\}^*$ such that $|a(n)|\le n^{O(1)}$, and for each $x$, $M(x,a(|x|))$ halts and decides whether $x\in L$. (However, $M(x,y)$ may not necessarily halt for other choices of $y$.) Strictly speaking, this should be called $\mathrm{RE/poly\cap coRE/poly}$, I guess; but anyway, this class seems to be more robust, and I can say something about it.
Under the second definition, R/poly includes RE; moreover, it includes all languages computable with polynomially many RE oracle queries, and languages computable with exponentially many parallel RE oracle queries.
To see this, let $L\in\mathrm{RE}$, and let $M$ be a Turing machine that accepts $L$. We define the advice to be $a(n)=\#L_n$ (written in binary so that it has $O(n)$ bits), where $L_n=L\cap\Sigma^n$. Given an input $x$ of length $n$, and knowing $a(n)$, we can compute $L_n$ (and then check whether $x\in L_n$) by running in parallel (using dovetailing) $M$ on all inputs $w$ of length $n$, until $a(n)$ many of the instances halt and accept; then we know that the remaining instances cannot accept, and we can stop the search.
If $L$ is itself not in RE, but it is computable with an RE oracle $L'$ to which it only makes queries of length bounded by a polynomial $p(n)$, let the advice be $\sum_{m\le p(n)}\#L'_m$, using a similar argument. More generally, this shows that R/poly is closed under polynomially bounded Turing reductions.
If $L$ is computable by a TM $M$ with polynomially many queries to an RE oracle, which we may assume w.l.o.g. to be the halting problem $H$, then $L$ is also computable with polynomially bounded queries to $H$, hence it is in R/poly by the previous paragraph: we successively determine answers to the oracle queries by asking $H$ polynomially many questions of the form "what is the answer to the $i$th oracle query made by $M$ on input $x$, assuming the previous oracle queries were answered by $a_0,\dots,a_{i-1}\in\{0,1\}$" (this can be expressed as a polynomially long query to $H$). A similar argument applies if $L$ is computable with exponentially many parallel (= non-adaptive) oracle queries to $H$.
To place an upper bound on R/poly, for any $L\in\mathrm{R/poly}$, the Kolmogorov complexity of $L_n$ (as a $2^n$-bit string) is $n^{O(1)}$: to compute $L_n$, we only need to specify $n$, $a(n)$, and a (constant-size) description of the TM $M$ from the definition. In contrast, a random string has Kolmogorov complexity about $2^n$. Thus, most languages are not in R/poly, or even in R/subexp.
This also shows that R/poly does not contain $\Delta_2$, or even $\mathrm{EXP}^H$, as we can compute in this class the lexicographically first string of length $2^n$ and Kolmogorov complexity $\ge2^n$ by binary search (using queries expressing the RE predicate "every $2^n$-bit string extending $a_0\dots a_{i-1}$ is computed by some program of length $<2^n$").
Furthermore, a generalization of the Kolmogorov complexity argument shows that there is a strict hierarchy: if $\alpha,\beta\colon\mathbb N\to\mathbb N$ are functions such that $\alpha(n)\le\beta(n)\le2^n$ and $\beta(n)-\alpha(n)\ge2\log n$ or so, then $\mathrm R/\alpha(n)\subsetneq\mathrm R/\beta(n)$, as all languages $L\in\mathrm R/\alpha(n)$ have Kolmogorov complexity $K(L_n)\le\alpha(n)+O(\log n)$, whereas $\mathrm R/\beta(n)$ contains a language $L$ with $K(L_n)\ge\beta(n)$.
Come to think of it, Kolmogorov complexity provides an exact characterization of R/poly:
$$L\in\mathrm{R/poly}\iff\exists\text{ a polynomial $p$ }\forall n\in\mathbb N\:K(L_n)\le p(n).$$
We have already seen the left-to-right implication; for the converse, we can use as advice $a(n)$ a description of an algorithm that computes $L_n$.
Comment: How large is R/poly? Does it contain $Δ^0_2$, and does it equal ALL?(I presume not.) But how far does R/poly extend? This also raises the question of if $Δ^0_n/poly$ contains $Δ^0_(n+1)$
Comment: R/poly does not contain $\Delta_2$, and does not equal ALL; I included this extra information in the answer. I also realized that the description of R/poly is ambiguous, hence I explicitly pointed out the definition which I am operating with.
Comment: For the first version of R/poly, R/poly = ∪{f/poly: computable f}, which by diagonalization does not include RE.  For the second version of R/poly, another characterization is R/poly = (P/poly)$^H$.
Comment: Does R/subexp contain $EXP^H$? where instead of merely polynomial advice we allow sub-exponential advice. Though R/EXP and indeed for any class C C/EXP trivially equals ALL.
Comment: All languages in R/subexp have subexponential Kolmogorov complexity, whereas $\mathrm{EXP}^H$ contains languages with exponential Kolmogorov complexity, thus the former cannot include the latter. (Btw: EXP/exp or even PSPACE/exp equals ALL, but e.g. P/exp does not, as a polytime-machine can only access polynomially many bits of the advice).

Is there a well-defined notion of an “R/poly” complexity class?


X-bee and accelerometer: problem streaming data

Question: Hoping someone might be able to point me in the right direction.
I am currently trying to create a wireless accelerometer using two x-bees (series 1). The accelerometer module is set up so that the x,y,z channels are connected to the DIO0, DIO1 and DIO2 channels on an x-bee explorer. The device is all powered through the 3.3V input on the explorer by a 3.7V (110mAh) li-po battery which is also connected to a usb li-po charger.
I have setup the x-bees within X-CTU and there is no problem communicating between them. DIO0, DIO1 and DIO2 are all set to ADC and i have set it using several different sampling frequencies. I have noticed within the terminal window that when moving the device both DIO0 and DIO1 appear to remain constant (FF 03 from memory) and only DIO2 seems to vary within each data packet. If i change the setup at any one time to only transmit the data from one of the three channels at a time, they all change with movement.
Any chance you might be able to guess where ive managed to mess it up. I am assuming that the wiring and power between the accelerometer and the explorer is fine given it works when only displaying one channel at a time but my experience with these things is limited so im stumped with where to go with it now... Just wondering if the x-bee requires more power for the ADC for all three channels and the it might just need more power to the device to work?
Answer: Make sure the accelerometer doesn't put out more than 1.2V (03 FF is the max value for XBee's ADC). Make sure to use pull-up/pull-down resistors if your sensor requires them.


Error when deploying discord.py bot to Heroku: pathspec 'rewrite' did not match any file(s) known to git

Question: so when I'm trying to deploy my discord.py bot to Heroku, it shows following error when executing the last command: > error: pathspec 'rewrite' did not match any file(s) known to git
I already searched everywhere, but I couldn't find any solutions. Following you will find my cmd commands + output. I really appreciate any help!
C:\Users\Ruben\Desktop\rubot-git>git init
Initialized empty Git repository in C:/Users/Ruben/Desktop/rubot-git/.git/

C:\Users\Ruben\Desktop\rubot-git>heroku login
heroku: Press any key to open up the browser to login or q to exit:
Opening browser to []
Logging in... done
Logged in as []

C:\Users\Ruben\Desktop\rubot-git>heroku apps:create rubot-host
Creating ⬢ rubot-host... done
https://rubot-host.herokuapp.com/ | https://git.heroku.com/rubot-host.git

C:\Users\Ruben\Desktop\rubot-git>heroku buildpacks:set heroku/python
Buildpack set. Next release on rubot-host will use heroku/python.
Run git push heroku main to create a new release using this buildpack.

C:\Users\Ruben\Desktop\rubot-git>heroku git:remote -a rubot-host
set git remote heroku to https://git.heroku.com/rubot-host.git

C:\Users\Ruben\Desktop\rubot-git>git add .
warning: LF will be replaced by CRLF in bot.py.
The file will have its original line endings in your working directory

C:\Users\Ruben\Desktop\rubot-git>git commit -m "initial commit"
[master (root-commit) e1eb173] initial commit
 4 files changed, 32 insertions(+)
 create mode 100644 Procfile
 create mode 100644 bot.py
 create mode 100644 requirements.txt
 create mode 100644 runtime.txt.txt

C:\Users\Ruben\Desktop\rubot-git>git push heroku master
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 913 bytes | 304.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Python app detected
remote: -----> Installing python-3.6.12
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting git+https://github.com/Rapptz/discord.py@rewrite (from -r /tmp/build_36bc5831/requirements.txt (line 1))
remote:          Cloning https://github.com/Rapptz/discord.py (to revision rewrite) to /tmp/pip-req-build-jxayyj_3
remote:          Running command git clone -q https://github.com/Rapptz/discord.py /tmp/pip-req-build-jxayyj_3
remote:          WARNING: Did not find branch or tag 'rewrite', assuming revision or ref.
remote:          Running command git checkout -q rewrite
remote:          error: pathspec 'rewrite' did not match any file(s) known to git
remote:        ERROR: Command errored out with exit status 1: git checkout -q rewrite Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to rubot-host.
remote:
To https://git.heroku.com/rubot-host.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/rubot-host.git'

Answer: It appears that your requirements.txt file is incorrect. It presumably has a line that looks like
git+https://github.com/Rapptz/discord.py@rewrite

which references a Git branch that does not exist.
The package name, with options that you may or may not want to install, is documented in its README. You should configure your requirements.txt accordingly to use a package name, not a Git URL.


Xcode "Add Copy Files" build phase fails to copy header files when building universal framework

Question: I'm trying to create a universal framework for iOS and I have "Add Copy Files" build phase in my aggregate target which tends to behave unexpected (copy some of the files at target location), can you tell me if this can be resolved somehow?
I have added 3 files in this copy build phase...

After the build is done, this is what I see build log..

The result is not consistent - sometimes all (3) files get copied but most times it copies only few files to the target location. The build log doesn't give any error/warning for this (copy) phase.
Most probably it's an issue with Xcode. Any workaround/idea to get around this problem is highly appreciated since i need to build the project multiple times in a day (to save time).

Updates/Edits
If I don't edit any of 3 header files added (+) in 'add copy files' after last build then none of the files is copied inside framework folder on build (cmd+B).
Below are the scripts used in targeted build phases-
Script 1: Build static lib
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator

xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos

Script 2: Build universal framework
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a" &&
DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" &&
UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal" &&
UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}" &&
FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}.framework" &&

# Create framework directory structure.
rm -rf "${FRAMEWORK}" &&
mkdir -p "${UNIVERSAL_LIBRARY_DIR}" &&
mkdir -p "${FRAMEWORK}/Versions/A/Headers" &&
mkdir -p "${FRAMEWORK}/Versions/A/Resources" &&

# Generate universal binary for the device and simulator.
lipo "${SIMULATOR_LIBRARY_PATH}" "${DEVICE_LIBRARY_PATH}" -create -output "${UNIVERSAL_LIBRARY_PATH}" &&

# Move files to appropriate locations in framework paths.
cp "${UNIVERSAL_LIBRARY_PATH}" "${FRAMEWORK}/Versions/A" &&
ln -s "A" "${FRAMEWORK}/Versions/Current" &&
ln -s "Versions/Current/Headers" "${FRAMEWORK}/Headers" &&
ln -s "Versions/Current/Resources" "${FRAMEWORK}/Resources" &&
ln -s "Versions/Current/${PRODUCT_NAME}" "${FRAMEWORK}/${PRODUCT_NAME}"

I seriously need to fix the underlying real issue to automate the build (avoid workarounds mentioned in my answer). Thank you.
Answer: I found that one of the workaround is - just open and save all the files you included in the copy build phase and then build (Cmd+B). (just make the file dirty by adding a space so that modified date is updated)
Comment: **Another workaround:** Building the project _twice_ (i.e. consecutive Cmd+B) ensures the header files specified in 'add copy phase' are copied to absolute path.
Comment: This workaround isn't working for me with Xcode 8.3.3.


Knightian Uncertainty Iff Bayesian Probabilistic View Point

Question: If an investor operates under knightian uncertainty, does that investor then have a Bayesian viewpoint on probability implicitly, and vice versa?  Has this been answered or do I have a poor understanding of one of them?
Answer: You have a correct understanding.  There is a subtle difference in that Knight effectively distinguishes uncertainty from chance.  It could be argued that there is no such thing as chance in the Bayesian posterior density.  To understand why, imagine that you were holding a strictly fair coin and you were going to gamble with an unknown stranger who would flip the coin.
Upon doing some research on the stranger you discover it is either Mandrake the Magician who will always be capable of controlling which side comes up, or his brother Chuck the Clueless, his identical twin brother and who know nothing about tossing coins.  The chance properties of the coin matter if Chuck tosses the coin, but there are no chance properties if Mandrake does.  In the absence of a mistake by Mandrake, the outcome is known.  If Mandrake can make mistakes, that still isn't chance, but an incorrect application of policy.
The Bayesian posterior predictive distribution integrates out the uncertainty leaving only chance effects, but unlike Knightian uncertainty, there is no uncertainty remaining at all because the true value of the parameter is no longer a determinant of the decision process.
Now the problem with Knightian uncertainty is that I do not believe you can really operationalize it.  I think you are either trapped with uncertainty or chance.  I think you are either in the parameter space or the sample space.  I don't think you get to be in both at the same time.  I am not sure what it would mean to try and split them the way he does, except as a mental exercise.  After all, Chuck might also be a magician, but he is purposefully behaving as if chance were the decider.


What happens if I start up my DSL-Modem

Question: As far as I know the dsl modem tries to authenticate at the ISP via CHAP in a PPPoE-frame which is in an Ethernet-frame. But in a "normal" Ethernet frame needs a destination MAC address. How does my DSL-modem get the destination-address of the ISP-device on the other end?
Answer: PPPoE clients use PPPoE Active Discovery to discover PPPoE Access Concentrators (servers) on the network. The first packet the client transmits is a PPPoE Active Discovery Initiation (PADI) which is sent to the Ethernet broadcast address (all ones in binary, all f's in hex: ff:ff:ff:ff:ff:ff). And PPPoE ACs on the network respond with PADO's (Offers). The client notes the source MAC address of the PPPoE AC that sent the PADO the client is interested in, and replies to that MAC address with a PADR (Request). If the AC accepts the request, it responds with a PADS (Session-confirmation).
PPPoE Active Discovery uses EtherType 0x8863.
After Active Discovery completes, the PPPoE client and AC start sending frames using the PPPoE Session EtherType 0x8864. These frames contain PPP messages, including LCP, authentication, and IPCP negotiation, and eventually IP datagrams in PPP.
So the CHAP frames are sent to the unicast MAC address of the PPPoE Access Concentrator, which was discovered via PPPoE Active Discovery.
Comment: @kimliv http://tools.ietf.org/html/rfc2516
Comment: @Mohamad It's not assigned during PAD, it's assigned during IPCP negotiation (which is part of the PPP negotiation at the start of the PPP session).
Comment: Do you have a official document link where that is specified?
Comment: In which of these PPPoE Active Discovey steps the IP is assigned?
Answer: It sends to ff:ff:ff:ff::ff:ff which is the "broadcast" mac address.  If you receive a frame with this destination don't drop it.  It's for you!
Comment: Not quite. The CHAP frame would go to the Access Concentrator's unicast MAC address, which was discovered during PPPoE Active Discovery.

What happens if I start up my DSL-Modem


Lincoln Continental 2000 fuel pump connector loses 12v when connect fuel pump

Question: I have a Lincoln Continental 2000 and had changed the fuel pump one time and it worked for about a month and after a month the fuel pump failed again and confirmed it failed by applying 12v and ground to the fuel pump motor with a car battery. After that I bought another fuel pump and changed it and I noticed that the connector has 12v and ground but as soon as I connect it to the new fuel pump, it loses 12v, I checked with the multimeter on the fuel pump motor. I checked with other fuel pump motors that I have, not knowing if they work or not and it does the same thing, 12v disappear. When fuel pump connector is disconnected, there is 12v. I have changed the FPDM and the ECM as well to see if it would make a difference and it did not. I think this could be a wiring or a fuse box issue, since I already changed ECM and FPDM. Although I am not sure, does anybody why this is happening?
Comment: When you say "12v disappear" ... what do you mean? How exactly are you testing this to see the 12v drop completely?
Comment: I am probing the positive and negative side with multimeter on the fuel pump motor.
Comment: Are you just testing at the plug with the pump plugged in? If so, you should try between the hot side and directly to ground (not the ground wire).
Answer: You must have a bad connection somewhere in the wiring with a high resistance, rather than a completely broken circuit that you would get from a blown fuse.
With no load connected (the fuel pump), the high resistance would allow you to see 12v at the fuel pump connector.  Since a very small current is being drawn by the voltmeter, there will be no significant voltage drop (ohms law).
Once you connect the fuel pump, the fuel pump's low resistance will attempt to draw a larger current.  This will then cause a large voltage drop across the high resistance bad connection.
I would start by probing the fuse for the fuel pump to see what voltage is present there while the fuel pump is powered up.  If you see 12 volts there, then you know that the bad connection is after the fuse.  If it is a low voltage at the fuse, the issue is before the fuse.
Comment: I connected my autel scanner and used the fuel pump on/off feature to activate the fuel pump and it successfully activated the fuel pump motor. I dont know why it does not activate by itself when key is on half way.


Why did we first incarnate?

Question: Our Number of births going into the past has to necasserily be finite not infinite.an infinite number of births without a first is logically infathomable.so why did we first incarnate?
Comment: just go with 'ignorance'... also, if we're talking about the desire realm, i guess something to do with hunger
Answer: Most suttas in SN 15 like SN 15.1, have the following ending:

Transmigration has no known beginning. No first point is found of
sentient beings roaming and transmigrating, hindered by ignorance and
fettered by craving. For such a long time you have undergone
suffering, agony, and disaster, swelling the cemeteries. This is quite
enough for you to become disillusioned, dispassionate, and freed
regarding all conditions."

From a different translation of the Tears Sutta:

From an inconstruable beginning comes transmigration. A beginning
point is not evident, though beings hindered by ignorance and fettered
by craving are transmigrating & wandering on. Long have you thus
experienced stress, experienced pain, experienced loss, swelling the
cemeteries — enough to become disenchanted with all fabricated things,
enough to become dispassionate, enough to be released."

Please also see this answer.
Comment: I would agree and suggest further that the answer also relates strongly to some of the answers to the Unanswerable Questions which are presented as "unwise reflection" into the eternal/finite existence of the self.
Answer: In the ultimate Truth there's no birth, past , present and future. birth is illusion.
That is why the Buddha said there is no apparent beginning. As there's no beginning for the rat horn or a sky flowers.
Answer: In commentary, we born by avijjā. Avijjā arises by Kāmāsava, Bhavāsava, and Avijāsava. These 3 Āsavā originate Avijjā. It's non stop loop.
I can see only stronger and stronger unwholesome in the loop. And I don't think we can find the beginning.
Ignorant > Old and Death > Doing (Managing) > Old and Death > Nāma Rūpa Arise > Old and Death > Senses Arise > Old and Death > Meeting > Old and Death > Feeling > Old and Death > Remembering > Old and Death > Managing > Old and Death > Craving > Old and Death > Craving again and again > Old and Death > Doing (Managing) for New  Nāma Rūpa Arise as in Memory > Old and Death > Born as Managed > Old and Death > Arising Old and Death >  Arising Old and Death >  Arising Old and Death > Unlimited.

Why did we first incarnate?


Insert page break into a PDF file

Question: There is a given PDF file, in which I would like to insert only one page break to a page. I have tried to use Nitro PDF to convert it to MS Word, insert page break and convert it back, but it makes a lot of mistakes during conversion. Also same problem with Foxit softwares. Is there any easier way/advanced editor to insert a page break to a PDF file?
Answer: The best option would be to use something like Adobe Acrobat or Foxit PhantomPDF (disclosure: I work for Foxit) to create a new, blank page after your target page X, which I will call Page X+1. Then cut and paste the objects from the bottom half of page X to page X+1.
I don't know of any PDF software that has an option to directly split pages.
Answer: Sorry, you can't. PDF doesn't work that way - it isn't "flowing" text like MS Word, where you can insert a page break and it reflows the text. Think of PDF's as a picture of the text. It has a page, it has instructions on where on the page to put the blocks of text. Each page is an entity to itself, the pages have no idea that other pages exist.
The best you could do is to export the PDF as you have already, fix the results as best you can, then re-convert it back to a PDF.
Answer: I have the same problem. I plan to make however many new pages I need in the same document, paste the desired text into each, and delete the page(s) that aren't the way I want them. However, some pages have images and those ones I think this option won't work so I will still probably have a problem with those ones.
Comment: As it's currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Comment: This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://superuser.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://superuser.com/help/whats-reputation), you can also [add a bounty](https://superuser.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/1177768)

Insert page break into a PDF file


Epimerization in peptide synthesis

Question: How can epimerization during peptide synthesis be detected? And how can we change or modify the coupling conditions to stop epimerization occurring?
Answer: The technique of Circular dichroism (CD) is used to detect changes and the presence of chirality in peptides and can detect both helical chirality in polypeptide chains that form helices and in individual chiral centers.
Polarimetry. The optical activity of a polypeptide (oligopeptide) has a specific rotation. A change in the optical rotation of such a peptide. Chirality is a property of a molecule as a whole. Such a change will alter the optical rotation of the peptide.

Epimerization in peptide synthesis


Simple MIPS error relating to div, $HI, and a branch statement

Question: I'm trying to replicate the following C code in MIPS:
//sum, n and added are integers and have already been initialized
if(n%3 == 0){
    sum = sum + n;
    added = added + 1;
}

Here is what I tried doing.
#Let t0 = n
#Let s0 = sum
#Let a0 = added
#All have been set earlier in the program

addi $t1, $zero, 3    #Let t1 = 3 for division
div $t0, $t1          #Remainder will be stored in $HI
bne $HI, $zero, ENDIF #skip to ENDIF when remainder != 0; same as if(n%3 == 0)
    add $s0, $s0, $t0
    addi $a0, $a0, 1
ENDIF:

When I run it in my MIPS simulator (I'm using QtSpim), I get a compiler error on the if statement.  It reads:
bne $HI, $zero, ENDIF #skip to ENDIF when remainder != 0; same as if(n%3 == 0)
     ^

What is wrong with the statement, exactly?  I can see that the ^ is under $HI.  Is something wrong with my div statement, causing the error in $HI? Or can $HI not be used in a branch like that? Will I need to move $HI into a temporary register?  Or is something wrong with the branch statement anyway?
Thanks for the help!
Answer: Yes, you need to move $HI into a register (MIPS branch instructions compare registers).
Answer: You can't access the HI register directly, use mfhi to get the value in it.
#Let t0 = n
#Let s0 = sum
#Let a0 = added
#All have been set earlier in the program

addi $t1, $zero, 3    #Let t1 = 3 for division
div $t0, $t1          #Remainder will be stored in $HI
mfhi $t2          #Store the value from $HI in $t0
bne $t2, $zero, ENDIF #skip to ENDIF when remainder != 0; same as if(n%3 == 0)
    add $s0, $s0, $t0
    addi $a0, $a0, 1
ENDIF:


Subpanel main circuit breaker trip but not the smaller branch circuit breakers

Question: I have a problem with my 100 amp sub panel in my garage. I'm using only one 40 amp branch circuit to power a service unit to charge my Nissan Leaf. The service unit is connected to the 40 amp breaker through a NEMA 10-50 socket over 8 gauge wire. I charge the car every night for about three to four hours. Occasionally the main, 100 amp, circuit breaker in the sub panel will trip during the charge period, it happens once every five to seven days, but the 40 amp branch breaker never trips. There are no other circuits in the sub panel. There's a couple extra circuit breakers installed in the panel but there's nothing connected to them and they are switched off. What's the mostly likely reason for this to be happening and what are some steps to resolve it? Thanks.
Comment: Is it a simple circuit breaker or GFCI/AFCI(one with test button)?  Picture of the sub panel will help also.
Comment: Is the breaker warm when it trips? Can you plug the car in during the day and get this to happen with you around when the breaker trips?
Comment: it's a simple breaker, not a GFCI, photo is available here, https://photos.app.goo.gl/PsRRVBkpf4Xkaif4A. I just noticed that after about 30 minutes of charging, the 100 amp breaker is very hot. too hot to touch for more than an instant. The 40 amp breaker is warm but easily bearable.
Comment: I'd say that if you're charging an EV, then the 40A breaker being warm is probably to be expected and likely normal.  If the 40A charger is truly the only thing going through that 100A breaker, then if everything is good, it probably shouldn't get even slightly warm to the touch.  Do you have the ability to take the cover off your breaker panel so we can see the inside wiring?  That might help to see what's going on and offer more advice.  I'm not familiar with the Leaf and what it can report - do you have any way to see how much power it says it's consuming while charging?
Answer: Bad connection to the 100A breaker
The position of the 100A breaker in the panel, and the fact it's tripping on thermal overload while the 40A breaker isn't budging, is telling me that one of the connections to the 100A breaker has gone bad.  Hopefully, this can be fixed fairly simply by undoing the faulty connection, cutting off the heat-damaged section of wire, and redoing the connection properly with a torque wrench to set the lug screw to its specification torque.
However, if this has been happening for a while, then the breaker lug is most likely shot, which means that the breaker itself needs replacing.  Luckily, QOM100VH breakers are readily available, presuming your subpanel is 100A or 125A, which a 12-space Homeline panel is likely to be.
Comment: I think that was it. I pulled the cover off the panel and checked the connections between the 100 amp breaker and the two bus bars. Both were not even snugged down, much less torqued-down. I removed the breaker and there was some heavy burn marks on one of the two connections. I then scrubbed everything clean with some fine sandpaper and reinstalled it all. Now, the car has been charging for over an hour and the 100 amp breaker is as cool as a cucumber and the 40 amp is so lightly warm it's hardly noticeable.  I think all is good now. Thanks!
Comment: @EdR. where precisely were the burn marks? the sandpaper job probably damaged the plating on the lug, so while it's holding together for now, I'd get a replacement main breaker for the subpanel on order
Comment: Thanks for the tip. The burn marks were primarily on the lug of the breaker that attaches to the bus bar. They were minimal on the bus bar itself.
Answer: Concluding from the comment, that the big breaker is very hot, hotter then the smaller breaker, there are 2 possibilities left:

The breaker itself is defect, i.e. the switching contacts have a too-high resistance.
The connection resistance of the wires of the big breaker are too high. F.e., the bolds/screws need a re-tightening, and/or some oxyde layers have been developed in the garage (outdoor) conditions (which may have also affected the switching contacts of the breaker).

In both cases, the thermal system in the breaker (bimetal) gets above the limit after some time, since heat will easily move in copper or aluminum wires.
In order to have an exact evidence by values, some measurements could be made.
Here the voltage at the downstream side of the big 100A and small 40A breaker is very interesting:

case A if the car is charged, test point downstream the 100A breaker
case B if the car is charged, test point downstream the 40A breaker
case C  if no power  is consumed via the 100A breaker, test point anywhere
downstream the 100A or 40A breaker, or upstream the 100A breaker.

The measurements case A and B should be done after the car has been loaded for a while.
Those 3 values will show if the small breaker does also need some maintenance.


MSE Virus removal

Question: I downloaded MSE and finally detected all the problems none of the antivirus programs would ... turns out I had 29 exploit viruses and 5 trojans thanks to a program I downloaded a while back ... most of it pertains to Java and I haven't been able to goof off on the computer like i enjoy. I'm sure I know how to fix the problem, but the removal of the viruses is take a long time. I'm going into my 3rd day of waiting for them to be removed. Do I need to be nervous or just sit back and let it do what it does?
Comment: I cannot believe that it takes 3 days. I wouldn't be nervous but I would cancel and try again.
Answer: You computer was probably too infected to deem safe anymore. The removal should defiantly not take that long and since you have been infected so long you probably have a rootkit.
Per Microsoft's recommendation for major malware infections:

Once you've identified a rootkit on your system, the remediation
  options are somewhat limited. Because rootkits can hide themselves,
  you may not know how long they've been on the system. You also may not
  know what information the rootkits have compromised. The best reaction
  to an identified rootkit is to wipe and reinstall the system. Although
  drastic, this is the only proven method to completely remove rootkits.
Comment: I'd add that these days, once you have a confirmed malware infection odds are good enough that the infection brought a rootkit along for the ride to warrant jumping right to the wipe/reinstall phase. The risk of an unknown keylogger/credential stealer remaining behind are too great.
Comment: @JoelCoehoorn Malware is vicious these days.
Answer: I would try a couple things - first, make sure that your virus definitions are up to date, reboot into Safe Mode and re-run MSE.  Then, reboot normally, download ComboFix, and run it, as it seems to handle rootkits very well.
If after that, things still do not seem right, download a bootable, updateable antivirus live cd, like BitDefender Rescue CD with auto-update, boot to it, and re-scan your system.
Worst case scenario, wipe your machine, restore your system, and start over. This, of course, may be the healthy option as your machine may never run the same again once infected.
Comment: On a system with known infections you should only run malware scans from  well defined clean environments. So just skip the first steps and start with a live CD. Since there will still be a risk remaining, just reinstalling/restoring from a clean backup is the only reliable solution.

MSE Virus removal


CakePHP 2.x: Embedding a login form as an element using CakeDC's User plugin and Security component

Question: newish CakePHP user here. I haven't been able to find a solution to this issue.
I would like to embed a login form as an element in an existing page. I am using the CakeDC user plugin. The goal is to embed the login form in the page and then, when they log in, update some content on the page without refreshing the page. Before we get to worrying about AJAX and SecurityComponent, I would like to at least get the form embedded on some other page as an element.
For starters, I tried to straight up copy and paste the contents of '/Views/Users/login.ctp' into the element. This gave me an warning of 'undefined variable "$Model"', so I hardcoded the model as 'Users.User" (because I assumed that the notation for accessing a model inside a plugin was 'plugin.model' like they said in the manual). This failed with the error message Error: Users.usersController could not be found.
So, I adjusted the form to take 'User' as the model instead of $model and the request now gets blackholed. If I disable the security component, I can log in successfully. This isn't quite a satisfactory solution (I mean, I could opt to not validate the form or define 'login' as an unlocked action, but if I do that, then I may as well not have security enabled for login, right?).
Here is the code for app/Plugin/Users/View/Elements/login.ctp:

<?php echo __d('users', 'Login'); ?>

<fieldset>
    <?php
        echo $this->Form->create('User', array(
            'action' => 'login',
            'id' => 'LoginForm'));
        echo $this->Form->input('User.email', array(
            'label' => __d('users', 'Email')));
        echo $this->Form->input('User.password',  array(
            'label' => __d('users', 'Password')));

        echo '
' . __d('users', 'Remember Me') . $this->Form->checkbox('remember_me') . '
';
        echo '
' . $this->Html->link(__d('users', 'I forgot my password'), array('action' => 'reset_password')) . '
';

        echo $this->Form->end(__d('users', 'Submit'));
    ?>
</fieldset>

Following is the code for the View that is calling the element:

<?php echo $this->element('Users.login'); ?>

If I copy and paste the element code into a View (say, in apps/Plugin/Users/View/Users/login.ctp), it works regardless of whether Security is on or off, so I suspect some monkeying around with the form or Security calls is in order.
Any ideas or help would be greatly appreciated.
Answer: I think the problem is that elements are essentially dumb views - they aren't meant to know about models.  You'll have to pass the data in yourself.
I usually put $this->set("authUser", $this->Auth->user()); in my AppController after setting up auth, this lets me check the data on the currently logged in user anywhere, including elements.
You can also pass data directly like so:
<?php echo $this->element("Users.login", array("user"=>$user));?>
Also, I'm not quit clear on your wording there, but login should be an unlocked action, otherwise how will users first log on?


How do you summon a zombie on a zombie horse?

Question: What is the command to summon a zombie on a zombie horse?
Comment: What have you tried so far?
Answer: There is no single command to accomplish this task in Bedrock Edition 1. However, with that in mind, it can be done with multiple commands.
Note: This answer assumes you're aware of how the summon and ride commands work.

Summoning Jockeys
The summon command can only be used to summon specific jockeys 1 which does not include a zombie jockey:

Only some jockeys can be summoned via commands: Skeleton Trap and a Ravager being rode by an Evoker, Pillager or a Vindicator.

Note: This quote has been paraphrased for the sake of brevity. For more complete information, please check the wiki article on summoning jockeys.
Break it Down
To accomplish your desired result, you'll need to summon a zombie horse, followed by a zombie, then finally execute a ride command targeted at the two:
summon zombie_horse
summon zombie
ride @e[type=zombie,r=5] start_riding @e[type=zombie_horse,r=5] teleport_rider

1: As of 20 SEP 2021.
Answer: Im sorry but this doesn't work in bedrock edition. In Java it would be /summon zombie_horse ~ ~1 ~ {Passengers:[{id:zombie}]} but you can't use this command in bedrock.
See this links for more:

Reddit/using Java commands in bedrock
Minecraft Fandom/summon jockeys
Minecraft command generators

Again I'm sorry that there is no way to do this but I hope, I could help you with the links
If you find an answer please create an answer and describe you way you did it to help others.
Anyway, if my answer is useful for you, please mark this answer as accepted

Have a great day!
Answer: In mcpe jockeys are created through events with /summon or /event(check wiki for advanced and updated help, but just put it after the entity specifier) , as these events only allow for vanilla jockeys this can't exist. I will update if find an addon solution or if this is changed
Comment: Welcome to the Arqade! I'm not sure what pocket edition has to do with the author's question since they only explicitly point out that they're using [tag:minecraft-bedrock-edition]. I recommend removal of that reference, and perhaps try adding details about the commands you mention to improve your post for future readers.


Is there a Base58 encoder function that runs in pure javascript without node?

Question: I see a lot of JavaScript Base58 encoder functions online, but all of them seem to require node.  Is there a simple JavaScript Base58 encoder that will just run in the browser without any node installation or modification?
Answer: Here's a pure javascript base58 encoder fuction I helped put together. Included are some comments that helped me understand what is going on beyond the barebones functions you can find elsewhere.
<code>function encode_b58(hex_number) {
    // Set of base58 chars (Note: there is no '0','O','I' or 'l').
    const base58 = [1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
    //Take input string of hexadecimal bytes and convert it to a base 10
    //decimal number. BigInt needed as regular JS numbers don't represent enough significant digits.
    var num = BigInt('0x' + hex_number);
    //Our very large number will be repeatedly divided by 58.
    const fifty8 = BigInt(58);
    //The remainder of this division will be a number (0-57).
    var remainder;
    //Each remainder's value maps to a character in our base58 array, and
    //the string of these characters becomes our Base58 encoded output.
    var b58_encoded_buffer = '';
    //We move from: Hex Bytes -> Decimal Number -> Base58 Encoded string.
    //To move through each place value of a base58 number, we continue to
    //divide by 58, until the integer number rounds down to 0.
    while (num > 0) {
        //The modulus operator returns our remainder, which depends on
        //the least significant digit in our BigInt converted input.
        //For example: if we were doing modulo 2 division, all odd
        //numbers - regardless of how long they are - would return a
        //remainder of 1, because the least significant digit is odd.
        remainder = num % fifty8;

        //Thus, we're encoding the right most (lowest place value)
        //digits first, and so each subsequently encoded character
        //needs to be added to the left of our encoded buffer
        //so that the beginning & end of our input string/bytes aligns
        //with the beginning & end of our Base58 encoded output.
        b58_encoded_buffer = base58[remainder] + b58_encoded_buffer;

        //Dividing by 58 gives us our quotient (rounded down to the
        //nearest integer), and moves us over one base58 place value,
        //ready for the next round of b58 division/mapping/encoding.
        num = num/BigInt(58);
    }

    //When we convert our byte-based hex input into a base 10 number, we
    //lose the leading zero bytes in the converted decimal number.
    //For example, if our hex input converted into the decimal number
    //000017, this number would be reduced automatically to 17 in base10,
    //and so we'd lose the leading zeros, which aren't important
    //when doing base 10 math, but are important in preserving the
    //information held in our original input value. So, in order to not
    //lose the leading zeros, we count them, and then prepend them (as
    //1's, which is their corresponding base58 value) to the beginning
    //of our Base58 encoded output string.
    while ( hex_number.match(/^00/) ){
        //For each leading zero byte, add a '1' to the encoded output.
        b58_encoded_buffer = '1' + b58_encoded_buffer;
        //And remove the leading zero byte, and test for another.
        hex_number = hex_number.substring(2);
    }

    return b58_encoded_buffer;
}
</code>


Are Jews allowed to deliver for food delivery apps?

Question: Since it's forbidden to derive benefit from milk and meat, does that mean it's also forbidden to make a living as a doordash driver who has to deliver things like mcdonalds?
Comment: R. Aryeh Lebowitz discussed this a couple years back: [From The Rabbi's Desk - Staying at a Wake, Uber Eats](https://www.yutorah.org/lectures/lecture.cfm/885926).
Comment: related https://judaism.stackexchange.com/questions/23277/working-in-a-non-kosher-yogurt-store/23295#23295
Comment: Apparently if that was a correct sevara, it would also be prohibited to work for McDonald's in any capacity, e.g. as a business manager?
Comment: @TheGRAPKE I think that was the premise of the question. If I'm not mistaken it's a correct one.
Comment: @robev I have no idea, to be honest :-)
Comment: Are you asking in area where the majority of residents are Jews or non-Jews?
Comment: Hi OB7DEV! Please CYLOR, for [many reasons](https://judaism.stackexchange.com/questions/9146/why-is-it-necessary-to-ask-a-rabbi). ❧ A.) How long have you been doing food deliveries? When you started, were you religious? ❧ B.) If you stopped doing food deliveries, would you lose your income? If so, how could you survive? Is there some other sort of work which you're trained and able to do?
Comment: its a side gig, I have another job as my main.
the area is mostly non-jews
Answer: You should ask your Rabbi for a final ruling on this matter. For those wondering what potential issues there might be, and angles for leniency, @Alex posted that Rav Aryeh Lebowitz has a lecture on this exact topic. He discussed the issue with Rav Herschel Schachter, and provided four potential issues, and why they're okay.
The following is just a summary of what he said, and not necessarily an implicit agreement to the arguments provided:

Lifnei Iver - Causing another Jew to stumble. This isn't an issue as it's only a Torah prohibition if the Jew couldn't commit the transgression without you. It's very likely someone else will deliver the food if you don't. There is however a Rabbinic prohibition anyways. Here it would be fine, as the Shach holds there's no Rabbinic prohibition if the Jew doesn't observe any mitzvos whatsoever. We can assume someone ordering non-kosher food isn't a frum Jew with a momentary lapse in observance. Rather, it must be someone, even if Jewish, who isn't observant.

Mar'is Ayin - Doing something that looks prohibited. Walking into a non-kosher establishment could look  like  you're eating the food there. This isn't a problem nowadays because people would assume you're using the bathroom or getting a drink. Coming out of the store also looks bad, as people see you have their merchandise. However, if you look like a delivery person (you have an uniform/badge/hat that says so, or the establishment clearly displays they use food delivery apps) people won't assume you bought it for yourself.

Business activities with prohibited foods. There's a prohibition (debated if Biblical or Rabbinic) against conducting business with prohibited foods. Rav Herschel Schachter said that delivering food that isn't kosher isn't considered conducting business. The restaurant is; you're just transporting it.

Getting any benefit from milk and meat. This is the biggest issue, as the Mishnah in Avodah Zara explicitly prohibits receiving pay to deliver idolatrous wine, as it's something from which benefit is prohibited. The same should be true here, as milk and meat is also prohibited from benefit. First he suggested maybe it's not Biblically prohibited milk and meat, as the meat wasn't slaughtered properly (neveilah). Rabbinically prohibited milk and meat is permissible to benefit from (Shulchan Aruch Yoreh Deah 87:3; Rema ad. loc. § 1). However, he said the halacha is that even neveilah cooked with milk is prohibited from benefit. Then he suggested that a cheeseburger isn't milk and meat cooked together, as the meat is cooked separately. However, since the meat is probably hot when they put the cheese on it (and it's a davar gush), it's halachically considered cooked together. Also, steak cooked with butter would obviously be an issue. Nevertheless, Rav Herschel Schacter said here it is permitted, as this isn't considered getting paid to deliver milk and meat. You're being paid for delivering the order. No matter what's in the order, you're paid the same amount. Whether it's a $1000 order or a $5 order. So it's not called benefiting from milk and meat.

He concluded that there really should be other job opportunities out there. This isn't necessarily the best job for a frum Jew to take, but would be permissible if necessary.
Comment: @bluejayke 1) that's a machlokes rishonim, so not necessarily, but most importantly 2) Rema in Yoreh Deah 87:1 says rabbinically forbidden milk and meat is permitted to benefit from. I'll add this to avoid confusion.
Comment: thank you robev, I wish I could award you the bounty but it expired a few days ago.  I appreciate your thorough answer none the less.  Your answer here is really good and really appreciated. Shalom.
Comment: "First he suggested maybe it's not Biblically prohibited milk and meat, as the meat wasn't slaughtered properly (neveilah)" so what? its a biblical mitzvah to listen to rabbinic mitzvos, why is this even mentioned?


A problem about $e^{2\pi i \alpha_1}+e^{2\pi i \alpha_2}+\cdots+e^{2\pi i \alpha_N}=0$

Question: Let $\alpha_i\in [0,1),\; i\in \{1,\cdots,N\}$ for some positive integer $N$, such that
$$e^{2\pi i \alpha_1}+e^{2\pi i \alpha_2}+\cdots+e^{2\pi i \alpha_N}=0$$
and if for any non-empty proper subset $E\subset \{1,\cdots,N\}$ satisfy $\sum_{k\in E}e^{2\pi i\alpha_{k}}\neq 0$, then $N$ be a prime number, and $\{\alpha_i: i\in \{1,\cdots,N\}\}=\rho+\{\frac{i}{N}:i\in\{0,\cdots,N-1\}\}$  for some $\rho \in [0,1)$.
Comment: Of course, I also thought about this from N -sided polygon, but it is not easy to see the answer. What more, if $\alpha_i \in \mathbb{Q}$(rational number), from [H. B. Mann, On linears relations between roots of unity, Mathematika 12 (1965),107–117.], we have the proof.
Comment: Fixed the spelling of "problem" in your title; nice question, ***+1!***
Comment: There's a geometric way to think about your hypotheses:  each unit complex number is a unit length vector in the plane.  The sum of the vectors being zero is saying that they form the sides of an $N$-sided polygon.  Can you translate the hypotheses about proper subsets into this geometric language?
Comment: This is essentially a duplicate of http://math.stackexchange.com/questions/480008/zero-sum-of-roots-of-unity-decomposition, though the equivalence is not so immediate that I voted to close.
Comment: @ErickWong The big difference is that, in this question, the $\alpha_i$ are simply real, whereas in that question they are rational. According to the OP's comment here, Mann answered the rational case, so perhaps the OP should go leave an answer there.
Comment: @DavidSpeyer Now I'm confused, doesn't the answer to the other question give a counterexample in the rational case, making the other question stronger?  Ah, I see that Mann's result allows for negative coefficients (the cancellation exploited by mercio's counterexample to reduce the number of non-zero terms).  So it doesn't apply to this question.
Answer: No, this is false. For $N=5$, there are many other solutions. Heuristic reasoning: There are $5$ angles, and the condition they impose is a codimension two condition. Thus, we expect the solutions to the problem to form a three-dimensional set. However, for each way of dividing the $5$ angles into a pair $D$ and a triple $T$, there is only a $2$ dimensional space of ways to have $\sum_{i \in D} \alpha_i = \sum_{i \in T} \alpha_i = 0$. Also, there is only a one-dimensional space of ways to have a rotation of a pentagon. We expect there to be lots of points in a three-dimensional set which are not in finitely many one- and two-dimensional sets.
To give an explicit example, in the picture below, choose $\pi/3 < x < \pi/2$ and $x \neq 2 \pi/5$ and take $y = \cos^{-1}(1/2+\cos x)$, to get an equilateral pentagon which is not regular and no subset of whose sides add up to zero.
Answer: Your conjecture is false, see mercio's answer here for a 6-term counterexample with all $\alpha_i$ rational:
$$\alpha_1 = \frac{3}{30},\quad \alpha_2 = \frac9{30},\quad \alpha_3 = \frac{10}{30},\quad \alpha_4 = \frac{20}{30},\quad \alpha_5 = \frac{21}{30},\quad \alpha_6 = \frac{27}{30}.$$
I believe there's no non-trivial proper subset of these which sums to zero (if there were, then it would decompose into regular polygons).  However, it is composed of sums and differences of regular polygons, so it does not contradict Mann's result cited in the comments.


Number of Hospitals in the US with emergency departments

Question: How many US hospitals have emergency departments?
Answer: Hospital General Information
General information & quality ratings for almost all US hospitals
This file contains general information about all hospitals that have been registered with Medicare, including their addresses, type of hospital, and ownership structure. It also contains information about the quality of each hospital, in the form of an overall rating (1-5, where 5 is the best possible rating & 1 is the worst), and whether the hospital scored above, same as, or below the national average for a variety of measures.
This data was updated by CMS on July 25, 2017. CMS' overall rating includes 60 of the 100 measures for which data is collected & reported on the Hospital Compare website. Each of the measures has different collection/reporting dates, so it is impossible to specify exactly which time period this dataset covers.
For more information about the timeframes for each measure
For more information about the data itself, APIs and a variety of formats
The below links might be helpful

DATA.GOV
This database contains locations of Hospitals for 50 states and Washington D.C. , Puerto Rico and US territories. The dataset only includes hospital facilities and does not include nursing homes.

DATA.Medicare.Gov

HealthData.gov


Can I create a common domain user and associate it with other domain users?

Question: I need a common domain user that can be used by multiple people. These people have their own domain user accounts. They should be able to login to a machine using the common domain user account, but at the same time their original identity should also get logged/authenticated. This is something like a group. But i need it to be a user so that when they login to a machine, separate user profiles are not created for each of them. Is it possible to achieve this in some way?
Answer: First, a common login is not a great security idea, but I do realize that some companies user them. If they do log in as that common user, short of a security camera, or file monitoring software, you are not going know who logged in...To a computer and domain, they ARE that common domain account.
A better idea is just to have them log in with their domain accounts to that computer, and if you need to set up a common set of programs, just make sure they are copied to the default user before the users log in for the first time, so they get those settings.


"Easy looking" indefinite integral to be performed

Question: In my work, I am confronted with the following indefinite integral, which looks like it should be performed easily, although I (nor Maple) can find it. I would appreciate any help finding it explicitly.
$$
\int{\left(1-\frac{1}{x}\right)}^p\,{\rm{d}}x,
$$
where $p$ is a real number, and where we consider $x<0$.
Comment: What is the domain of x? If x >1, then 1-1/x <0, which means that raising it to a non-integer power gets very messy.
Comment: For what it's worth, applying the substitution $u = 1 - \frac 1x$ lets us rewrite this integral as
$$
\int \frac{u^p}{(1-u)^2}\,du
$$
Comment: This integral leads to a hypergeometric series
Comment: It doesn't look easy.
Comment: To @Acccumulation, I added that I am interested to $x<0$.
Comment: To @YvesDaoust : oui tu as raison. It just looked easy the very first time I looked at it.
Comment: Term by term integration of power series.
Answer: For positive integer $p$,
$$\int\left(1-x^{-1}\right)^pdx=\sum_{k=0}^p\int\binom pk(-x)^{-k}dx=x-p\log x+\sum_{k=2}^p\binom pk\frac{(-x)^{1-k}}{k-1}$$
which doesn't seem to have a simpler form.
For fractional $p$, you will obtain an infinite series by means of the generalized binomial theorem.
Answer: Call the integral $J$.  The substitution $s = 1/x$ gives you
$$ J = - \int (1-s)^p s^{-2}\; ds $$
For $0 < |s| < 1$ the integrand has the binomial series expansion
$$ \sum_{k=0}^\infty {p \choose k} (-1)^k s^{k-2} $$
We integrate the $k=0$ and $k=1$ terms separately, and obtain
$$ \eqalign{J &= \frac{1}{s} + p \ln(s) + \sum_{k=2}^\infty (-1)^{k+1} {p \choose k} \frac{s^{k-1}}{k-1} + c\cr
&= \frac{1}{s} + p \ln(s) -{p\choose 2}s\; {\mbox{$_3$F$_2$}(1,1,2-p;\,2,3;\,s)} +c }$$
where ${}_3F_2$ is a generalized hypergeometric function.


Dynamically load SWF file with Java

Question: I want to load SWF file dynamically in my webpage. But I don't know how to do it. Is it possible to load SWF from back-end? In this website Insert SWF into html page I found a way to load SWF, but it is static. I have a database where I will store the paths of the SWF files and load those files dynamically. Is there any way to dynamically change the source of the swf object [ "EMBED SRC="file.swf" ]?
Any information will be very helpful to me. Thank you.
Comment: Are you just hosting static html pages on their own or is there some actual Java involved here somewhere?
Comment: I guess you actually want to use JavaScript to do that. Using Java would probably be overkill.
Answer: Though I have no personal experience using Wicket, but here's how I understood it should go. Use the AttributeModifier to change the value of the value attribute of the param tag and the src attribute of the movie tag. You also need to give them the Wicket id's on the HTML template to be able to refer them from the Java code. In general the HTML template would look something like this:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  width="300" height="170"
  codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
  <param wicket:id="swfReference1" name="movie" value="" />
  <param name="quality" value="high" />
  <param name="bgcolor" value="#000000" />
  <param name="allowScriptAccess" value="always" />
  <embed wicket:id="swfReference2" src="" quality="high" bgcolor="#000000"
    width="300" height="170" align="middle"
    play="true"
    loop="false"
    allowScriptAccess="always"
    type="application/x-shockwave-flash"
    pluginspage="http://www.adobe.com/go/getflashplayer">
  </embed>
</object>
...

You could also do it on JavaScript level to be even more dynamic by using for instance jQuery to switch the SWF sources. Here's a working example.
$('param[name=movie]').attr('value', 'https://demo.adobe.com/Home.swf');
$('embed').attr('src', 'https://demo.adobe.com/Home.swf');

Comment: I am designing the webpage by Wicket. Is this supported in Wicket?
Comment: I guess the JavaScript example would work as is. I modified the Java example to take Wicket into account since it has its own templating system. Depending on your use-case, I'd also consider using just JavaScript to change the SWF and avoid the page load.
Comment: Thank you for your suggestion. I will try and let you know.

Dynamically load SWF file with Java


Pipelight flash plugin installation doesnt work with 16.04

Question: I have recently installed 16.04 as a replacement for a 14.04.
Reinstalling flash plugin with pipelight, I have followed the french ubuntu page for installing pipelight. Everything seems to work fine except when at the end I go on the about:addons page from mozilla, I do not see shockwave, Cisco H264 is the only addon installed...
I have redone the all procedure twice, same issue.
Any hint?
Answer: With Mozilla/firefox closed, run the following command:
sudo pipelight-plugin --create-mozilla-plugins

Open Mozilla and check about:plugins: it should now be listed.
You will probably have to do this every time the plugins are updated.


IC can light with holes

Question: I was sealing around air leaks in the attic and realized one can light had holes in it. My impression was that means the can was not IC compliant. I took the trim off and it does say IC on the sticker. Is it normal to have holes in these cans?
Comment: Yes. They dissipate heat.
Answer: Yes it's normal.
The holes do not go all the way through but to a space that is covered by another can that does not have holes and can be in contact with the insulation.
Just in case there is also a thermal safety switch within the fixture that automatically turns off the light when too much heat from the bulb has been trapped and the temperature to rise to a certain point. Once the fixture has cooled, the switch turns the light back on again.

IC can light with holes


charging circuit for Lithium Ion Battery

Question: I am going to prepare a 12v battery using 3 18650 Lithium Ion batteries in series.
As i am new to these batteries, i read some articles about it. But I'm not clear in charging it.
Suggest me the correct circuit for charging 3S 18650 battery pack.
Answer: You need to manage the charge balancing between the individual cells. Different cells will have (slightly) different capacities, and different self-discharge rates. Unless managed, the state of charge of all cells will not remain matched and will drift apart. If you do not manage this, ultimately, when charging the pack, some cells will become dangerously overcharged, while others will not be fully charged. Similarly, on discharge, some may become over discharged.
It is imperative to use a battery management system to avoid these issues. This will maintain the same state of charge on all cells in the pack. As an alternative, consider connecting the cells in parallel, and using a DC/DC converter to deliver the 12 V you need.
Comment: How to manage the charging of cells? Is there any circuit for it?
Answer: You should consider what you are powering and the voltage range it requires. A 3S battery will be only 9V when drained (3v) whereas a 4S lithium will be 12v.  A fully charged cell is 4.2 volts so if you're using 3 in series you should charge to 12.6 volts
Voltage sag or drop should also be considered. Some cells will drop considerably especially if you're using repurposed laptop cells. You should also have a BMS  (battery management system) to balance the individual cells. The BMS can also protect against over discharge and over current.