Lambert's Original Proof that $\pi$ is irrational.

Question: I am trying to find Lambert's original proof that $\pi$ is irrational. Wikipedia has a little description but it is quite lacking. Can someone direct me to Lambert's original proof or post his proof here?
Thanks.
Answer: Here is the complete proof:
Part I Derivation of continued fraction for $\tan(x)$
Part II Proof of Irrationality of continued fractions
Part III Proof of Irrationality of $\pi$.
Part I
We show
$$\tan x=\cfrac{x}{1-
\cfrac{x^2}{3-\cfrac{x^2}{5-\cfrac{x^2}{7-\cdots}}}}$$
First we treat Lambert's continued fraction expression for the quotient of two power series.
Let $F_0$ and $F_1$ be two power series we may assume without loss of generality that they both have nonzero constant term
and that in fact  both have constant term of $1$.
Define
$$F_1-F_0=b_1 x F_2$$
$$F_2-F_1=b_2 x F_3$$
$$F_3-F_2=b_3 x F_4$$
$$F_{n+1}-F_n =b_{n+1} x F_{n+2}$$
where at each step we make the assumption that $F_n$ has a constant term of $1$. In general we would simply get higher powers of $x$ in the equation.
Define $$G_n=\frac{F_{n+1}}{F_n}$$ then we have by dividing the last equation by $F_{n+1}$,
$$G_n=\frac{1}{1-b_{n+1}xG_{n+1}}$$
therefore
$$\frac{F_1}{F_0}=G_0=\cfrac{1}{1-
\cfrac{b_1 x}{1-\cfrac{b_ 2 x}{1-\cfrac{b_3 x}{1-\cdots}}}}$$
Now we shall apply this to obtain continued fraction expansions for several functions including $\tan x$.
Let us define the particular power series,
\begin{equation*}
\begin{split}
F_n =&1+ \frac{x}{1! (\gamma +n)} +\frac{x^2}{2! (\gamma +n)(\gamma +n+1)} +\frac{x^3}{3! (\gamma +n)(\gamma +n+1)(\gamma +n+2)} \cdots \\
&1+ \sum\limits_{k=1}^{\infty} \frac{x^k}{k! (\gamma +n)\cdots (\gamma +n+k-1)}
\end{split}
\end{equation*}
Then we have
$$F_{n+1}-F_n =-\frac{x}{(\gamma +n)(\gamma +n+1)} F_{n+2}.$$
Thus with $b_n =  -\frac{x}{(\gamma +n)(\gamma +n+1)}$ we get
\begin{equation*}
\begin{split}
\frac{F_1}{F_0}=&\cfrac{1}{1+\cfrac{\frac{x}{(\gamma)(\gamma +1)}}{1+\cfrac{\frac{x}{(\gamma +1)(\gamma +2)}}{1+\cfrac{\frac{x}{(\gamma +2)(\gamma +3)}}{1+\cdots}}}} \\
&=\cfrac{\gamma}{\gamma +\cfrac{x}{(\gamma+1)+\cfrac{x}{(\gamma +2)+\cfrac{x}{(\gamma +3)+\cdots}}}}
\end{split}
\end{equation*}
Now let us set $\gamma=\frac{1}{2}$ and instead of $x$ write $-\frac{x^2}{4}$
Then $$F_1= \sum\limits_{k=0}^{\infty}(-1)^{k}\frac{x^{2k}}{(2k+1)!}=\frac{\sin x}{x}$$
and
$$F_0= \sum\limits_{k=0}^{\infty}(-1)^{k}\frac{x^{2k}}{(2k)!}=\cos x.$$
Putting this altogether we get
$$\tan x=\cfrac{x}{1-
\cfrac{x^2}{3-\cfrac{x^2}{5-\cfrac{x^2}{7-\cdots}}}}$$
Part II
In the continued fraction,
$$\cfrac{b_1}{a_1 -
\cfrac{b_2}{a_2 - \cfrac{b_3}{a_3 - \cfrac{b_4}{a_4 -\cdots}}}}  $$
assume that
where $1+b_n \leq a_n$ for all $n$, and that we have $1+b_n < a_n$ infinitely often.
Then the fraction is irrational.
Assume that the fraction is rational, say
$$\frac{\lambda_1}{\lambda_0}=\cfrac{b_1}{a_1 -
\cfrac{b_2}{a_2 - \cfrac{b_3}{a_3 - \cfrac{b_4}{a_4 -\cdots}}}} $$
where $\lambda_1$ and $\lambda_0$ are positive integers, now since the fraction converges to a number less than one, $\lambda_1 < \lambda_0$
If we set $$\rho_1=\cfrac{b_2}{a_2 - \cfrac{b_3}{a_3 - \cfrac{b_4}{a_4 -\cdots}}} $$
then we have
$$\frac{\lambda_1}{\lambda_0}=\frac{b_1}{a_1 -\rho_1}$$
so$$\rho_1=\frac{a_1 \lambda_1 - b_1 \lambda_0}{\lambda_1} < 1$$
So $\rho_1=\frac{\lambda_2}{\lambda_1}$ where $\lambda_2 < \lambda_1$.
Continuing in this way we obtain a strictly decreasing sequence of positive integers, $\lambda_0 > \lambda_1 > \cdots$, a contradiction.
Part III
This expression leads to the following fundamental result.
$\pi$ is irrational.
Assume that $\pi$ is rational, then $\frac{\pi}{4}$ is also rational.
Let $$\frac{\pi}{4}=\frac{a}{b},$$
and substitute $x=\frac{\pi}{4}$ into Lambert's continued fraction for $\tan x$.
We get
\begin{equation*}
\begin{split}
1=&\cfrac{\frac{a}{b}}{1-
\cfrac{\frac{a^2}{b^2 }}{3-\cfrac{\frac{a^2 }{b^2}}{5-\cfrac{\frac{a^2}{b^2}}{7-\cdots}}}} \\
&=\cfrac{a}{b-
\cfrac{a^2}{3b-\cfrac{a^2}{5b-\cfrac{a^2}{7b-\cdots}}}} \\
\end{split}
\end{equation*}
 Now since eventually $nb > a^2 +1$ we have that this expression is irrational, and this is absurd since it is equal to $1$.
 Therefore $\pi$ is irrational.
Comment: How did you get $\rho_1 < 1$?
Comment: Following up on @Isomorphism's comment, if you assume that $\rho_1 < 1$, why can you then plug in $x = \frac{\pi}{4}$ and apply the theorem? In that case, $\rho_1 = 1$.
Comment: It seems to me that the concerns expressed by Isomorphism and @templatetypedef are valid ones. I am posting an answer to address those concerns.
Answer: There is a proof here, but i am not sure if it's helpful or not: http://www.pi314.net/eng/lambert.php
Here is a link to the original article: http://www.kuttaka.org/~JHL/L1768b.pdf
Comment: I don't know what to make of the proof given in your first link. The proof given of lemma 1 does not make any sense.
Comment: @Sandeep Silwal Lambert's original proof is long and complicated with respect to some other proofs (as you can see from the original article). All 'Lambert's proofs' i came across have gaps in them (for me at least), since they try to shorten it. Have a look at this: http://paramanands.blogspot.com.tr/2011/05/irrationality-of-pi-lamberts-proof.html#.U-qez6P5eoY and the next post http://paramanands.blogspot.com.tr/2011/05/irrationality-of-pi-lamberts-proof-contd.html#.U-qgp6P5eoY. Maybe this will help.
Answer: This post is meant to supplement the useful answer of Rene Schipperus, in view of the unanswered comments by Isomorphism and templatetypedef under Schipperus's answer (which seem to me to be valid concerns regarding Part II).
Claim: let $a$ be a positive integer, and let $b_1, b_2, b_3, \ldots$ be a sequence of positive integers, and assume that for all $n$ we have
$$0 < \cfrac{a}{b_n - \cfrac{a}{b_{n+1} - \cfrac{a}{b_{n+2} - \ldots}}} < 1.$$
Then each of these continued fractions is irrational.
Putting aside questions of convergence, the proof was essentially given by Schipperus in his answer. Without loss of generality, we prove the continued fraction in the case $n=1$ is irrational. Suppose it were rational, say $\frac{c_2}{c_1}$ where $c_1, c_2$ are positive integers. Then $c_1 > c_2$ by our assumption in the case $n=1$. Write
$$\frac{c_2}{c_1} = \frac{a}{b_1 - e_2}$$
so that $e_2$ is the continued fraction above in the case $n=2$. By our assumption, we have $0 < e_2 < 1$. Solving for $e_2$, we have
$$e_2 = \frac{c_2b_1 - ac_1}{c_2}$$
so that defining $c_3 = c_2b_1 - ac_1$, we have that $c_3$ is a positive integer less than $c_2$. Proceeding in this way, we produce a strictly decreasing sequence of positive integers $c_1 > c_2 > c_3 > \ldots$, contradiction.
Now we finish off Schipperus's proof as follows. Consider the sequence of numbers
$$\cfrac{a^2}{(2k+1)b - \cfrac{a^2}{(2k+3)b - \cfrac{a^2}{(2k+5)b - \ldots}}}$$
for some large $k$. It is enough to prove that one of these numbers is irrational. But clearly these numbers decrease as $k$ increases, and for large enough $n$ we reach a point where for all $k \geq n$, all these numbers are in the range strictly between $0$ and $1$. This completes the proof.


Why not using segmentation architectures for object detection?

Question: Current object detection architectures like Faster-RCNN and YOLO seem to be overcomplicated in comparsion with segmentation architectures like Unet. So, why can't we just draw some rectangles around the instances on the segmentation mask (which can be done easily using opencv or skimage)? Such an appro
Comment: Is your question complete? Looks like it got cropped
Answer: At the end of the day, if an architecture satisfies your goal, you should use it. If you can detect objects using a segmentation model, go ahead.
But that's where practice differs from theory. Don't forget that there is a reason that image segmentation and object detection are different tasks. Not every task that can be solved by object detection can be solved by image segmentation, and vice versa. For instance:

If you need to classify objects that are not contiguous or particularly rectangular (i.e. you need to segment out the background behind someone's face on a webcam), segmentation will be much more practical
If you need to rapidly detect a small object on a picture, you really shouldn't care about the other pixels.
Trying to detect objects using segmentation would mean that your training data would need to be at the pixel level, and it might create funny artefacts, especially if your objects are small (your model might just guess that everything is "not your object" because it is what the vast majority of pixels are anyway)

There are also opinionated differences between U-NET and YOLO.
U-Net, specifically, was built with medical imaging in mind. So the architecture should:

Learn effectively with smaller amounts of training data
Work well with very detailed images
Not care too much about speed or performance, as the output quality is paramount

Whereas YOLO was built with this in mind:

Speed is of the essence as you'd typically use YOLO with video streams, and it needs to scale well to scenarios where multiple bounding boxes need to be computed
Because it's typically used on many images, the exact quality of the bounding boxes is less crucial (as you could maybe average out the bounding boxes of a few frames together or do other sorts of postprocessing)
YOLO assumes use cases where training data is widely available

So at the end of the day, the reason object detection architectures might appear "overcomplicated" is because they are optimizing for something different. And the reason U-net appears so simple (I'd rather call it elegant), is because it only has so much data to train with, so if the model was too complex, it wouldn't learn as effectively.


Asymptotic distribution of a measure of homogeneity

Question: For an exam preparation I'm trying to solve the following question, but I get stuck. The question is

One measure of the homogeneity of a multinomial population with $k$
  cells and probabilities $p = (p_1,\cdots,p_k)$ is the sum of the
  squares of the probabilities $S(p) = \sum_{i=1}^k p_i^2$. Note that
  $\frac{1}{k}\leq S(p)\leq 1$, with higher values indicating greater
  heterogeneity. Given a sample of size $n$ from this population, we may
  estimate $S(p)$ by $S(\hat{p})$, where $\hat{p} =$
  $(\hat{p}_1,\cdots,\hat{p}_k)$ and $\hat{p}_i$ is the proportion of the
  observations that fall in cell $i$. What is the asymptotic
  distribution of $S(\hat{p})$?

Following a proof for Neyman's $\chi^2$, I define random variables $X_{ij}$ such that $P(X_{ij} = 1) = p_j$ and $P(X_{ij} = 0) = 1 - p_j$. Then $EX_{ij} = p_j$ and $EX_i = p$ where $p = (p_1,\cdots,p_k)$. Furthermore the covariance matrix of $X_1,...,X_n$ is given by $\Sigma = \begin{bmatrix} p_1(1-p_1) & -p_1p_2 & \cdots & -p_1p_c\\ -p_1p_2 & p_2(1-p_2) & \cdots & -p_2p_c \\ \vdots & \vdots & & \vdots \\ -p_1p_c & -p_2p_c & \cdots & p_c(1-p_c)\end{bmatrix}$.
Then $S(\hat{p}) = \sum_{i=1}^k \begin{pmatrix} \frac{n_i}{n} \end{pmatrix}^2$ where $n_i$ denotes the number of trials that result in outcome $i$ for $i = 1,...,c$. So $S(\hat{p}) = \bar{X}_n^T\bar{X}_n$.
Starting here I get stuck trying to find an asymptotic distribution for $S(\hat{p})$. I know that $\sqrt{n}(\bar{X}_n - p) \xrightarrow{\mathcal{L}} \mathcal{N}(0, \Sigma)$, but I fail to see how I can derive the asymptotic distribution of $\bar{X}_n^T\bar{X}_n$ from here. I hope someone can help me out!
Answer: Use the multivariate form of the delta method for $g: \mathbb R^k \to \mathbb R$ defined by $x\mapsto x^\intercal x$. So, for $\sqrt n (\bar X_n - p)\stackrel{d}{\longrightarrow}N(0,\Sigma)$, we have $$\nabla g_{(p)}=2p\,\,\,\,\, \text{and} \,\,\,\,\, \sqrt n (\bar {X}_n^\intercal\bar X_n - p^\intercal p)\stackrel{d}{\longrightarrow}N(0,\nabla g_{(p)}^\intercal\Sigma\nabla g_{(p)})= N(0,4p^\intercal\Sigma p).$$
Comment: what if the vector p is uniform, you will get $p^T \Sigma p = 0$.


What do these korean workplace titles mean?

Question: I'm here to ask a question, what do 실장 and 팀장 mean in a company scale like celebrity agency?
Thanks in advance
Answer:

Korean
English

실장
General Manager/Department Manager/Head of Corporate Office

부장
General Manager

차장
Deputy General Manager

과장
Manager

(팀장)
Office Manager/Team Leader/Head of Team

대리
Assistant Manager

주임
Senior Clerk/Senior Staff/Supervisor

사원/직원
Clerk/Staff

Many companies have often changed positions with overlapping positions such as "Manager" and "Manager" to "Team Leader."
It's hard to know for sure unless someone is actually working at the company. And also it is not clear because each company has different jobs depending on their positions.
Department Manager(실장) will be involved in all tasks of the agency, and the Team Leader(팀장) will manage one of them.
Answer: 실장 is a corporate rank, whereas 팀장 is more of a business title. Traditionally, Korean conglomerates do not include the position 실장 in their corporate hierarchy but I've heard of smaller firms, e.g. celebrity agencies as you point, that do. 실장 should fall in somewhere between 차장 and 부장, both a team lead or 팀장 role.

사원: Analyst (non-executive)

대리: Associate (non-executive)

과장: Manager (non-executive)

차장: Associate Director (team lead, non-executive)

부장: Director (team lead, non-executive)

이사/상무보: Vice President (executive)

상무: Senior Vice President (department lead, executive)

전무: Executive Vice President (department lead, executive)

부사장: Senior Executive Vice President (executive)

사장: President/CEO (executive)

부회장: Vice Chairman (executive)

회장: Chairman (executive)


Reinstalling python on CentOS to be able to use yum

Question: Yesterday I accidentally removed the python package using "yum remove" on a CentOS server. After then I realized yum was dependant on python and I could no longer use yum. I think I need to reinstall python to fix the problem. How can I do this without using yum?
Comment: this is not a programming question
Comment: you can compile Python from source if you have a compiler installed and make and autoconfigure
Comment: You may find that your question gets better results on ServerFault =)
Answer: I'm surprised you were able to remove the python package. It has so many dependencies on a RHEL/CentOS system, that there's a good chance you removed far more than python. Running yum remove python on one of my CentOS systems yields:
Dependencies Resolved

====================================================================================================================
 Package                                 Arch           Version                             Repository         Size
====================================================================================================================
Removing:
 python                                  x86_64         2.4.3-46.el5                        installed          72 k
Removing for dependencies:
 AcronisAgentLinux                       x86_64         41.0.16-1                           installed          13 M
 BackupAndRecoveryAgent                  x86_64         11.0.17318-1                        installed         154 M
 GConf2                                  i386           2.14.0-9.el5                        installed         4.6 M
 .
 .
 .
 yum-metadata-parser                     x86_64         1.1.2-3.el5.centos                  installed          55 k
 yum-security                            noarch         1.1.16-21.el5.centos                installed          60 k
 yum-updatesd                            noarch         1:0.9-2.el5                         installed          55 k
 yum-utils                               noarch         1.1.16-21.el5.centos                installed         194 k
 zsh                                     x86_64         4.2.6-6.el5                         installed         3.6 M

Transaction Summary
====================================================================================================================
Remove      493 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: (Heck-no!)

Did you actually let the process remove hundreds of installed packages?
If you only removed a single package, you would need to download the python RPM for your particular version of CentOS. If this was CentOS version 5.8 on 64-bit, for instance, you'd find the current package name in the CentOS repository... Look for python-2.4.3-46.el5.x86_64.rpm
To install that particular package, use wget http://mirror.anl.gov/pub/centos/5.8/os/x86_64/CentOS/python-2.4.3-46.el5.x86_64.rpm to download the individual package. Use rpm -ivh python-2.4.3-46.el5.x86_64.rpm to actually install it with the RPM package manager.
Comment: That surprised me as well. Here is what happened:
- I got problems when I tried "yum update", mostly on python packages
- I called yum remove python, and then I realized it had so many dependant packages and stopped uninstallation.
- After then yum started failing because python was removed
- I logged out of the server and couldn't connect ever again using SSH terminal as OpenSSL packages were dependant on python.

I'm not a linux admin but I don't think an OS should let you remove python using yum (which is dependant on python).
Answer: Building your own Python back didn't work for me. This works:
(note this is for a Centos 6x host, which now uses Python2.6, but it's the same thing)
wget  http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch
wget  []://mirror.centos.org/centos/6/os/x86_64/Packages/python-devel-2.6.6-51.el6.x86_64.rpm
wget  []://mirror.centos.org/centos/6/os/x86_64/Packages/python-2.6.6-51.el6.x86_64.rpm
wget  []://mirror.centos.org/centos/6/os/x86_64/Packages/python-libs-2.6.6-51.el6.x86_64.rpm

rpm -Uvh --replacepkgs *.rpm

And then Yum will work again.
Comment: when i had this issue, wget/curl didnt work either but fortunately scp did
Comment: I did have the same kind of incident when porting to Python3 in order to install a Python Webserver on Apache. I discovered that Yum was Python2 only. I have been looking for a wget solution to recover Yum. Thanks AndyD! I am on VM Centos7 though but I guess it shouldn't be an issue.
A bit off topic but I am left with a option to install both Python versions in /usr/local directory and to point Python2 to system and Python3 for Apache.
Answer: If you have make&&gcc installed:
wget http://www.python.org/ftp/python/2.4/Python-2.4.tar.bz2
tar jfvx Python-2.4.tar.bz2
cd python
./configure
make all
make install

Then you can have your Python back.
Comment: Thanks for that but as I lost the access to the server using SSH terminal, I couldn't try this. I ended up reinstalling the OS.


Should I upgrade the hub, cassette or wheel so my bike will make a sound when I don't pedal?

Question: I have a Hardtail 29' M Niner 2016, Shimano XT 10 speed, everything is perfect but I always wanted to have that sound from the hub when I go for a ride, so I want to know what I need to upgrade to have that sound?
Comment: A playing card and a clothespin.
Comment: Do you know the brand of your rear wheel hub ?  It may be written on the hub, or possibly on the side of the wheel's rim.
Comment: Pull apart your hub and wipe all of the grease out of the ratcheting mechanism.
Answer: It's the freehub rachet mechanism in the hub that makes a rapid repeated clicking sound when you stop pedaling. The cassette is not involved as it slides on the splined freehub body and has no moving parts. (Older technology freewheels combined the sprockets and rachet mechanism on on unit though.)
Silent or quieter hubs are usually considered an upgrade. If you really want a noisy hub you can but a replacement hub and have the wheel rebuilt. Wheel rebuilds almost always require new spokes and take a couple hours of labor so it's very often more cost effective to simply buy a new wheel.
Comment: And if you do want to have a freewheel that sounds louder, some brands offer ratchets with more teeth and/or pawls, or more contact points that reduce the the degree of back play in the drive train so that your forward crank movement is more immediately engaged in forward thrust, which makes having a louder hub a real upgrade. look for brands like Chris King or DT Swiss. I love DT Swiss hubs.
Answer: As Argenti Apparatus already mentioned, the sound comes from the hub. There are various kinds of springs and ratchets in different hubs. You can use this Youtube playlist with hub sound checks as a guide when selecting your hub. The videos also contain explanation commentary for the features of the sounds.
For example:
Comment: One more thing , can these hubs fit my bike or what else should i upgrade ?
Comment: @Fitim search this site for questions and answers on rear wheel compatibility. It's not hard to work out.
Answer: Instead of rebuilding a new hub to your rim, it will probably be most cost effective to get a new rear wheel with one of the louder freehubs or you could even go for a complete set of wheels so the front & rear wheels have the same spokes & rims.
BUT, Shimano XT hubs are excellent and yes Shimano is noted for making quiet freehubs. I have wheels from Mavic and Fulcrum Racing which are quite loud. Both of these brands make excellent wheels and charge accordingly.


Does work only equal the change in energy for non-conservative forces? If so, is power measuring work of non-conservative forces?

Question: I have these formulas: work(net forces) = change in kinetic energy, and then work (non-conservative forces)= change in energy, and power=w/t=change in energy/time. So im confused about what the work in the power formula stands for? Is it only for non-conservative forces? Because it can't be for net forces since net forces equal kinetic energy, right?
Comment: Your question is rather broad.  If you could give a specific example and ask questions of that example, it would be easier to provide an answer to your question.
Comment: I find the definition of work unclear, for example here: https://en.wikipedia.org/wiki/Work_(physics)#Work_and_energy. I will stick to energy.
Answer:
then work(nonconservative forces)= change in energy,

This is where you are going wrong. A change in kinetic energy can be due to conservative forces as well as nonconservative force.
Consider the work done by gravity, which is a conservative force, on an object falling from rest at a height $h$ from the ground in the absence of air resistance. Per the work energy theorem
$$W_{net}=mgh=\frac{1}{2}mv_{final}^{2}-\frac{1}{2}mv_{initial}^{2}$$
For $v_{initial}=0$
$$mgh=\frac{1}{2}mv_{final}^2$$
Now the time it takes to fall a distance $h$ is based on
$$h=\frac{1}{2}gt^2$$
so
$$t=\sqrt\frac{2h}{g}$$
Given that
$$P=\frac{W}{t}$$
You can calculate the power delivered to the falling object by gravity.
Hope this helps.
Comment: It *is* true, however, that the work done by non-conservative forces is equal to the change in kinetic energy plus the change in potential energy.   From the way the OP phrased things, I suspect that's what they meant.
Comment: @MichaelSeifert Is it not true that If work results in a change in potential energy, then a conservative force has to be involved? Can you give me an example where there is a change in potential energy when no conservative force is involved.
Comment: You're correct there, but I wasn't trying to say otherwise.  I was trying to point out that if by "energy" the OP means mean "kinetic energy plus potential energy", then the OP's statement that "work done by non-conservative forces = change in energy" is actually correct (contrary to your first sentence.)
Comment: @Michael Seifert Perhaps. But it was my impression the OP thought that only non conservative forces can cause a change in KE.  I think we can agree that it's not really clear what is being asked.
Answer: From $\mathbf F = m\mathbf a$, making the dot product with a infinitesimal displacement $\mathbf {dr}$, we have $dw = \mathbf{F.dr} = m\mathbf{a.dr}$.
The right side of the equation can be proved to be $$d\left(\frac{1}{2}mv^2\right)$$.
So, the work of the net force is always equal to the change in kinetic energy. The force doesn't need to be conservative.
Power is the derivative of the work with respect to time.
Answer: The definition of work done being equal to the change in kinetic (or potential) energy is specific to conservative systems. Power, the timed rate in change of a systems energy usage, is not specific to conservative systems.
These are two separate concepts. For example, if a conservative force $F$ changes an object's velocity, then we say that the work done by $F$ is $W=\Delta E$ where $E$ is the kinetic energy.
But the power required to do so is $P=\frac{\Delta E}{T}$ where $T$ is the time taken to change the object's velocity. But at the same time, our object could have been made out of a metal, and its velocity changed by a magnetic force, which is not conservative. Nevertheless, the amount of power is still defined by $P=\frac{\Delta E}{T}$
Power is therefore a general term and not specific to conservative systems, and always describes the rate of energy used by a system. It is not only defined in mechanical systems, but others, like electrical systems.
Answer: It sound like you have a decent handle on conservative forces.  Let's compare an instance of conservative forces with non-conservative forces.  Conservative: An object falling in a vacuum in constant gravity.  Bob D has already spelled out that example.  Now, how about an object falling in constant gravity, but inside a thick atmosphere, or even water, instead?  In this case the change in potential energy will still be $mgh$.  But the change in kinetic energy, $(mv_{final}^2-mv_{init}^2)/2$, will be something smaller than $mgh$, perhaps much smaller.  And this raises the question of where the energy went.
Well, as the object was passing through the atmosphere, or water, it collided with millions (billions, whatever ...) of molecules and transferred energy to them.  Gravity gave energy to the object, but the object, instead of turning all of that energy into kinetic energy, "gave" some to the atmosphere.
If we had the ability to measure, we would see that the atmosphere was heated somewhat by the object, and the energy of the heat would be equal to the "missing" kinetic energy of the object at the end of its fall.  So energy is always conserved, as far as we know (and that's what it's looked like for about 400 years now), if the energy of the entire system is taken into account.  In this case, the energy of the entire system is the falling object plus the atmosphere.  So in this case, the work done by gravity, which is still equal to $mgh$, does not equal the change in kinetic energy.  But the work done by gravity does equal the total change in energy of the system.
As for power, that is still the work done by gravity on the whole system divided by the time over which the work is done.  But it is no longer the change in kinetic energy divided by the time.  So power is still $mgh/T$, but not change in kinetic energy divided by $T$.


What is wrong with my Chest script?

Question: I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script! But it doesn't work. I just want some help fixing this script.
#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?
Answer: The issue in your code is that you only check for the key press in the OnTriggerEnter function, which only gets called when the collider enters the trigger. What you probably want to do instead is check for the keypress inside the OnTriggerStay function, which gets called while the collider lies inside the trigger.
Comment: Always happy to help, glad to hear that this solved the problem!
Answer: Is the script attached to the game object of one of the two chests CurrentChest and OpenChest? Then keep in mind that deactivating a game object also deactivates all scripts attached to it. That means any events on them won't fire anymore. You likely only want to disable specific components of the chests.
Comment: I know that. Infact I created an empty game object and put the 2 chests in there with the game object having the script on it. Still nothing works. But someone already helped with it. Thanks anyway.

What is wrong with my Chest script?


Install PHP 5.3 on Ubuntu 13.04

Question: How I could install an old PHP version on Ubuntu 13.04 (Raring Ringtail) -preferably version 5.3.3?
Comment: Because before me was used Spreadsheet_Excel_Writer, wich couldn't work with new PHP version. I get many error like

"Non-static method System::tmpdir() should not be called statically"

and

"Call-time pass-by-reference has been removed"
Comment: @Blaze - please click the tick button next to the answer that helped you to close the thread.  Alternatively answer this yourself with full instructions how you installed an old PHP version.
Comment: Just out of curiosity, why are you wanting to force your system to use such an old version?
Comment: Thanks for all. I install PHP 5.4.9 and rewrite old script, witch made errors.
Answer: You can install php as usual, which will install 5.4, then use
this script to downgrade it to 5.3:
http://www.ubuntugeek.com/how-to-downgrade-php-version-from-5-4-to-5-3-in-ubuntu-12-10-quantal.html
Procedure to follow
First you need to download the shell script from above link.
Once you have php5_4_downgrade_5.3.sh file you need to change the permissions using the following command
sudo chmod 755 php5_4_downgrade_5.3.sh

Now you can run the script using the following command
sudo sh php5_4_downgrade_5.3.sh

Follow the on screen instructions
It worked on Rackspace cloud Ubuntu 13.04 today!
Answer: Unless you do a full recompile from sources on the 13.04 platform, I'd recommend NOT installing any pre-packaged version of an older PHP version on a later OS.  The reason is that there are many incompatibilities between major releases and you'll be UNpleasently surprised when things do not work.
In any event, its going to be a hassle taking time and effort.  You'll probably be forced into recompilation and reinstallation of a number of dependent packages as well to make this work.  It could require a lot of effort to keep the old version as newer support packages are released and updated by the vendor as well (i.e. more recompiles and reinstalls).
Also, keep in mind that there are problems fixed in the newer version of PHP (security issues) that are not worth backtracking to an older version.
One other suggestion might be to reinstall an OS that supports the PHP version you desire as part of the distribution.
Comment: Possibly install into a virtual machine as a sandbox.
Answer: I would propose to just run older Ubuntu release - especially Ubuntu precise still contains PHP 5.3 and it's also LTS.
Answer: There is a page with unsupported previous PHP versions here. I suppose that there is a README in the tarball with instructions.

Install PHP 5.3 on Ubuntu 13.04


Attack on RSA and ECC

Question: I am reading information about RSA and Eliptic Curves cryptography. Assuming that both these two algorithms have stages until two parts achieve key exchange. If an attacker eavesdrop the stages before achieving successful key exchange, and more specifically in wireless nodes, can't he manage to read/eavesdrop critical information in order to get the secret keys?
Comment: I believe you are asking about key exchange algorithms, like Diffie-Hellman, which allows to create a secret shared key between two parties even in the face of eavesdropping. Check out explanations on the Diffie-Hellman Key Exchange and that should answer your question.
Answer: With regard to Elliptical Curve Diffie Hellman (ECDH) key exchange, the answer is no, because the only information that goes over the wire is the users' public keys.  See the diagram below:

As you can see, after Alice and Bob exchange their public keys, Bob computes the shared secret by multiplying his private key and Alice's public key.  Alice does the same thing, she multiplies her private key and Bob's public key.  They arrive at the same shared secret.  But, someone eavesdropping on the connection would not be able to compute the shared secret, because that person would not have knowledge of either party's private key.

Attack on RSA and ECC


Integration over the state space

Question: I came across the concept of average fidelity
$\int f(\psi)d\,\psi$ where the integration is with respect to the uniform Haar measure on pure states.
I've only seen Haar measures in connection with topological groups, so I don't understand what measure is used in this context. Could anyone provide a reference where this is explained ?
Comment: I do not understand well. Are you dealing with the projective complex space (containing pure states) of a **finite** dimensional Hilbert space? The "Haar" measure is that induced by $U(n)$ on that projective space viewed as a quotient?
Comment: Yes it is over a finite dimensional space. Where can I find a reference about the measure induced by $U(n)$ that you mentioned?
Answer: The group $U(n)$ has a unique Haar measure, both right and left invariant, since it is unimodular as it is compact. Now consider the complex projective space $$\cal{P}(\mathbb C^n)=
\left({\mathbb C^n} / \sim\right) - [0]\quad \mbox{when}\quad v \sim v' \quad \mbox{iff}\quad  v = cv'\:, \quad c\in \mathbb C -\{0\} \:.$$ The group $U(n)$ acts smoothly (with respect to the natural real smooth 2n-2 dimensional manifold structure of the projective space) and transitively on $\cal{P}(\mathbb C^n)$, trivially: $${\cal P}(\mathbb C^n) \ni [v] \mapsto [U\psi]\:.$$
${\cal P}(\mathbb C^n)$ can therefore be viewed as a smooth quotient of $U(n)$ and the compact subgroup $H_n$ which leaves fixed a point of ${\cal P}(\mathbb C^n)$.
Under these conditions, taking into account that both $U(n)$ and $H_n$ are compact (Lie) topological groups and thus are unimodular, there exist a $U(n)$-invariant positive Borel measure $\mu$ on ${\cal P}(\mathbb C^n) = U(n)/H_n$, unique up to the normalization. That is your measure.
These results were essentially due to Mackay. An account of the general theory can be found in Ch.4 of fundamental  Barut-Raczka's textbook on the theory of group representations and applications World Scientific 1986.

Integration over the state space


ShowWindow()...mfc

Question: I am calling one dialog box from another.....before calling 2nd dialog box i am hiding the 1st dialog box using ShowWindow(SW_HIDE) and after finishing the operation on 2nd dialog box i destroy it....now when the control comes back to the function i am using ShowWindow(SW_SHOW) to show the 1st dialog again but it remains hidden..can anybody help me how to show it again????
EX:
<code>Funcn(){

    ShowWindow(SW_HIDE);//hide the dialog box 1st

    SecondDlg var;//Class variable of 2nd dialog box

    var.DoModal();//call the 2nd dialog box

    ShowWindow(SW_SHOW);//after executing this statement the dialog still remains hidden...how to show it??

}
</code>
Answer: Maybe you want to call ShowWindow(SW_RESTORE) instead of SW_SHOW?

ShowWindow()...mfc


Where and how can i study UX Design

Question: What are the different options to study UX DESIGN? Specific degree or formation? can we do a home study?
Comment: UX people come to the table with all sorts of different degrees.
Comment: I up voted this because it got down voted so many times. I don't see why, its a legit question. People are too trigger happy with down votes! More elaboration would help though
Comment: Studying UX can be made in the university or at home, but never without practicing. UX is more of a practical work than a theoretical one. Still the principles and laws of design (there are quite a few) can be studied at home. But be sure to practice much!
Comment: I came across this very recently, and thought it might be germane. Not having gone through that system, though, I can't vouch for its accuracy (others will surely comment): http://www.andyrutledge.com/the-ux-design-education-scam.php
Comment: An additional thread from here that may provide some additionally helpful info: http://ux.stackexchange.com/questions/16000/what-do-i-need-to-know-to-get-started-as-a-professional-ux-interaction-designer
Answer: Yes ;-)
People come to the UX world from many different places. Some from design degrees, some from UX / HCI type degrees, some from cognitive psychology, others from CS, others from other weird and wonderful vocations.
All get good at UX work by actually doing UX work. Degrees, books, blogs, courses, etc. are all great - and impart lots of useful information. However, like riding a bike or learning to draw, you don't get good at UX by being told about it or reading about it. You get good at it by doing it.
So if you're looking to get into the field by all means find a degree or course you can start learning relevant facts, skills and techniques - but most importantly find a way to start practising and applying that knowledge.
Answer: Besides adrianh's answer, I'd alsorecommend reading UX.SE (this site)
Even if you don't answer the questions, it's important to think about them.
In the real UX world, a lot of different issues come up in seemingly unexpected ways. Some of them end up on this site. You can never know when will you need to design an Android app (even if you work on WebApps), or make a huge intranet application more usable (even if you're focusing on consumer products right now)
So I guess it's pretty fine and gives you a lot to learn if you try to step into the questioner's shoes, and click on the Balsamiq button to try to create a solution, or try to trace the issues back to primary UX values.
Even if you find out there's already a better answer than yours, or you find out that you don't know the answer, and you don't hit the Post Your Answer button at the end, it's an amazing learning opportunity.
Answer: Although the class is now 3 weeks in, Stanford is running their Intro to Human Computer Interactions class online through Coursera:
https://class.coursera.org/hci-2012-002/class/index
This is the second time it's being run, and I imagine it will be run again in the future. The class is a great introduction to designing an actual product, starting with observing users and looking for problems to design for, all the way through testing a functional prototype. I took the class both in person at Stanford as an undergrad, and I'm taking it right now through Coursera (it's a great refresh of the content!). I'd highly recommend it.
Comment: +1, it's from Scott Klemmer, University of California, San Diego. https://www.coursera.org/course/hciucsd
Answer: The best advice I've ever received regarding UX education:

If you want to be a UX designer, start calling yourself a UX designer. Pretend you are one, and do everything a great designer would do. At some point, you won't have to pretend.

Find good books in the industry and read them -- cover to cover. Ones I've found particularly useful include The Design of Everyday Things for theory, About Face for "soft" techniques, and Quantifying the User Experience for "hard" techniques.
The best thing you can do for yourself is practice. Practice the things they talk about, and soon enough you'll know them by heart. Classes can teach you a few things, and there's good reason to complete up to a master's degree. But it doesn't seem to matter what you complete, just that you have a degree and that you're good at what you do.
Join some organizations and meet people. UXPA is a good one that I'm a part of here in NYC. It'll help you get a sense for what people are actually doing in the industry. And yes, @Aadaam is right: read this site.
Edit:
Here's a great article that helped shape my thinking when I was in the process of breaking into the industry: How to Break Into UX Design.
Comment: @Captain: actually.... http://en.wikipedia.org/wiki/Frank_Abagnale#Airline_pilot (and let me not shoot my joke about the Airbus planes, I dub it "press takeoff cockpit") but I have huge problems with people who "look like" designers (newest berlin fashion, apple-only gadgetry, black glasses, scarf, and such) and don't know sh.t about design, so be careful with this method pls.
Comment: @Captain I'd drop the mac
Comment: "If you want to be a UX designer, start calling yourself a UX designer. Pretend you are one, and do everything a great designer would do. At some point, you won't have to pretend." You could say that with most things, apart from stuff like airplane pilot!
Comment: Very true. I guess it was just good overall life advice. (I wish I had thought it up myself!)
Comment: Hahah -- very true. Looking the part is certainly different than acting it.
Comment: Surely a beanbag and a mac makes me a better designer? ;)
Comment: Guitar Center exists almost solely because of this same misconception. If only there were a Guitar Center for designers... Hmmm anyone want to start a company? We'll be rich in no time.
Answer: You can study UX design all by yourself (as with any other subject in web design). You can easily be self-taught but it depends on your ability to execute the UX process and the outcome, to be a good UX designer.
However, and to be very specific to your question, there ARE courses provided by universities. They usually call it: Human-Computer Interaction. In there you will learn how to carry out user research, focused groups, learn more about user psychology, social studies, document your finding, etc... This is all very useful and it is really what UX is about.
As an example, my university offers a Master's degree on this:
http://www.ucl.ac.uk/lifesciences-faculty/degree-programmes/human-computer-interaction-ergonomics
Answer: There are many academic programs that will result in anything from a certificate to a PhD. Human Factors International (HFI), a for-profit UX training and consulting firm, has a good list on their site:
http://www.humanfactors.com/downloads/degrees.asp
There are also certificates that you can earn by taking an exam. Training for the certificates will provide you quick exposure to the field, but will not make you an expert on UX immediately. This will only come through work experience and mentoring. Here are a couple of those certificate options:
http://bcpe.org/page/BCPE-Certifications-at-a-Glance
http://www.humanfactors.com/certification/default.asp
Like others, I recommend diving into the UX literature. Everyone has their own favorites, but I would start with "The Design of Everyday Things" by Norman, "Don't Make Me Think" by Krug, and "A Practical Guide to Usability Testing" by Dumas & Redish.
Finally, I would get involved in any local chapters of national groups like UXPA, ACM SIGCHI, IxDA, IA Institute, etc. Through those channels (or via your own workplace), I would identify a mentor locally to help you start your career in UX.
Answer: UX design can be studied independently from home, you need to start practicing. The theory can be found on the Internet, and practice to see sites with examples of works, for example,https://www.behance.net/, https://dribbble.com/, and on the websites of design agencies, for example, https://fuselabcreative.com/ or http://momentumdesignlab.com/. If self-study is not enough, you can contact specialists  in social networks, for example https://www.linkedin.com/. You can find a specialist and ask for advice. There are also online courses for free and paid education, for example https://hackdesign.org/, https://www.coursera.org/, https://www.skillshare.com/, https: // www .thegymnasium.com / and others. During the training you can more closely communicate with specialists on the relevant topic.

Where and how can i study UX Design


The probability distribution of the number of coin flips needed to get $n$ heads or $k$ tails

Question: Suppose we are flipping a fair coin. Let n,k be fixed numbers. We flip the coin until we get a total of n heads or a total of k tails. What is the probability distribution of the number of coin flips needed to get n heads or k tails? If it is easier, what is the expectation? The support of this discrete distribution is from the min(n,k) to n+k-1.
Answer: The probability of getting the $n$-th head on the $r$-th toss,
is that of the $r$-th toss being a head, and exactly $n-1$ of the first
$r-1$ tosses being heads, that is $p_r=
2^{-r}\binom{r-1}{n-1}$. In this case
this probability is only relevant if $r-n<k$. There is a similar
formula for the probability that the $k$-th tail occurs on the
$r$-th toss, that is $q_r=2^{-r}\binom{r-1}{k-1}$. So the probability
you seek is $p_r+q_r$ if $n\le r<k+n$ and $k\le r<k+n$, is $p_r$
if $n\le r<k+n$ and $k>r$ and is $q_r$ if
if $k\le r<k+n$ and $r>k$.
Comment: Thank you! I think this is right. Is there a name for this distribution? I want to find a closed form for its expectation. Also, is there a way to find a multinomial version. By that I mean instead of a coin flip, we can have a roll of a die. We stop if we get k1 ones, or k2 twos etc until k6 sixes. It is probably elementary to figure it all out, but I was wondering if it had a name so that I can lookup properties, asymptotics etc. Thanks again.
Answer: This is a negative binomial distribution.
Suppose that $X \sim NegBin(r;p)$
The probability mass function is given as
$$f(k;r,p) \equiv Pr(X=k) = \binom{k+r-1}{k}p^{k}(1-p)^{r} $$
where $k$ is the number of successes and $r$ is the number of failures with probability $p$
We have
$$E(X) = \frac{r}{p} $$
In your specific case we have
$$ X \sim NegBin(k;p) $$
Then our mass function is
$$f(n;k,p) \equiv Pr(X=n) = \binom{n+k-1}{n}p^{n}(1-p)^{k} $$
where we have $n$ heads and $k$ tails.
Given that you said it was fair $p =\frac{1}{2}$
$$f(n;k,p) \equiv Pr(X=n) = \binom{n+k-1}{n}(\frac{1}{2})^{n}(\frac{1}{2})^{k} $$
$$f(n;k,p) \equiv Pr(X=n) = \binom{n+k-1}{n}(\frac{1}{2})^{n+k}$$
$$f(n;k,p) \equiv Pr(X=n) = \binom{n+k-1}{n}2^{-(n+k)}$$
Comment: There is no $n$ in your answer.
Comment: Thanks for the response. It is not negative binomial because we stop either when we get n ones or k zeros.
Comment: Ahh that is unfortunate..


Get list of users from OpenFire server

Question: I'm currently trying to make a Strophe based javascript script to get the list of available users in an OpenFire server (live refreshing needed). I don't care if I have to create a group, room or whatever it's called (anyway, the server will be running for only a small group of users, everyone connected to eachother), but I want to be able to make the server give such a list.
How can I do this? I've read that I need to use muc extension, but I can't seem to find it anywhere...
Answer: Problem solved! I had to add the users I was working with to a group and eachtime a user leaves or enters the room OpenFire notifies the other users of the room with a presence stanza wrapped inside a body tag most of the times. This makes Strophe to not identify those presence stanzas very well, so I had to overwrite the xmlInput function from the Strophe connection to get every single xml stanza that I get from the server.
<code>conn.xmlInput = onXmlInput;
function onXmlInput(data) {
    Strophe.forEachChild(data, "presence", function(child) {
        var from = child.getAttribute('from');
        from = from.substring(0, from.indexOf('@'));
        //'type' will contain "unavailable" when offline and no attribute 'type' when online
        if (!child.hasAttribute('type')) {
            addUser(from);
        } else {
            deleteUser(from);
        }
    });
}
</code>
Comment: Hi , you are creating a group and from that you are getting online users but is this having limitation for 30 user ?
Comment: I haven't had any trouble with limitations since I've not worked with large amounts of users... maybe you could post a question in a separate thread about this ;)
Comment: what inside adduser and deleteuser method?
Comment: @ButaniVijay `addUser` and `deleteUser` are your custom methods to execute when a new user joins or disconnects from the server. In my case, I added and removed them from a list of connected users. Here's my `addUser` method: `$("select#recepients").append(""+from+"")`

Get list of users from OpenFire server


Signal reflections inside CPU?

Question: Given the fact that the clock frequency is about one GHz and the corresponding wavelength is about the same order of magnitude (velocity of propagation is lower than 3 * 10^8 m/s inside the chip) with chip dimensions, is care taken care of to suppress signal reflections inside the chip?
Comment: Some SoC devices have internal bond paths measured in inches (I first encountered one in 2000); for high speed inputs there is often a termination on the die itself.
Comment: No, before the wire is so long that reflections become relevant you will have trouble meeting timing. In which case you add buffers in which case the path get shorter.
Comment: If the signal propagates at 0.7c then the wavelength is roughly 15cm. For the sake of discussion let's say that a quarter wavelength is 4cm. So, if you wanted to use Manhattan-style wiring and get a wire length of 4cm you need a die that is somewhat larger than 2cm on each side, maybe an inch on each side. Pretty big but not impossible. However, it would be very unlikely to have a single uninterrupted wire from one corner of the die to another operating at 1GHz. High speed signals are distributed with many buffers in the path.
Comment: Did you actually calculate the wavelength at 1 GHz and compare it to chip dimensions? Also, the velocity of propagation in a wire is not equal to the speed of light in a vacuum.
Comment: λ=10^8/10^9 = 10 cm. I am assuming velocity equals 10^8. Chip dimensions is one third or one fourth of the wavelength? Am I geting this right or wrong?
Answer: Most traces inside of dies are pretty short relative to the wavelength. An individual x86 processor core at 14nm is only 3x4 mm, while even the longer traces connecting things like L3 cache slices between cores in the Intel die photos look to be only about 4-5 mm long.  Compared to the wavelength (>40mm), that is pretty short.  My guess is they're not terminated, and they've picked that spacing and die orientation specifically to avoid it, but I could be wrong.
Conversely things like off die links (memory, PCIe, etc) are impedance matched because the distances are much longer.  AMD for example shows how they use on-die termination resistors for their chip to chip links in this diagram:
https://en.wikichip.org/wiki/File:amd_if-ifop-serdes.png
Answer: hard to get reflections, when skin effect causes current crowding and the higher frequency edges are attenuated.
Skin depth in copper is about 35 microns, at 4MHz.
At 400 MHz, the depth is sqrt(100) smaller, at 3.5 microns.
At 100 * 400MHz, or 40GHz or 25 picosecond edge rates which is about what the faster MCUs have internally, the skin depth is sqrt(100) smaller still, at 0.35 microns.
===================
Now we should consider the aspect ratios of modern metalizations, where plasma etching is used ----- very steep sidewalls.
Comment: 350nm is huge. Remember that modern IC technologies these days have feature sizes well under 100nm.
Comment: How does the skin depth compare to the conductor thickness on a 1GHz integrated circuit?

Signal reflections inside CPU?


Mailman: How to split up mails into batches

Question: Having huge mailinglists with maybe 10k subscribers, is there a way to split list forwarded by mailman into batches maybe a 1000 mails sending out each batch maybe with an offset? Or would it make more sense to configure postifx  a little smarter?
Answer: The only reason you would want to split your mailing queue is to pass spam filters on major mail servers, but the problem is it won't help you to get through them. Instead of trying to bypass spam-protection by technical means, you should comply to Bulk Senders Guidelines which every major server has. This mean implementing SPF, DKIM and unsubsrcibe header. That way your mail won't be sent to spam no matter how much messages you are sending in one batch...
Comment: It's not about spam -- I want to leverage load a little on my box a little. But tahnks for the hint anyway.


Max Farming in Dark Souls III

Question: What is the maximum possible item discovery level in Dark Souls III, with 99 luck, Symbol of Avarice, etc. In short, every possible thing you can do to increase item discovery and what is the maximum number?
Answer: According to the Wiki:

The highest possible Item Discovery is 599, when equipped with two Crystal Sage's Rapiers, the Symbol of Avarice, the Gold Serpent Ring +2, using a Rusted Gold Coin and having 99 Luck.

As pointed out in the comments, if you have the Ringed City DLC, you can get a Gold Serpent Ring +3, raising the max by 15 to 614.
Comment: With the Ringed City DLC, there is now a Gold Serpent Ring +3, which gives 115 item discovery, 15 more than the +2 version.
Comment: @fhl thanks for the information! I edited my answer.
Comment: Don't think it won't still take for-freaking-ever to farm Concords, though. -_-

Max Farming in Dark Souls III


Cyclic orbit animation

Question: I'm trying to make one object orbit another. But I want it to repeat, rather than stop at 100 frames. It seems there is no option for this. Is there a way to make this happen?
Comment: Do you want to render it over 100 or play in the view port repeatedly?
Answer: There are several ways to do what you want here's one:
Create an object, then and a Curve->Circle to act as the path for your orbit.
NOTE Make sure that the origin of the curve is in the same place as the object's origin.

Select the object and add a Follow Path constraint and select the curve as the path to follow. Make sure you click on Animate path.

Now your object will follow that path forever and ever and ever...

To control the speed of the orbit select the curve and change the Path Animation value to a smaller number of frames to go faster or a bigger number to go slower.
Answer: The oldest way to have an object follow a path is by Parenting the object to the curve with the Follow Path option.
This method has the problem mentioned on the question: the object moves along the path once and stops at frame 100.

How to make the movement cyclic since there are no Keyframes or other obvious choices?
Let's look at how the movement works.
The Object travels along the path following the settings on this control panel:

The Frames Value determines how many frames the object is going to take to travel through the path. The default value is 100, meaning that the object will take 100 frames to complete the circular motion (or the complete lenght of the path).
The Evaluation Time determines how far along the path is the current frame.
At frame 1 the object will be at the starting point of the path.
At frame 100 the object will have finished travelling through the full length of the path.
The problem is that past frame 100 the evaluation time keeps advancing, but the object has already completed a full loop through the path and has nowhere else to go!

Yes! But how to change it!!??
Well, there is another piece of this puzzle. Selecting the curve and opening the Graph Editor reveals this graph:

That shows the problem clearly. The horizontal scale is Time and vertical is Value. At frame 0 the evaluation time is 0. At frame 100 the evaluation time is 100 and from there it keeps growing. To make a cycle we want the evaluation time to start over from 0 at frame 101!
By Pressing N on the Graph editor (or the + sign on the top right of the window) you can access the panel and the Modifier function that is creating all this mess.

Enough already!! How do I fix this???!!!
Delete the Generator Modifier by clicking on the X

Create two keyframes by clicking while pressing Ctrl. One keyframe should be at frame 1 with the value of 1 and one at frame 100 with a value of 100. Set the interpolation to linear and add a Modifier, selecrting the option Cycles to create and endless cycle!

Every 100 frames the Evaluation time will reset to 0 and start over. To alter the speed of the orbit just set the keyframes closer together to go faster or further away to go slower.
Answer: So what to do if you have painstakingly made the orbit with keyframes and want to make them cyclic?

You could copy and paste the keyframes of the curve... Too much work again...
If you press N you can access the numeric panel for the curves and ther you can add a cycles modifier to create cyclic motion.

Answer: Place an empty at the location of the object you wish to orbit around, make this empty the parent of the object you want to do the orbiting, animate the rotation of the empty.

To get a continuous rotation, insert a rotation keyframe as a starting point, then advance a few frames, rotate the empty, then insert another rotation keyframe. In the graph editor select the rotation value and change channel extrapolation to linear. Channel->Extrapolation Mode->Linear Extrapolation.

This allows you to have two keyframes on the rotation and have it constantly rotate. By changing the frame and the value you control the speed at which the object orbits around.
Answer: Ok if i understand what you are asking there is 2 ways to do this , The first is to set the finishing frame number to 100 in the following image :

The second being to duplicate the frames in the dope sheet. To do this select all the keyframes by pressing A twice ( make sure your mouse is over the dope sheet tab ) , and press Shift + D , And move your mouse over until it is sitting next to the last keyframe , and also make sure the finishing frame number is set to the number which the last keyframe is on.
Answer: Just parent your object to an empty, then parent empty to an object you want to orbit around, animate one cycle, extrapolate channel to Linear:
Answer: I'm surprised no one has mentioned geometry nodes yet! You can't apply geonodes on a camera because it's not a mesh but you can apply translate and rotation transforms on a mesh through geonodes and through vertex parenting apply them on a child camera

Add any mesh, for example a cube that you'll call cameraman
click on the cameraman then shift+click on the camera to select both
Ctrl+P to make the camera the child of the cameraman, select the vertex (triangle) option
Rotate the camera 90° on the Y axis (shortcut: click on camera, then R, then 9,then 0)
Create this geonodes modifier on the cameraman so that it rotates around the circle:

This works by translating the cameraman by a vector of $(5,0,0)$ (5m is the radius I chose here), and having this vector rotate by one full rotation (ie an angle of $2*pi$, which explains the multiply by 6.253, once every 100, which explains the divide by 100.
At this point the camera is translated along a circle, but in order to look at the center one must also add the Combine XYZ { x: pi/2, y: 0, z }.
You can find a .blend file showing just that in this .blend collection.

Cyclic orbit animation


1) "before all" hook: prepare suite for " "

Question: I am trying to create an Integrated test (to test multiple smartContracts working together). I re-initialize them inside beforeEach() function. So I get the clean test for each test case. I have done the same things in other integrated tests,(using the same contracts), but here I get this errors.

As you can see, there was no issues in IntegrationTestWhitelist (all 4 sub-tests passed)
However, TransactionTests failed

While troubleshooting I figured out that, the TransactionTests works only if I initialize two or less smartContracts in beforeEach().
Any more than that and I get "out of gas" error. I tried to initialize/comment them in different combinations too, and it is always fine as long as I do not initialize more than two. There seems to be nothing wrong with contracts individually. Rather it looks like the are "too" expensive when combined.
So I wonder if anyone had a similar issue?
The Code:
<code>pragma solidity >=0.4.21 <0.7.0;
pragma experimental ABIEncoderV2;

import "../../../contracts/Whitelist.sol";
import "../../../contracts/Blacklist.sol";
import "../../../contracts/dgE.sol";
import "../../../contracts/ECB.sol";
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";

contract TransactionTests {

    //Contracts
    dgE public DGE;
    ECB public ecb;
    Whitelist public WHITELIST;
    Blacklist public BLACKLIST;

    // Run before every test function (Only works if I comment out any two of them)
    function beforeEach() public {
        DGE = new dgE();
        ecb= new ECB();
        WHITELIST = new Whitelist();
        BLACKLIST = new Blacklist();
    }

    /**
    * The function should always return the same value. (Just an initial test)
    */
    function testSender() public {
        Assert.equal(msg.sender,msg.sender,"Values should be Equal");
    }
</code>
Comment: Did you solve your problem bro?
Comment: You have the same issue??
Comment: Yes :((((((((((
Comment: I guess maybe its depends of contract count, im also try to use 2 contracts but got same errors
Comment: I did some tests, and it 100% isn't the contract count (I used 3-4 no problem). It seems to be related to contract size, or maybe some conflict in contract inheritance. (As some of my Contracts import a bunch of other contracts)

Would love to contact you over Zoom/Discord or something to see your issue to compare our issues and get at the bottom of it.
Answer: I had this error because of the solidity contract size issue, if your compiler is throwing an error about exceeding the maximum ~24kb size, fix the contract size issue first and the error will go away. This is what solved my similar problem.


Toggle between dev and production mode

Question: I would like to have a way  to toggle between production and dev endpoints within from the phone settings. I am worried that this will mess up the cash and might display incorrect data. what's the best way to do it, please?
Comment: you need a setting inside the app that can set it to development mode?
Answer: I was wondering the same thing!

In your code, you can use the __DEV__ global flag to differentiate between Dev and Production "mode".
Expo's Production switch is not a reliable way to handle environment switches (production and dev endpoints in your case). Why? 2 main reasons:

Production mode always minifies your code and better represents the performance your app will have on end-user's devices.
Development mode includes useful warnings and gives you access to debugging tools.

What if you want to have the flexibility to run the app against the Production endpoints you have, but still being able to access the debugging tools? You can't.
Here's my approach: I handle environment switches with .env files.

With Expo, I got my .env to work with the following:

Added babel-plugin-inline-dotenv to devDependencies:
npm install --save-dev babel-plugin-inline-dotenv

Added inline-dotenv to .babelrc:
{
  "plugins": ["inline-dotenv"]
}

Added a .env file:
ENDPOINT="https://development"

Kudos for the .env set-up instructions goes to jdrydn.

Finally, use the environment variable in your code:
<Text>{process.env.ENDPOINT}</Text>

Plus, I have one more file .env-production (technically, I have also .env-staging in case you're wondering):
ENDPOINT="https://production"

The real caveat is when you want to run your app against the Production environment. You need to:

Copy .env-production content to the .env file.
Restart Expo's Metro Bundler and clear its cache (must be always restarted between .env changes). Do that either by running expo r -c or by pressing shift-r in your terminal to restart and clear cache while the Metro Bundler is running.

That's the most optimal approach I've been able to find.
PS: If you want to toggle between Dev and Production endpoints within you app - I'd simply use a js file with exported variables for each environment.
Comment: this is very informative, can you please elaborate more about this " If you want to toggle between Dev and Production endpoints within you app - I'd simply use a js file with exported variables for each environment."
Comment: It depends on your specific use-case. Big picture overview: wire-up the toggle with a variable you can access easily from anywhere, let's say `currentEnv` (that can be 'PROD' or 'DEV'). Your env configuration might look something like `export const env = { DEV: { endpint: 'https://development' }, PROD: { endpint: 'https://production' }};`. Then, in your code you go for `env[currentEnv].endpoint`.

Toggle between dev and production mode


blow-up along singular variety

Question: Can somebody give me a nice example of blow-up of a smooth algebraic variety along a singular subvariety? Something I can do some exercise on and check the differences with a smooth blow-up. Thanks!
Answer: Perhaps the easiest is to blow up a plane along a fat point:
Blow up $\mathbb A^2_k=\mathrm{Spec} k[x,y]$ at the ideal $(x^2,y^2)$. You should get a pinch point (Whitney's umbrella). This itself is an interesting singularity. It's simple normal crossing away from the pinch point, but not so simple there. If you want to practice blow-ups, then as a second step blow up the pinch point and marvel at the fact that you get a new pinch point. The only way to resolve or even make a pinch point any better is to normalize it.
Not all fat points lead to singular varieties. Blowing up $(x^2,xy,y^2)$ is the same as blowing up the simple point $(x,y)$.
Comment: Yet another example is blowing up $(x^2,y)$. Then you will get an $A_1$ singularity.
Comment: In general, blowing up a toric variety along a toric subscheme will get you another toric variety, so that's fun, since you can think about it polytopally. In Sasha's example, start with the first quadrant, and cut off the triangle with vertices $(2,0),(1,0),(0,0)$. The result has two vertices, one of which is smooth and the other an $A_1$ singularity. (Sándor, do you remember us discussing this example at the blackboard around 1995?) In Sándor's second example, we cut off the triangle with vertices $(2,0),(0,2),(0,0)$ which is just a rescaling of $(1,0),(0,1),(0,0)$. Try $xy=z=0$ in $A^3$.
Comment: @Allen: That's nice. Actually I do remember that conversation (somewhat vaguely though). I still don't think about polytopes instinctively even though again and again I see the usefulness of it. Thanks for reminding me!
Comment: Can one explain the example of blowing up along a snc divisor? e.g. Blowing up P^3 along union of two planes.
Comment: @MohammadF.Tehrani: the union of two planes in $\mathbb P^3$ or more generally an snc divisor in a smooth variety is Cartier and hence blowing it up does nothing. It's an isomorphism.

blow-up along singular variety


Can light radiation pressure change its own path

Question: Well i have seen that light creates radiation pressure
Can two light waves coming from two different direction change each others path?
Comment: Related - https://physics.stackexchange.com/q/81943/37364
Comment: Also related: https://physics.stackexchange.com/a/441670/206691, which includes a quantitative estimate and a couple of references.  It's a relatively small quantum effect, absent in classical electrodynamics.
Answer: The scattering of light by light is a very tiny quantum effect that was first observed in 2016 with high-energy photons at the Large Hadron Collider.
https://en.wikipedia.org/wiki/Two-photon_physics
Most of the time, photons do not interact with each other. When they occasionally do, they do not do so directly but instead indirectly through virtual electrons and positrons, or, even more rarely, through other charged particle-antiparticle pairs.

(Picture from Wikipedia.)
The cross section for this scattering process, in the zero-total-momentum frame, averaged over the polarization of the photons, can be calculated and is
$$\sigma(\gamma\gamma\rightarrow\gamma\gamma)=\frac{973\alpha^4\omega^6}{10125\pi m^8}$$
where $\alpha$ is the fine-structure constant, $\omega$ is the angular frequency of each of the two photons in the zero-total-momentum frame, and $m$ is the mass of the electron. This formula applies when $\omega$ is small compared to $m$ and is in natural units where $\hbar=c=1$.
https://arxiv.org/abs/1111.6126
For example, the cross section for green light with frequency 600 THz is $1.7\times10^{-67}\;\text{m}^2$. In other words, green photons behave as if they have a "radius" of about $2\times10^{-19}$ fermi. By contrast, the radius of a proton is about 0.9 fermi, so this shows how fantastically small the cross section is and how unlikely visible photons are to scatter off of each other. The effect is only observable with very high-energy photons.
Answer: Light waves in a linear medium such as the vacuum do not interact with each other at all, so the answer is "no".
Answer: No, photons create pressure when they interact with electrons in matter. Photon waves travel right through each other, similar to water waves, they do superimpose but only temporarily and then continue on their way.
Answer: TLDR: no, photons do not normally react with each other.
All of the answers above are technically correct (the best kind of correct), but I'm not sure they really explain what's going on if I'm reading your post correctly. I'll try using a toy model to illustrate some of the main features.
Particles with electrical charge, like the electron, produce a "sea" of "virtual photon"s around them. We'll skip the details of this for now, they're ultimately not important to this discussion. What is important is this: for every virtual photon, there is, over time, the exact opposite photon. So for instance, if the electron "releases" a photon going left with energy 1, it will also release one going right with energy 1. When you sum up all of this, you get zero. That makes sense, otherwise the electron would evaporate.
Now another important point is that the spectrum of these virtual photons is very specific - there is a relationship between their energy and the time before they are zeroed out again. So high-energy photons exist, but only for short times, and vice versa. When you add in this wrinkle you get something very interesting; the energy density of the overall "sea" (or "cloud", what have you) drops off almost exactly like the classical electric field.
Ok, so how does this cause a force? Well consider what happens when one of these things hits another electron. It is absorbed. So that second electron has now picked up the momentum from the virtual photon, and that makes it move away from the original electron. But even more interesting: since that electron was absorbed, the original electron now has a partner virtual electron that no longer has its partner. And that one had the exact opposite momentum, so that means the original electron starts moving away from the second. Just like classical electric force.
So what does all of this have to do with your original question? Well, photons are not electrically charged. That means they don't (normally) give off these virtual photons. That means they don't have an field, and that means, basically, they ignore each other completely.
Now the caveat to that statement is outlined by G. Smith above - at very very high energies other things start to occur that mean that two photons may indeed recoil from each other, but I don't think that's what you're asking about.


Adding extra data to Django Rest Framework results for entire result set

Question: I'm using Django Rest Framework and need to add extra data to a result set. Specifically, where you would usually have:
{
    "count": 45,
    "next": "http://localhost:8000/foo/bar?page=2",
    "previous": null,
    "results": [
        {...}
    ]
}

I would like to add extra counts like so:
{
    "count": 45,
    "10_mi_count": 10,
    "20_mi_count": 30,
    "30_mi_count": 45,
    "next": "http://localhost:8000/foo/bar?page=2",
    "previous": null,
    "results": [
        {...}
    ]
}

The extra counts in this example are just how many of the objects have a field distance with a value less than the miles described in the key.
My issue is that I have no idea where the best place to extend and insert this behaviour is.
Ideally I'd like this to work whether or not the results are paginated, making no assumptions.
What I'm really after here is a nod in the right direction (and why that is the right place for it go).
I've checked the docs and can't find anything that describes how to add things like this, but I would be more than happy to be proven wrong on that score.
Answer: Since you seem to be using one of the ListViews from the Rest Framework, you could override the list() method in your class and set new values on the resulting data, like this:
    def list(self, request, *args, **kwargs):
        response = super().list(request, args, kwargs)
        # Add data to response.data Example for your object:
        response.data['10_mi_count'] = 10 # Or wherever you get this values from
        response.data['20_mi_count'] = 30
        response.data['30_mi_count'] = 45
        return response

Notice that your class must inherit the ListModelMixin directly or via a GenericView from the Rest Framework API (http://www.django-rest-framework.org/api-guide/generic-views#listmodelmixin). I really don't know if it is the right way to do this, but it is a quick fix.
Hope it helps!
Comment: Hey, I went with a different method in the end which I've described in my own answer. This is a good alternative though so thanks very much.
Comment: I did a variation of this that worked great.  I wanted some aggregate min-max data returned with my query for some slider ranges.  I copied the implementation of the list method from the parent class completely into my subclass.  It gets the queryset object so i could modify it to run aggregate on the query set and add the results to the response.  thanks!
Answer: Use SerializerMethodField as mentioned in this solution.

It can be used to add any sort of data to the serialized representation of your object. (REST framework doc)

Example from the documentation:
from django.contrib.auth.models import User
from django.utils.timezone import now
from rest_framework import serializers

class UserSerializer(serializers.ModelSerializer):
    days_since_joined = serializers.SerializerMethodField()

    class Meta:
        model = User

    def get_days_since_joined(self, obj):
        return (now() - obj.date_joined).days

Comment: A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](http://meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it's there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted](http://stackoverflow.com/help/deleted-answers).
Answer: In the end I just created a custom pagination serializer with a field like so:

class DistanceCountField(serializers.Field):
    def to_native(self, value):
        try:
            distance_counts = {
                '1_mile': self._count_lte_miles(value, 1),
                '5_mile': self._count_lte_miles(value, 5),
                '10_mile': self._count_lte_miles(value, 10),
                '20_mile': self._count_lte_miles(value, 20),
            }
        except FieldError:
            distance_counts = None

        return distance_counts

    def _count_lte_miles(self, value, miles):
        meters = miles * 1609.344
        return value.filter(distance__lte=meters).count()

class PaginatedCountSerializer(pagination.PaginationSerializer):
    distance_counts = DistanceCountField(source='paginator.object_list')

    class Meta:
        # Class omitted, just a standard model serializer
        object_serializer_class = MyModelSerializer

I also added a distance annotation to each object in the queryset for the filtering to work on.
Answer: I'm piggybacking off the accepted answer here!
I think the main issue is that the serializer returns a ReturnList, which is just a regular list with some extra context.
You can just replace the data with your own OrderedDict like so:
response = super().list(request, *args, **kwargs)
new_data = OrderedDict()
new_data.update({
    'results': response.data,
    '10-mi-count': 10,
    #etc...
})
response.data = new_data

return response

Answer: I used DRF with pagination as well and wanted to add a summary of the returned queryset itself, so first I had to get the queryset in the list method.
def list(self, request, *args, **kwargs):
    queryset = self.filter_queryset(self.get_queryset())
    summary = {}
    summary['x'] = queryset.filter(transaction_type='x').count()
    summary['y'] = queryset.filter(transaction_type='y').count()

    page = self.paginate_queryset(queryset)
    if page is not None:
        serializer = self.get_serializer(page, many=True)
        data = {}
        data['summary'] = summary
        data['details'] = serializer.data
        return self.get_paginated_response(data)

    serializer = self.get_serializer(queryset, many=True)
    data = {}
    data['summary'] = summary
    data['details'] = serializer.data
    return Response(data)

This gave me the following response:
{
  "count": 20,
  "next": "http://..",
  "previous": null,
  "results": {
    "summary": {
      "x": 15,
      "y": 5,
    },
    "details": [
      {.....

Note: this will work for non-paginated results as well.


Elementary Sets

Question: I am just beginning to learn sets and am in need of a little guidance. The problem I need help with is: $A = \{a, b, c\}$, $B = \{\{a\}, \{b\}, \{c\}\}$. I believe that $A$ is not a subset of $B$, and $B$ is not a subset of $A$. I think my main question is if what I believe is correct. Is $a = \{a\}$ ?
Comment: Nope. it is not correct.
Answer: I hate this, I hate this, I hate this....
... but it tends to work and is useful for people.
A set is a bag full of groceries.  The elements of a set are the individual groceries inside the bag.  The bag of groceries is a "thing" in an of itself and is not the groceries that make it.
And it the store you can buy, smaller bags of groceries and put them in your bag.
So $A = \{apple, banana, carrot\}$ is a bag with three things in it.  They are apple, banana, carrot.  But $B=\{\{apple\},\{banana\}, \{carrot\}\}$ is a bag with three things in it.  The three things are a BAG with an apple in it, a BAG with a banana it it, and a BAG with a carrot in it.
An apple is a completely different thing that a bag with an apple in it.  These are not at all the same.
Anyway I really hate that analogy as it implies the skin of the bag made of paper is itself an thing and it avoids the question of "Well, gee, if an apple is inside a bag, and the bag is inside a bigger bag, isn't the apple also inside the bigger bag just deeper?"  The answer to that is a resounding no; a set is concept of the collection and although a collection may have a set as an element that does not imply the elements inside the set are in the collection.
An analogy I prefer is a library and you get to the reference desk and there is a reference book called "The Encyclopedia of Associations"  which includes the Boy Scouts.  And there is a reference book called "Books in Print" which includes "Razor Girl" by Carl Hiason.  And there is a reference book called "Guide to Reference Books" which includes... "The Encyclopedia of Associations" and "Books in Print".  But it does not include, for obvious reasons, either the Boy Scouts (which are not a reference book) nor "Razor Girl" (which is also not a reference book).
Of course, this analogy has it it problems too.  Namely, these lists are references to things and not the things themselves.  In sets the are the things themselves but being a collection things is different than the things being themselves rolling about without a bag.
Comment: Thank you so much for this, it helped me understand the problem really well.
Answer: Nope. it is not correct. As $a$ is a member of $A$ and $\{a\}$ is a subset of $A$. In other words, type of $a$ is an element, but the type of $\{a\}$ is a set.
Comment: Does this mean that $A$ is a subset of $B$ too? Thank You in advance.
Comment: @P.Patel Definitely no. This means $A$ cannot be subset of $B$.
Comment: @OmG What if $a = \{b\}$ and $b=\{c\}$ and $c = \{a\}$? (which violates ZFC which proves A cannot be a subset of B-- but for different reasons).
Answer: Set $A$ contains 3 elements $a$,$b$,$c$. On the other hand set $B$ however, contains 3 sets that all contain 1 element each.
That means that every set in set $B$ (in your case $\{a\},\{b\},\{c\}$) is a subset of $A$.
Answer:
$A = \{a, b, c\}$, $B = \{\{a\}, \{b\}, \{c\}\}$. I believe that $A$ is not a subset of $B$, and $B$ is not a subset of $A$.

That's correct. $A$ and $B$ do not even share any objects, which is a requirement for non-empty subsets. $\{a,b\}$ is a subset of $A$. $\{\{a\},\{c\}\}$ is a subset of $B$.

I think my main question is if what I believe is correct. Is $a = \{a\}$ ?

No, that's not correct.

Elementary Sets


How do I switch the default accounts in Google Drive?

Question: How do I take the default off of my secondary Google Drive account, so my primary account shows up first in Google Drive?
Answer: You can do the following.

Log out from all Google accounts.
Log in Google with the account that you want to use as primary first.
Login with your secondary Google account (add account).
Go to drive.google.com (It will be by default open with primary account). You can also switch account from there.

If you want to switch primary account of Drive, log out from all Google accounts and follow the above steps.
Comment: I have done this but it does not work. The account I log in with first is shown as "Default" in the list of accounts, and is first in the list, but if I open a link to a drive document, it always opens with the second account in the list.
Comment: @polm23 If your link has `/drive/u/1/` that could be the reason. Change it to just `/drive/`. Links can be altered to suggest the account to open it with. `/drive/u/0/` or `/drive/` is primary account, `/drive/u/1/` is the next account, and so on. (I wish `/drive/` would be the last chosen account instead, like what YouTube does... oh well.)


How to compile x64 code with Visual Studio in command line?

Question: I want to compile a simple hello-world-style program using the Windows command line.
cl file_name.c

is easy enough. Now I want to do the same thing in 64 Bit. What should I do?
Answer: You need to use a version of the cl.exe compiler which emits x64 code.  Which one depends a bit on your setup.
Let's consider the case you're on a 64 bit machine.  For this you'll need to use the compiler which lives at

c:\Program Files (x86)\Microsoft visual Studio 10.0\VC\bin\amd64\cl.exe

If you're on a 32 bit machine you'll need to use the cross compiler located at

c:\Program Files\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\cl.exe
Comment: Well, on x64 machines, there's 2 options. One can use either the 32-bit x64 cross compiler, or the native 64-bits compiler. Same result.
Answer: Run cl from a Visual Studio x64 Command Prompt.
Comment: How do I do that? There is only one Visual Studio Command Prompt in my Start Menu. Which is what I am already using.
Comment: @bastibe, Found it under Windows Start Menu --> Under "V" (do not type ha ha) --> Visual Studio (FOLDER) -> x64 Native Tools
Answer: You can also use the batch file "Vcvarsall.bat" (By default, the full path for this file is C:\Program Files\Microsoft Visual Studio 8\VC\Vcvarsall.bat for VS2005).
If no arguments are provided, this batch file configures the necessary environment variables for using the x86 32-bit compiler. But it can be used to configure any of the 64-bit compilers, for example to use the native 64-bit compiler pass "amd64" as argument. Then just run cl.exe.
Answer: Kyle is right.  It is just a matter of setting the PATH environment variable properly.  The regular x86 compiler lives in the vc\bin subdirectory.  There are two 64-bit compilers, a 32-bit compiler that generates 64-bit code in vc\bin\x86_amd64 and a 64-bit compiler that generates 64-bit code in vc\bin\amd64.
The default Visual Studio setup always uses the 32-bit compiler to generate 64-bit code.
Note that the 64-bit compilers are not installed by default.  You'll have to re-run setup.exe if you didn't use the custom install option.  And re-run the SP1 installer.
Comment: OK, but I get libcpmtd.lib(ios.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64', and I am unable to set linker options using /link /MACHINE:AMD64 in VS2013
Answer: Run cl from a "Visual Studio x64 Command Prompt" or something similar like "x64 Native Tools Command Prompt for VS 2017". Run where cl to see the path of which "cl" you're running. Something like "x64" or "amd64" should be in the path.
The start menu search can be unhelpful at times. Try typing "vs20xx" or "vs 20xx" instead of "visual studio" to find it. The name of the prompt changes over releases.  If it does not say "64", then it will set up a 32 bit environment.
The 64 prompt tends to just call "Vcvarsall.bat" with a 64 argument, but the argument changes over time and may not be backwards compatible.
Answer: If you have code as a part of project you can use as below
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe"  myproject.sln /Build "Release|x64"
got from below link
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/ed855b9d-55ef-49f1-bf27-f20a79be687e
Answer: As others have mentioned the answer depends on whether you are using a native x64 compiler or the cross compiler. This webpage should help you http://msdn.microsoft.com/en-us/library/x4d2c09s.aspx
Answer: if you type cl/? you see option /favor:<blend|AMD64|INTEL64|ATOM>
where INTEL64 is x64. see further here :
https://learn.microsoft.com/en-us/cpp/build/reference/favor-optimize-for-architecture-specifics?view=msvc-170
Comment: This specifies the compiler optimization. It does not switch from 32-bit to 64-bit targets. When using the 32-bit compiler, adding this option results in the warning `ignoring unknown option '/favor:INTEL64'`.


I have a hardwired ceiling light . I didn't know it was not switched. What is the easiest way to control (on/off) it?

Question: I didn't realize a ceiling lamp was not switched (hardwired) I need a solution
Comment: @DanielGriscom, I don't see how this is a shopping question -- it's asking for a solution to switching a light, not a specific product.
Comment: run wiring to a wall switch
Answer: Easiest?  Probably one of these:

(Image curtesy of Lowes; not an endorsement)
That will add a pull chain switch to a simple light socket.  Extra chain can be clipped on if you need longer length.
Other options would be:

Replace the fixture with one with a built-in switch
Run some wiring to add a switch loop to a standard light switch (possibly required by code if the room doesn't have another light)
Add a smart relay module behind the fixture in the box, and control the light with an app, remote, or smart home device
Like Phil suggests, put a smart light bulb in the fixture and control the light with an app, remote, or smart home device
Answer: Easiest way is probably to replace the bulb with an LED bulb that includes WiFi control via your tablet or cell phone. Your claim of a non-switched fixture is suspicious, though. How do you know?
Comment: I agree. In my area the only built-in lighting that is not switch controlled are the old style wall fixtures that used a rotary or pull-chain switch, found on old houses. Never on the ceiling...
Comment: It's not that unlikely if the house is a certain age -- I have several non-switched ceiling fixtures in my house.  Closet lights with pull chains, ceiling fans that are controlled only from their pull chain, etc.
Answer: Try one of these type sockets. They screw into the fixture and then the bulb screws into the new socket. The remote control then operates the new socket.

Picture from Walmart
Answer: I think This remote switch may be what you need. (There are several brands that do the same thing)
It is receiver with a remote switch, it works quite well and  will solve your problem.
You wire in the little receiver unit to the fixture inside the electrical box and you can put the wireless remote switch any place you like. The convenience of a wall switch,  as opposed to a smart bulb where you have to find your phone, open an app and negotiate to the bulb interface.
You can get more then one switch for the same receiver or visa versa.


How to avoid Silverlight application Hanging Problem...?

Question: I developed a Silverlight application with various animations.. While I running my application, it runs better for first 30-45 secs without any problem... After that, It becomes hanging... I am using XP, 32 bit and VS2010 (SL4).. When i reduce my MaxFrameRate value to 10, there is no use.. Still i have the same issue... this is in local as well as in IIS.. So anybody have better idea to overcome this problem... Waiting for your kind help..
Answer: Sounds like a memory leak, you need to provide more info.  Have you tried using hardware acceleration? http://msdn.microsoft.com/en-us/library/ee309563%28v=vs.95%29.aspx


encrypting data on client-side via html5 javascript

Question: im building a web app in html5.. basically a form with a time counter and questions and answers.
im looking for a way that the user cannot change the score (that is calculated from the time took to answer  the question) via browser debugger or etc.
encrypting the raw data sounds like an options.. but when the data is at dom, the user can change it.
i added some "time checking" in server side.. but still i would prefer some client side protection as well.
any suggestions? thanks
Answer: I'm no web pro, but I'd say just stick all the validation on the server side. From what I know about people exploiting MMORPGs, there is always a way to access/change client side data.
Answer: What you're asking for is impossible. No matter how you implement it, the user can use debugging tools to alter how the code runs in their browser - or, ultimately, just generate the HTTP POST request themselves, independent of your code.
Answer: Well, since you're saying you're using html5, why don't you just use the storage support?
e.g:
<code>var store = sessionStorage.question= new Array();
store[0]="10s";
store[1]="5s";
</code>
Now just set that programmatically! It will last for the whole session
Put that in a file and import it and the better-than-average user wont know where to look!
You can also check This Link for a more robust solution
Answer: As Nick says, a determined user will be able to get round any encryption scheme you use on the client machine.  At most you can make it difficult for them to break.  You need to do two things, 1) encrypt so as to make tampering difficult and 2) try to detect any tampering that does occur.
I don't know what is available off the shelf for Javascript, if available then use AES for encryption and HMAC to detect tampering.  If you have to write your own then use RC4 for encryption (not as strong as AES but much simpler to code) and a checksum to detect tampering.
One thing you can do to make it more difficult for an attacker to find your encryption key and HMAC key is not to store them in one place.  Have two arrays such that the real key is array1 XOR array2.  That way the actual key is not explicitly in code anywhere.


Does Salesforce indexes work in the same way as a SQL indexes?

Question: I mean SQL indexes generally speed up  retrieving and slow down inserting. Does Salesforce indexes work in the same way as a SQL indexes?
Answer: For most part, yes, since there is no definitive article on this topic and the query execution optimization is abstracted to the end users or internally handled by Salesforce.
You can use the Query Plan Tool in Developer Console to explore the details of query plan and its execution details to some extent. If you run an expensive SOQL thru developer console multiple times and then observe the query plan details, you will notice that Salesforce chooses the fastest path or most efficient plan over a period of time.
Answer: Just would like to add some more points, straightforward to questions:
Does SOQL indexes generally speed up retrieving?
Yes, It does.Salesforce supports indexes (standard and custom) to speed up queries, and you can create custom indexes by contacting Salesforce Customer Support.
https://developer.salesforce.com/docs/atlas.en-us.salesforce_large_data_volumes_bp.meta/salesforce_large_data_volumes_bp/ldv_deployments_infrastructure_indexes.htm
Does SOQL indexes generally slow down DMLS?
https://help.salesforce.com/articleView?id=000325247&language=en_US%C2%A0&type=1&mode=1

Additionally, indexes can add cost to DML and/or in some cases Query
  Optimizer needs to do things differently based on indexes which may
  impact performance
Answer: Hard to say for certain unless we get some input from Salesforce themselves, but we can say a few things...
Salesforce uses a collection of technologies (lots of Apache Software Foundation stuff) behind the scenes. HBase, Solr, Lucene, Phoenix, and some others if I recall. There was a session I attended at Dreamforce a few years back that went over those things at a high level. I'll try to find it again.
+edit: found it! The Future of Scale at Salesforce from Dreamforce '16. Around 11:30 in the video is when they start talking about their tech stack.
At the end of the day though, we end-users aren't too concerned about the details of how Salesforce is performing. They're a large entity and have teams dedicated to making sure they have the hardware and software to provide a fairly consistent and snappy level of service to their global customer base. I imagine that there are multiple datacenters that take incoming requests and divide them among available compute resources to build indices, and eventually get back to data consistency (i.e. perhaps favoring A and P of the CAP theorem, though that's just speculation)
Instead, what we are concerned about are the various governor limits. Things like:

We can generally only query 50k rows per transaction
We can only perform CRUD (via DML) on 10k rows per transaction
We can perform 100 queries per transaction (200 if async)

And beyond that, our queries need to be "selective" (which is a topic all its own).
In the end, the benefit of indices are more apparent to us end-users (to help us adhere to the governor limits) than the costs of building and maintaining those indices.


Does personal photo on the website improve its credibility?

Question: I know there are several techniques to improve website credibility like putting client references, portfolio (or any proof of work and its presentation) etc. Does personal photo on the website improves its credibility? For example, http://www.atulesh.com/ and http://www.adhamdannaway.com/ have personal photos on the main page. I understand that my question is general and there are different websites where having personal photos would impact credibility differently. But I'm interested in a specific case: having my photo on the personal website (as a UX designer), like those two websites above.
Comment: Off topic, but if you are concerned about credibility and are going to write in English, get a native English speaker to proof read it.
Answer: Credibility for a personal website is determined by a number of different factors. It is seldom the case that a person will make up their mind or establish trust based on a single factor, although if it has an important significance then it will have a greater weighting. In general, the more elements that you can add to a website to substantiate the perceived credibility, the more likely it is that you will achieve the desired outcome. However, it is not just about putting a photo on the website, but having the right type of photo.
So if you have a good photo but the rest of the website is of low quality, it is quite possible that the photo will be seen as the 'odd' one out and therefore the value of the photo in adding credibility to the website will diminish.
On the other hand, if the photo is of poor quality or is a poor representation of the person (i.e. in terms of their personality, values or brand) then it will also decrease the audience's perception of the website's credibility.
Answer: Researchers at LinkedIn, Yelp, Meetup and other sites have come to the conclusion that personal photos are important.
You are selling yourself and your abilities. You are, in effect, interviewing with each new visitor. You are selling yourself. Your appearance counts.
It is a form of branding.
Take a look at StackExchange. The avatars are a form of branding.
What does the avatar (or lack of one) say about the individual?
As a side note maybe I ought to put a photo up. :)


How do I make a jQuery loop which changes the href attribute of a link?

Question: I've built a slideshow gallery from scratch using jQuery. It can have any number of slides. Under the slideshow I have a 'More info' button. I would like this link to change every 5000ms to reflect the slide being show.
I know I can use .attr to change the href value itself, it is just changing it at intervals of 5000ms to different things (on a loop!) that I'm completely at a loss with...
Help would be greatly appreciated!
Answer: Use a timer.
//Set Image to first picture by default.
$('#yourImageId').attr("src", imageSrcArray[0]);

var milliseconds = 5000;

//Call Function after 5 seconds to show second picture
var t=setTimeout("changeSlide();", milliseconds);

//If you set the image's original src to your first array item, this will cause the first update in 5 seconds to display the second item.
var cnt=1;

function changeSlide(){

    //update image src
    $('#yourImageId').attr("src", imageSrcArray[cnt]);

    t=setTimeout("changeSlide();", milliseconds);//Call Function Again after 5 seconds

    cnt++;

    //Check that cnt is within image array bounds
    if (cnt > imageSrcArray.length-1) cnt=0;

}

Comment: Why pass a string to `setTimeout`? Just pass a function pointer. Evals are potentially evil. ie `setTimeout(changeSlide, milliseconds);`
Comment: Why not use `setInterval` instead of calling `setTimeout` every function call?
Comment: because this way, image load time is not taken out of the 5000 ms. The timer is not started until the image loads.