Correct vector space of eigenkets of angular momentum

Question: When we say an particle is in the state:
\begin{equation}
|l,m\rangle,
\end{equation}
what is the underlying state space, as a vector space? Is it a tensor product vector space, of dimension:
\begin{equation}
l\times(2l+1)\ ?
\end{equation}
How can I find the matrix representation of the angular momentum operators that act on the $2l+1$ vector space in that tensor product? I am used to angular momentum operators taking the form of a cross-product:
\begin{equation}
x_ip_j - p_ix_j,
\end{equation}
but can we still do that for the $2l+1$ dimensional space corresponding to $m$?
Comment: I don't believe it is a tensor product space. The states with a certain $l$ are $2l+1$-fold degenerate, so in this case I don't think $|l,m\rangle$ is shorthand for $|l\rangle\otimes|m\rangle$, but rather a convenient way of representing the $2l+1$ possible different eigenstates for each $l$.
Comment: As for finding matrix elements, $L_z$ and $L^2$ should be easy since they are diagonal in the $|l,m\rangle$ basis. As for $L_x$ and $L_y$, try expressing those in terms of the ladder operators $L_{\pm}$, whose action you know on the $|l,m\rangle$
Comment: $|l,m\rangle$ is normally for the eigenvectors of one of the angular momentum components operators and the total angular momentum operator. It does not refer to the Hydrogen Atoms eigenfunctions. The radial part and with that the Coulomb potential is missing. Still would like to know if you can write them as tensor prod. though.
Comment: pindakaas - thanks - I'm just learning QM, and angular momentum turns out to be very hard for me. No doubt am I making errors :-) I should probably edit the title. What would you suggest?
Answer: For orbital angular momentum, indeed, $L = x\times p$ even as a quantum operator, see this question.
When writing a ket $\lvert l,m \rangle$, this is meant to live in the $2l+1$-dimensional space $\mathcal{H}_l = \mathbb{C}^{2l+1}$ on which the representation of the angular momentum algebra labelled by $l$ exists ($m$ is the eigenvalue of the ket for $L_z$). The total space of (bound) states for your system is then the infinite sum of these spaces for all possible $l$, i.e.
$$ \mathcal{H} = \bigoplus_l \mathcal{H}_l$$
Comment: Except, that if you go to high in energy, there won't be any bound state anymore - so the sum is not really infinite in practice :-) Thanks ACuriousMind, that's precisely the answer I was looking for.
Answer: My understanding of this limited, but this might help (too long for a comment):
The state space is spanned by the set of simultaneous eigenstates of the Hamiltonian, $ \hat L^2$, and $ L_z $. In fact, they form an orthonormal basis of a Hilbert space $ H $ which is the state space.
Out of convenience, we denote the eigenstates by the quantum numbers, indexing them with $ n, \ell$ and $m $ which correspond (though are not equal to) their respective eigenvalues for each of the operators.
I suppose that a state with only $\ell$ and $ m $ specified lies in the subspace of $ H $ with an orthonormal basis equal to the set of simultaneous eigenstates with those quantum numbers.


Was that frog thing outside Jabba's Palace that eats an animal and burps in the original Return of the Jedi?

Question: I just noticed it for the first time when I watched the re-release. I tried looking it up and I've heard it called "worrt," "sevorrt," and "frog-dog." (I'm pretty sure its a worrt, but I'm not sure. A frog-dog is seen shortly before inside Jabba's palace near the Rancor pit trap door, if I'm not mistaken).Was it in the original film, and did it just get some CGI edits to make it more noticeable, or was it added later? If so, this looks like a prelude to Jar Jar. Could someone also tell me exactly what it is?
Answer: It was in the original
As you said, this is a worrt.

Worrts are brown, chuba-like creatures with toothy mouths that made
  their home in the desert wastelands of Tatooine. They would use their
  long tongues to capture unsuspecting prey as it passed, mostly insects
  and rodents. Perhaps the most notable worrt in the galaxy lived on the
  road to Jabba's Palace in the Dune Sea.

It was in the original, and was not CGI.
According to the Star Wars Databank:

The worrt was a puppet, like many of the creatures seen at Jabba's
  palace in Return of the Jedi. Its production nickname is simply "road
  creature."

Here's a picture of the worrt puppet, from someone who seems to have attended a prop show.
Comment: Just curious though, was this for comic relief, or was it just a distraction factor to make that sequence less boring? What I mean by that is, the film is slow moving and inside Jabba's palace for a long time. Was this to make that part of the film less boring by giving a glimpse out side of the main set, e.g. "squirrel scene?"
Comment: @JakeSagier - I don't really know.


How can I have different Emacs sessions loaded on different Emacs windows while using Emacs on daemon mode?

Question: I'm currently using Emacs on daemon mode. I save my sessions using the desktop package. I also combine that with this in order to have several named sessions saved. If I have several Emacs windows open they all open up in the same session and if I switch to another session all the Emacs windows switch to the same session. I would like to be able to have different session in different Windows. How can this be done?
Answer: from the emacs info documentation:
<code>You can run multiple Emacs servers on the same machine by giving
each one a unique "server name", using the variable `server-name'.  For
example, `M-x set-variable <RET> server-name <RET> foo <RET>' sets the
server name to `foo'.  The `emacsclient' program can specify a server by
name, using the `-s' option.
</code>
Does this help?
Comment: It sure works for me.
Comment: Note: when you set the server-name, the new name must be in quotes.
Comment: It did not work for me at first. I thought I was running in server mode, it was behaving like it was, I used emacsclient to connect. But going to `customise emacs -> top level -> external -> server -> server mode` and switching it on, did the trick.


Apple push notification with php

Question: Hi i have a PHP script to send push notifications to devices through apple push notification server. I want to know is there any way of setting apple push notification with a certain time that apple sends the push notification to device when the time happens.
Thanks.
Answer: No. The notification will be pushed to the device as soon as possible. You can see all the possible parameters you can send here. If you want to schedule it for a certain time, you'll have to do that on your server and push it to Apple at that time.

Apple push notification with php


What control circuit element will control an ESC while doing bench testing?

Question: While doing bench testing of motor and prop combinations what simple device would I use in the circuit to properly control the ESC for the full range of power from 0% to 100% ?
I have seen a few videos where bench testing is demonstrated to measure the thrust and power usage of a brushless motor and propeller. Typically the control of the ESC is done with a very small device attached to the ESC? What is that device? (I find it hard to believe it as simple as a rheostat, or is it?)
Comment: what input does the ESC expect?
Comment: I expect the input signal for all ESCs used to control the speed of the motor on multirotors is a PWM.
Answer: To Control an ESC, or rather, give a control signal, one generally uses some kind of micro controller (arduino, esp32, Ti c2000, STM, countless others) with a ESC dependent control signal. The mcus themselves don't have to be large, they simply need to be able to provide a signal usually at 5v, which is trivial for them.
Some (most) of them require a PWM signal, such as the escons

The ESCON Module 24/2 is a small-sized, powerful 4-quadrant PWM OEM servo controller for the highly efficient control of permanent magnet-activated brushed DC motors and brushless EC motors up to approximately 48 Watts.

Others like the espos are controlled over a communcations protocol such as CAN.

The EPOS4 Compact 24/1.5 CAN is a dynamic, ready-to-connect positioning controller in a compact design. Designed for use with brushed DC motors with encoders and brushless EC motors (BLDC) with Hall sensors and encoders up to 36 W / 108 W.

If you're in the professional area, and in hobby areas
Things like the turnigy
Are also done with PWM,
Here is a post on using an esc with arduino.
Answer: If your ESC uses servo-like control signals, the you want to send it a servo PWM pulse, generally at 50hz (20ms) with a pulse between 1ms (5% duty cycle) which is full reverse, and 2ms (10% duty cycle) which is full forward.  You can generate that signal with a microcontroller or a cheap servo tester.  Search amazon or aliexpress for 'serve tester' and you will find things like this, https://www.amazon.com/ICQUANZX-Aluminum-Consistency-Controler-Helicopter/dp/B081D5VHVY/ref=sr_1_6


What decides electric charge of a particle? how do particles create their own electromagnetic field?

Question: What decides electric charge of a particle? A proton has 3 quarks (up,up,down) we know that according to charge of those quarks decides the charge of proton but what decides charge of those quarks? not only quarks every particles in standard model? how do they create their own electromagnetic field? what creates their field?
Comment: Related: http://physics.stackexchange.com/q/31247/2451 , http://physics.stackexchange.com/q/33990/2451 and links therein.
Comment: It's  their coupling to the electromagnetic field that decides the charge. For example an electron has a term proportional to  $e A_\mu$ in its Lagrangian where $e$ is the charge and $A_\mu$ is the electromagnetic field.
Answer:
what decides charge of those quarks? not only quarks every particles in standard model

Nature, or "the way the cookie crumbled" when the universe appeared.
The standard model is an encapsulation of an enormous amount of data, (measurements). It describes practically all particle interactions and is very predictive, as the recent LHC experiments showed. The SU(3)xSU(2)xU(1) symmetry of the standard model is where the quarks and leptons have a niche in the representations, and is a minimal way of ordering all this plethora of data.
It is analogous to mathematical axioms. A physics theory has a number of "axioms" on which it depends, which connect the mathematics to the physical measurements. One of these "axioms" is the particle table of the standard model. More complex "particles" appear according to strict conservation laws, including charge and quantum numbers.


Custom Post Types Archives and daily/monthly joke

Question: I have created a custom post type called joke using custom post types ui plugin. I have enabled archives for that ctp. I would like to have a page that would display the daily (or monthly) joke, and also have a page that would display an archive of all previous jokes. Is it possible, and if so, can you point as to how it can be achieved?
Comment: How do you want to choose the top daily/monthly joke?

To show all your jokes, you would be best to create a template for your CPT. See here: http://codex.wordpress.org/Template_Hierarchy#Custom_Post_Types_display
Comment: for the daily joke I would choose the most recent joke published, that has a publish date of the current date...
Answer: OK, following on from my comment above, I would suggest creating a template for your Jokes archive e.g. archive-my_jokes.php (where my_jokes is the name of your CPT). You can likely copy some template content from category.php or a similar existing template file to get started.
To deal with showing the top joke, you'll need to put your code before any loop in your template.
I'd suggest using wp_get_recent_posts (see here) to call one post from your CPT.
For example:
$args = array(
    'numberposts' => 1,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'post-type' => 'my_jokes', //CPT slug here
    );

$top_jokes = wp_get_recent_posts ($args);
     foreach ($top_jokes as $top_joke) {
        //Echo what you like here
        echo $top_joke['post_title'] . '
';
        echo $top_joke['post_content'];
    }

The styling of the above output is up to you to sort out according to your theme/template/styling needs.
N.B. The reason I used a foreach loop even though you only want one post is for flexibility later if you deicde you want more.


Drill size for thermal via (and how many)

Question: Following my previous question, I'm putting via's under an SOIC-8, the thermal pad is 0.12 x 0.09". So how big a drill and how many thermal vias?  I was talking to a smart guy at work today.  And he said, lots of small holes.  'Cause I gain more copper that way.  (Better thermal conductivity.)  I was thinking maybe just two big holes, and fill them up with solder.  The thermal conductivity of solder is only ~1/10 (a bit better) that of copper.  So a big slug of solder beats a lot of thin rings of copper.  The first batch of boards will be hand soldered.  What do you think?
Answer: For hand soldering, one (or two) large holes are best as that way you can ensure that there is a good solder joint between the PCB and the thermal pad. Unless you use reflow techniques, there is no other way to ensure a good connection, and leaving the pad unsoldered can lead to poor thermal performance - think air between the chip and pad.
For production, lots of small holes are better, as you said, more area between the top and the bottom. In fact many datasheets will have recommended layouts for thermal pads which usually show lots of small holes.
What I do when hand soldering a board is usually have one large hole (as big as feasible) in the centre of the chip, and then several small vias either side to increase the amount of copper between the top and bottom. You can then feed solder into the large hole after soldering the chip on - put the soldering iron tip in the hole and then feed in the solder. This should achieve a good solder joint to the pad.
You can also add more holes either side of the chip with a large plane connecting them if more heat transfer is required.
One thing to remember though, make sure that thermals are off on the section of copper plane that is connecting these holes. Adding thermals to the vias/pads being used for heat transfer will only reduce thermal conductivity.


What is referencedColumnName used for in JPA?

Question: In JPA there is an attribute called referencedColumnName that can be set on @JoinColumn, @PrimaryKeyJoinColumn what is the idea behind this setting, can someone give a good example of where this can be used?
Answer: It is there to specify another column as the default id column of the other table, e.g. consider the following
TableA
  id int identity
  tableb_key varchar

TableB
  id int identity
  key varchar unique

// in class for TableA
@JoinColumn(name="tableb_key", referencedColumnName="key")

Answer: "referencedColumnName" property is the name of the column in the table that you are making reference with the column you are anotating. Or in a short manner: it's the column referenced in the destination table. Imagine something like this: cars and persons. One person can have many cars but one car belongs only to one person (sorry, I don't like anyone else driving my car).

 Table Person
  name char(64) primary key
  age int
Table Car
  car_registration char(32) primary key
  car_brand (char 64)
  car_model (char64)
  owner_name char(64) foreign key references Person(name)

When you implement classes you will have something like
class Person{
   ...
}

class Car{
    ...
    @ManyToOne
    @JoinColumn([column]name="owner_name", referencedColumnName="name")
    private Person owner;
}

EDIT: as @searchengine27 has commented, columnName does not exist as a field in persistence section of Java7 docs. I can't remember where I took this property from, but I remember using it, that's why I'm leaving it in my example.
Comment: eh...`columnName` is not a field of the [annotation](https://docs.oracle.com/javaee/7/api/javax/persistence/JoinColumn.html)...
Comment: @searchengine27, this answer is from more than 7 years ago... as per documentation it looks like `columnName` is not defnined in java7 spec nor java6 (this was the version I was using when answered this). So it looks like you're right
Comment: Also, with only quite a few minimal exceptions, Java (and JavaEE) are quite backwards compatible. Things are typically deprecated in favor over removal. So I wouldn't jump straight to 'it was removed' typically. Even generics in JavaSE were released in Java SE 5, and done so with backwards compatibility in mind, at the pure frustration and bewilderment of everyone who knows anything about type erasure.
Comment: Any example for OneToMany in parent table that has the JoinColumn annotation?
Comment: Sorry @firstpostcommenter but I haven't used Java for almost 10 years and can't remember anything JPA related.
Answer: Quoting API on referencedColumnName:

The name of the column referenced by this foreign key
  column.
Default (only applies if single join column is being used):
  The same name as the primary key column of the referenced table.

Q/A

Where this would be used?

When there is a composite PK in referenced table, then you need to specify column name you are referencing.
Comment: Or, in `@ManyToMany` mapping when you have a middle table.
Answer:
name attribute points to the column containing the asociation, i.e. column name of the foreign key
referencedColumnName attribute points to the related column in asociated/referenced entity, i.e. column name of the primary key

You are not required to fill the referencedColumnName if the referenced entity has single column as PK, because there is no doubt what column it references (i.e. the Address single column ID).
@ManyToOne
@JoinColumn(name="ADDR_ID")
public Address getAddress() { return address; }

However if the referenced entity has PK that spans multiple columns the order in which you specify @JoinColumn annotations has significance. It might work without the referencedColumnName specified, but that is just by luck. So you should map it like this:
@ManyToOne
@JoinColumns({
    @JoinColumn(name="ADDR_ID", referencedColumnName="ID"),
    @JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP")
})
public Address getAddress() { return address; }

or in case of ManyToMany:
@ManyToMany
@JoinTable(
    name="CUST_ADDR",
    joinColumns=
        @JoinColumn(name="CUST_ID"),
    inverseJoinColumns={
        @JoinColumn(name="ADDR_ID", referencedColumnName="ID"),
        @JoinColumn(name="ADDR_ZIP", referencedColumnName="ZIP")
    }
)

Real life example
Two queries generated by Hibernate of the same join table mapping, both without referenced column specified. Only the order of @JoinColumn annotations were changed.
/* load collection Client.emails */
select
emails0_.id_client as id1_18_1_,
emails0_.rev as rev18_1_,
emails0_.id_email as id3_1_,
email1_.id_email as id1_6_0_

from client_email emails0_
inner join email email1_ on emails0_.id_email=email1_.id_email

where emails0_.id_client='2' and
emails0_.rev='18'

/* load collection Client.emails */
select
emails0_.rev as rev18_1_,
emails0_.id_client as id2_18_1_,
emails0_.id_email as id3_1_,
email1_.id_email as id1_6_0_

from client_email emails0_
inner join email email1_ on emails0_.id_email=email1_.id_email

where emails0_.rev='2' and
emails0_.id_client='18'

We are querying a join table to get client's emails. The {2, 18} is composite ID of Client. The order of column names is determined by your order of @JoinColumn annotations. The order of both integers is always the same, probably sorted by hibernate and that's why proper alignment with join table columns is required and we can't or should rely on mapping order.
The interesting thing is the order of the integers does not match the order in which they are mapped in the entity - in that case I would expect {18, 2}. So it seems the Hibernate is sorting the column names before it use them in query. If this is true and you would order your @JoinColumn in the same way you would not need referencedColumnName, but I say this only for illustration.
Properly filled referencedColumnName attributes result in exactly same query without the ambiguity, in my case the second query (rev = 2, id_client = 18).
Answer: For a JPA 2.x example usage for the general case of two tables, with a @OneToMany unidirectional join see https://en.wikibooks.org/wiki/Java_Persistence/OneToMany#Example_of_a_JPA_2.x_unidirectional_OneToMany_relationship_annotations
Screenshot from this WikiBooks JPA article:
Example of a JPA 2.x unidirectional OneToMany relationship database


Volume of Region in 5D Space

Question: I need to find the volume of the region defined by
$$\begin{align*}
a^2+b^2+c^2+d^2&\leq1,\\
a^2+b^2+c^2+e^2&\leq1,\\
a^2+b^2+d^2+e^2&\leq1,\\
a^2+c^2+d^2+e^2&\leq1 &\text{ and }\\
b^2+c^2+d^2+e^2&\leq1.
\end{align*}$$
I don't necessarily need a full solution but any starting points would be very useful.
Comment: One might ask if there is a general formula for the volume of $n$ intersecting cylinders in $\mathbb{R}^n$, centered on the coordinate axes and having unit radius.  Asymptotics as $n \to \infty$ could also be interesting.
Comment: Nice problem.  The only problem of this type that I have seen is the old calculus puzzle (that doesn't quite require calculus) of finding the volume of intersection of cylinders. There are nice solutions for $2$ cylinders, and even $3$.
Comment: A starting point would be finding the boundary. Any 2 hypercones positioned exactly on the axes (direction vectors $e_i$, $e_j$) will have two hyperplanes of intersection, their normal vectors being $e_i + e_j$ and $e_i-e_j$. Our resulting figure will thus have $2{5 \choose 2} = 20$ intersecting hyperplanes. All 5-hypercone intersections determine the vertices of a 5D hypercube, which has 10 different 4-cells, each cell showing 8 (no. of 3-cells on a 4D cube) pieces of curved surface, each piece shown on 2 4-cells, hence 10(8)/2 = 40 disjoint curved hypersurfaces of the figure. Good luck, lol.
Comment: I mean hypercylinder, not hypercone. My brain switched them for whatever reason.
Comment: @Nate: Funny you should say that just now -- I was just adding something about that to my answer :-)
Answer: It turns out that this is much easier to do in hyperspherical coordinates. I'll deviate somewhat from convention by swapping the sines and cosines of the angles in order to get a more pleasant integration region, so the relationship between my coordinates and the Cartesian coordinates is
$$
\begin{eqnarray}
a &=& r \sin \phi_1\\
b &=& r \cos \phi_1 \sin \phi_2\\
c &=& r \cos \phi_1 \cos \phi_2 \sin \phi_3\\
d &=& r \cos \phi_1 \cos \phi_2 \cos \phi_3 \sin \phi_4\\
e &=& r \cos \phi_1 \cos \phi_2 \cos \phi_3 \cos \phi_4\;,
\end{eqnarray}
$$
and the Jacobian determinant is $r^4\cos^3\phi_1\cos^2\phi_2\cos\phi_3$. As stated in my other answer, we can impose positivity and a certain ordering on the Cartesian coordinates by symmetry, so the desired volume is $2^55!$ times the volume for positive Cartesian coordinates with $a\le b\le c\le d\le e$. This translates into the constraints $0 \le \phi_4\le \pi/4$ and $0\le\sin\phi_i\le\cos\phi_i\sin\phi_{i+1}$ for $i=1,2,3$, and the latter becomes $0\le\phi_i\le\arctan\sin\phi_{i+1}$. The boundary of the volume also takes a simple form: Because of the ordering of the coordinates, the only relevant constraint is $b^2+c^2+d^2+e^2\le1$, and this becomes $r^2\cos^2\phi_1\le1$, so $0\le r\le\sec\phi_1$. Then the volume can readily be evaluated with a little help from our electronic friends:
$$
\begin{eqnarray}
V_5
&=&
2^55!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_4}\int_0^{\arctan\sin\phi_3}\int_0^{\arctan\sin\phi_2}\int_0^{\sec\phi_1}r^4\cos^3\phi_1\cos^2\phi_2\cos\phi_3\mathrm dr\mathrm d\phi_1\mathrm d\phi_2\mathrm d\phi_3\mathrm d\phi_4
\\
&=&
2^55!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_4}\int_0^{\arctan\sin\phi_3}\int_0^{\arctan\sin\phi_2}\frac15\sec^2\phi_1\cos^2\phi_2\cos\phi_3\mathrm d\phi_1\mathrm d\phi_2\mathrm d\phi_3\mathrm d\phi_4
\\
&=&
2^55!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_4}\int_0^{\arctan\sin\phi_3}\frac15\sin\phi_2\cos^2\phi_2\cos\phi_3\mathrm d\phi_2\mathrm d\phi_3\mathrm d\phi_4
\\
&=&
2^55!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_4}\left[-\frac1{15}\cos^3\phi_2\right]_0^{\arctan\sin\phi_3}\cos\phi_3\mathrm d\phi_3\mathrm d\phi_4
\\
&=&
2^55!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_4}\frac1{15}\left(1-\left(1+\sin^2\phi_3\right)^{-3/2}\right)\cos\phi_3\mathrm d\phi_3\mathrm d\phi_4
\\
&=&
2^55!\int_0^{\pi/4}\left[\frac1{15}\left(1-\left(1+\sin^2\phi_3\right)^{-1/2}\right)\sin\phi_3\right]_0^{\arctan\sin\phi_4}\mathrm d\phi_4
\\
&=&
2^55!\int_0^{\pi/4}\frac1{15}\left(\left(1+\sin^2\phi_4\right)^{-1/2}-\left(1+2\sin^2\phi_4\right)^{-1/2}\right)\sin\phi_4\mathrm d\phi_4
\\
&=&
2^55!\left[\frac1{15}\left(\frac1{\sqrt2}\arctan\frac{\sqrt2\cos\phi_4}{\sqrt{1+2\sin^2\phi_4}}-\arctan\frac{\cos \phi_4}{\sqrt{1+\sin^2\phi_4}}\right)\right]_0^{\pi/4}
\\
&=&
2^8\left(\frac1{\sqrt2}\arctan\frac1{\sqrt2}-\arctan\frac1{\sqrt3}-\frac1{\sqrt2}\arctan\sqrt2+\arctan1\right)
\\
&=&
2^8\left(\frac\pi{12}+\frac{\mathrm{arccot}\sqrt2-\arctan\sqrt2}{\sqrt2}\right)
\\
&\approx&
5.5035\;,
\end{eqnarray}
$$
which is consistent with my numerical results.
The same approach readily yields the volume in four dimensions:
$$
\begin{eqnarray}
V_4
&=&
2^44!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_3}\int_0^{\arctan\sin\phi_2}\int_0^{\sec\phi_1}r^3\cos^2\phi_1\cos\phi_2\mathrm dr\mathrm d\phi_1\mathrm d\phi_2\mathrm d\phi_3
\\
&=&
2^44!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_3}\int_0^{\arctan\sin\phi_2}\frac14\sec^2\phi_1\cos\phi_2\mathrm d\phi_1\mathrm d\phi_2\mathrm d\phi_3
\\
&=&
2^44!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_3}\frac14\sin\phi_2\cos\phi_2\mathrm d\phi_2\mathrm d\phi_3
\\
&=&
2^44!\int_0^{\pi/4}\left[\frac18\sin^2\phi_2\right]_0^{\arctan\sin\phi_3}\mathrm d\phi_3
\\
&=&
2^44!\int_0^{\pi/4}\frac18\frac{\sin^2\phi_3}{1+\sin^2\phi_3}\mathrm d\phi_3
\\
&=&
2^44!\left[\frac18\left(\phi_3-\frac1{\sqrt2}\arctan\left(\sqrt2\tan\phi_3\right)\right)\right]_0^{\pi/4}
\\
&=&
12\left(\pi-2\sqrt2\arctan\sqrt2\right)
\\
&\approx&
5.2746\;.
\end{eqnarray}
$$
The calculation for three dimensions becomes almost trivial:
$$
\begin{eqnarray}
V_3
&=&
2^33!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_2}\int_0^{\sec\phi_1}r^2\cos\phi_1\mathrm dr\mathrm d\phi_1\mathrm d\phi_2
\\
&=&
2^33!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_2}\frac13\sec^2\phi_1\mathrm d\phi_1\mathrm d\phi_2
\\
&=&
2^33!\int_0^{\pi/4}\frac13\sin\phi_2\mathrm d\phi_2
\\
&=&
8(2-\sqrt2)
\\
&\approx&
4.6863\;.
\end{eqnarray}
$$
With all these integrals miraculously working out, one might be tempted to conjecture that there's a pattern here, with a closed form for all dimensions, and perhaps even that the sequence $4,4.69,5.27,5.50,\dotsc$ monotonically converges. However, that doesn't seem to be the case. For six dimensions, the integrals become intractable:
$$
\begin{eqnarray}
V_6
&=&
2^66!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_5}\int_0^{\arctan\sin\phi_4}\int_0^{\arctan\sin\phi_3}\int_0^{\arctan\sin\phi_2}\int_0^{\sec\phi_1}r^5\cos^4\phi_1\cos^3\phi_2\cos^2\phi_3\cos\phi_4\mathrm dr\mathrm d\phi_1\mathrm d\phi_2\mathrm d\phi_3\mathrm d\phi_4\mathrm d\phi_5
\\
&=&
2^66!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_5}\int_0^{\arctan\sin\phi_4}\int_0^{\arctan\sin\phi_3}\int_0^{\arctan\sin\phi_2}\frac16\sec^2\phi_1\cos^3\phi_2\cos^2\phi_3\cos\phi_4\mathrm d\phi_1\mathrm d\phi_2\mathrm d\phi_3\mathrm d\phi_4\mathrm d\phi_5
\\
&=&
2^66!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_5}\int_0^{\arctan\sin\phi_4}\int_0^{\arctan\sin\phi_3}\frac16\sin\phi_2\cos^3\phi_2\cos^2\phi_3\cos\phi_4\mathrm d\phi_2\mathrm d\phi_3\mathrm d\phi_4\mathrm d\phi_5
\\
&=&
2^66!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_5}\int_0^{\arctan\sin\phi_4}\left[-\frac1{24}\cos^4\phi_2\right]_0^{\arctan\sin\phi_3}\cos^2\phi_3\cos\phi_4\mathrm d\phi_3\mathrm d\phi_4\mathrm d\phi_5
\\
&=&
2^66!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_5}\int_0^{\arctan\sin\phi_4}\frac1{24}\left(1-\left(1+\sin^2\phi_3\right)^{-2}\right)\cos^2\phi_3\cos\phi_4\mathrm d\phi_3\mathrm d\phi_4\mathrm d\phi_5
\\
&=&
2^66!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_5}\left[\frac1{48}\left(\phi_3+\sin\phi_3\cos\phi_3-\frac1{\sqrt2}\arctan\left(\sqrt2\tan\phi_3\right)-\frac{\sin\phi_3\cos\phi_3}{1+\sin^2\phi_3}\right)\right]_0^{\arctan\sin\phi_4}\cos\phi_4\mathrm d\phi_3\mathrm d\phi_4\mathrm d\phi_5
\\
&=&
2^66!\int_0^{\pi/4}\int_0^{\arctan\sin\phi_5}\frac1{48}\left(\arctan \sin \phi_4 + \frac{\sin \phi_4}{1 + \sin^2 \phi_4}-\frac1{\sqrt2}\arctan\left(\sqrt2\sin \phi_4\right)-\frac{\sin \phi_4}{1 + 2 \sin^2\phi_4}\right) \cos \phi_4\mathrm d\phi_4\mathrm d\phi_5
\\
&=&
2^66!\int_0^{\pi/4}\left[\frac1{96} \sin\phi_4 \left(2 \arctan\sin\phi_4-\sqrt2\arctan\left(\sqrt2 \sin\phi_4\right)\right)\right]_0^{\arctan\sin\phi_5}\mathrm d\phi_5
\\
&=&
480\int_0^{\pi/4}\sin\arctan\sin\phi_5 \left(2 \arctan\sin\arctan\sin\phi_5-\sqrt2\arctan\left(\sqrt2 \sin\arctan\sin\phi_5\right)\right)\mathrm d\phi_5
\\
&\approx&
5.3361
\;.
\end{eqnarray}
$$
Wolfram|Alpha doesn't find a closed form for that last integral (and I don't blame it), so it seems that you may have asked for the last of these volumes that can be given in closed form. Note that $V_2<V_3<V_4<V_5>V_6$. The results from Monte Carlo integration for higher dimensions show a monotonic decrease thereafter. This is also the behaviour of the volume of the unit hypersphere:
$$
\begin{array}{|c|c|c|c|c|c|}
d&\text{sphere}&\text{cylinders}&\text{sphere}&\text{cylinders}&\text{ratio}\\
\hline
2&\pi&4&3.1416&4&1.2732\\
3&4\pi/3&8(2-\sqrt2)&4.1888&4.6863&1.1188\\
4&\pi^2/2&12\left(\pi-2\sqrt2\arctan\sqrt2\right)&4.9348&5.2746&1.0689\\
5&8\pi^2/15&2^8\left(\frac\pi{12}+\frac{\mathrm{arccot}\sqrt2-\arctan\sqrt2}{\sqrt2}\right)&5.2638&5.5036&1.0456\\
6&\pi^3/6&&5.1677&5.3361&1.0326\\
7&16\pi^3/105&&4.7248&4.8408&1.0246\\
8&\pi^4/24&&4.0587&4.1367&1.0192\\
\hline
\end{array}
$$
The ratio seems to converge to $1$ fairly rapidly, so in high dimensions almost all of the intersection of the cylinders lies within the unit hypersphere.
P.S.: Inspired by leonbloy's approach, I improved the Monte Carlo integration by integrating the admissible radius over uniformly sampled directions. The standard error was less than $10^{-5}$ in all cases, and the results would have to deviate by at least three standard errors to change the rounding of the fourth digit, so the new numbers are in all likelihood the correct numbers rounded to four digits. The results show that leonbloy's estimate converges quite rapdily.
Comment: @The Chaz: Never underestimate the stranglehold an interesting problem can have :)
Comment: So it seems there's a vote on my likely motivation and addiction is leading altruism 4:3? :-)
Comment: wow this is more than I could've asked for. Thanks a ton for all your help! To answer your above question I had the result for 4 dimensions from plugging the problem into mathematica but it was unable to calculate the result for 5 dimensions, and I was hoping to be able to calculate it myself, which your solution allows beautifully. Thanks again!
Comment: @MJD: More generally, Monte Carlo integration chooses a large number of random points (distributed according to the integration measure) and calculates the average of the integrand at those points. The estimate for the integral is then the total volume being sampled times the calculated average. In the present case of computing the volume of a region, the integrand is the characteristic function of the region, so this simplifies to what you wrote, calculating the fraction of points inside the region. See http://en.wikipedia.org/wiki/Monte_Carlo_integration.
Comment: Regarding your observation about the maximum at $V_5$, recall that that fact is merely a scale/dimension thing, for comparing these quantities we should better use spheres with unit diameter (instead or radius) (or divide all by 2^n), see http://math.stackexchange.com/questions/15656/volumes-of-n-balls-what-is-so-special-about-n-5
Comment: Does "Monte Carlo integration" mean that you choose a large number of random points and calculate the fraction which are inside the target region?
Comment: Is it possible to somehow visualize hyperspherical coordinates?
Answer: There's reflection symmetry in each of the coordinates, so the volume is $2^5$ times the volume for positive coordinates. There's also permutation symmetry among the coordinates, so the volume is $5!$ times the volume with the additional constraint $a\le b\le c\le d\le e$. Then it remains to find the integration boundaries and solve the integrals.
The lower bound for $a$ is $0$. The upper bound for $a$, given the above constraints, is attained when $a=b=c=d=e$, and is thus $\sqrt{1/4}=1/2$. The lower bound for $b$ is $a$, and the upper bound for $b$ is again $1/2$. Then it gets slightly more complicated. The lower bound for $c$ is $b$, but for the upper bound for $c$ we have to take $c=d=e$ with $b$ given, which yields $\sqrt{(1-b^2)/3}$. Likewise, the lower bound for $d$ is $c$, and the upper bound for $d$ is attained for $d=e$ with $b$ and $c$ given, which yields $\sqrt{(1-b^2-c^2)/2}$. Finally, the lower bound for $e$ is $d$ and the upper bound for $e$ is $\sqrt{1-b^2-c^2-d^2}$. Putting it all together, the desired volume is
$$V_5=2^55!\int_0^{1/2}\int_a^{1/2}\int_b^{\sqrt{(1-b^2)/3}}\int_c^{\sqrt{(1-b^2-c^2)/2}}\int_d^{\sqrt{1-b^2-c^2-d^2}}\mathrm de\mathrm dd\mathrm dc\mathrm db\mathrm da\;.$$
That's a bit of a nightmare to work out; Wolfram Alpha gives up on even small parts of it, so let's do the corresponding thing in $3$ and $4$ dimensions first. In $3$ dimensions, we have
$$
\begin{eqnarray}
V_3
&=&
2^33!\int_0^{\sqrt{1/2}}\int_a^{\sqrt{1/2}}\int_b^{\sqrt{1-b^2}}\mathrm dc\mathrm db\mathrm da
\\
&=&
2^33!\int_0^{\sqrt{1/2}}\int_a^{\sqrt{1/2}}\left(\sqrt{1-b^2}-b\right)\mathrm db\mathrm da
\\
&=&
2^33!\int_0^{\sqrt{1/2}}\frac12\left(\arcsin\sqrt{\frac12}-\arcsin a-a\sqrt{1-a^2}+a^2\right)\mathrm da
\\
&=&
2^33!\frac16\left(2-\sqrt2\right)
\\
&=&
8\left(2-\sqrt2\right)\;.
\end{eqnarray}$$
I've worked out part of the answer for $4$ dimensions. There are some miraculous cancellations that make me think that a) there must be a better way to do this (perhaps anon's answer, if it can be fixed) and b) this might be workable for $5$ dimensions, too. I have other things to do now, but I'll check back and if there's no correct solution yet I'll try to finish the solution for $4$ dimensions.
Comment: This is exactly what I was looking for, and it agrees with the answer I have for 4 dimensions. I'll see if it can be simplified further, but thanks a ton for the help so far!
Comment: @Ryan: Any luck?
Comment: I worked out $V_4$ and got the answer that you wrote in a comment, $12\pi-24\sqrt2\arctan\sqrt2$. I don't really feel like writing it all out here, unless that would be of value to you :-). I'm not sure I understand what you've been saying in the comments -- your comment above sounds as if you worked out the integral for $V_4$ yourself? Or did you get that result using a different method?
Answer: Here's how I'd tackle the problem (i.e. a starting point). For some intuition, reduce the problem to 3D. Now, you have 3 right-angled cylinders intersecting each other:

This article gives a solution to compute the volume of the intersection in 3D ; do you think it can be extended to 5D?
Comment: Yeah, MathWorld, as a knowledge base, is pretty notorious IMO for rarely having reasonable explanations of its solutions. However, it *did* have a calculation for 3 cylinders (with the expectation the reader should figure out the basis for it, of course). The key insight I got from the article was "Noting the solid has a square cross-section" (for the 2-cylinder case), which enabled me to generalize to five hypercylinders in five dimensions.
Comment: I don't see where that page gives the solution for three cylinders -- as far I can tell, all the calculations are for two cylinders.
Comment: Looks like they updated it with $V_3,V_4,V_6$.
Answer: It is clear that the valid region lies between the hyperspheres of radius $r_1=1$ and $r_2=\sqrt{5/4}$. This already gives some trivial bounds, but the upper bound is not tight.
Lets try to compute the excess volume, beyond the unitary sphere.
Let fix some $1<r<r_2$. The valid region over that surface corresponds to the points with $|x_i|>\sqrt{r^2-1}$ ($\forall i$). We wish to compute $p(r)$, the proportion of the surface that lies in that region, i.e. the probability that if we throw a random point uniformily over a hypershpere surface, all its coordinates are greater than some value.  This happens to be closely related to other recent question. The approximation I proposed there, using independent  gaussians, can also be applied here, and we can expect to perform better (because we are interested in a more "probable" region). Applying the same reasoning, ($n$ gaussians with variance $r/n$ here, and $\epsilon = \sqrt{r^2-1}$), we get the approximation:
$$p(r) \approx \left[ 1 - erf\left(\sqrt{ n \, \frac{r^2-1}{2 r}}\right)\right]^n$$
and from this we can compute the total volume integrating:
$$ V(n) = V_1(n) + V_e(n) = \frac{\pi^{n/2}}{\Gamma{(\frac{n}{2}+1})} + n \frac{\pi^{n/2}}{\Gamma{(\frac{n}{2}+1})} \int_1^{r_2} p(r) \; r^{n-1} dr$$
where $r_2 = \sqrt{\frac{n}{n-1}}$. Pluggin the above approximation, I get these values:
<code> n       A       J        Ae      Je
---------------------------------------
 2    3.7664   4.0000   0.6248   0.8584
 3    4.6359   4.6863   0.4471   0.4975
 4    5.2619   5.2746   0.3271   0.3398
 5    5.5004   5.5036   0.2366   0.2398
 6    5.3353   5.3361   0.1676   0.1684
 7    4.8406   4.8408   0.1158   0.1160
 8    4.1366   4.1367   0.0779   0.0780
</code>
where column A is my approximation, J are the values from Joriki's answer (Montecarlo integration for  $n>5$). The columns Ae,Je show the respective excess volumes over the unitary hypersphere, they are actually the relevant quantities to be compare to judge the goodness of the approximation. (I must say I'm surprised that gives so good results for small $n$, and the speed of convergence)
Here goes the Octave/Matlab code:
<code>clear
global N=5
r2=sqrt(N/(N-1));

function pp=pp(r)
 global N;
 pp = (1-erf( sqrt( N* (r.^2 - 1)./(2*r) ) )).^N .* r.^(N-1);
endfunction

(pi^(N/2)/gamma(N/2+1)) * ( 1 + quad ("pp",1,r2) * N)
</code>
Comment: This is nice -- it converges quite rapidly! I realized from this that I could improve my Monte Carlo integration by sampling the admissible radius at uniformly distributed directions. That yields numbers to four-digit accuracy; I took the liberty to edit those into your table to enhance the comparison, which turns out to be quite favourable. You could add the difference from the hyperspherical volume to the table, since that's what you're actually approximating.
Comment: @joriki: I actually wake up this morning thinking on adding those two columns. Done. :-)

Volume of Region in 5D Space


Regarding Speed of launched rocket inside the atmosphere

Question: I am a 15 yr old, so please forgive my mistakes as I have not entirely read rocket mechanics.
I have been wondering why rockets accelerate to mind-boggling speeds, (mach7-8 or even more)when that must be causing massive drag forces wasting energy.
Why can't the rocket produce little thrust to accelerate upto say mach 1, and then maintain this speed until the rocket is at a high enough altitude where the air resistance is negligible where it can then use the thrusters at total capacity to speed up for space travel or to achieve a stable orbit?
And in this way maybe we can use more efficient but less thrust-producing methods like ion propulsion. (although we may not currently have the technology to do so)
I feel by moving slowly through the atmosphere and then picking up speed in space we can save a lot of much-needed fuel, but none of the rocket launches take place this way so there must be some point I'm missing.
Comment: Note: you might get better answers on https://space.stackexchange.com.
Answer: The reason is that there are actually two types of "drag" acting on the rocket: atmospheric drag and gravity drag (or gravity loss).
Atmospheric drag is what you have mentioned in your question and gets a lot worse the faster you go.
Gravity loss is the effect of the planet pulling the rocket back down against the thrust of the engines. It is a constant* cost until you reach orbit and it reduces the acceleration generated by the engine thrust.
To limit gravity losses you want your engine thrust to be as high as possible so that the proportion of thrust lost to gravity is minimised and the time you spend not in orbit is also minimised.
Take an extreme case where the engines produce an acceleration of 1g. The rocket would hover and not go anywhere, thereby wasting all of its fuel and being 100% inefficient (despite having no aerodynamic drag).
On the other hand, if your engines produce 5g then only 20% is lost to gravity and you still accelerate at 4g.
So, in summary, you need to find a balance such that the rocket's velocity in the atmosphere is not so great that there is excessive aerodynamic force, heating and drag and not so little that you waste all of your fuel fighting gravity.
*Not really constant, but it isn't proportional to velocity.
Comment: thank you really helped me understand my mistake
Comment: Gravity drag is perfectly shown in action in this rocket start: https://www.youtube.com/watch?v=x2jU5W4ehPE The rocket had lost an engine pretty much in the moment of lift-off, and it didn't go to space because all that the remaining four engines achieved during the first seconds was fighting gravity drag. It did produce quite some unique footage, though.
Answer: Actually you are correct that drag wastes energy. Actually rockets are designed differently for different purposes.
Those rockets which are designed to send satellites to low earth orbit actually take some help from air drag to slow them down a bit to get them to the parking/ low earth orbit. So they usually go fast initially although this might be different for different agencies.
Those rockets for deep space actually go slower as you predicted, like Saturn V or SLS. Then they accelerate further in deep space. Ion propulsion is actually not appropriate for big bulky rockets and with air drag acting, and are suitable for satellites in deep space.
Further understanding requires calculus and deep math stuff.
Hope it helped you.
Comment: Another concern for rockets is the mass of the fuel that burns up and is then emitted out the bottom.  This blast of burning fuel is actually what causes the thrust on the rocket.  When a rocket speeds up slowly, that rocket remains heavy for a longer time.  This is why some rockets use the solid rocket boosters (SRBs).  They help get the extreme mass of fuel moving so that more of the fuel can be used at a higher altitude.
Comment: Thank you....:)
Comment: Hey i was just checking the data for the Saturn V rocket
Its given that at the end of stage 1 at an altitude of 42 miles
The speed was 2756 m/s, that's more than mach 8
isn't that very fast
pls correct me if I'm making a mistake
thank you
(SOURCE- Wikipedia)
( for context the stage 3 speed was almost mtch 34 i know that's a lot more than mach 8 but still isn't it just wasted energy?)
Comment: ohh okay thank you
Comment: I would never use the word "help" in the second paragraph, as there's no need to slow anything down to get into "parking" orbit. Instead, rockets ascent more or less in a single smooth curve to reach their target orbit, exactly nailing height and velocity at second stage main engine cutoff. The variables for doing so are how fast the rocket turns sideways and the burn times. If they overshoot their target height at first, they do so because the second stage burn needs some extra time.


Saddle for beginner rider!

Question: I havent ridden a bike since I was a kid. And now I just purchased a second hand one to go to and from work and I found the seat like sitting on a block of wood. It was horrible! What is the best seat to get? I was going to get a large padded one but now after reading some posts saying they were no good, i dont know what to do. I know nothing about this. Please help me. Thanks!
Comment: How much have you ridden the bike? I wouldn't run out and buy a new seat just yet. If you haven't ridden a bike in a while it can take a little with for your muscles and other tissues to get used to being on a bike seat again. Also, there is no right answer for this, as everyone's opinion is different.
Comment: If you're not a purist, there's nothing wrong with having some padding in the seat.  But you generally won't do as well with a super-wide, super-padded seat as with something a bit narrower and only moderately padded.  But for starters, look for a padded cover for your existing seat -- many bike shops and dept store bike departments have these.
Comment: Hardly at all. didnt want to get back on it after how much it hurt the first couple of times!! The bike is not the best quality either. There is no padding on seat at all, just rock hard.
Comment: Thank you Kibbee and Daniel R hicks. I will keep trying to ride and i think i will get a padded cover. Thanks so much for your help
Comment: Welcome to Bicycles! Can you tell us more about your bike? The model and make would work, or just a picture of the bike. Best of all would be a picture of you riding the bike. Also, how long is your ride?
Answer: As @Kibbee stated give a little time. Don't expect to be able to do a one hour ride and be painfree the next day. Try to increase your saddle time gradually over a couple weeks. You can do several short rides a day to toughen-up the sore spots. The saddle may not be the only issue. Did you consult with anyone about bikefit? The bike may need some adjustments to fit you correctly. If after a few weeks your body is still complaining take your bike to your local shop. Have them look at your bike and the saddle. Explain to them where the pain is and ask for help in choosing a saddle that fits your body. Most shops will give a fit or comfort guarranty for a certain number of days.`
Comment: @Ashleigh - Bike fit may seem complicated, but it's really a matter of sliding the seat forward and back, up and down; and doing the same with the handlebars. There are recommended ways to adjust things that help make it easier, and there's some trial and error involved.
Comment: No didnt consult. just wanted a bike to get to and from work, didnt realise it was so complicated now!! haha. Thanks for your help i guess i will have to suck it up and keep trying!! thanks :)
Answer: Big fat padded seats do work well and can be had rather cheaply.
I have recently fallen in love with a Brooks leather saddle.  It is basically a leather hammock built in the shape of a seat.  They are expensive, so see if you can find someone's you can try before you buy.  I stumbled into mine by accident but I know I will never ride on anything else.
Comment: Big fat padded seats are comfy for a little while, but when the padding wears out, they're not so comfy. Brooks saddles are awesome - I have two bikes with B17s - but I don't think the OP is going to go out and buy a $100+ saddle.
Comment: +1 because this answer doesn't really deserve a negative score. "Buy a Brooks" is pretty much the canonical answer. Even though it's impractical for someone just getting back onto a bike, it's definitely something for them to know about for the future.
Comment: @Stephen Thanks!  Didn't realize that "Buy a Brooks" was a canonical answer.  If so, then it is definitely a "correct" one. Was just trying to provide the two options that I was aware of... one that was cheaper and one that wasn't.  I was trying to leave it to the OP to make the decision on her long term level of commitment and budget constraints.
Answer: Do you ride with padded bike shorts? This is a very worth while option to consider. You can get "baggies" (like MTBers wear) if the tight lycra look does not suit you fashion sense - don't worry - despite what roadies tell you it is NOT illegal to wear baggies while riding on the road :).
Comment: And, despite the upturned noses of the purists, many relatively experienced riders wear underwear of some sort under their bike shorts (just in case you're uncomfortable "going commando").  Just be sure it's something that won't bunch up.
Answer: The answer depends on how much you ride and your position on the bike.
If you only take short trips and sit upright on the bike, then get a plush big comfy saddle.
If you intend to go on longer rides (1+h), you have a sportier (leaned forward) position on the bike, and want to ride often, then give your current saddle another chance. If your bum is not used to sitting on a bike, it will get sore during the first few rides. However, gradually you will build up more muscles in your bum and legs (taking weight off your bum) and the harder saddle will actually be more comfortable than the plushy one. The reason is that the harder, more minimal saddle will only put pressure on your sitbones, where you contact the saddle. The plushy saddle will deform under your weight and put pressure on your soft tissue.
Leather saddles (like Brooks) are very hard initially, but soften gradually only where your sitbones put pressure on them. Thus, when they're broken in they give support for your sitbones without putting pressure on your soft tissue.

Saddle for beginner rider!


Why does EEVEE take More time when it is rendered from the button than viewing in the actual viewport?

Question: Why does EEVEE take More time when it is rendered from the button than viewing in the actual viewport? I mean when you pan around in the rendered mode in EEVEE it takes no time to render it to the viewport but when you hit the render button from the menu, it takes some time and renders it frame by frame.
Other than that im loving 2.8 and EEVEE...
Comment: just like with cycles, eevee offers separate quality settings for viewport and render. one of them is the sample count. another reason could be that your camera resolution is bigger than the viewport, so more pixels have to be rendered.
Comment: Thank you for the answer :) Can you guide me about adjusting the camera resolution to match the viewport's? and is it possible to pan the camera around using the the normal viewport pan around methods. I mean without selecting the camera first then pressing G and then moving it around. Thank you.
Comment: there is no way to magically match them. for rendering needs, one sets the output pixels as required. to manipulate the camera using viewport navigation, see cegatons question here https://blender.stackexchange.com/questions/68996/assign-shortcut-to-lock-camera-to-view
Answer: Because viewport sampling is lower even with eevee. Also, viewport has lower resolution.
Comment: This is a comment, not an answer. Answers usually try to give a more elaborate explanation why things happen. Please read [How do I write a good answer?](https://blender.stackexchange.com/help/how-to-answer) thoroughly


Forgot my Username feature - community users can't remember their username

Question: Has anyone built a feature to retrieve a user's username?  There is a Forgot my Password but you have to provide your username.  In our partner community we've had to get creative with the usernames due to the uniqueness requirement across SF partner orgs.  So now our partners can't figure out what their username is.
I was thinking of a VF page where you enter your email, then the page checks for active users with that email and if none, shows an error.  If found, it could trigger a templated email to their email with their username.  Has anyone done this before or have suggestions?
Answer: Whatever you suggested is totally feasible, even though I haven't tried it. Usually in such cases I implemented Google/Facebook bases Single Sign On.


How do you calculate the decimal expansion of an irrational number?

Question: Just curious, how do you calculate an irrational number? Take $\pi$ for example. Computers have calculated $\pi$ to the millionth digit and beyond. What formula/method do they use to figure this out? How does it compare to other irrational numbers such as $\varphi$ or $e$?
Comment: This is a really good question, because it's simple to ask  but has no simple answer. It depends a lot on which number you have in mind. For an interesting counterpoint, consider [Euler's constant $\gamma$](http://enwp.org/Euler's_constant)$\approx 0.57721\ldots$. Methods are known for calculating $\gamma$ with great precision, but it is not known whether it is irrational or not!
Comment: Minor aside: your question is not "how do you calculate an irrational number", but "how do you calculate the decimal expansion of an irrational number".
Comment: At the other extreme, there are irrational numbers that are not computable at all, such as Chaitin's constant.  See http://en.wikipedia.org/wiki/Chaitin%27s_constant
Comment: @Sean All these formulas have been proven equivalent, otherwise they wouldn't be called "formulas for $\pi$". In general, showing that two formulas are equivalent is very hard, and requires a great deal of mathematics
Comment: Relevant [this](http://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula) and [this](http://en.wikipedia.org/wiki/Approximations_of_%CF%80#Development_of_efficient_formulae).
Comment: Just keep solving the expression which defines the irrational number? If you into programming check out ycruncher [here](http://www.numberworld.org/y-cruncher/)
Comment: Also check out the paper which mentions one of the method and implementation details. http://www.ams.org/journals/mcom/1962-16-077/S0025-5718-1962-0136051-9/S0025-5718-1962-0136051-9.pdf
Comment: You may be interested in this question: http://math.stackexchange.com/questions/129777/what-it-the-fastest-most-efficient-algorithm-for-estimating-eulers-constant-g
Comment: [This](http://math.stackexchange.com/questions/135827/computing-decimal-digits-of-irrational-numbers/138114#138114) might help for non square $n$s and $\sqrt{n}$.
Comment: By looking at everyone's responses it has sparked another question. How are we really sure of what Pi or Phi is? Many of these formulas seem different. How do we verify if a formula is correct or not?
Comment: But if they are equivalent, then how is it possible for one to be more accurate than another?
Comment: And how to we create these formulas?
Answer: $\pi$
For computing $\pi$, many very convergent methods are known.  Historically, popular methods include estimating $\arctan$ with its Taylor's series expansion and calculating $\pi/4$ using a Machin-like formula.  A basic one would be
$$\frac{\pi}{4} = 4 \arctan\frac{1}{5} - \arctan\frac{1}{239}$$
The reason these formulas are used over estimating $\arctan 1 =\frac{\pi}{4}$ is because the series for $\arctan x$ is move convergent for $x \approx0$.  Thus, small values of $x$ are better for estimating $\pi/4$, even if one is required to compute $\arctan$ more times.  A good example of this is Hwang Chien-Lih's formula:
$$
\begin{align}
\frac{\pi}{4} =& 183\arctan\frac{1}{239} + 32\arctan\frac{1}{1023} - 68\arctan\frac{1}{5832} + 12\arctan\frac{1}{113021}\\
& - 100\arctan\frac{1}{6826318} - 12\arctan\frac{1}{33366019650} + 12\arctan\frac{1}{43599522992503626068}\\
\end{align}
$$
Though $\arctan$ needs to be computed 7 times to a desired accuracy, computing this formula interestingly requires less computational effort then computing $\arctan 1$ to the same accuracy.
Iterative algorithms, such as Borwein's algorithm or Gauss–Legendre algorithm can converge to $\pi$ extremely fast (Gauss–Legendre algorithm find 45 million correct digits in 25 iterations), but require much computational effort.  Because of this, the linear convergence of Ramanujan's algorithm or the Chudnovsky algorithm is often preferred (these methods are mentioned in other posts here as well).  These methods produce 6-8 digits and 14 digits respectively term added.
It is interesting to mention that the Bailey–Borwein–Plouffe formula can calculate the $n^{th}$ binary digit of $\pi$ without needing to know the $n-1^{th}$ digit (these algorithms are known as "spigot algorithms").  Bellard's formula is similar but 43% faster.
The first few terms from the Chudnovsky algorithm are (note the accuracy increases by about 14 decimal places):
n     Approx. sum     Approx. error (pi-sum)
0     3.141592653     5.90 x 10^-14
1     3.141592653     -3.07 x 10^-28
2     3.141592653     1.72 x 10^-42
3     3.141592653     1.00 x 10^-56

See these two questions as well.

$e$
The most popular method for computing $e$ is its Taylor's series expansion, because it requires little computational effort and converges very quickly (and continues to speed up).
$$e=\sum_{n=0}^\infty \frac{1}{n!}$$
The first sums created in this series are as follows:
n     Approx. sum     Approx. error (e-sum)
0     1               1.718281828.
1     2               0.718281828
2     2.5             0.218281828
3     2.666666666     0.051615161
...
10    2.718281801     2.73 x 10^-8
...
20    2.718281828     2.05 x 10^-20

One should also note that the limit definition of $e$ and the series may be used in conjunction.  The canonical limit for $e$ is
$$e=\lim_{n \to \infty}\left(1+\frac{1}{n}\right)^n$$
Noting that this is the first two terms of the Taylor's series expansion for $\exp(\frac{1}{n})$ to the exponent of $n$ for $n$ large, it is clear that $\exp(\frac{1}{n})$ can be computed to a higher accuracy in fewer terms then $e^1$ in the series, because in two terms give a better and better estimate as $n \to \infty$.  This means that if we add another few terms of the expansion of $\exp(\frac{1}{n})$, we can find the $n^{th}$ root of $e$ to high accuracy (higher then the limit and the series) and then we just multiply the answer $n$ times with itself (easy, if $n$ is an integer).
As a formula, we have, if $m$ and $a$ are large:
$$e \approx \left(\sum_{n=0}^m \frac{1}{n!a^n}\right)^a$$
If we use the series to find the $100^{th}$ root (i.e. using the above formula, $a=100$) of $e$, this is what results (note the fast rate of convergence):
n     Approx. sum    Approx. sum^100    Approx. error (e-sum)
0     1               1                 1.718281828.
1     1.01            2.704813829       0.013467999
2     1.01005         2.718236862       0.000044965
3     1.010050166     2.718281716       1.12 x 10^-7
...
10    1.010050167     2.7182818284      6.74 x 10^-28
...
20    1.010050167     2.7182818284      4.08 x 10^-51

$\varphi$
The golden ratio is
$$\varphi=\frac{\sqrt{5}+1}{2}$$
so once $\sqrt{5}$ is computed to a sufficient accuracy, so can $\varphi$.  To estimate $\sqrt{5}$, many methods can be used, perhaps most simply through the Babylonian method.  Newton's root-finding method may also be used to find $\varphi$ because it and its reciprocal, $\Phi$, are roots of
$$0=x^2-x-1$$
If $\xi$ is a root of $f(x)$, Newtons method finds $\xi$:
$$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$
$$\xi=\lim_{n \to \infty}x_n$$
We thus assign $f(x)=x^2-x-1$ and $f'(x)=2x-1$.  Then
$$x_{n+1}=x_n-\frac{x_n^2-x_n-1}{2x_n-1}=\frac{x_n^2+1}{2x_n-1}$$
If $x_0=1$, the first few iterations yield:
n     value of x_n     Approx. error (phi-x_n)
1     2                -0.381966011
2     1.666666666      -0.048632677
3     1.619047619      -0.001013630
4     1.618034447      -4.59 x 10^-7
...
7     1.618033988      -7.05 x 10^-54

The quadratic convergence of this method is very clear in this example.

$\gamma$
Unfortunately, no quadratically convergent methods are known to compute $\gamma$.
As mentioned above, some methods are discussed here: What is the fastest/most efficient algorithm for estimating Euler's Constant $\gamma$?
The algorithm from here is
$$
\gamma= 1-\log k \sum_{r=1}^{12k+1} \frac{ (-1)^{r-1} k^{r+1}}{(r-1)!(r+1)} +
\sum_{r=1}^{12k+1} \frac{ (-1)^{r-1} k^{r+1} }{(r-1)! (r+1)^2}+\mbox{O}(2^{-k})
$$
and this method gives the following approximation:
k    Approx. sum         Approx. error (gamma-sum)
1    0.7965995992978246  0.21938393439629178
5    0.5892082678451087  0.011992602943575847
10   0.5773243590712589  1.086941697260313 x 10^-4
15   0.5772165124955206  8.47593987773898 x 10^-7

This answer has even faster convergence.
Some other methods are also reviewed here: http://www.ams.org/journals/mcom/1980-34-149/S0025-5718-1980-0551307-4/S0025-5718-1980-0551307-4.pdf

$\zeta(3)$
A method for estimating $\zeta(3)$ is the Amdeberhan-Zeilberger formula ($O(n \log n^3)$):
$$\zeta(3)=\frac{1}{64}\sum_{k=0}^{\infty}\frac{(-1)^k(205k^2+250k+77)(k!)^{10}}{((2k+1)!)^5}$$

$G$ (Catalan's constant)
Fee, in his article, presents a method for computing Catalan's constant based on a formula of Ramanujan:
$$G=\sum_{k=0}^\infty \frac{2^{k-1}}{(2k+1)\binom{2k}{k}}\sum_{j=0}^k \frac1{2j+1}$$
Another rapidly-converging series from Ramanujan has also been used for computing Catalan's constant:
$$G=\frac{\pi}{8}\log(2+\sqrt 3)+\frac38\sum_{n=0}^\infty \frac{(n!)^2}{(2n)!(2n+1)^2}$$

$\log 2$
The Taylor's series for $\log$ has disappointingly poor convergence and for that alternate methods are needed to efficiently compute $\log 2$.  Common ways to compute $\log 2$ include "Machin-like formulae" using the $\operatorname{arcoth}$ function, similar to the ones used to compute $\pi$ with the $\arctan$ function mentioned above:
$$\log 2=144\operatorname {arcoth}(251)+54\operatorname {arcoth}(449)-38\operatorname {arcoth}(4801)+62\operatorname {arcoth}(8749)$$

$A$ (Glaisher-Kinkelin constant)
One usual method for computing the Glaisher-Kinkelin constant rests on the identity
$$A=\exp\left(\frac1{12}(\gamma+\log(2\pi))-\frac{\zeta'(2)}{2\pi ^2}\right)$$
where $\zeta'(s)$ is the derivative of the Riemann zeta function. Now,
$$\zeta'(2)=2\sum_{k=1}^\infty \frac{(-1)^k \log(2k)}{k^2}$$
and any number of convergence acceleration methods can be applied to sum this alternating series. Two of the more popular choices are the Euler transformation, and the CRVZ algorithm.

Another interesting website that has many fast algorithms for common constants is here.
Comment: $\gamma$ is the golden/black sheep of the herd.
Comment: "These methods produce 6-8 digits and 14 digits respectively." That would be *per iteration*, no?
Comment: @GerryMyerson Every time you add another term.  I will edit.
Comment: In lieu of writing a different answer, I decided to add to this CW answer. I hope you don't mind.
Comment: @J.M. No problem!  I edited the style a tad, if that's okay.
Answer: Different irrationals yield to different techniques. $\phi=(1+\sqrt5)/2$ just involves calculating $\sqrt5$, which can be done easily by Newton's method from introductory calculus. The infinite series $$e=1+1+1/2+1/6+1/24+\cdots$$ where the denominators are the factorials, can be used to calculate $e$. For pi, this article on Gauss-Legendre algorithm will give you some ideas.
Comment: Perhaps it looks better if you name the link instead of showing the link address directly in your answer. Like, "For pi, [this Wikipedia article](http://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm) [...]".
Answer: Gerry Myerson's answer above is correct in saying that different irrational numbers lead to different techniques. In essence, though, all those techniques boil down to one idea: Find some sort of method (formula, infinite series, algorithm, etc.) that when used, will yield a decimal expansion that will converge to the value of the irrational (or rational, for that matter!). Naturally, certain techniques are more useful in certain circumstances (e.g., in computing, techniques that converge very quickly, but also result in as few processor instructions as possible are preferred).
As an aside, my personal favorite formula for $\pi$ was given by Ramanujan:
$$
\frac{1}{\pi} = \frac{\sqrt{8}}{9801} \sum_{n=0}^{\infty}\frac{(4n)!}{(n!)^4}\frac{1103+26390n}{396^{4n}}
$$
This formula converges really really quickly. The MathWorld article notes that it provides, on average, 6 to 8 decimal places per term.
Answer: An example not yet given.
$\zeta(3)=1.20205690315959428539973816151144$
$\qquad\qquad 999076498629234049...$ (here)
The number $$\zeta (3)=\sum_{n=1}^\infty \frac{1}{n^3} \tag{1}$$ is called Apéry's constant, because its irrationality was first proved by Roger Apéry. The following series, which converges to $\zeta (3)$ faster than $(1)$, can be used to compute it
$$\zeta (3)=\frac{5}{2}\sum_{n=1}^{\infty }\frac{\left( -1\right) ^{n-1}}{n^{3}\binom{2n}{n}}.\tag{2}$$
For the same purpose we can use the continued fraction expansion for $\zeta (3)$, which is
$$\zeta \left( 3\right) =\dfrac{6}{5-\dfrac{1}{117-\dfrac{64}{535-...-\dfrac{n^{6}}{34n^{3}+51n^{2}+27n+5}}}}.\tag{3}$$
Another possibility is to use the following limit
$$\begin{equation*}
\zeta (3)=\lim_{n\rightarrow \infty }\frac{a_{n}}{b_{n}},
\end{equation*}\tag{4}$$
where
$$\begin{equation*}
a_{n}=\sum_{k=0}^{n}\binom{n}{k}^{2}\binom{n+k}{k}^{2}c_{n,k},
\end{equation*}\tag{5}$$
$$\begin{equation*}
b_{n}=\sum_{k=0}^{n}\binom{n}{k}^{2}\binom{n+k}{k}^{2},
\end{equation*}\tag{6}$$
and
$$\begin{equation*}
c_{n,k}=\sum_{m=1}^{n}\frac{1}{m^{3}}+\sum_{m=1}^{k}\frac{\left( -1\right)
^{m-1}}{2m^{3}\binom{n}{m}\binom{n+m}{m}}\quad k\leq n.
\end{equation*}\tag{7}$$
--
References
Apéry, Roger (1979), Irrationalité de $\zeta 2$ et $\zeta 3$, Astérisque 61: 11–13
Alfred van der Poorten (1979), A proof that Euler missed..., The Mathematical Intelligencer 1 (4): 195–203
Answer: For $\pi$ there is a nice formula given by John Machin:
$$ \frac{\pi}{4} = 4\arctan\frac{1}{5} - \arctan\frac{1}{239}\,. $$
The power series for $\arctan \alpha$ is given by
$$\arctan\alpha = \frac{\alpha}{1} - \frac{\alpha^3}{3}+\frac{\alpha^5}{5} - \frac{\alpha^7}{7} + \ldots\,. $$
Also you could use (generalized) continued fractions:
$$ \pi = \dfrac{4}{1+\cfrac{1^2}{3+\cfrac{2^2}{5+\cfrac{3^2}{7+\cdots}}}} $$
There are many other methods to compute $\pi$, including algorithms able to find any number of $\pi$'s hexadecimal expansion independently of the others. As I remember, the wikipedia has a lot on methods to compute $\pi$. Moreover, as $\pi$ is a number intrinsic to mathematics, it shows in many unexpected places, e.g. in a card game called Mafia, for details see this paper.
As for $e$, there are also power series and continued fractions, but there exists more sophisticated algorithms that can compute $e$ much faster. And for $\phi$, there is simple recurrence relation based on Newton's method, e.g. $\phi_{n+1} = \frac{\phi_n^2+1}{2\phi_n-1}$. It is worth to mention that the continued fraction for the golden ratio contain only ones, i.e. $[1;1,1,1,\ldots]$ and the successive approximations are ratios of consecutive Fibonacci numbers $\frac{F_{n+1}}{F_n}$.
To conclude, majority of example methods here was in one of the forms: computing better and better ratios (but each fraction was calculated exactly) or work with approximations the whole time, but create a process that will eventually converge to the desired number. In fact this distinction is not sharp, but the methods that are used in those approaches are usually different. Useful tools: power series, continued fractions, and root-finding.


When does rm remove open files?

Question: Particularly, I want to know what happens when I rm an open file and don't explicitly kill the process holding the file descriptor to that file. Will the file be removed when the system is shut down?
Answer: Basically, yes - whenever the process holding it open dies. Nothing "magical" happens at that point. Just like a directory entry for the file is a "hard link" to the blocks that contain that file's data, so is an open file handle. If there is no directory entry and no open file handle then the blocks are free to be reused. This means that even if you don't do a clean shutdown (eg. yank the power cord) the file will still be deleted - it was "deleted" when you ran rm, only its blocks were not immediately available for reuse.
Answer: kernel maintains a copy of the in memory file inode locked so the data blocks belonging to this file and the inode cannot be released while one process has the file open.  Once the file is definitely closed (as will happen when the system is being shutdown and the process is killed), all the blocks and the inode get released for reuse.  This happens before the filesystem can be unmounted (it cannot be unmounted if it has open files) and the system is shutdown.

When does rm remove open files?


predict conditional mean after truncated negative binomial regression

Question: I was using tnbreg command and wanted to predict conditional mean. As suggested by Stata for post-estimation after tnbreg code, I used predict condmen, cm to calculate the conditional mean, E(y|y > ll). When  I manually calculated the conditional mean it was different than the output from Stata. So, I want to make sure that why the value I calculated is different than the Stata output. Could anyone please recommend me any supporting document describing the actual formula behind predict, cm?, then, I should be able to know that I am using the same formula manually as Stata does by its code.
Comment: (1) It is Stata, not STATA. It isn't an abbreviation, and there is no need to yell. (2) Show your code: provide a reproducible example. (3) Migrate the question to CrossValidated (although this is up to moderators): there is zero content in it that relates to deal with open data sources per se.
Answer: The formula is given on p. 2388 of http://www.stata.com/manuals13/r.pdf. Without a reproducible example from you, it is impossible to discuss this further. You may have a bug, or they may have a bug -- looking at their formula, it seems like they've assumed that ll=0, as the formula quoted seems to assume the truncation point of zero.


How to stop following all blogs on Google FriendConnect

Question: Somehow, I managed to add all of my subscriptions from Google Reader to Blogger's 'following' service: FriendConnect. This is really annoying, as my 153 subscriptions show up in a list in my Google Reader. I know I can just hide them in Google Reader, but how can I remove all sites from my 'Blogs I'm Following' list (without doing it randomly).
Answer: I eventually just removed them manually. The quickest process I found for doing so was:
Visit http://www.blogger.com/manage-blogs-following.g and log into your Google account if not already.
Click on the Settings link next to one of the blogs in the list

Don't click on Stop following this site in the window that pops up. Instead, click on the Sites you've joined tab on the right sites.
Here should be a compact list of all of the sites you're following along with stop following links.

Clicking on these links should be much quicker than removing sites from the main list and dealing with a popup window opening and closing all of the time.
Comment: @FeralOink That's okay, I upvoted your answer anyway
Comment: This is the only way that I even know how to remove blogs from friend connect, especially without Google Reader. I didn't realize that this was all you wanted to do! (I don't know of a programmatic way of doing it, but I don't think it is intended to be an application, jut a convenient little tool).
Comment: bungeshea: You are a kind soul :o) Thank you.
Answer: I just noticed that that happened to me yesterday. I don't know what caused it. I don't mind it, but to undo, try this:

Go to Google Reader overview page
http://www.google.com/reader/view/#overview-page
Go to the little cog wheel on the left. Click it and select Settings from drop-down menu.
You'll get a screen with tabs, that I don't recall seeing horizontally. (It was a vertical list instead). On the Preferences tab, look toward the end, under the Misc heading. Uncheck the second box:
"Show followed blogs from Blogger".

This won't unsubscribe you from the blogs. I assume that you don't want to unsubscribe, just not view those blogs in Google Reader. This works if using Google Chrome browser with Google Reader. I haven't tried anything else.
EDIT
I read a CNET post about Google Reader issues this morning. Google seems to have addressed whatever the issue was. Maybe it was a minor feature upgrade? I don't remember seeing all these options. Also, I accessed Settings from a link here  http://www.google.com/reader/ but can't find that now. Anyway, it is working fine for me today.
Comment: Since Google Reader is no more, it is no longer possible to follow the advice of this answer.
Comment: Hello, @AlEverett !! Yes, Google Reader is no more, but FriendConnect lives on. However, the question specifically asked about Google Reader. Should I delete this, or try to answer the question sans Reader? Either alternative is fine. Just let me know, and I will comply.
Comment: Thanks, but I mentioned that I can *hide* the blogs in Google Reader, but I want to clean up and remove the blogs completely.


Create a beeper when a battery voltage goes down to specific number

Question: I have a 6 X 2V (400Ah) batteries in the office and I use usual DC to AC inverter to run our computers. One problem that we have is there is no way to know how soon our batteries are going to die. I got usual volt meter, but I need to monitor that all the time.
What can I do to make a beep when a battery volts goes below 11.5? I think it is very simple thing but I don't know what it is called or how to make it.
Answer: Here is a circuit I made some time back and it was very useful. The Zener value can be roughly between 7v and 10v. The 555 IC acts as a comparator and turns on the output at pin 3 (OUTPUT) when pin 2(TRIGGER) is less than 1/3 Vcc. Adjust the Potentiometer(R1) so that the output is turned on at 11.5 volt.

simulate this circuit – Schematic created using CircuitLab
A quick search returned a few circuits that may be better. I had originally built my circuit based on the second link.
http://www.aaroncake.net/circuits/lowvolt.asp
http://www.homemade-circuits.com/2013/05/simple-low-battery-indicator-circuit.html
For the second one, you can replace the LED with a buzzer.
For all circuits, select a buzzer that works when directly connected to a voltage (ie: make sure it is not a simple piezo disk or speaker).
Comment: Answers that depend almost completely on links are discouraged on Stack Exchange. Links go bad or change all the time on the web. The result is that in the future this answer could become useless. You can improve your answer a whole lot by publishing a picture of a suitable circuit. As a matter of fact this site even has a built in schematic drawing tool that could be used to show a low battery buzzer circuit.
Comment: Thanks for the feedback. I've edited the answer to add a circuit. The built in drawing tool is pretty easy to use.
Comment: @Vinod I am not able to simulate the schema above, could you please help me to make it work? I also looked at the second link and I can't understand it. It says Battery + and - but hard to figure out where is the battery. I appreciate your help!


Replacement for System.out.println() log statement - Please don't say "Debug Logs"

Question: In java it's easy to throw in a Sytem.out.println() and get some helpful info on the console.    The closest I have come to that on Force.com is system.debug(); and then plowing through pages of Debug Logs trying to find my line of output.  There must be a better way, right?
Comment: Are you working with a VF page or some apex classes only?
Comment: Primarily just Apex code in Eclipse.   Is this the best way to go:  https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_debugging_system_log_console.htm   I have found some of the Developer Console pretty buggy
Answer: system.debug() is how you get the system to print to the debug log. There is no other way. If you don't like ploughing through pages of log (although when you view the log in the browser UI it's always just one page) there are several things you can do.

Filter the log in the dev console as you suggest in your comment. Dev console works better in Chrome / Firefox / Safari than in IE but it isn't entirely glitch free in my experience
Filter the log at source so that only your debug statements get into it see  Debug Log Filtering for Apex Classes and Apex Triggers and Setting Debug log Filters

To set log filters:
  From a class or trigger detail page, click Log Filters.
  Click Override Log Filters.
  The log filters are set to the default log levels.
  Choose the log level desired for each log category.

The log file entry includes the line number where the entry originated. So if you're calling system.debug() on line 447, the entry includes [447]. Search for that in the browser and you'll find your debug.
Old school - prepend an identifier to every debug output: system.debug('@@@ ' + someVar); and then CTRL-F search the log page for @@@ and you can easily skip through to all your statements.

EDIT: and there's a great full answer here: Need to get logfile smaller
There are also good arguments for building your own debug message store in a custom object, not least of which is that debugging an installed managed package in a client's org is still impossible as far as I know. Although I think they're working on making it possible.
And if you have access to sandbox, the apex debugger is coming. It was announced at DF14 but it's an extra cost.
Answer: I totally understand your question. For me standard debug logs and developer console were just huge time burners.
My approach to get something useful is the following: at system.debug use severity WARN. If possible it try to Execute Anonyous and in eclypse filter everything below WARN out. That you have to do for about 5 categories but it will be persistent. In rare cases when you need the endless default verbosity you can easily switch back.
As a convenient wrapper I wrote a (one liner) method called xt.log() which is pretty much like system.debug but allways WARN. You find this among other helper stuff here:
https://github.com/UweHeim/xt
Since we developed our own native and free IDE for Execute Anonyous we rarely use eclipse anymore but CodeFusion you can find here:
https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B5SYEEA3
Then to debug everything else (pages, triggers, batches, future) we have created an other managed package called XLog. It effectively logs into an custom object. We have not released it yet and it comes with some quirks, but it's good enough for 90% of all usecases.
Answer: If its for debugging purposes and not needed long term you could add all your debugging into a Document so that you don't have tons of logs to look at and then delete that code afterwards when it's no longer needed.
String myLog = 'Start Log ' + DateTime.now();
...
myLog += '\nFinishing Log ' + DateTime.now();

Document d = new Document();
d.Name = 'LogFile xyz';
d.Body = Blob.valueOf(myLog);
d.ContentType = 'text/plain';
d.Type = 'txt';
insert d;


How to enable editing for a single column in Gridview?

Question: Right now, I have three columns in a GridView:
<asp:GridView ID="ProjectTable" runat="server" AutoGenerateColumns="False" DataSourceID="PopulateProjectTable">
        <Columns>
            <asp:BoundField DataField="ProjectID" HeaderText="Project ID" SortExpression="ProjectID" />
            <asp:BoundField DataField="ProjectDescription" HeaderText="Project Description" SortExpression="ProjectDescription" />
            <asp:BoundField DataField="ProjectNotes" HeaderText="Project Notes" SortExpression="ProjectNotes" />
        </Columns>
</asp:GridView>
<asp:SqlDataSource ID="PopulateProjectTable" runat="server" ConnectionString="<%$ ConnectionStrings:sandboxConnectionString %>" SelectCommand="SELECT * FROM [Projects]"></asp:SqlDataSource>

For the most part, it's read only except for the third column. At first, I thought about using AutoGenerateEditButton, but it causes every column to be writable. I thought that would be fine, but I don't want to give user that much power. Therefore, I thought of two ways to tackle this problem. The first way was to have it such that the third column would be readable by default, but by left clicking a row in that column, it would change it to be writable. It would be reminiscent of lightly double clicking a file name in Windows and it would be editable.
The second way is to disable the editing for the first two columns when I hit the AutoGenerateEditButton and to instead only have it "work" for the third column. However, I'm unsure of how to do this part.
Is my first way even possible in GridView? Note that I am doing all of this in Visual Studio. Thank you.
Answer: In this case you will need to use Edit template>> it will allow you to make cell editable or read only
Answer: Go to the design mode for the .aspx file.
Click on your GridView control.
Click the small ">" arrow button that appears.
Click Edit Columns.
In the selected fields list, you can set the attributes for each column.
Make a column editable by setting readOnly to false.
Comment: Also, you must enable the 'edit' functionality for the gridview:
Go to the design mode for the .aspx file.

Click on your GridView control.

Click the small ">" arrow button that appears.

Click Enable Editing.
Answer: In the onRowDataBound event for the grid, you can set the columns you want disabled on a case by case basis.


Car reversing in drive

Question: 2012 Optima (automatic) with a broken transmission casing mount (1 of the 3, was in the process of repairing). Was on the freeway yesterday and I felt a drop/shift in my engine and every dash light came on and my power steering turned off, 0 rpms and cruising on leftover momentum but the engine was still on. When I'm able to pull off safely enough to test the car, the engine won't turn off. Every time I tried to turn it off it made a terrible clanking sound, so I figured I would attempt to gas it softly and see if it'll move. Then the car started reversing while in drive. Is my transmission blown? No smoke or burning smell occured
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Answer: What happened
There is a physical linkage between the gearshift lever and a mechanism on the transmission. This commands the selection of gears.  The computer (PCM) may also be involved, but the physical linkage is at least a failsafe in case of computer malfunction.
This linkage probably has some mechanism to allow for relative motion between transmission and body.  But this has limits.
If your transmission mounts are broken badly enough for you to actually get to repairing them, then most likely the transmission moved around enough to actually interfere with or break that linkage. Thus causing it to select ??? gear, possibly reverse.
This may have been caused by a marginal mount failing altogether, possibly due to strain from the now-mismatched mounts.
By the way, this happened because you extremely underestimated the amount of force on engine and transmission mounts. That transmission multiplies torque by 400% so if you're pulling 100 ft.lb. with a gentle start, those mounts are seeing 400 ft.lb.
Why were the controls weird?
There are also electrical connections between transmission and body. Some interlock functions happen through that electrical connection.  So for instance the interlock that doesn't let you remove the key until the transmission is in Park, might be electrical and would care about what gear the transmission is in, not what gear the shifter handle is in.
While it is correct to immediately shut the engine off in that situation, one should only shut the engine off by moving to the Intermediate OFF or OFF/ACCY position!!!  And you better know how to do that.
Moving it all the way to "OFF/LOCK" (the position from which the key can be removed) is a deadly mistake, because that will lock the steering column after a limited amount of wheel movement! So you will be steering and then suddenly click you are not steering anymore.   That is a good way to wind up in opposing traffic or in the ditch!   Never do that. Know the difference.
What to do about it
You will need to have it towed home. This is way beyond any roadside repair, and I am very bold with those.  It cannot be done roadside.
Once it is home, you will need to tear into it to find out what exactly happened and if the sites the transmission mounts tie into are still intact enough to be usable. With any luck, it's just a matter of the failing transmission mounts having failed the rest of the way, and 2 more mounts and you're golden.
Then repair or replace the transmission linkage, which is more likely than not borked. Since it's hard to tell a bent one from a straight one, just hit Pick-n-Pull and get another.
Then you can button it up and do a standing test to make sure all the gears select properly, and take it carefully out for a very cautious 10 mph road test.  Then if that checks out, then a 25 mph road test, and if that's simpatico try normal speeds.  You won't know about transmission damage until you try it.
I think most likely the transmission is alright, so I would consider it worth buying the other mounts and popping them in.
Oh. And if you have to change transmission or vehicle, think about a manual.  It is slightly inconvenient to drive until you catch the habit, but so much cheaper to maintain. No more having to scrap a car because the tranny went out, a manual lasts the life of the car. You replace a clutch every 100k miles or so, $150 in parts.
Comment: Thank you for your insight! I am considering a manual car at this point. I had taken the car to a few different shops and was told it was safe to drive with the broken mount if I didn't go too far but evidently not.

Car reversing in drive


Golden age science fiction comic about shrinking man

Question: I'm trying to find a comic from the golden age era about a scientist that is sitting in a psychiatrist office describing an experiment that went awry and has him continuously shrinking, finding out that each atom is another solar system. The doctor thinks the man is crazy until he looks up from his notes just in time to see the man shrink from view. Please help me!
Comment: It might have been Lost In the Microcosm, Buzz. I read the story in a hardback anthology book some years ago. If it helps there was also a story about some space explorers whose ship ends up in sauerkraut battling microorganisms.
Answer: I suspect you're thinking of "Lost in the Microcosm", a story in EC Comics's Weird Science #12 (dated May-June 1950), which was an adaptation of Henry Hasse's "He Who Shrank" (Wikipedia link).

A world-celebrated professor reveals to his assistant, the tale's narrator, that he has discovered that the visible universe at the largest scales corresponds to the microscopic universe at the smallest observed scales, the relations between universe's planets suns, and star cluster being identical to the relations of electrons, atomic nuclei, molecules. Rather than explore the universe at their own scale, the professor intends to explore the worlds endlessly nested within matter itself, which he argues by induction, must go on to ever smaller levels, and claims to have invented a substance, that once-applied will cause an individual to perpetually shrink. His assistant thinks him insane, but the professor, surprising the assistant, injects him with the substance, temporarily paralyzing the assistant and dooming him to eternally shrink ever smaller, through successively smaller worlds, each a subatomic particle of the previous one. (The injected substance, "Shrinx", has engineered secondary properties such as oxygenating the blood and protecting against heat loss in space.) The professor will monitor the assistant's fate through a device that receives his sense of sight and sound, and intends to eventually follow suit and set himself shrinking as well, although they would never meet again due to the infinitesimal chance of tracing the same path through the subatomic worlds.

Here's a motion comic version of it (he begins to shrink into the chair around the 16 minute mark):

NOTE: Weird Science #12 was actually the first issue of Weird Science; it took over the numbering of another comic. This has to do with postal regulations at the time; and, due to issues with those regulations, they changed the numbering to #5 as of the fifth issue (so, #12 - 15, then #5 - 22). So, this is the first Weird Science #12.
Comment: Note that neither of the answer links @FuzzyBoots lists in his comment refers to the comic book - as he says in the comment, both refer to the original prose short story.
Comment: If this is the correct answer, you can accept it by clicking on the checkmark by the voting buttons.
Comment: The short story has been provided as an answer at https://scifi.stackexchange.com/questions/117756/what-is-this-shrinking-scientist-story/117757#117757 and https://scifi.stackexchange.com/questions/146784/atomic-man-story-identification/146788#146788 albeit neither accepted.


Work on multiple Sandboxes that belong to the same org. in Google Chrome

Question: I wish to test carry out testing in a Production environment and in the Sandbox environment using Google Chrome in different windows. Currently I have to use different browsers - (Firefox or Safari etc.) to test. Is there anyway or any Google Chrome Application that will allow me to run the Production org and Sandbox with just using Google Chrome?
Answer: As long as they are on different instances (the naX/csY part in na1.salesforce.com) you can work in multiple orgs simultaneously. Just remember to always visit login.salesforce.com and not to logout from one org.
When using chrome, this extension may help a big deal: Chrome Salesforce.com Sandbox Favicon Extension
Comment: Also, I find Incognito mode helps a lot since the browsers will have different color schemes,  helping to differentiate which org you are in.
Comment: If they are on the same instance you can refresh the sandbox org (which will delete everything in it and refresh to what production has in it) and the instance may change or during a preview release window you can get the org to move instances if you really want it to be different.
Answer: I use Google Chrome's multiple user feature. When you switch the user, Chrome opens a new Chrome window, with entire different set of everything including cookies.
Answer: In addition to Off's answer, you can use the Chrome Incognito window to open up another instance of Chrome that doesn't share session details (Cookies) with any existing instance. As such, you can log into another sandbox regardless of it being on the same pod as another session you have open.


BERT has a non deterministic behaviour

Question: I am using the BERT implementation in https://github.com/google-research/bert for feature extracting and I have noticed a weird behaviour which I was not expecting: if I execute the program twice on the same text, I get different results. I need to know if this is normal and why this happens in order to treat this fact in one or another way. Why is the reason for this? Aren't neural networks deterministic algorithms?
Answer: I had the exact same problem using the pytorch implementation, until I realised I didn't set the model in eval mode. Hence, dropout was still activated. I guess this is also the source of your undeterministic behavior.
Fix using pytorch:
model.eval()

Using tensorflow with an Estimator, ensure you call estimator.evaluate or estimator.predict during testing. If you exported the model in some ways, then you should check the tensorflow documentation.

BERT has a non deterministic behaviour


Non-root tethering app with Ubuntu client for Moto Droid on Verizon

Question: I love PDAnet for android, works great on my Windows machine. Unfortunately, I just found out (after installing Ubuntuon my HP mini) that there's no Linux client. Can anyone recommend a tethering app,  non-root, with a Linux/Ubuntu client?
Comment: What Android version are you running? Froyo 2.2 already has wireless tethering so that should do it for you otherwise can you upgrade to 2.2?
Comment: 2.2: Verizon doesn't allow wifi tethering on Droid 1 to my knowledge (without paying more ) @mlev
Comment: So they modify the actual OS to disable that feature do they? Go to *Settings > Wireless & networks > Portable Wi-Fi hotspot* Can you enable it? Does it even exist on your phone?
Comment: @mlev it's sad,they ripped it right out.
Answer: Try AziLink (http://code.google.com/p/azilink/).  You will need to do a little setup on your Ubuntu machine in addition to loading the app on your DROID, but it will work without requiring you to root your DROID.  This is a USB tethering solution that I have used in the past with my Ubuntu netbook to great success.
Answer: I used this modified version of Proxoid for quite a while.
You need to set up the android developer kit first, and follow the instructions on the Proxoid website on how to enable it.
Answer: Recycling an answer from a recent duplicate.

Easy Tether from Mobile Stream should work. It's a way to share your internet connection with another device via USB. Get the Lite version (does not support https, or tethering to gaming consoles) or the Full version.

Supports Windows 7/Vista/XP (32-bit and 64-bit), Mac OS X
  10.7/10.6/10.5/10.4, Ubuntu 10.4+ and Fedora 13+

Full version supports the following:

Tether PS3, Wii, XBox via PC Internet Connection Sharing, you need a
  computer for game console tethering.
Answer: Just a mention I have AziLink working to tether both Puppy Linux (dpupbuster64) and Lubuntu 19.04 to an older Sonim XP5 phone.  I use a reseller MVNO on ATT network.  They have no problem with customers on GSMA network (ATT) tethering, but the phone I am using is network locked to ATT and ATT had hotspot and tethering locked to try and charge more. Try to use the built in hotspot/tethering and get popup to call ATT.  I tried rooting with no success, but the free crippled EasyTether and open source free AziLink worked.  AziLink took little more work to set up and it seems abandoned, least no mention of it since like 2011 (Its 2020 now).  So saved myself $10 over uncrippled EasyTether and learned something in setting AziLink up.
I am just posting that AziLink still works in 2020.  It will occasionally go into a connect-disconnect loop, rare but happens.  You just reboot your computer, make sure service is on in AziLink app on phone, then run the commands (I use a script with shortcut on desktop to make it one click).  I think openvpn is the cause of this, so killall openvpn might work too. Havent tried that though. Remember AziLink was made for version openvpn from ten years ago and AziLink hasnt been updated.  I am using current version openvpn so...


Link tables issue for Compiled Access (mde) file

Question: I have an old compiled Access Application mde file. This application has linked tables to network shared folder. I tried to upgrade main database using upsizing wizard on main database and everything went well. Then when the application starts it gives error message that

Microsoft jet database engine cannot find the input table or query table

I have checked the shared mdb file it has exact table names and everything.
Then I called the guy who developed this application. He said I have to rewrite the application to not use Jet engine...
What does Jet Engine has to do with linking tables? Do I really have to rewrite the whole application to use ADO?
Comment: Did you upgrade the .mde or .mdb?
Comment: I upgraded the main mdb database. I just upgraded to improve performance. I thought it is gonna be faster.
Answer: Many questions:

do you have the source MDB file? I can't recall if creating an MDE fails if the linked tables are not correctly connected. In any event, should you end up needing to alter the app, you're going to need the source MDB file.
the error message you report should give the name of the missing table.
do you know when the error is being reported? There could be any number of places where simply replacing tables linked to a Jet MDB back end with ODBC links to a server will not fix things. For instance, should there be any saved queries or SQL in code that bypasses linked tables and uses a direct connection string, that could produce an error like you see.
in regard to the developer's response that "I have to rewrite the application to not use Jet engine..." either you misunderstood what he said, or your developer is completely incompetent. Or both, I guess. Jet works very well with ODBC linked tables and if you're using an MDB front end, it is impossible to completely eliminate Jet, as the MDB is a Jet data file. The desire to eliminate Jet mostly comes from people who can't be bothered to learn how to use it properly.

It sounds to me as though you're getting an unhandled errror but insufficient information on what's producing it. You need the actual MDB to troubleshoot it, as the code isn't there to display in the MDE so there's no way to figure out what the actual source of the problem is. If your developer won't give you the MDB, then you need to check the contract under which the app was developed -- if you agreed to letting him control the source code, you're basically at his mercy and should fire whoever signed off on that. For what it's worth, when I deliver an MDE to a client, they also get the full MDB. They generally don't do anything with it, but should I no longer be available to do further development work, they've got the source code that they can give to whomever they want.
Last of all, I think it's very unlikely that even if you get your app working, a mere upsizing is going to offer much in terms of performance or stability. It is true that very often, 90% or more of an upsized app will work without alteration, but the other 10% can be very problematic. Often you need to move certain operations server-side to get the efficiency a server back end offers. This means your front end app needs to be re-architected to work better with your upsized back end. The degree to which this is true will differ from app to app, but it's very seldom that absolutely everything works without revision.
Comment: + Thank you. Anyway it is not mission critical application. I just wanted to improve its performance linking to SQL server, but i didn't think about conversion problems that you mentioned.
Comment: BTW the person sent me the mdb file and now it is working with linked tables. Seems like it was Access mdb version incompatibility.
Answer: You did change Access database version?
It is possible that your mdb was linked with old version of Jet drivers and these drivers cannot connect to newer mdb version.
Comment: the Application is written on OfficeXP I created with Access 2003.