The factorials of -1, -2, -3, …

Question: Well, $n!$ is for integer $n < 0$ not defined — as yet.
So the question is:

How could a sensible generalization of the factorial for negative integers look like?

Clearly a good generalization should have a clear combinatorial meaning which combines well with the nonnegative case.
Comment: Meta (scnr): This question was asked in the first weeks of mathoverflow and has received a lot of attention. When such an elementary question would be asked nowadays, it would get closed almost immediately.
Comment: I am not a mathematician, and I'm finding the comments on here a bit confusing.  In school we learned that factorial is like this: 3! = 3 x 2 x 1.  I saw a comment on here asking if negative numbers could work like this: -3! = -3 x -2 x -1 ... and it got 3 down votes for even suggesting this.  It seems to me (as a lay person) that a simplification of the problem is to say that x! = |x!| but somehow returned w/ the sign of x (I know how to do this in computer code but not in math).  From the mathematicians on here ... why is this considered a bad approach to the problem?  Just want to learn.
Comment: @TMWP the point is that mathematicians are attached to the axiom $\mathrm{fact}(x)=x\mathrm{fact}(x-1)$. They also seek things that are not just trivial extensions (e.g., interpolating $n!$ as a piecewise affine function or as a piecewise constant discontinuous function is not interesting). Euler has found one subtle way to interpolate factorial. Defining $u(-n)=(-n)\dots(-1)$ is meaningful but probably does not deserve be called factorial. I don't know if there are particular reasons to look at this function, or interesting "canonical" ways to interpolate it.
Comment: Sometimes I have got the impression that some little effort of responsibility is still needed when up-voting soft questions and answers...
Answer: It's not that it's not defined... Actually it has been defined more than it should have. There are plenty of functions that interpolate the factorials, some of them extend to the negative integers as well. Hadamard's Gamma function is entire, logarithmic single inflected factorial function is another example. But on the other hand, for some mysterious reason, the nice property that we want an extension of the factorial to enjoy is log-convexity. The Bohr-Mollerup-Artin Theorem tells us that the only function which is logarithmically convex on the positive real line and satisfies $f(z)=zf(z-1)$ there (also $f(1)=1$ and $f(z)>0$) is the Gamma function. Unfortunately the gamma function doesn't extend to negative integers, and that is why I guess people don't really care that much for defining them as they know that no "good" answer can be found.
Comment: Don't blame log-convexity for making $(-1)!$ undefined.  The functional equation $n!=(n-1)!n$ does that job all by itself.  First (with $n=1$) it forces the standard convention that $0!=1$, and then (with $n=0$) is requires $(-1)!$ to be the reciprocal of 0.
Comment: I would just add that the definition $n!=\infty$ when n<0 makes good sense; it extends the usual recursion of the factorial function and is consistent with the poles of the Gamma function. It also allows combinatorial formulas to work in degenerate cases.  That is, when the factorial of a negative number appears in the denominator of a fraction, the usual convention is that the fraction is 0.
Comment: Hadamards gamma function and the logarithmic single inflected factorial function are different functions.
Comment: I am just referring to various functions that one can interpolate the factorials with, mostly based on playing around with the diGamma function. There is no citeable reference but here's a "pictoresque" account :) http://www.luschny.de/math/factorial/hadamard/HadamardsGammaFunction.html
Comment: @JonasMeyer Another way to see that this makes sense: the reciprocal of the gamma function is an entire function (note that $\Gamma(z)\ne0$ for all $z$), so in some ways can be viewed as the more "fundamental" one (although $\Gamma$ itself is more common for historical reasons).
Comment: @LSpice Yes, I also assumed that we're dealing with genuine factorials for positive integers.
Comment: Am I mistaken? Hadamars Gamma function is not logarithmic single
inflected. The 'mysterious reason of log-convexity' /does not/
carry over to the general gamma function, i. e., it does not
characterise the complex gamma function. This might be regarded
as a hint, that there /is/ room for other sensible definitions
and that log-convexity is not the last word in this matter, it
is just a substitute for some analytical condition.
Comment: Actually, looking only at integers, there is a definition as the trivial left factorial that is consistent with a scheme for enumerating m-ary trees.  See https://oeis.org/A094638.
Comment: Can you use grassman numbers to define negative factorials?
Comment: @AndreasBlass, [re](https://mathoverflow.net/questions/10124/the-factorial-of-1-2-3/32302#comment219180_10129), why does the functional equation $n! = (n - 1)!n$ *alone* with $n = 1$ force $0! = 1$?  It seems to me only to force $1! = 0!$.  Indeed, the terrible "definition" $n! = 0$ (for all integers $n$) satisfies $n! = (n - 1)!n$ for all integers $n$.  So perhaps you meant that it forces $0! = 1$ once we have declared that $1! = 1$?
Comment: Could you please give me a citable reference to what obscure item you are referring to?
Answer: I think it's worth pointing out here that, if $a\ge0$, then, near z = -a, we have
$$ \Gamma(z) = (-1)^a {1 \over a!} {1 \over {z+a}} + O(1) $$
and so it might be tempting to say that, in some sense,
$$ \Gamma(-a) = (-1)^a {1 \over a!} \infty $$
where the symbol $\infty$ represents the rate at which $\Gamma$ blows up near the pole at $a = 0$.  That is, $\Gamma(0) = \infty, \Gamma(-1) = -\infty, \Gamma(-2) = \infty/2, \Gamma(-3) = -\infty/6$, and so on.
In particular, this interpretation might work in some formula in which $\Gamma$ evaluated at nonpositive integers appears in both the numerator and the denominator, and the symbol $\infty$ can be canceled to yield a real number.
Comment: http://mathworld.wolfram.com/RomanFactorial.html
Answer: For a related paper see D. Loeb, Sets with a negative number of elements,
Adv. Math. 91 (1992), 64–74.
Answer: If you're wanting to compute factorials as an intermediate step to computing binomial coefficients, you may find a more satisfactory answer to your question.  See this chart for determining how to compute binomial coefficients for general arguments.
Comment: [Re](https://mathoverflow.net/questions/10124/the-factorial-of-1-2-3#comment14837_10145), Loeb's related paper [Sets with a negative number of elements](https://doi.org/10.1016/0001-8708(92)90011-9) was also [referenced](https://mathoverflow.net/a/10166) by @RichardStanley.
Comment: See also "Getting results with negative thinking", D. E. Loeb et alia, especially the table on page 10 and the proposition on the six regions. http://arxiv.org/abs/math/9502214
Answer: I think, a sensical definition stems from the generalization of the triangle of eulerian numbers.
For positive integer indexes the rows sum to factorials, and even if the rows are interpolated to fractional indexes (based on the closed-form-formula for the direct computation) the rowsums are fractional factorials or gamma values.
Thus I assume the extension of the eulerian triangle to negative indexes gives the answer to a sensical definition of the factorials at negative parameters.
For instance, we get
$$ \small \begin{array}{r|lllll|lll}
 \text{index $k$} & \\
\hline\\
 &&&& \text{ extension to negative indexes} \\
 \cdots &\cdots \\
 -4& 1 & 3+\frac 1{16} & 6+\frac 3{16}+\frac 1{81}& 10+\frac 6{16}+\frac 3{81}+\frac 1{256}&\ldots &\tiny \sum  \overset ?= & -4! \\
 -3& 1 & 2+\frac 18 & 3+\frac 28+\frac 1{27}& 4+\frac 38+\frac 2{27}+\frac 1{64}&\ldots &\tiny \sum  \overset ?= & -3! \\
 -2& 1 & 1+\frac 14&  1+\frac 14+\frac 19& 1+\frac 14+\frac 19 + \frac 1{16}&  \ldots &\tiny \sum  \overset ?= & -2! \\
 -1& 1 & 0+\frac 12 & 0+0+\frac 13 & 0+0+0+\frac 14 & \ldots &\tiny \sum \overset ?= & -1! \\
 \hline \\
 &&&& \text{ triangle of Eulerian numbers} \\
 0& 1 &  . &  . & . &. &\tiny\sum = & 0! \\
 1& 1 &  . &  . & . &. &\tiny\sum = & 1! \\
 2& 1 &  1 &  . & . &. &\tiny\sum = & 2! \\
 3& 1 &  4 &  1 & . &. &\tiny\sum = & 3! \\
 4& 1 &  11 &  11 & 1 &. &\tiny\sum = & 4! \\
 \cdots & \cdots \\
 \end{array} $$
and so on.

I have a more involved discussion in a hobby-treatise about the Eulerian-triangle here.
Comment: this answer definitely did not get enough love
Answer: My question was intended somewhat along the line: Assume the Gamma function is not yet invented and Goldbach asks you the question: "What is (-n)! ?" You know that Goldbach expects a combinatorial answer in the domain of integer or rational numbers. What would you answer? I will give my answer in this sense.
Looking at Graham, Knuth, and Patashnik's Concrete Mathematics, Table 253, the combined Stirling triangles in their dual form, we see: If we sum the columns in this triangle for k < 0 we get the factorial numbers, if we sum the rows for k > 0 we get the Bell numbers.
What about saying the Bell numbers are the factorial numbers at negative integers? Is the answer encoded in one of the most important triangles in combinatorics?
See what Knuth (Two notes on notation) says about the origin of this duality (table on page 11).
<code>{120}
  . {24}
  1,  .  {6}
 10,  1,  .  {2}
 35,  6,  1,  .   {1}
 50, 11,  3,  1,  .  {1}
 24,  6,  2,  1,  1,  .
  0,  0,  0,  0,  0,  1,
  0,  0,  0,  0,  0,  0,  1,.....{1}
  0,  0,  0,  0,  0,  0,  1,  1,....{2}
  0,  0,  0,  0,  0,  0,  1,  3,  1,....{5}
  0,  0,  0,  0,  0,  0,  1,  7,  6,  1,....{15}
  0,  0,  0,  0,  0,  0,  1, 15, 25, 10, 1,....{52}
</code>
Comment: Then you should have definitely mentioned this in the question :). To convince us that your correspondence is appropriate one has to give a combinatorial theory where the Stirling number duality makes sense. This is precisely what this thread http://mathoverflow.net/questions/9721/highbrow-interpretations-of-stirling-number-reciprocity is about.
Comment: Thanks for the link. I just ask here another question to exemplify my main question. Looking at this triangle which was been considered by Kramp, Stanley, B. F. Logan, I. Gessel and D. Knuth, among others, the question is: Is there a simple and uniform mathematical explanation why summing rows and columns lines up the double infinite sequence ...203, 52, ,15, 5, 2, 1, 1, 1, 2, 6, 24, 120, 720,... and does this make the definition (-n)! = Bell(n) meaningful? Or do I have to conclude from your answer that there is no 'combinatorial theory where the Stirling number duality makes sense'?
Answer: Hadrian Ulgenes David Peter give the following answer in
Series and Product Representations of Gamma and Pseudogamma Functions, Theorem 5:
The function
\begin{equation}
\Lambda(x)=\prod_{n=1}^{\infty}\prod_{k=1}^{n}
k^{\frac{\left(-1\right)^{n+k}\left(2k-1\right)}{\left(n-k\right)!\left(k+n-1\right)!}\frac{\left(x+n-1\right)!}{\left(x-n\right)!\left(2n-1\right)}}
\end{equation}
interpolates the factorial at the positive integers, interpolates the reciprocal factorial at the negative integers, and converges for the entire real axis.
Answer: As 0! and 1! = 1 ,
2! = 2,
3! = 6 and so on
Can we not have
-1! = -1
-2! = 2 = -1 X -2
-3! = -6 = -1 X -2 X -3
-4! = 24 = -1 X -2 X -3 X -4
-5! = -120 = -1 X -2 X -3 X -4 X -5
...and so on?
It would produce some sort of series but would they be of any use anywhere?
Comment: This is known as the Roman Factorial - see Qiaochu's comment to Michael Lugo's answer.
Comment: [@QiaochuYuan's comment](https://mathoverflow.net/questions/10124/the-factorial-of-1-2-3#comment72618_10150) on [@MichaelLugo's answer](https://mathoverflow.net/a/10150) (which just links to the [MathWorld definition of "Roman factorial"](http://mathworld.wolfram.com/RomanFactorial.html)), as [referenced](https://mathoverflow.net/questions/10124/the-factorial-of-1-2-3#comment219206_85197) by @S.Carnahan.
Answer: According do the definition of factorial, $1 = 0! $ and $ 0! = -1! * 0$. So, first negative integer factorial is $$-1! = 1/0 = \infty$$. I am not sure why it should be a negative infinity. Possibly because zero can be very small negative number as well as positive. I cannot derive the sign. But, I can prove that other integer negatives are also infinities.
Take -2! * -1 = -1!. It follows that $-2! = -1!/-1 = -\infty$.
Next, -3! * -2 = -2! whereupon, $-3! = -2!/-2 = {-1!\over (-1)(-2)} = +\infty$.
Generally, we see that all factorials are infinities with alternating sign, $$-n! = {-1! \over (-1)(-2)\cdots(1-n)} = \infty/(-1)(-2)\cdots = (-1)^n\infty$$
Comment: Hi Val: Sorry, the point I was trying to make is that games with $\pm 0$ are fun, but mathematicians have much more advanced ways to make them precise, including residues of analytic functions.  The Gamma function is the unique analytic function satisfying the functional equation $\Gamma(a+1) = a\Gamma(a)$.  I'm sure that OP knows that the naive generalization to negative integers is $(-n)! = (-1)^n\ n!\ \infty$.
Comment: Please see Michael Lugo's answer http://mathoverflow.net/a/10150/78 for a more precise version of this manipulation.  (Also, note that if you believe that $-\infty \neq +\infty$, you might as well also believe in $2\infty \neq \infty$.  Lugo's answer also makes this precise.)
Comment: He starts with "gamma" function but we, with the author of this post, show how to derive the answer without being aware of that. Also, Lugo makes the difference between + and - $\infty$. But, thanks for pointing out that they are equal. I think that my example shows that $+\infty$ must be equal to $-\infty$, as there is a simmetry. That is, we cannot guess that zero is positive infinitecimal rather than negative.

The factorials of -1, -2, -3, …


Specific instrument increase

Question: Is it possible to increase the volume of a xylophone on a cd recording? Can you separate the increased volume from the rest of the recording?
Answer: Whether it is possible or not depends on the recording. If the xylophone is separated from the rest of the instruments in time or frequency then it can be done. But if it plays at the same time as other material and in the same frequencies then it's very hard (inclined to say impossible).
The answer to the second question is yes. If using whatever technique you had a recording same as the CD but with increased volume for the xylophone, you could inverse its phase and mix it to the CD to get just the xylophone.
Comment: @rudolphparker Don't forget to upvote if the answer helped you. If you feel it is the best answer, accept it as the answer. Thanks.

Specific instrument increase


Use of you tube videos in a church service

Question: How can I find out whether or not it's permissible to use a you tube video in a church service?
Answer: There are two sides to this question:
1. Does the owner grant permission to use it in the church service?
Before using a video in a church service, message the owner. Usually they will be happy to let you use it, and on occasion they will direct you to a higher quality download without ads. In general, YouTube is free to play.
2. Is the church okay with the ads that are likely to come along with it?
Youtubers make their money off of advertising, and they have no control over the ads that are likely to be presented. I recall a time when a children's church program (tee-totalling denomination) started with a beer advertisement because that what was shown with the video we had selected.
Further Considerations
If you are live-streaming or recording services for later playback on youtube, you have to pay extra attention to permissions on copyrighted material. Your CCLI license does not cover streaming, but the CSLP license does. Hillsong blocks re-streaming of their content, as do major networks (nbc, etc).
Answer: It depends on how the video is licensed.  There are two main licenses used on Youtube.  The Standard Youtube Licence and the Creative Commons license.
The Creative Commons license gives free reign to use the video for whatever you want, so long as you maintain attribution of the author of the content.
Youtube standard license is a bit more tricky.  Section 5.B of the Youtube terms of service reads (in part) "Content is provided to you AS IS. You may access Content for your information and personal use solely as intended through the provided functionality of the Service and as permitted under these Terms of Service. "  It comes down to the meaning of "personal use" and if that applies to the playback during the church service.  I'm not a lawyer, but I would tend to think that public display probably isn't personal use, so it would probably be a violation of the license.
As far as restreaming that pojo-guy mentioned in his answer, any CC licensed videos would be fine to re-stream as well as long as the attribution is intact for the work being used.  Youtube doesn't use a SA (share alike) CC license, so it is not necessary for your stream to also be CC licensed.


Is it legal to look for work in the US while on a B1/B2 (Business Visitor) visa?

Question: I have got 10-year multiple entry US VISA on my Indian passport. I got it to attend a technical conference.

I was curious to know if I give job interview during this visit?
I may not have time in this visit, but what if I go after couple of months with $3000 of my saving to sustain for a month and look for job. Is this legal?

I know I need H1-B VISA to work there, but I feel it is easier to get job (even if sponsorship is needed) to be face2face with potential employers. So, is it legal to look for job with B1/B2 ? Can I mention that to immigration officer?
PS: Yes, I'm Software Developer :P
Comment: Seems to be a duplicate of: [Can you search for a job when using a tourist visa (B-2) in the US](http://travel.stackexchange.com/questions/2157)
Comment: I disagree @Gagravarr. He's asking if while he's in the US on a business trip to attend a conference whether it's legal for him to look for a job. Now if he got a job and then wanted to move there he might then have some immigration and/or expat questions, but this is a travel question. In fact I think it might be a dupe.
Comment: Hi and welcome to Travel SE. Unfortunately questions about immigration are off-topic here. Maybe you want to commit the [expat proposal on Area51](http://area51.stackexchange.com/proposals/38732/expatriates)
Comment: The other question is specifically for B-2 visas whereas this question is about a B-1/B-2 visa. I'm not a US visa expert but if the former is a tourist visa and the latter is a business visa then the answers could be quite different and separate questions could be warranted. Especially since we have more a controversy than a definitive answer over there.
Comment: I've also asked a new variant of this question: **[Is it permitted to look for a job while visiting the US under the visa waiver program?](http://travel.stackexchange.com/questions/20614)**
Comment: Any takers after all?
Answer: Just looking at the summary of the B-1 Visa from the state department and USCIS item #4 states that one of the potential reasons for B-1 Visa is:

negotiate a contract

So based on this you can conduct a job interview, which is a form of negotiating a contract for yourself.  What you cannot do is to be employed and receive payments for services in the United States while on B-1 visa without employment authorization.
For any other information I would suggest contacting an Immigration lawyer since I am not one and laws and precedents tend to change.
Comment: *"Can I mention that to immigration officer?"*  It would be madness to do that.  Anyone reading the above Q, don't do that!
Comment: Hi @karlson.  I would dismiss the idea that "negotiate a contract" includes *seeking work* or *interviewing for a job*.  if you are interviewing for a job you, very simply,  *are not* "negotiating a contract". You're just being interviewed by some boss, so that the boss can see he they like you.  even more significantly **"looking for work"** has nothing to do with either a meeting or a contract
Comment: Note too that this anecdote, assuming true, is a knockout example: http://travel.stackexchange.com/a/45270/19233
Answer: You cannot seek for employment while you are in US on B1/B2. If you get job offer, then US employer has to file Petition first for you. Only with approved petition, you can apply Temporary Workers visa at US Embassy in your home country.
However, you can have the company apply for a change of status and become an H1B.
That's about the only work status you can change to from a B1/B2. Maybe an H2A/B.
But again, it's the employer who files and pays, not you.
Comment: A B1/B2 is a tourism & business visa.  If you tell the officer "I have a job interview at Google, then I'm going to the Grand Canyon, and here's my flight home to my family in one week's time", you will almost certainly be granted entry, and the other question has a poster who has done just this several times.
Comment: INA Act 212 Sec 5a says aliens entering the US for the purpose of *performing* work are prohibited.  What's your reference?  http://www.uscis.gov/ilink/docView/SLB/HTML/SLB/0-0-0-1/0-0-0-29/0-0-0-2006.html
Comment: As discussed in the other question, I'm fairly sure you are incorrect -- while you are prohibited from *actually working* on any B* visa, there is nothing stopping you from attending job interviews etc.
Comment: @jpatokal No, 'cause a job interview would mean you are looking for work and the B1/B2 visas are only for visitors. You can go to meetings because it's part of your current job elsewhere but the interviews are a whole different thing.

If you tell the CBP Officer at the port of entry that you are coming to the USA to look for a job he/she will turn you around and put you on the first flight back to where you come from.
Comment: @jpatokal Why don't you just tell the immigrant officer the truth what your purpose of the trip is? It's off topic asking this question here since the outcome is about seeking job on a tourist visa.


how to disable a user to install program being domain user?

Question: My client (XP) can install Chrome in his system being a domain user account.
how can i stop him/them from installation of Chrome through Windows Server 2003.
Comment: @dunxd I ask because there is a Group Policy [to block per-user installs specifically](http://msdn.microsoft.com/en-us/library/windows/desktop/aa368309(v=vs.85).aspx).   This policy would not block administrators from performing per-computer installs.
Comment: Is the user granted local administrator rights?
Comment: Chrome installs into the users account so generally Admin rights don't come into it.
Answer: If the users do not have local administrator access, you may simply disable per-user installations via Group Policy.
DisableUserInstalls is a machine policy which will block per-user installations.  There is also an option for "hiding" existing per-user installed applications in favor of the per-computer installed versions.
To configure:

Open gpmc.msc, select the GPO to which you will add the policy.
Navigate Computer Configuration, Policies, Administrative Templates, Windows Components, Windows Installer.
Set the policy "Prohibit User Install" to "Enabled".
[Optional] Set the policy "User Install Behavior" to "Hide User Installs".
Comment: @KabirHossain gpedit will modify the local policy. gpmc is the domain policy editor. You may need to install RSAT.
Comment: 1. may be    gpedit.msc    . It works for me not  gpmc.msc.
Comment: I've since learned that gpmc.msc doesn't come loaded on Windows Server by default, and must be installed as follows:

1. Open Server Manager and click Add Roles and Features.
2. In the Add Roles and Features Wizard dialog that opens, click Features on the left pane, and then select Group Policy Management.
3. Click Next to proceed to the confirmation page.
4. Click Install to enable it.
This allowed me to run gpmc.msc and perform the steps in this answer.
Answer:
Open the Group Policy Management Console (GPMC).
Right-click your domain and choose the Create a GPO in this domain, and link it here option.
Name the Group Policy Object (GPO) Block Google Chrome and click OK.
Right-click the policy you just created and click Edit.
Navigate to the User Configuration\Policies\Windows Settings\Security Settings\Software Restriction Policies folder.
Right-click Software Restriction Policies and select New Software Restriction Policies.
Right click Additional Rules and choose New Path Rule.
In the Path field, type chromesetup.exe.
In the Security level drop-down box, choose Disallowed and click OK.
Repeat steps 7 through 9 for the chrome.exe and gears-chrome-opt.msi files.
Repeat steps 7 through 9 for the path C:\Users\%username%\AppData\Local\Google\Chrome\Application\chrome.exe for Vista machines or C:\Documents and Settings\%username%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe for XP machines. You should include this rule in case some of your users have already installed the browser. After you implement the GPO and the Group Policy settings refresh on those users' local machines, they'll no longer be able to successfully run Google Chrome.
Open a command-prompt window and run the command to apply the new rules.
gpupdate /force
Run the command
gpresult /R
Verify that the newly created GPO has successfully been applied. As a final test, attempt to run the installer from the Google Chrome website.


Unable to install cav-linux (comodo antivirus)

Question: I am using ubuntu 16.04 on my new Dell laptop. I just have this laptop 2 days ago, and I am new to Linux. I download this software this afternoon but unable to install. It has a waiting to install icon on the Unity Launcher column. I also installed the Deb packet installer. How can I put it into the Deb packet installer? or any other way to install this software. Thank you very much for your helps in advance.
Answer: The Comodo linux antivirus hasn't seen real care in years. I think the last time I looked at it (perhaps mid 2016), the version still being offered was from 2013. While it is the definitions that matter most, I opted for Sophos antivirus on Linux. It takes a little more work to get it installed, but it is well documented and actively maintained.
They are the only AV vendor that seems to still be active in their support of Linux for the home user.
While not directly in answer to the OPs question, I think trying to wrestle with an installer that's designed for much older releases of Ubuntu isn't the correct road forward.
https://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-linux.aspx
Comment: Thanks, Mark. I did install sophos-av. The software located at /opt directory.  I went to bin directory and ran the command sudo savscan -all /.  However, it showed "could not open file" for all of them. Please help if you could. Thank you very much for your helps in advance.
Comment: I'd suggest a screenshot to http://picpaste.com and maybe I can give a thought.
Comment: Thank you very much for your time and effort. However, I was just be able to use Avast to scan my system.  So, I decided to use Avast from now on.


Problems running Ruby program with Aptana Studio

Question: The request below is based upon an earlier version posted on the Aptana Tender site, where it didn't receive a response - presumably because the Aptana Tender site has now been deprecated in favour of StackOverflow.
I'm using Eclipse 3.6.2.r362_v20110210 with the Aptana Studio plugin version 188.8.131.52107141410 (i.e. all fully up-to-date, I believe) on Mac OS X 10.6.8 Snow Leopard on a Macbook.
I created a Ruby project, and then created a single file inside it called "item.rb", into which I wrote some Ruby code.
The file is very short: it defines an "Item" class with an initialisation method that asks the user for a value (using a "puts" followed by a "gets.chomp") and a get method that returns the value, and it also contains two more lines: one to create a new Item, and one to call that method on the newly-created Item.
When I run "ruby item.rb" from the Terminal, it works as expected: it asks the user for a value, and returns that value. No errors/warnings.
Now, I don't want to have to use the Terminal every time I want to execute the file, but I'm having trouble getting it running any other way.
Here are the steps to reproduce:

In the main Eclipse menu, go to Window > Open Perspective > Other.
In the resulting dialogue box, click "Ruby" and click "OK".
In the Script Explorer view, click the triangle next to the name of the project containing the file I want to run, so that the project's contents are shown.
In the Script Explorer view, double-click on the name of the file I want to run (item.rb).
This causes item.rb to open in an editor view, and gives that view focus (i.e. the editor view containing item.rb has a blue rather than a grey border, and there is an active cursor inside the view).
Click the "Run" button on the Eclipse toolbar (the one that looks like a green "Play") button.
THE FIRST PROBLEM: a "Run as..." dialogue box pops up (I don't know why) asking me to "Select a way to run 'item.rb'". It gives me two options (again, I don't know why): "Android Application", "Ruby Application".

Expected behaviour: because item.rb is a file ending in ".rb" and containing only valid Ruby code, Eclipse/Aptana should, by default, run it as a Ruby application.

I click "Ruby Application", and then click "OK".
THE SECOND PROBLEM: the dialogue box disappears, but nothing else happens.

Expected behaviour: the Console view should get focus, and item.rb should be executed, with the results showing up in the Console view's textarea.

By this point, it would be reasonable to give up. But programmers are unreasonably persistent, right? So: click the Console tab.
The Console view's header says, "item.rb [Ruby Application] /usr/bin/ruby", and below this is a blank textarea containing only a blinking cursor.
Press the <Return/Enter> key on the Macbook's keyboard once or twice.
THE THIRD PROBLEM: the Console view's textarea suddenly updates with the output of item.rb, but weirdly, it doesn't stop at gets.chomp, it just acts as though the user has entered an empty response at that stage (i.e. as though the user has simply pressed the <Return/Enter> key on the keyboard), and ploughs on until the entire program has executed. The Console view's header then changes to "<terminated> item.rb [Ruby Application] /usr/bin/ruby".

Expected behaviour: item.rb should execute in the Console view just as it does in the Terminal.

Please can you help me troubleshoot these three problems?
Many thanks.
Answer: It sounds like you have an older version of Aptana, RDT, RadRails or DLTK Ruby installed, as there is no "Ruby" perspective in Aptana Studio 3.x.
You should be able to right click the file in the Project Explorer, App Explorer, or in the open editor for the file and choose Run As > Ruby Application.
Ideally you'd remove any old installation of ruby plugins to avoid some sort of conflict before doing so. It should then launch the file as expected.
The Enter/Return behavior you're talking about sounds like the program is not flushing STDERR/STDOUT and hitting Enter is proceeding to enter in the input (so, it's buffering the output you should see that forms the prompt, then you hit Enter/Return and it takes that as the input so it proceeds after the gets call). if things printed to STDOUT don't show, you can try and force auto-flushing by adding <code>$stdout.sync = true</code> to the top of your script. Studio 3.x should set that up silently for you on programs launched through it. If not, then you should file a bug: http://jira.appcelerator.org/secure/CreateIssue!default.jspa
Comment: Thanks for answering this, & sorry for the delay. I had a go at using a fresh install of Aptana Studio 3 to see if that helped, but I still had some problems. I'll report back with more details next opportunity I get.
Comment: I'm afraid that I decided to simply stop using Aptana (in favour of Vim), which is why I didn't report back.


I need help understanding the meaning of the covariant derivative of the dot product of two tangent vector fields along a parameterized curve

Question: In my differential geometry class, I am learning about the covariant derivative of a tangent vector field of an n-surface in R(n+1). We learned that the formula for the covariant derivative of a tangent vector field at a point p is (in English) equal to the regular derivative of the vector field minus the component of the regular derivative normal to the tangent space, thus thereby yielding a covariant derivative that is in the tangent space. One of the theorems we covered is that (XdotY)'=X'dotY+Y'dotX, for two vector fields, X and Y, of length n+1, at a point, p. My problem is, while I feel that I can understand the covariant derivative based on the original definition which involves subtracting out the normal component, I can't follow what it means in the case of the scalar function XdotY. More specifically, how does it relate to the theme of the covariant derivative in n+1 space being an object which subtracts out the component in the direction of the normal? Does this scalar function have a normal direction? Which space are we even talking about?
Answer: I presume you're doing the covariant derivative along a curve (or you should think about that case). Consider a curve $\alpha(t)$ and the function $f(t) = X(\alpha(t))\cdot Y(\alpha(t))$. We're differentiating the scalar function $f$. So we apply the product rule to get $f'(t)=(X\circ\alpha)'(t)\cdot Y(\alpha(t)) + X(\alpha(t))\cdot (Y\circ\alpha)'(t))$. Here's the main point: $(X\circ\alpha)'(t)$ is the sum of two terms: the covariant derivative of $X$ in the direction of $\alpha'(t)$ [which is usually written $\nabla_{\alpha'(t)}X$] and a vector $Z$ normal to the surface. But when we compute the dot product $Z\cdot Y$, we of course get $0$, since $Y$ is tangent to the surface. So we get:
$$f'(t) = \nabla_{\alpha'(t)}X\cdot Y(\alpha(t)) + X(\alpha(t))\cdot\nabla_{\alpha'(t)}Y.$$


Isn't the equation of state for ideal gas valid in the free expansion?

Question: I am deeply confused.... For a thermally insulated ideal gas expanding freely, I think that $PV^{\gamma}=cnst$ must hold. Through the equation $PV=nRT$, it must be that $TV^{{\gamma}-1}=\rm constant$. Because the free expansion changes the volume of the gas, the temperature of the gas must change too. However, any book on thermodynamics says that there is no change in the internal energy of the gas in free expansion. Thus, the temperature of the ideal gas must not change. Why does this discrepancy occur? I am just totally stuck.....
Comment: The equation $PV^\gamma = const$ holds for a *reversible* adiabatic process. The free expansion, however, is not reversible.
Answer: $PV^{\gamma}=C$ applies only to the reversible expansion of an ideal gas.  Free expansion is not a reversible expansion because, even though the gas can be returned to its original state, its surroundings can not (without changing something else).  The ideal gas law describes the behavior of ideal gases only for thermodynamic equilibrium states.  In an irreversible expansion, the gas does not pass through a sequence of thermodynamic equilibrium states.
Answer: It depends on the system you are considering. Let's consider two different cases:
1) An ideal gas is inside an insulated piston which can move. You can write:
$$dU=\delta Q -\delta L \rightarrow dU= -\delta L \rightarrow nc_{v}dT=-dL$$
Now, if the process is reversible you have $dL=pdV$. And so:
$$nc_{v}dT=-pdV$$
Also remember:
$$pV=nRT \rightarrow p=\frac{nRT}{V} \rightarrow nc_{v}dT=-\frac{nRT}{V}dV$$
Then you integer in $dT$ and in $dV$ and obtain $pV^{\gamma}=kost$. Note that we have got this equation ONLY for reversible processes. Of course you can write this equation in some different ways by mixing it with the equation for ideal gases. If you draw this equation into the Clapeyron plane (p-V), you see that this is an
hyperbole.
2)Joule free expansion. You have an ideal gas inside a tank; this first tank is linked to a second tank by a valve. In the second thank there is nothing. By opening the valve the gas will go inside the second tank and finally it will be inside the two tank. Let's analyze this process:
$$dU=\delta Q -\delta L \rightarrow dU=\delta Q $$
Note that the work is zero and the process is irreversible. If you measure the temperature of the gas at the end of the process, you will note that it hasn't changed, and for this reason the gas hasn't exchange heat. So:
$$\delta Q=dU=0$$
I mean only the second one is a free expansion. How you have seen during a free expansion the system is not insulated however its temperature doesn't change, and it doesn't exchange work. While the first case I've analyzed isn't a free expansion: the gas is insulated, it exchanges work and its temperature changes.


Nailing a joist hanger to ledger with concrete behind

Question: So I've got a 2x10 Ledger attached to a concrete wall. I have a double 2x10 joist that needs to connect to the ledger. I have a joist hanger for this but the installation requirements say to use 16d nails (which are typically 3 1/2" long) to connect to the ledger. How can I do that if the ledger is only 1 1/2" thick? Will the nail go into the concrete? Are there shorter nails?
Comment: FYI, joist hangers are almost never installed with 16d nails. They're usually hung with "teco" nails, as described in the answers below. They're roughly as thick as 16d nails, but of a length appropriate for a single two-by ledger.
Comment: 16d on a 2× not heard of that before, Teco yes.
Answer: Joist hangers resist loads in shear, not withdrawal. While a 16d is more common, full resistance is developed in a 2x.
Simpson Strong-Tie makes a short nail that is 1 1/2" long x 9 ga. diameter.
Oh, and be sure to order the nails treated (galvanized) or stainless steel based on the type of pressure treated ledger.
Comment: @isherwood you are correct about the Tico nail origins. https://www.hansenpolebuildings.com/2013/01/tico-10d-common-nails/
Comment: 16d are not more common. It would be a massive effort to put 8-12 full-size framing nails in dozens or hundreds of hangers by hand. Almost everyone uses nails like those you've described, except in some girder situations. We call them "teco" nails, probably after an early manufacturer.
Comment: @UnhandledExcepSean TICO ???? I'm talking Simpson. Where did TICO come from?
Comment: @LeeSam did you not read the comment directly above mine?
Comment: @UnhandledExcepSean Exactly. My "Answer" referred to Simpson and now Isherwood and you are concerned about Tico. Why?
Comment: I'm not concerned. Isherwood made a comment on them being called Teco/Tico an I had never heard the term; I thought it was interesting enough to respond
Answer: There are shorter nails, but there are also short screws available.  I'd go with the screws every time.  For example these are made by Simpson and fully approved for use with their hangers.
Note that the #10 screws are the correct size to replace 16d nails.


PWM frequency for braking circuit

Question: I am running a small DC car motor with PWM and I am using 20 kHz. This requires special op-amps with fast v/us times to get a proper square wave out to drive the MOSFETs even with drivers. I am trying to keep the costs down. I want to be able to reduce this frequency for the PWM braking circuit. I'm just pulsing a MOSFET directly across the motor using the direct short duty cycle to control the amount of braking. It will only brake for a fraction of a second every second or so. Can the braking circuit be pulsed at 100-1000 Hz without worrying about any of the issues for using 20 kHz on the drive side.
Comment: Why are you using op-amps to drive MOSFETs? This sounds like underlying issues (that may deserve their own questions / research).
Comment: I'm trying to make this a simple and inexpensive PWM circuit. I'm using Op-amps to create the PWM signal. With low frequencies the losses in the FET would not be much, especially with just a braking circuit. I have redesigned using a Driver due to the lower current output of the TL084. I have been using the same circuit to develop the drive circuit for the same small motor. At a few hundred HZ the control was really good. When I increased to 17kHZ the motor just hummed. It needed about 80-90% duty cycle to move. I've been trying to figure out if these small motors just won't work at high freq.
Answer:
. Can the braking circuit be pulsed at 100-1000HZ without worrying about any of the issues for using 20KHz on the drive side.

Yes, as described.
There may be other issues which are not obvious from your description, but it should be acceptable.
You may produce audible noise due to the low frequency - probably not a significant issue in this context.
Lower than 20 kHz PWM should work for motor drive unless audible effects or special considerations are relevant.

PWM frequency for braking circuit


Why won't my villagers become unemployed?

Question: I am building an iron farm on the realm I play with my friends. The farm wasn't spawning iron golems (it had when I built it in another world), so I decided to try relinking the workstations. I broke all of the fletching tables, and the villagers all are still fletchers, even though it is over 2,000 blocks from the nearest fletching table. What could I do to get them to become unemployed and then relink them? Also world version is Bedrock Edition 1.19.71 if it helps at all.
Comment: Have you traded with any of them (You can check by looking at their "experience" bar)? If so, they won't become unemployed, because trading with them locks in their trade.
Answer: According to the Minecraft Wiki:

Removal of a claimed job site block causes the owner to switch to another profession or become unemployed, provided that the villager has no prior trades with the player. If the villager has prior trades, it keeps its profession and claims a new job site block that matches its profession if one is available.
Answer: Try employing them again, and then breaking the new workstation.
Comment: You're going to need a little more information than that, pal.


Can I recover a deleted iCloud note?

Question: I'm syncing my iPhone's Notes to iCloud. If I delete one of these notes, is it permanently deleted, or is there a way for me to recover it?
Comment: The rule to keep in mind is that synchronisation amplify data modifications. The good ones and our errors.
Answer: From my own testing, it seems to depend on how you delete the note...
If you delete the note on iCloud.com:

You can easily recover the note by going to the Trash folder.

If you delete the note on an iOS device:

You can recover the note by restoring the device (if it's been backed up).
You can recover the note from a device that hasn't recieved the latest sync changes.
Comment: where is the trash folder in icloud?
Answer: Yes, there is a way to recover it.
The way I did it was to:

Go to my iPad (or any iDevice): Settings: General: Reset: Erase All Content and Settings.  This will wipe clean the iDevice, prompting you to set up as a new device or restore from an iTunes or iCloud backup.
Restore from iCloud backup.  I had just deleted the note, so I chose an iCloud backup from the day before. You will need to be connected to your wifi network at this point.  Let it go through the motions of restoring the information.  It will give you an "estimated time remaining" status bar.  You need to be by your router at this point.  Once it finishes restoring, your iDevice will reboot. During the reboot, your iDevice will be loading all of the information that it just downloaded from the iCloud backup.  At this point, your old note will be in there, but as soon as it loads, if you're connected to the internet, it will re-sync with iCloud and you'll will right back where you were before you did the restore. I know because I did it once already.  To stop this from happening:
As soon as your iDevice starts to reboot, turn off your wifi router or otherwise make it to where the iDevice has no internet connection. Your iDevice will finish loading the iCloud backup, and your notes will be as they were the day before or at the time of the last back up.

I only had one note that I needed to retrieve, so I copied it and opened an email and emailed it to myself. I was a little concerned that this may not work, seeing as I was not connected to the internet, but, once I reconnected, the email sent. Naturally, at that point my notes were all synced back to current, but I had the note in the email and, thus, was able to recreate the note.
Note: If you have a cellular device, pull out the sim before you start this process. If not it will still sync the new notes even with the WiFi off.
Comment: Logging in just to say that Michiel's answer worked for me as I just had this issue and was able to retrieve the mistakenly deleted note by doing as he describes, and as apparently I need 15 rep to up-vote him so this is my only way to tell others it works.
Answer: Depends if you have any other devices that also sync.  If so, then if you can stop them from syncing, you can at least copy the contents before it is removed.  Other than that, once it's gone, it's gone.  Their may be more potential for getting it back in Mountain Lion which has a dedicated Notes client and also the standard HFS filesystem which may allow you to "undelete", but this is conjecture at this point.
Answer: Check your email program.The iCloud notes are in there too.
Your locally stored content from Mail.app is backed up by Time Machine as well; if you have it enabled you can go back in time and see your old notes.

Can I recover a deleted iCloud note?


Have we found stable, super-heavy elements?

Question: Have we found a stable super heavy element or created one in a lab, or are they still hypothetical?
Comment: More sci-fi then hypothetical. There's no reason to think any superheavy nuclide wouldn't be highly radioactive (half-life measured in minutes, at most).
Comment: It depends on how you define "stable." The notion is that there is a region of super heavy isotopes that would have a longer half-life than isotopes which are lighter or heavier. But the "stable superheavies" won't be as stable as say helium-4.
Answer: There already is an element, heavier  (higher atomic and mass numbers) than all naturally occurring ones, that is stable enough for everyday use.  You are probably using it, well, everyday, in your smoke detector.
It's americium, element 95, with three isotopes having 100+ year half-lives.  Americium-241 has a half-life of over 400 years, for americium-243 it's over 7000 years and there is even an odd-odd isomer, with mass number 242, having a half-life over 100 years.  (https://en.wikipedia.org/wiki/Americium).
This is not perfect (and whether it's called "superheavy" depends on definition), but the americium is out-lasting other components of smoke detectors, or industrial gauges where americium is also used.  In that sense we can indeed call the most long-lasting americium isotopes stable.
Comment: I thought superheavies have $Z \geqslant 104$, so actinides are supposed to be out of scope.
Comment: This is just wrong. For some background on stable super heavy elements see https://www.scientificamerican.com/article/superheavy-element-117-island-of-stability/
Comment: So, will we hit the jackpot again like with americium?  No one knows.
Comment: Am isn't "hitting jackpot", it's just after plutonium, which has most stable isotope with half-life over 80 mln years...


Is there any way to throttle the network bandwidth that an svn checkout does?

Question: On checking out a very large svn repository I would like to throttle the bandwidth used by an svn client as to not impact a very sensitive network.  Is this configurable within svn?  Is this configurable in some other way?
Answer: It's not configurable within SVN.  You can (with pain) handle this by running the SVN connection through a bandwidth-throttled (virtual) router, such as DummyNet on FreeBSD.  You can also route the traffic through an HTTP proxy such as Squid that can limit bandwidth, or use built-in Linux iptables functions (using "tc" for Traffic Control) to limit bandwidth, but this is often not easy to configure/use.
For various (mostly out-of-date) information, see http://lartc.org/, but the lartc mailing list (and archives) may be more informative.  Also see http://www.docum.org/docum.org/
Answer: I don't see anything in any of the svn clients.  However, you could write your own proxy service and put a simple throttling class in it.
Consider this as a reference or suggest some code to the SO community if you want to attempt.
Answer: If you have sophisticated networking on your workstation (like OpenBSD's firewall or Linux's traffic control) then you should configure traffic shaping based on destination network.
Answer: If you're in control of the SVN server, and it's running through Apache via mod_dav_svn, a workable solution is to install mod_bw or mod_cband.
With either solution, you can set a bandwidth limit on the virtual host that's providing the SVN repository.


Migrate from dev org to partner editon

Question: How to migrate the triggers and classes and components created in developer edition to the partner org so we can make it into to package. The objective is to make it into a unmanaged package..please advise.
Comment: That's a very broad question you're asking with no simple answer. Migrating the components is one thing, but creating an unmanaged package is another. I suggest you read Andrew Fawcett's Force.com Enterprise Architecture available from Amazon or Pact Publishing.
Answer: If your end goal is to create an unmanaged package you shoud be able to do that right in the developer org. For a nice walkthrough go here, it walks you through creating a simple class and packing it up in a Developer org.

To get going, log in to your Developer Environment and then go to
  Setup -> Develop -> Apex Classes to create the class.
Now you're ready to create a package, so navigate to Setup -> Create
  -> Packages. Hit "New" to start. After providing a name for the package (SimplePackage), you'll be given the opportunity to add
  package components. Packages are collections of components, and these
  components range the gamut of the Force.com Platform. For example, you
  can package an Apex class, a Visualforce page, triggers, email
  templates, documents and workflow rules (see references at bottom for
  links to entire list). For this tutorial, click "Add" and select a
  component type of "Apex Class" and select the SimpleClass defined
  above. You'll end up with a package definition that looks similar to
  the following figure.
Comment: Thank you so much for the detailed answer. However, once the package is created, is it possible to upload it as unmanaged package into appexchange ? I understand that for managed package we need to have salesforce partner account. However, with limited license available in developer edition, if we want to create component , app with the objective to publish into appexchange, would it be possible through developer edition ?
Comment: @GaneshKarthick - As a private unlisted app that you can share with a link, haven't done much beyond that.
Comment: @GaneshKarthick there is a new module for creating an app - https://developer.salesforce.com/trailhead/module/isv_app_development
Answer: You could use the Salesforce ANT Migration Toolkit which is a command line tool to move the metadata from developer org to partner org. It has a package.xml file in which we can specify what components we want to migrate.

Migrate from dev org to partner editon


Configuring Maven 2 POM Editor to open pom.xml files in source mode

Question: I use the Maven 2 POM Editor mainly for editing POM XML files directly. Is there a way to make the editor always open files in the "Source" tab?
Answer: In the Eclipse preferences for the Maven plugin, there is a check box for Open XML page in the POM editor by default. Its exact location varies by plugin version.
Juno/Kepler/Luna/Mars (4.x)
In these versions of Eclipse:

Click Window → Preferences
Expand Maven
Click User Interface
Check Open XML page in the POM editor by default
Click Apply and Close

POMs will open in source view by default.
Helios/Indigo (3.x)
In these versions of Eclipse:
Maven > POM Editor
Comment: This is so counter intuitive. The `POM Editor` would be the GUI editor, which **IS** the default. Checking this box makes the `XML editor` default.
Comment: @AlexanderMomchliov: I was confused, too (and it really is highly confusing) - but what they mean is that you open the POM Editor (which is the whole thing) with the XML editor ("XML page") selected.
Answer: Like Damien suspected, myWindow>Preferences>Maven>User Interface option to open POMs in the Maven POM editor automatically was indeed broken.  Here's how I fixed it (Juno):
Open Window>Preferences>General>Editors>File Associations.  In the upper right area click Add..., type "pom.xml", then OK.
Then click on the new entry pom.xml in the upper list, and in the lower list click on Maven POM Editor, then click the Default button on the right.
Click OK and then double click your pom.xml file in project explorer and it should open in the Maven POM editor.
Bonus:  The Ctrl+Shift+F formatting does a sweet job of formatting POMs in the Maven editor.  The default XML editor's formatting is pretty bad for POMs, which have attribute-free tags.
Answer: Eclipse Juno / Mars:
Go to Window > Preferences > Maven > User Interface
Check Open XML page in the POM editor by default
Answer: In eclipse  indigo preferences>Maven>User Interface there is a check box for Open XML page in the POM editor by default". Uncheck it. (The feature can be broken as it is on my eclipse)
Answer: Checking the check box "Open XML page in the POM editor by default" will open the POM editor but this will not automatically select the second tab - "Source".
You still have to click at the bottom on the "Source" tab. By default, the POM editor opens the first tab - "Design". The POM editor will remember the last tab you clicked, so if you clicked on Source the second time you open it it will show the Source tab.
Eclipse
Version: Oxygen.3a Release (4.7.3a)
Build id: 20180405-1200 , ubuntu 16.04


How many morphemes are in a contraction?

Question: I'm a little bit confused about how to count morphemes when we talk about contractions such as "I'm" or "don't". I need to calculate the ratio of morphemes to words.
Comment: Two morphemes in each, the ones that differ from their standalone variants are allomorphs, e.g. _'m_ is an allomorph of _am_, a clitic form thereof.
Comment: 3 is quite common in English - _Shouldn't've_ or _shouldna_, likewise _wouldna, couldna,, oughtna,_. And then there's _Whatcha_, with 3, though not always the some 3: _What do you_ or _What are you_.
Answer: First, you have to have a theory of morphemes, whereby you can answer the question "how many morphemes are there in do, does, did, is, am?". If you think that "am" has two morphemes, then "do" probably does as well, which can affect your count of morphemes in don't. In a writing-based analysis, you would not notice that the root of do is different from the root of don't. Most contemporary theories of morphosyntax have numerous phonologically empty or nearly-empty morphemes, corresponding to agreement features. So it ultimately depends on why you are counting morphemes, rather than counting something else. Also incidentally, you have to have a theory that tells you that "I'm" is one word and not two.


Does it make sense for a low authority website to compete against a high authority website with the same website name but different domain?

Question: Let's say I buy a website name (.com) and compete against other low authority websites with the same name but different domain (.co), and then manage to get to the top. Would it make sense for the low authority website to try and compete to beat me to get to the top?
Comment: Please clarify. By "the top", what do you mean? Search results for a keyword? If so, what type of keyword? And what do you mean by "would it make sense"? Do you mean "would it be possible for a low authority site to retake the top position in the SERP for a specific keyword"?
Comment: If it made sense in the beginning for _you_ to compete with _them_, then why would it not make sense for _them_ to compete with _you_?
Comment: @MaximillianLaumeister "the top" = SERP and "search results" = the website name (both of ours being the same) and "would it make sense" = competitively feasible
Comment: @MrWhite If I figure out a way to reach #1 in the SERP, it wouldn't make sense for  them to compete with me because they would have to put in extra effort to try and take my position when they could go a path of least resistance and start a new website in a different name.
Answer: It almost never makes sense to try to compete with the same name as a competitor.
You want to build your own brand.  The only way to do that is to have a unique name.   You want users to be able to type your name in and be sure they get to your site.   You don't want to have competitors in the search results for your name.  You don't want users to forget which URL belongs to you.  You want your brand to be as obvious as possible so that your (good) reputation is tied to it and isn't used by a competitor.
Brands are so important that you may even want to trademark your brand name.  That gives you legal rights when a competitor tries to use your brand name.   That allows you to take them to court and get monetary damages.
If you are using the same name as a competitor, there is the chance that the competitor already has the trademark and they could sue you.  You can check if they registered the trademark.  Even if they haven't registered it, they can argue they have been using it and they have rights to it under "common law".   So in addition to not being able to build your brand, you could get sued by your competitor by using their name.
Pick a unique and brandable name.  Your website will be much better for having done so.
Comment: I thought "common law" only applies to small geographical areas where the business started. What happens if it's started on the internet?
Comment: It is unclear.  It will probably take expensive court cases to gain the needed clarity.
 "Determining trademark rights based upon a trademark's use on the internet is a developing area of law.  The law is still struggling with how to define the geographic limits of a trademark used on the internet." -- https://www.thompsoncoburn.com/insights/blogs/internet-law-twists-turns/post/2015-07-01/web-trademarks-it's-not-the-words-it's-the-action


Do ships' targeting computers affect missiles?

Question: In the original Master of Orion, do the targeting computers help when attacking with missiles, or do they only affect lasers/beam weapons?
Answer: Wow, nice blast from the past. According to the manual it would seem that a ship's Battle Comptuer does affect missle weapons.

Missile Weapons are fast travelling
  drones mounted with explosive
  warheads. Unlike beam weapons, when a
  missile hits, it scores its full
  damage. Each missile is also equipped
  with a targeting computer that
  improves its chance to hit (its rating
  is added to the firer's battle
  computer). However, ECM jammers will
  reduce the missile's chance to hit.
  Each missile rack has a limited number
  of missiles that can be used in a
  single combat. The number of shots is
  shown in the description.
Comment: As missiles always hit for full damage, its worth noting that getting more than 100% to hit won't help, unlike for beam weapons. This means that with advanced missiles (which have an inherent +to hit) you often don't need a very advanced battle computer unless your opponent is using ECM jammers.


How come the Tesseract was with Von Strucker?

Question: If the Tesseract was in Asgard after the Avengers (Thor took it along with Loki) how come Von Strucker had it at the end of Captain America: The Winter Soldier? Even more at the end of Thor: The Dark World they said that they took the Aether to the Collector since they already had the Tesseract in Asgard. And didn't want to Infinity Stones be together.
Answer: Von Strucker is not in possession of the Tesseract. He is performing experiments using Loki's scepter, which contains a different Infinity Stone. You can see the scene here.
Comment: The Tesseract contained the Space Stone. Loki's scepter contained the Mind Stone.


How to add additional storage when creating google cloud instance from a machine image (using CLI)?

Question: I want to use the gcloud CLI to create new instances based on a machine image. I can create the instance just fine, but I can't figure out how to add additional storage to the instance. beyond the fixed size of the machine image's boot disk (in this case 30GB). If I don't use the "--source-machine-image" option, I can create a boot disk or additional disk of any size and I see it when I type "lsblk", but so far nothing I've tried actually gives me an extra disk that shows up on the instance.
Answer: To create a VM  instance you can use the following command:
gcloud compute instances create VM_NAME \
    [--image IMAGE | --image-family IMAGE_FAMILY] \
    --image-project IMAGE_PROJECT

And  --source-machine-image is the option that you can use to  create your instance from a machine image.
Here you have two options to add additional storage to the instance, and you could check this documentation for further details.

Resizing a zonal persistent disk

You can resize zonal persistent disks when your instances require more storage, and attach multiple secondary disks only when you need to separate your data into unique partitions.
In the gcloud tool, use the disks resize command and specify the --size flag with the desired disk size, in gigabytes.
gcloud compute disks resize DISK_NAME --size DISK_SIZE

Adding a blank zonal persistent disk to your instance

gcloud compute disks create DISK_NAME \
  --size DISK_SIZE \
  --type DISK_TYPE

After you create the disk, attach it to any running or stopped instance. Use the gcloud compute instances attach-disk command:
gcloud compute instances attach-disk INSTANCE_NAME \
  --disk DISK_NAME

Keep in mind that a new blank zonal persistent disk starts with no data or file system and you must format this disk yourself after you attach it to your instance, you can follow this documentation for this task : Formatting and mounting a zonal persistent dis


The row rank of an $m\times n$ matrix $A$ is at most $\min\{m,n\}$. Why?

Question: Ok, so let $A$ be an $m\times n$ matrix. I understand by intuition that the row rank has to be $\le m$, but why also $n$? Is this because there can be no more leading ones than $m$ or $n$?
Answer: A matrix $A\in\mathcal M_{nm}(\Bbb R)$ is a representation of a linear transformation
$$f\colon\Bbb R^m\rightarrow \Bbb R^n$$
so the image of $f$ is a subspace of $\Bbb R^n$ hence
$$\operatorname{rank} f=\dim (\operatorname{Im} f)\le n$$
but also by the rank-nullity theorem we have
$$\operatorname{rank} f\le m$$
hence we find the desired result
$$\operatorname{rank} f\le\min(m,n)$$
Answer: Elementary row operations don't change the row space, that is, the set of linear combinations of the rows.
The number of leading ones in the elimination is at most equal to the number of columns, because they fall in distinct columns. So the number of nonzero rows in the row echelon form of $A$ (which is the row rank) is at most equal to the number of columns.
Answer: It is so because the column rank of a matrix equals the row rank of the matrix.
Answer: The rank of a matrix is the dimension of the vector space generated by the columns, hence it is smaller than the number of columns. This involves vectors with a number of coordinates equal to the number of the rows $m$, hence a linearly independent family of such vectors cannot have greater than $m$.


Make a network-accessible file undeletable

Question: We have a network share on one of our local servers in our office. When users log onto the domain in Windows on their laptops a script runs that maps the share to their P drive. It's basically a dropbox. I want to create a read-only text file on it in the root. I want to be the only person allowed to edit or delete it. The biggest issue is that most of the people on the network are admins. Can I do this? I do have complete access to the server as an admin so I'll do whatever it takes (other than removing admin access from the other people).
Comment: In similar situations I usually just added to the top of the file **** DO NOT DELETE **** comment. But, if it's a hostile situations (with regard to other admins) then that's another story ...
Answer: Can't be done, if everyone is an admin. One of the admin privileges is taking ownership of a file, and once they do that, they can change it however they like.
You could try taking the machine the file lives on off of the domain, and setting the permissions on the local machine, but that's bound to be a huge headache, and it'll make it very difficult to do granular permissions.
What sort of file is it? If it's just text, you might want to switch it to another format, one that can't be edited, or something. They would still be able to delete it, however.
Comment: That's what I thought. I just wanted to create a P Drive Rules.txt file and don't want people to edit or delete it. I think I'm going to just backup the file elsewhere on the server and have a scheduled .bat file run daily that checks if its still in the share and if not, copies it in.
Comment: @Mark You might want to replace it regardless, just in case someone edited it during the day...
Answer: Are you admins savvy enough to "take ownership" of a file? Do they have admin rights to the box where the share is located? A couple of things you have to consider before doing security.
You can go to the security tab of the file, from the "Advanced" option, turn off "Inherit permissions from parent". Then from the Access List, remove everyone except for the user who needs it.
Second option would be to maintain a file lock on the file. If it's a text file, you might have use an editor other than notepad to accomplish that. For Word, Excel, etc. the program will maintain a lock on the network share.
Answer: Have you tried setting the sticky bit for the files or directories in question?


Screen orientation in only one child of a ViewSwitcher in Android

Question: I've got a ViewSwitcher containing a LinearLayout in position 0, and an ImageView in position 1.
Now I want the LinearLayout only to be shown as Portrait, and, when the ImageView is shown, give the user the chance to rotate the device and see that view in Landscape mode.
So, I added android:configChanges="orientation" in the Activity in my AndroidManifest.xml file.
Then I need to override onConfigurationChanged (Configuration newConfig) in my Activity, but I can't find any way to get what I want...
I've tried editing newConfig.orientation param directly, before calling super.onConfigurationChanged(newConfig), and also creating a new Configuration from newConfig and using updateFrom method, but It doesn't work.
Any idea?
Thank you
Answer: include also keyboardhidden
          android:configChanges="orientation|keyboardHidden"


Austronesian Alignment

Question: Can someone give a brief explanation for it? I heard about it once and I couldn't wrap my head around it, and the Wikipedia article wasn't much help either.
Comment: To start with, are you familiar with case, valency, and ergativity? I'm thinking of writing an answer, but the level of detail will depend on how much of this you already understand.
Comment: @curiousdannii Yeah.
Comment: So your question is really a task: explain Austronesian alignment. We don't know what you don't understand about it, so we can't give an objective answer here. Tell us what you know about it already and then we can elaborate.
Answer: In most languages, there are (at least) two fundamental types of verbs. Transitive verbs require two nouns:

Alice hits Bob.

And intransitive verbs require one noun:

Claire sings.

When the verb is transitive, there needs to be some way of marking which noun is doing the action, and which is having the action done to it. In English, this involves the placement of the nouns: the noun doing the action goes to the left of the verb, and the noun it's done to goes to the right. In Latin (and German and Japanese), this involves putting different markers on the two nouns.
The question is, then: what sort of marking do you put on the noun attached to an intransitive verb? Is it doing something, or having something done to it?
In English, we treat it as a doer. Which makes a certain amount of sense.

Alice eats the pie.
  Alice eats.

But sometimes that single noun isn't really doing anything, and it's still marked as a doer.

Bob broke the window.
  The window broke.

English is called a nominative-accusative language, because it treats the noun on an intransitive verb as the doer. Languages which make the opposite decision are called ergative-absolutive.
Some languages, however, don't want to choose one or the other. They use one system in one circumstance, and the other system in the other circumstance. The noun attached to an intransitive verb is always marked with the "direct case". And with a transitive verb, one of the nouns is marked as either "thing doing the action" or "thing the action is done to", while the other is "direct".
So you could have:

Alice-DIRECT eats.
  Alice-DIRECT eats the pie-THING DONE TO.
  Bob-DOER breaks the window-DIRECT.
  The window-DIRECT breaks.

While complicated, this is in some ways the most logical system. Since "Alice" is marked the same in both sentences, and "the window" is marked the same in both sentences.
Comment: This does look more in like with what the Wikipedia article says. It seems like there is also a difference in the marking of the verb between the two types of transitive clauses.
Comment: @sumelic Indeed; I left that part out since it seems to be language-specific. (I.e. it should be possible to have an Austronesian alignment system without that sort of marking on the verb.)
Comment: The verb marking becomes more important in e.g. Tagalog, where the "doer" and "thing done to" (which I really should have named better) are conflated into a single "indirect" case.
Comment: Austronesian "transitivity" phenomena often lead to a three-headed analysis -- one transitive subject, one transitive object, and one intransitive subject. Neither accusative nor ergative, but partaking of flavors from both.

Austronesian Alignment


Why a CPLD input pin behaves almost like an output pin?

Question: I want my CPLD (a MAX II CPLD, EPM240, see datasheet) to accept an S/PDIF input using an optical receiver with TTL-compatible output.
I tested the receiver alone: when giving proper power and optical connection to an emitter, its output pin shows a nice waveform on the oscilloscope.
But when connecting it to a pin of the CPLD configured as input (pin 44, 3.3-V LVTTL, default) I stop seeing the waveform; instead the signal seems stuck to ~3V. Of course the CPLD receives no data.
Suspecting that the CPLD pin was accidentally configured as an output, I disconnected the receiver and connected the pin to a 10kΩ pull-down resistor. I'd expect almost 3V if it were an output and almost zero if it were an input, instead I measure a voltage of 1.6V which is something in the middle.
So why is the CPLD behaving so weirdly with a digital input, almost behaving like it was configured as output?
Answer: Found out that pin 44 was faulty, probably burnt by earlier experiments. Remapping to another pin like pin 52 solved the issue and the signal can now be read.


Does Group by with order by work ion Dql?

Question: I am trying to execute a DQL (Doctrine) query that retrieve the latest answers of different doctors.
we have table answer, member, Location (doctor table) and many other table connected to the doctor information. However I want to get the latest answer but the condition is one answer for a doctor. I do some search and know something about group by and order by dont work together !
Here is the query in DQL:
<code>  $query = Doctrine_Query::create()
  ->select("a.answer_id as answer_id,m.member_is as member_id,a.member_id")
  ->from('Answer a')
  ->leftJoin('a.Member m on m.member_id = a.member_id')
  ->orderBy('a.date_added DESC')
  ->groupBy('m.member_id')
  ->limit(5);
</code>

but this query return undesirable results. Can anyone tell me where is the mistake?
Answer: Unfortunately you need to perform a subquery for that, which according to this question, DQL does not support. However in that question it's suggested that you send a native query.


Gift that adds Difficulty

Question: I heard there is a reflexive gift that allows one to pay variable gnosis to add a +2 difficulty per gnosis spent to attacks aimed at the targets mind. Does anyone know of a gift that is like this?
Answer: A gift that raises the difficulty for attacks against the minds does instantly ring the bell of Shell (Metis Rank 3) from the W20 prints to me, but it is a full immunization, is a new one and so it clearly isn't this one. It does allow us to gauge that the gift we are looking for is most likely a rank 2 to 4 gift! So let's sift and see what we find...
Mindblock, a Silverfang/Stargazer Rank 4 gift, is very similar to Shell and I could trace it back to the revised edition core book, I can't find my 2nd edition core book at the moment.

"Any direct mental attacks or
  attempts to control the Garou's mind, as well as more insidious
  psychic assaults (mind-reading, mentally implanting illusions
  or possession) are raised to 10. The effects of this Gift are
  permanent, but they do not apply to powers that sway emotion."

But I believe it is Resist Temptation, Stargazer Rank 2, Tribebook Stargazers p.51 (which is 2nd Edition):

The player rolls Wits + Rituals and spends one
  Gnosis point. Each success raises others' difficulties to ensorcel
  or supernaturally coerce the character by one. For instance, a
  vampire trying to Dominate the Garou would find it harder to
  succeed. Against non-supernatural coercion, this Gift is automatically
  successful. Thus, mundane con artists and temptresses
  have no power over the Stargazer.
Comment: While Shell does have its uses, I am not looking to handicap my character in this way. I have seen Mindblock and am considering it. However, Mindblock just sets the Diff to 10, which means specs can lower the Diff and most Mind attacks are at Diff Willpower. I REALLY like Resist Temptation and plan on picking it up. I am still hoping to find another Gift that is closer to what I am looking for,

Thank you for your response!

Gift that adds Difficulty


What is the relationship between the current produced fuel cell, the electrodes and the voltage of a fuel cell?

Question: I read somewhere that the bigger the surface area for the redox reductions to take place, and ultimately, the more redox reactions that take place, the more electrons that flow through an external circuit and the more electricity that can be generated. If this is the case, what does the voltage of a fuel cell, which I believe is caused by using dissimilar metals for the electrode and anode (correct me if im wrong) has to due with the amount of electricity and electrons generated?
doesn't V=IR tell us that for some fixed Voltage we will get some fixed current if resistance is kept constant.
Answer: The electrode materials and the fuel determines the cell voltage.
No current will flow from the cell without an external resistance connected. As the resistance is decreased, the current drawn increases, up to a limit set by the surface area of the electrodes or the amount of fuel being supplied, whichever bites first.
Increasing the limiting parameter, surface area or fuel supply, will increase the limit on the amount of current that can be drawn from the cell.


Implementing piechart with too many wedges

Question: Hello I need to implement a graph/pie chart between Customer support- time to first response of a case VS  severity of the case . Since the time to first response has a lot of values the pie chart has too many wedges to infer anything. Ive tried using bucket fields for time to first respons but due to the limit of the fields being maximum 20 , it says it is too complex and doesnt produce the output. Is there any work around for this ?
Answer: Your data needs to be made less granular or it will always look like this on a chart. Use a data type that can be grouped, e.g. a Number field named Hours Before First Response. That could easily be bucketed into digestible chunks and reported upon.


Retrieve some info based on the apk signature

Question: I'm trying to implement a version invalidation system for server-based apps. With the following model:
In some petitions to the server the client add a keyword and if that password isn't in a white list the server responds with an error, and the applications shows a message warning that a Market update is required (typically because its a hacked version or is a password that was used for a legit version but has been blacklisted because a cracked version is using the same code).
For generating that password I'd like a  key recovered in run time that identify the compiled version (that way if the apk is recompiled it won't work)
Initially I considered to use the apk signature retrieved by a code like this:
<code>public static int getSignature() {
    try {
        Signature sigs[] = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES).signatures;
        return sigs[0].hashCode();
    } catch (NameNotFoundException ignore) {
    }
    return 0;
}
</code>
But is is pretty stupid since the hacker can retrieve the signature of my apk (installing it in a device and running a program with the code above (using my.apk.package name instead of getPackageName() )
And then modify the getSignature() method to return a faked code instead of the real signature.
So my question is if there is some kind of info (signature dependent or similar) but not easily accessible from outside the app, that way if the code is recompiled with another signature that value is changed and can't be so easily to guess
Thanks
Answer: If your app is a paid one, you may want to have a look at:
http://developer.android.com/guide/publishing/licensing.html
This may be a long read and some work, but hey, that's the price for security.
Answer: I think you're out of luck since anything inside your .apk can be read by almost everyone, esp. on rooted devices.
You should definitely consider obfuscation of your app, e.g. using ProGuard.


Let R be the intersection of two lines, how do I prove that it lies on the radical axis?

Question: Given two circles $C_1$ and $C_2$ with centre $O_1$ and $O_2$ respectively. Choose two arbitrary points, one on $C_1$ and one on $C_2$. We name them $P_1$ and $P_2$. Draw the line $P_1P_2$ and mark the midpoint, $M$ of the line. Draw two lines $O_1M$ and $O_2M$. Then, drop a perpendicular line from $P_1$ to $O_1M$ and a perpendicular line from $P_2$ to $O_2M$.
How can I show that the intersection of the two perpendicular lines lies on the radical axis of two circles?
Answer: Let $S$ be te intersection of the perpendicular to $O_2M$ from $P_1$ and analogously define $T$. If one is able to prove that $STP_1P_2$ is a cyclic quadrilateral than it will be done. (Check yourself why)
This is easy because $MP_1=MS$ since $O_1M$ is the perpendicular bisector of $P_1 S$. Analogously $MP_2=MT$ and since $MP_1=MP_2$ by construction it follows that $STP_1P_2$ are equidistant from $M$ therefore the lie on the same circumference with centre $M$.


Bleed & Trim Area for LR

Question: I don't now how to go about this.  I'm trying to print to Nations Photo Lab.  They say I need to have a bleed & trim that should measure 3.75 x 2.25 and the trimming area, where the card gets cut, is 3.5 x 2 and the safe zone where you want to keep all the important info like text is 3.25 x 1.75.  I'm working in Lightroom.  My template that I'm using is a 5x7.  When it prints it's a bit on the small size because I guess it's used for web.  All I want is to print a 5x7 post card with a collage of photos on it.  It has a grey border as well, so I can't have any white paper showing.  Right now I am just guessing on how much space I need around the edge.  I can't have cut lines on because I have a collage of photos and can't have lines going though it.  Please help!
Comment: For my layout style, I'm using a custom package.  And I don't want to have to try to do this in Photoshop.
Comment: Just to clarify, you want to make sure that you size your photo so that everything that must be on the post card fits within the safe area, you want everything you hope gets on the card in the 5 by 7 area and you want to have stuff you don't mind if it gets on the card, but don't particularly want it there in the bleed area.  They will actually print to a card slightly larger than 5 by 7 (you'll need to check on the sizes for your 5 by 7) and then cut it down.  This lets them make sure the printing goes right to the edges.  The safe area is because sometimes the cuts aren't exactly even.
Answer: It looks like you're getting the wrong dimensions for what you want. Business cards are commonly found in a 3.5"x2" size. 3.5"x2" is the target size to cut.
To ensure that text isn't trimmed off if the cuts are made too short it is suggested that they are 1/8" inch inside the edges (which is your 3.25"x1.75" safe zone; 1/8" on each side).
On the other hand, if the cuts are made too large then there will be unprinted (usually white) strips on the edges, so it's recommended to bleed over some extra background in case that happens.
This all applies to your 5"x7" postcards as well, but with different dimensions. If it's the same 1/8" tolerance then you'd have a 4.75"x6.75" safe zone and a 5.25"x7.25" bleed. To mock this up in your editor of choice you'd make a 5.25"x7.25" canvas and place guides 1/8" inside the edges to mark your target cut line, then another guide 1/8" inside that to mark your safe zone.
Also, it's not a good idea to do borders because if the cuts don't come out even (and they probably won't, just a fact of life when working with this type of equipment) then it'll appear off as one side will be thicker or straighter than the others.
Comment: Most printers I've worked with offer templates that come with the right size canvas and guides already placed. Then you just drop in your art and align it the way you want, save it, and upload it to their website.
Comment: Thanks for the help! @tenmiles most help I've gotten so far. I'll see what I can do in the a.m.  Wish I knew how to use PS better. I love LR but certain things I wish where different.

Bleed & Trim Area for LR


Android: How to disable Desktops?

Question: We have an App for a tablet with Android 2.2. This is the only App that should run on this tablet. It starts automatically.
Thats why the user should not have access to other Apps on this tablet, especially not to the settings.
How we can realize this?
Answer: You should probably write your application as a Home application. There is an example in the developer docs here:
http://developer.android.com/resources/samples/Home/index.html
Then you'd be able to switch the default Home application for your one.

Android: How to disable Desktops?


Add Unix Executable to Mac OS X Dock

Question: I can't drag Unix Executables to the dock like I can with other executables. Is there another way to put them there?
Answer: You can use Platypus http://www.sveinbjorn.org/platypus to build a MacOSX compatable program which calls a bash script/executable.
Comment: Looks like this program can't be run on M2 Macbook Pro
Answer: Platypus will do the job fairly.
However, if you are not in the favour of installing any other software then you can also achieve the same using AppleScript:
Step 1: open Apple Script Editor from Spotlight search.
Step 2: write this command
to run
    do shell script "path_to_unix_executable"
end run

Step 3: Save it as an application bundle.
Step 4: Run
Answer: Platypus is nice. An alternative is to create an Applescript application with a do shell script command.
Here's the relevant apple technote:
http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
Comment: and the AppleScript can be saved as an `app` by File-> Export in the AppleScript editor. The drag & drop the `app` on your dock.

Add Unix Executable to Mac OS X Dock


How do you convert a changing input (square wave) into a single high signal?

Question: I am designing a circuit which will output a square waveform for a specific duration of time (t) but I need to be able to read the square waveform using a processor so would like to turn the changing square waveform into a single high pulse for time (t). The frequency of the waveform could be too high for the processor to read directly so I am looking for a method to convert it to a single high pulse (with duration t). I first thought about using a small capacitor which would be charged up during the rise of the square waveform and then be discharged through the low part of the waveform but I am unsure if this would work and what value the capacitor would need to be. Ideally I need way which does not use ICs (simple discrete components only would be best).
Any ideas?
Dan
Comment: Have you tried a LPF?
Comment: An LPF, followed by a comparator if you need a logic level output, should work fine.
Comment: Would a comparator work though during the low parts of the square waveform (my output is basically a chain of square pulses)?
Answer: You need a retriggerable one-shot, like the 74HC423  The first rising edge will make the output high, and each subsequent rising edge will keep it high.  The output will not go low until there is a time period between rising edges that exceed the output pulse width.
In the world of logic chips, one-shots aren't the greatest of ideas, and are considered to be cheats in many cases, but here it seems to make OK sense.
Answer: What is required is an RC & a circuit with a schmitt input.
This couple be constructed from a comparator or...a couple of 74HC14 - schmitt input inverter (two just to re-invert the original inversion)

simulate this circuit – Schematic created using CircuitLab

simulate this circuit
Comment: That would delay the rising edge of the output to be later than the beginning of the square wave, while a retriggerable one shot won't.  This might be fine behavior for the asker.
Comment: True, he might not want that. but it is easily fixed - diode. Its just another way of doing something similar
Comment: The cap will charge (almost instantly) but will take longer to discharge on a low. As long as a 74HC14 is used it will be fine


mysql join question, joining newest record in a one to many relationship

Question: I have a simple (hopefully) SQL question for you, any help would be much, much appreciated :).
I have two tables which I would like to join.
One Is Users, lets say it's called users
One is a kind of history of that user, lets say its called users_history.
The relationship of these two is a one users to many users_history relationship.
What I'd like to do is a query which joins the tables and joins the newest record in users_history onto each user.
Lets say the tables are like this, I'm simplifying for conciseness.
users

id
name

users_history

id
user_id
date

The date is formatted YYYYMMDD.
The end result is I'd like to be able to pull out all of the users who don't have a users_history record for today, for example today is 20101021.
Any help would be very gratefully received! :)
Answer: Try
SELECT MAX(users_history.date), users.name FROM users
LEFT JOIN users_history ON users.id = users_history.user_id
GROUP BY users_history.user_id
HAVING MAX(users_history.date) < CURDATE()

If you dont want users who doesnt have eny users_history records in the resultset, change the "LEFT JOIN" to a "JOIN"
Comment: If there is no Users_history record for a user then MAX(users_history.date) will be NULL and the HAVING clause will fail.  Users with no Users_history record satisfy the requirements and should be selected.
Comment: +1 COALESCEing the MAX date with a date before today in the HAVING clause should take care of the issue Paul mentions in his first sentence.
Answer: If all you really want is finding the users without a user_history entry for today, you can use a subquery like so:
SELECT * FROM users WHERE NOT EXISTS (SELECT id FROM users_history WHERE user_id = users.id AND `date` = DATE(NOW()));

IMHO, this is more readable than a join and some filtering in your host language.
edit: Judging from your date format description, you probably use a varcharcolumn to store the date. In that case, replace DATE(NOW()) with the appropriate string representation for "today" - though I'd recommend changing the column type to a date/time type.
Answer: pull out all of the users who don't have a users_history record for today, for example today is 20101021.
select
 u.*
from
 users u
left outer join users_history uh on
  u.id = uh.user_id and uh.history_date = curdate()
where
 uh.user_id is null;


Why does the amount of time required to train Jedi decrease?

Question: Many Younglings are as young as 4, which gives them decades to master the Force.  In The Empire Strikes Back, Yoda tells Obi-Wan's Force ghost that Luke is "too old" to begin training. Luke is only 22. While in The Phantom Menace, Mace Windu says the 9-year-old Anakin is too old to begin training. Rey is 19 in The Force Awakens and The Last Jedi and by the age of 20, she's able to use the Force like a Jedi master. In the training scene flashback in The Rise of Skywalker, Leia is over the age of 22. So, only a few decades after the eradication of the Jedi who served the Galactic Republic, these new Jedi students can be older, and attain mastery in "much less time" than the Jedi of centuries past could.
Comment: _"He is too old. There is already too much anger in him."_ The young age was due to attachments and feelings rather than much else. In the later films they mostly ignore that because they don't really have much other choice.
Comment: Luke is one of the most powerful Jedi of all time and Rey is a direct descendant of the Emperor.  The usual rules don't apply to prodigies.
Comment: Ever considered that the Jedi order is more about control of people than training them?
Comment: @L.T.Smash If Yoda gave a damn about restoring peace & order to the Republic, then he must have known that he "could not" follow the rigid tradition of only accepting students between the ages of 4 and 8. Then by the time Luke had attained a decent level of mastery, he knew "full-well" that an age limit of 8 was just preposterous, if he wanted to build a New Jedi Order.
Comment: After Order 66 all the midichlorians got concentrated into super powerful force users who don't need training. I kid, but it probably has something to do with the entire infrastructure and bureaucracy of the Jedi education system being gone as well as much of the history curriculum and all but a few ancient texts. Just needing to preserve what is still remembered and working with what they've got. (older individuals).
Comment: It's the converse of Parkinson's law.
Comment: I've always thought that the "old" training regime had a lot of "unnecessary" ancient baggage, stuff you "had" to do or learn "just because" your teachers had to too. Yoda and later Luke realized, out of necessity, that all that stuff just wasn't necessary.
Answer: There are two primary answers to this:
They are intently powerful in the Force
The Skywalker and Palpatine bloodlines are strong in the Force and so they not only have great power, but a strong attachment to the Force.
Luke and Rey were not fully trained
Both Luke and Rey were taught enough to survive. They had strength, and learned quickly, but what they learned was not the full breadth of Jedi mastery. They do have access to a lot of the teaching texts courtesy of Luke's efforts to find everything he could.
Ultimately, it might be for the best
While the Jedi were a great source of good in the universe, they also became a rigid bureaucratic organization that tore children away from their family and raised them to avoid all emotional attachment, which is not healthy. The events of The Book of Boba Fett suggest that Luke is continuing in this path of eschewing emotional attachment, and by the time of the sequel films, he is the last Jedi again. Maybe, this is a case where losing those centuries of tradition is a good thing, that the long course of Jedi training was as much about indoctrination as training then in the ways of the Force.


Are the per process memory and other statistics defined the same as the system wide stats?

Question: There's been a lot of posts about memory in OSX.  None have really documented what the screen below speaks to.  Especially the difference between private memory, and virtual private memory.  Also does port represent just network ports, or does it include open file handles on that screen? The link right here What's the difference between Real, Virtual, Shared, and Private Memory? is not the same question.  They're speaking of a different screen in OSX, which makes different measurements.  The screen I'm referring to in the image below is per process, not per system.  I would greatly appreciate if any one can provide information to what memory statistics in the image below represent, and what ports details.
Answer: Yes - the per process memory statistics and mach call counters mean the same thing as the system wide statistics.
Activity Monitor helps you break down which specific processes are making up the conglomerated statistics if you use the screens shown above. You may also find the sysdoagnose command useful in probing how the various numbers all add up if you prefer a textual output as opposed to a combined graphical and textual one.


What's this white crust in my kitchen pipe threads?

Question: I had to change the kitchen sink P-trap (J pipe and tailpiece) and there's hard white crusty stuff in the threads that's making it difficult to screw on the new ring nut connectors. The old parts had been on the sink drain and wall elbow for 25 years or more and had corroded. The rings broke when I turned them. I'm not sure if the white stuff is corrosion, minerals or what. I removed some of it from the threads [picture of threads with white crust]carefully using the tip of a knife and a wire bristle brush, but wonder if something else would work better.
Comment: You missed focus badly. Please try again.
Comment: I added the photo. If it's putty would anything clean it?
Answer: Without the photo it could be several things , the first that comes to mind is not normally used on those fittings normally pipe thread sealant or pipe dope , those threads normally have a compression ring of rubber or plastic and should never see any water that's why I put it first. Pipe dope turns hard and crusty after a couple of decades and is be easy to break those nuts on the tail piece and trap if dope was used.
Other things that come to mind when there are leaks quite common in the trap is calcium or lime both are white and crusty wince there is buildup but for that water to get out to the threads the seal would have had to fail.
So I believe it was pipe dope in a location that it should not have been used. A third possibility is plumbers putty that is used to seal the drain flange to the basin but it should not have been used on threads.