How would an international organization adopt Esperanto as a common corporate language?

Question: There are many global organizations that use English as a lingua franca, while using local languages as well in national and local offices. It's possible to work entirely in English in many fields, and in many major cities where English is not an official language. Are there examples of global organizations that have adopted a language as a lingua franca, where there is no reasonable expectation that incoming staff will already speak that language? What has proven to be required in order to accomplish this? Are there any further pertinent factors that are peculiar to Esperanto?
Comment: Didn't TEJO or UEA hire a few people that didn't know Esperanto beforehand a while ago? Maybe someone from these organizations could share their experiences here...
Answer: Even if you teach all of them Esperanto, there is still a chance they won't speak it. For example, the native language of the Philippines is not English, but most of the Schools encourage everyone to only speak English while they are on campus. However, in reality, this is rarely followed, despite the years of English classes throughout primary and secondary education. Even the faculty forget the English-speaking policy a lot of times while speaking with students. This is because they know the other person can speak a language you understand better, and it just naturally comes out, especially under pressure. Esperantists can probably avoid speaking English in their own gatherings because of their love for Esperanto. But you can't say the same with the new employees. For them, as long as you understand and get the point across, it's fine. And if the new employees are more proficient in their native language than Esperanto, they will fall back to speaking their native language.
However, all of this changes when you add a foreigner to the mix. Our meetings are in English if even one person is English-only and it feels natural to speak it in this case. But when the English-only person goes out of the meeting, it's too awkward and weird to continue speaking English and some will laugh at you and tease you if you even try, especially when they know you are very good at speaking the native language. We are not English language advocates, after all, we just want to communicate.
So guess is that an Esperanto speaking organization can exist if the native languages of each employee are mixed.
Answer: Esperanto Sube
I think that one of the central problems would be exactly what you brought up: not many people speak Esperanto, so to expect the workers to speak it would be rather unreasonable. I see two potential workarounds:

Spend resources on teaching all incoming workers the language;
Push for a world where Esperanto is taught as a lingva franca before starting the company policy.

The first would be the quickest but also the more expensive. It also runs into the problem of Esperanto not being commonly spoken in the world would raise the question as to the purpose of using it as a lingva franca if, as you've mentioned, most people accept English in that regard.
The second would be a lot more justified in the latter regard, but it would take a lot longer and need a direct shift from relatively pure raŭmismo to pure finvenkismo. It could be a good idea for Esperantistoj to volunteer or paid, but the company would not have a very good outreach program unless it's announcements are constantly translated to other languages.

Mi pensas, ke unu el la centraj problemoj estus precize tio, kion vi menciis: ne multe da homoj estas E-istoj, do atendi ke la laboristoj parolu ĝin estus iomete malrazone. Mi vidas du eblajn solvojn:

Elspezi rekursojn por instrui al ĉiuj eklaborantaj homoj la lingvon;
Atendi la finan venkon antaŭ ol fari la korporacion.

La unua estus la pli rapida sed ankaŭ la pli multekosta. Ĝi ankaŭ kontraŭstaras la problemon de ke Esperanto ne estas kutime parolata tra la mondo do oni demandus sin kial oni uzas ĝin kiel lingvo francan se, kiel vi jam menciis, multaj homoj akceptas la anglan tiel.
La dua estus multe pli justa, pripensante la lastan aferon, sed ĝi bezonus multe pli longe kaj bezonus tujan ŝanĝon el preskaŭ pura raŭmismo al pura finvenkismo. Ĝi povus esti bona ideo, ke E-istoj memvoluliĝu aŭ estu pagotaj, sed ĝi ne havus bonajn publikajn rilatojn krom se ĝiaj anuncioj estas tradukotaj konstante al aliaj lingvoj.


Is Web of Science the same as ISI?

Question: My institute requires us to publish our articles by ISI journals as the first priority, and Scopus as the second option. My question is: Is Web of Science the same as ISI?
Comment: They most likely indeed journals indexed in the Web of Science and having an impact factor published in their Journal Citation Reports. Be careful about fake impact factors claimed by various dubious journals on their websites. Some institutes even require only publishing in journals placed in the higher positions of the ranking.
Comment: While each index service works differently, *depending on your field of interest*, there may be considerable overlap of journals monitored by both Web of Science and Scopus.  Perhaps especially because Scopus is backed by Elsevier.
Answer: Web of Science is a product. ISI was an organisation that used to produce that product.
The Institute of Scientific Information (ISI) was bought by Thomson Reuters in 1992.
Web of Science is now produced by Clarivate Analytics, which bought the ISI intellectual property off Thomson in 2016.
Thus, in answer to your question, ISI as an organisation no longer exists, but when it did, being indexed by ISI probably meant being in the ISI Master Journal List (or in the Journal citation Report - JCR), which is a service that is part of the Web of Science website, and is now produced by Clarivate rather than ISI.
Comment: @Alice - you are going to have to ask your institute about that. Logic may not be their prime motivation.
Comment: There is no such thing as "published in ISI" and there hasn't been for at least 5 years now. Being indexed in Web of Science is the closest thing to being being indexed by ISI that currently exists.
Comment: https://en.wikipedia.org/wiki/Institute_for_Scientific_Information
Comment: Thanks. So, if I published a paper in a journal indexed in Web of Science, then it is not necessary been accepted as  published in ISI. Is that correct?
Answer: Is Web of Science the same as ISI?
It depends on what you mean by ISI.  If you mean "Institute for Scientific Information," then see the other answers here.
But ISI can also mean "International Scientific Indexing," which might look the same but isn't.  A nice discussion can be found here, which says "the International Scientific Indexing should be treated with extreme caution and it is probably best just to ignore it as its impact factor has no meaning."  (Many predatory journals claim to have an "ISI impact factor" but these are for the International Scientific Indexing, and not for the Web of Science.)

Is Web of Science the same as ISI?


What does "couldn't happen to a better person" mean?

Question: It seems like it should mean "if they were any better of a person, this wouldn't have happened to them" (which is quite negative), but it's always used in a way that implies a meaning of "no person is better than them" (which is obviously positive). How does the common usage make sense?
Comment: I most often hear "couldn't happen to a nicer person", and, when not being said ironically, it means that fortune has smiled on a person who well deserves it.
Comment: It happened to the best person it could have happened to.
Comment: The implication is that it couldn't happen to a better person because there is no better person (for it to happen to). So it means "It happened to the best person for it to happen to."
Answer: It typically means that the person to whom it happened (whatever it is) was best suited for it.  The thing happening is typically positive, so it might be rephrased as

No person could be more deserving (of it).
Answer: I do not believe it even means or implies that it couldn't have happened to someone better (than you).
Despite this there is often a dichotomous sense. If the thing that happened is pleasant - then the remark is a compliment.
However if it was unpleasant, saying it (usually about a third party, who is not present) provides an ironic twist - but essentially meaning they got their comeuppance.
E.g. A known pilferer has his wallet stolen. So someone says It couldn't have happened to a better person.
Comment: @WS2 Yes really!  My understanding is  as in the accepted answer by phoog.
Comment: I don't think I have ever come across this expression used ironically: only in a complimentary way about a 'good' person.
Comment: @TrevorD Really? My understanding is exactly per [Wiktionary](https://en.wiktionary.org/wiki/couldn%27t_happen_to_a_nicer).
Comment: +1 I'm familiar with: "It couldn't have happened to a nicer guy", and it's never meant as a compliment.
Answer: First one must interpret the idiom in it's non-ironic, non-hyperbolic sense.  It means that "it" happened to person who is absolutely the best/nicest guy that "it" could possibly happen to -- for once fate has appropriately rewarded goodness.
However, the idiom is never used without hyperbole, so (in it's non-ironic sense) it really means that the person to whom this happened was "pretty good" and/or "pretty nice" (though probably not the absolutely best/nicest guy in the Universe) and, as a result, deserved the (presumably beneficial) "it", whatever "it" is.
However to the second power, the idiom is probably more often used in an ironic sense than not (though either is possible), and when used ironically, it generally means that the "guy" mentioned "got what he deserved" -- the punishment suits the crime, as it were.
Comment: Ok. I've re-read it and I see what you mean. However, you must agree that your wording could have been more explicit, and has contributed to the confusion. I do not want to get into a protracted discussion about this, so on that basis I will delete my comment.
Answer: I know people sometimes, maybe even usually, mean this as a compliment, but to me, this reads as an insult, and the use of it as a compliment makes no sense.
I hear this mostly when something bad happens to somebody, for example, a losing streak for the Yankees, and someone says, "Ha! Couldn't happen to a nicer team." I interpret that as meaning, I'm glad the Yankees are losing, because I wouldn't wish this on a nicer team.
It makes no sense to me when someone gets a promotion and someone else says, "couldn't happen to a nicer guy". What, really? This most definitely could, and should, happen to a nicer guy. In fact, wouldn't you rather want this to happen to a nicer guy? Of course you would. So would I. So what is it you're really trying to say here? That the newly-promoted person is the nicest guy you know? OK, then maybe say, "There's no nicer guy I can think of to receive this honor." That's very clear, direct and unambiguous in its praise. Otherwise, implying that a nicer guy couldn't have been promoted, when that's not at all what someone meant, seems intellectually lazy, as in, he's not really sure what it is he's trying to put across, or else he doesn't know how to effectively put across what he is thinking.


Intuition behind regression sum of squares

Question: $SSR = \sum_{i = 1}^{n} (\hat{Y}_i - \bar{Y})^2$ is the sum of squares of the difference between the fitted value and the average response variable. In other words, it measures how far the regression line is from $\bar{Y}$. Higher $SSR$ leads to higher $R^2$, the coefficient of determination, which corresponds to how well the model fits our data. I'm having trouble wrapping my mind around why the farther away the regression line is from the average $Y$ means that the model is a better fit.
Answer: Just a bit of a misunderstanding with the definitions, I believe:
\begin{align}
\text{SST}_{\text{otal}} &= \color{red}{\text{SSE}_{\text{xplained}}}+\color{blue}{\text{SSR}_{\text{esidual}}}\\
\end{align}
or, equivalently,
\begin{align}
\sum(y_i-\bar y)^2 &=\color{red}{\sum(\hat y_i-\bar y)^2}+\color{blue}{\sum(y_i-\hat y_i)^2}
\end{align}
and
$\large \text{R}^2 = 1 - \frac{\text{SSR}_{\text{esidual}}}{\text{SST}_{\text{otal}}}$
So if the model explained all the variation, $\text{SSR}_{\text{esidual}}=\sum(y_i-\hat y_i)^2=0$, and $\bf R^2=1.$
From Wikipedia:

Suppose $r = 0.7$ then $R^2 = 0.49$ and it implies that $49\%$ of the
  variability between the two variables have been accounted for and the
  remaining $51\%$ of the variability is still unaccounted for.

The sum of the squared distances between the mean ($\bar Y$) and the fitted values ($\hat Y$) (the SSExplained) is the part of the distance from the mean to the actual value ($ Y$) (TSS) that the model has been able to account for. The difference between these two calculations, is the unexplained part of the variation (the residuals). If you take TSS as a fixed value, the higher the SSExplained, the lower the SSResidual, and hence the closer to 1 R.Square will be.

Here is some intuition, at the risk of actually making clear waters murky. In OLS we minimize distances to the points in the data cloud in an overdetermined system, rendering a line that fulfills $\text{SST}>\text{SSE}$. The difference is the $\text{SSR}$ (residuals).
But let's imagine a data "cloud" of three points, all perfectly aligned. Now, let's play a game of actually doing the opposite of an OLS: we are going to increase the error by proposing a line different from the line that goes through all the points, using the mean as a fulcrum. Remember that the OLS goes through the mean values $({\bf \bar X, \bar Y})$, which is the blue point in the middle, through which we draw a horizontal line. In this case, opposite to the expected situation in OLS and just to illustrate the point, we can see how by moving the line from having zero $\text{SSR}$ (all the variance, $\text{SST}$ accounted by the model (the line), $\text{SSE}$) on the left "column" of the diagram, we introduce residual errors (in red, on the right part of the diagram):

Logically, by minimizing errors, and in the typical situation of an overdetermined system, the $\text{SST}> \text{SSE}$, and the difference will correspond to the $\text{SSR}$.

Here is a quick example with a widely available data set in R:
<code>fit = lm(mpg ~ wt, mtcars)
summary(fit)$r.square
[1] 0.7528328
> sse = sum((fitted(fit) - mean(mtcars$mpg))^2)
> ssr = sum((fitted(fit) - mtcars$mpg)^2)
> 1 - (ssr/(sse + ssr))
[1] 0.7528328
</code>
Comment: I would appreciate it if the person who downvoted the answer pointed out where the error is, so I can correct it.
Comment: The answer looks good to me, the poster just doesn't appreciate it. @Adrian If $\hat{y}_i$ is close to $\bar{y}$ then clearly the regression line adds very little in terms of prediction.  You would just make predictions using $\bar{y}$.  The distance between the regression line and the constant line of $\bar{y}$, which we now know is important, is measured by the regression sum of squares.
Comment: @dsaxton The OP is completely incorrect in its definitions. I was just hoping that by correcting the misunderstandings in it, the idea would become crystal clear.
Comment: Your post is correct. But I think my question is just intuitively speaking, why is the distance between $\hat{Y}$ and $\bar{Y}$ a measure of how good of a fit our regression line is to the data? We want the regression sum of squares to be high. Intuitively, why do we want a big difference between $\hat{Y}$ and $\bar{Y}$
Comment: The sum of the squared distances between the mean ($\bf \bar Y$) and the fitted values ($\bf \hat Y$) (the SSExplained) is the part of the distance from the mean to the actual value ($\bf Y$) (TSS) that the model has been able to account for. The difference between these two calculations, is the unexplained part of the variation (the residuals). If you take TSS as a fixed value, the higher the SSExplained, the lower the SSResidual, and hence the closer to 1 R.Square will be.
Comment: Your sum of squares residual, at the beginning of your post is incorrect. Check it out on the link provided, but the name is self-explanatory: it is the sum of squared *residuals* - the residuals being the distance between $\bf Y$ (actual values) and $\bf \hat Y$ (estimated or fitted values). I know you know.
Comment: why pick mean value as the baseline? Is this because this would be the model without any independent variables?
Answer: why do we want a big difference between ŷ and ȳ?
maybe the graphs A, B, C, and D can be intuitively useful by visualizing the differences or distances between the
1. systolic blood pressure of each person from the mean systolic blood pressure(y-ȳ),
2. between the systolic blood pressure of each person from the regression line (y-ŷ),
3. and between the regression line and the mean systolic blood pressure (ŷ-ȳ).

the sum of squared differences of each sbp from the mean is the total sum of squares (tss) as shown in graph A.
if serum cholesterol is added or fitted as a predictor (x), a regression line can be placed on the graph. the sum of squared differences of each sbp value from the regression line is the regression sum of squares or explained sum of squares (rss or ess) as shown in graph B.
if the sum of squared differences of each sbp value from the regression line is smaller than the total sum of squares, then the regression line (serum cholesterol) has a better fit to the data than the mean sbp. the better the fit of the regression line the smaller the residual sum of squares( graph C).
if all the sbp fall perfectly on the regression line, then the residual sum of squares is zero and the regression sum of squares or explained sum of squares is equal to the total sum of squares (graph D). this means that all variation in sbp can be explained by variation in serum cholesterol.
to address the question: why do we want a big difference between ŷ and ȳ?
as the residual sum of squares approaches zero, the total sum of squares shrink until it is equal to the regression sum of squares when the y = ŷ. it this case, the mean of ŷ = ȳ.
Answer: This is the note I wrote for self studying purpose. I don't have much time to improve this due to lack of my English ability. But I guess this would be helpful. So I just paste this here. I will add some details later.
linear models
We can come up with several linear models with error $\vec  \epsilon$
$\vec y=\vec  \epsilon$   (It isn't model technically. There is no $\beta$s but I'd consider this as a linear model for explanation)
$\vec y=\beta_0 \vec  1+ \vec  \epsilon$ (0th model)
$\vec y=\beta_0  \vec  1+ \beta_1 \vec  x_1 +\vec  \epsilon$ (1st model)
$\vec y=\beta_0  \vec 1 +\beta_1 \vec  x_1 +...+\beta_n \vec  x_n + \vec  \epsilon$ (nth model)
$m$th model least square fit minimizing error $\vec  \epsilon ' \vec  \epsilon$
$\hat y_{(m)}=X_{(m)}\hat \beta_{(m)}$ (vector symbols omitted.)
$X_{(m)}=[\vec 1 \ \ \vec x_1 \ \ \vec x_2 \ \ ... \ \ \vec x_m ]$
$\hat \beta_{(m)}=(X_{(m)}'X_{(m)})^{-1}X_{(m)}' \vec y=(\hat \beta_0 \ \ \hat \beta_1 \ \ ...\ \ \hat \beta_m)'$
$SS_{residual}=\sum(\hat y^2_{i(m)}-y_i)^2$
$0$th model least square fit.
$\hat y_{(0)}=\vec 1(\vec 1' \vec 1)^{-1} \vec 1' \vec y=\bar y \vec 1$

What does regression really mean?
Let's consider this :$\sum y_i^2$.
If there's no model we there would be no regression so every $y_i$ can be treated as an error. (In other words, we can say the model is 0.) Then total error would be $\sum y_i^2$
Now let's adopt 0th model which is we don't consider any regressors ($x$s)
The error of 0th model is $\sum(\hat y_{i(0)}-y_i)^2=\sum(\bar y-y_i)^2$.
We can explain the error $\sum y_i^2-\sum(\bar y-y_i)^2=\sum \bar y^2$ and this is the regression of model 0th.
We can extend this in the same way to the nth model like below equation.
$$\sum y_i^2 = \sum \bar{y}^2_{(0)}+\sum(\bar{y}_{(0)}-\hat y_{i(1)})^2+\sum(\hat y_{i(1)}-\hat y_{i(2)})^2+...+\sum(\hat y_{i(n-1)}-\hat y_{i(n)})^2+\sum(\hat y_{i(n)}-y_i)^2$$
proof> First prove that $\sum (\hat y_{i(n-1)}-\hat y_{i(n)})(\hat y_{i(n)}-y_i) =0$
On the right hand, except the last term, is the regression of nth model.
Note this :
$\sum(\hat y_{i(n-1)}-\hat y_{i(n)})^2=(X_{(n-1)}\hat \beta_{(n-1)}-X_{(n)}\hat \beta_{(n)})'(X_{(n-1)}\hat \beta_{(n-1)}-X_{(n)}\hat \beta_{(n)})$
$=\vec y'X_{(n)}(X_{(n)}'X_{(n)})^{-1}X_{(n)}' \vec y-\vec y'X_{(n-1)}(X_{(n-1)}'X_{(n-1)})^{-1}X_{(n-1)}' \vec y$
$=\hat \beta_{(n)}'X_{(n)}'\vec y-\hat \beta_{(n-1)}'X_{(n-1)}'\vec y$
Using this we can reduce those terms.
Let  the regression of nth model $SS_R(\hat \beta_{(n)})=\hat \beta_{(n)}'X_{(n)}'\vec y$. This is the regression sum of squares due to $\hat \beta_{(n)}$
$$\sum y_i^2 = SS_R(\hat \beta_{(n)})+\sum(\hat y_{i(n)}-y_i)^2$$
Now substract 0th model's regression from each side of the equation.
$SS_{total}=\sum (y_i-\bar y)^2 = SS_R(\hat \beta_{(n)} )-SS_R(\hat \beta_{(0)})+\sum(\hat y_{i(n)}-y_i)^2$
This is the equation we usually consider during ANOVA method.
Now we can see that $SS_R( ( \hat \beta_1 \ \ ...\ \ \hat \beta_n)')=SS_R(\hat \beta_{(n)} )-SS_R(\hat \beta_{(0)})$, extra sum of squares due to $( \hat \beta_1 \ \ ...\ \ \hat \beta_n)'$ given $\beta_{(0)}=\hat \beta_0 \vec 1 =\bar y \vec 1$
So I guess regression sum of squares is how more we can explain the data than 0th model.

Model with no intercept
Here we don't consider 0th model.
$\vec y=\beta_1 \vec  x_1+ \vec  \epsilon$
By minimizing $\vec  \epsilon'\vec  \epsilon$ we can get
$\sum y_i^2 =\sum(\hat y_{i(1)})^2+\sum(\hat y_{i(1)}-y_i)^2$
So in this case $SS_R=\sum(\hat y_{i(1)})^2$
Comment: no beta means no model. not 0th model.


Why would minimum rent under franchise arrangements for McDonald's decrease year by year?

Question: I am working on a project regarding the refranchising strategy of McDonald's and came across this piece of data in their 2014 annual report. My understanding of minimum rent is that its a fixed amount to be paid by franchisees to McDonald's as the franchisees are leasing a restaurant location from McDonald's. Hence, I have no idea why its decreasing.
Comment: If in the documents you study, there exists an explicit description/definition of what "minimum rent" is and for what purpose it is paid, it would help to include this information in your question.
Comment: It is fixed rent paid from McDonald's franchisees to McDonald's due to a leasing arrangement if the percentage rent (rent based on percentage of sales) is lesser than the fixed rent. Also its quite strange that all the data for minimum rent is set in the future (as its a 2014 report).
Comment: Is there any indication that the rent values are being discounted (i.e., that these are the net present values)?
Answer: Suppose McDonald's has 2 franchisees. Franchisee A under its current franchise arrangement has to pay \$100 a year of minimum rent until the current arrangement expires in 2025. Franchisee B, on the other hand, has to pay \$75 a year but its arrangement expires in 2019.
The future minimum rent due to McDonald's in 2018 is $\$100 + \$75 = \$175$. This continues until 2020, where the payments then drop to only \$100 a year after Franchisee B's arrangement expires. Although, we would expect a high renewal rate with McDonald's franchisees, the table only shows future cash flows under contracts existing today, or as they say in the annual report

"The following table summarizes...future minimum rent payments due to the Company under existing franchise arrangements as of December 31, 2014."

Note that these values are not discounted. In our simple example, McDonald's is owed \$100 a year from 2021 to 2025 by Franchisee A and then gets $0 a year after 2025 since there are no more arrangements left. \$100 a year from 2021 to 2025 sums to \$500 for the thereafter row.

These tables of contractual obligations and future cash flows are helpful to analyze the future cash needs of a business. Often times companies may have a lot of debt due in a specific year when a bond issue matures. While companies often refinance ("rollover") that debt, it is helpful for investors to know that that debt maturity is coming up since if the company cannot refinance (say it is a lousy retailer or there is a financial crisis) and does not have enough cash on hand, the company could be forced into bankruptcy.
This future minimum rents table provided by McDonald's tells investors how much cash is contractually coming in the door, and also sheds light on the remaining life of McDonald's franchise arrangements.
Answer: The specific table appears to be part of the obligatory disclosures under applicable Accounting Standards, so that users of the company's financial statement have information of future obligations/claims the company may have based on existing long-term contracts. This is why it refers to future years.
Moreover, it is not an estimate or a projection, but it is based solely on existing contracts. This is why contractually guaranteed rent in total gets lower as we move into the future: some of the franchisee contracts expire earlier than others. The fact that there is a probability that they will be renewed-extended, is not taken into account.


Small network using ubuntu server 20.04LTS

Question: I am trying to setup a small server and I want to know how I can set the computers up to be on the same network. These system will not have internet access. I tried using regular ubuntu and I was able to ping both machines when I connected them to the same router. But with ubuntu server, they don't seem to be getting IPs. Do I have to separately install a DHCP server on one of the machines when using ubuntu server for all the systems to get an IP address? Does ubuntu desktop come with this pre-installed while ubuntu server does not?
Comment: desktop installations default to NetworkManager for managing network configuration, whereas server installations default to netplan, possibly in turn managed by cloud-init.
Comment: @anx thank you. That's useful to know. at least that might explain why Server doesnt get an IP address at all.
Answer: Generally your router will have a DHCP server in it to provide addresses for your machines, and desktop Linux will generally have DHCP enabled so it can accept addresses from the router. Ubuntu server may not; my own experience is that it generally does enable DHCP by default, but that experience is several years old. If you have a spare router, connect both the server and the desktop to the LAN side of the router; if you don't need Internet, you can leave the WAN socket empty. Check the network settings of your Ubuntu server to ensure that the network card has DHCP enabled. And with that you should be good.
Comment: Thank you! Yes, that's exactly what I did. Its odd that it works fine when both machines are running Ubuntu desktop but not Ubuntu server. regarding enabling the network card, both machines connect to the internet just fine when I try that. So that is what leads me to wonder if I need DHCP explicitly enabled on at least one machine when using Server? and that this is automatically done when using Ubuntu Desktop.
Comment: I think the operative thing here is that you need to ensure that your server is also set to use DHCP to get its network address. The Ubuntu desktop is set that way by default; if the server is not, it will be unreachable. Typically the router will be a DHCP server, so you would only need both the desktop and the server to be DHCP clients.
Comment: I just have a regular router, so I'm not sure if it has a DHCP server. Could I just install a DHCP server on the controller for my server instead?
Comment: You could; a simple example is `dnsmasq`. But I have to say that I have never seen a home router (one with a WAN port) that doesn't have a DHCP server in it. It may be disabled, in which case the quickest way to get it back, if you don't have the router admin password, is to reset it to factory defaults.


Android and MJPEG with java.lang.IllegalArgumentException

Question: I have implemented the demo from the post:
Android and MJPEG
But the application always occur error after a while later and I got the exception:
java.lang.IllegalArgumentException: Invalid Unicode sequence: illegal character

within the following code in class MjpegViewThread:

public void run() {
    start = System.currentTimeMillis();
    PorterDuffXfermode mode = new PorterDuffXfermode(PorterDuff.Mode.DST_OVER);
    Bitmap bm;
    int width;
    int height;
    Rect destRect;
    Canvas c = null;
    Paint p = new Paint();
    String fps = "";
    while (mRun)
    {
        if(surfaceDone)
        {
            try
            {
                c = mSurfaceHolder.lockCanvas();
                synchronized (mSurfaceHolder)
                {
                    try
                    {
                        bm = mIn.readMjpegFrame();
                        destRect = destRect(bm.getWidth(),bm.getHeight());
                        c.drawColor(Color.BLACK);
                        c.drawBitmap(bm, null, destRect, p);
                        if(showFps) {
                            p.setXfermode(mode);
                            if(ovl != null) {
                                height = ((ovlPos & 1) == 1) ? destRect.top : destRect.bottom-ovl.getHeight();
                                width  = ((ovlPos & 8) == 8) ? destRect.left : destRect.right -ovl.getWidth();
                                c.drawBitmap(ovl, width, height, null);
                            }
                            p.setXfermode(null);
                            frameCounter++;
                            if((System.currentTimeMillis() - start) >= 1000) {
                                fps = String.valueOf(frameCounter)+"fps";
                                frameCounter = 0;
                                start = System.currentTimeMillis();
                                ovl = makeFpsOverlay(overlayPaint, fps);
                            }
                        }
                    }
                    catch (IOException e)
                    {
                        Log.i(TAG, "Error: "+e);
                    }
                }
            }
            catch (Exception e)
            {
                Log.i(TAG, "Error: "+e);
            }
            finally
            {
                if (c != null)
                    mSurfaceHolder.unlockCanvasAndPost(c);
            }
        }
    }
}

I am not sure whether the following LogCat information is helpful.

    09-27 17:06:36.645: D/dalvikvm(10120): threadid=9: still suspended after undo (sc=1 dc=1)
    09-27 17:06:46.745: D/dalvikvm(10120): GC_EXTERNAL_ALLOC freed 132K, 47% free 2998K/5575K, external 1625K/2137K, paused 44ms
    09-27 17:06:46.825: D/dalvikvm(10120): GC_EXTERNAL_ALLOC freed 65K, 47% free 2997K/5639K, external 2227K/2779K, paused 27ms
    09-27 17:06:46.955: D/dalvikvm(10120): GC_EXTERNAL_ALLOC freed 127K, 48% free 2997K/5703K, external 2827K/2827K, paused 40ms
    09-27 17:06:47.385: D/dalvikvm(10120): GC_EXTERNAL_ALLOC freed 142K, 48% free 3000K/5703K, external 2827K/2827K, paused 31ms
    09-27 17:06:47.515: D/dalvikvm(10120): GC_EXTERNAL_ALLOC freed 131K, 48% free 2997K/5703K, external 2827K/2827K, paused 27ms
    09-27 17:06:47.615: D/dalvikvm(10120): GC_EXTERNAL_ALLOC freed 127K, 48% free 2997K/5703K, external 2827K/2827K, paused 31ms

Could anyone can give me some clues to solve this problem ?
Comment: Hello @Indiana, have you resolved this issue? I am getting the same exception...
Comment: Use   this  link

 http://stackoverflow.com/questions/10550139/android-ics-and-mjpeg-using-asynctask
Answer: I know this is a little old but I found a solution for this problem, the code works perfectly, it is the camera, the FPS is probably set to being "variable" or "auto".  I was using a TrendNet TV-IP551WI and the default setting was "auto" for the FPS and I noticed after maybe 5 -15sec the program would crash and I would get that very error, I also noticed that it was very jerky which led me to believe the fps wasn't right.  But after setting the fps to a fixed rate (doesn't matter what just choose one, I chose 20) the error should go away and it shouldn't spaz out anymore.
Answer: You might want to try neuralassembly's code for mjpegview as a new dummy project.
It's the same code but with added enhancement.
I've had same problem then tried his code with some adjustment, and it works like a charm.
Plus, if you encountered ndk_project_path=null while gradle is building, add this chunk of codes below in build.gradle inside the android tag:
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
sourceSets.main {
    jni.srcDirs = []
    jniLibs.srcDir 'src/main'
}

Hope this helps other people.


Rotation invariant tensors

Question: It is often claimed that the only tensors invariant under the orthogonal transformations (rotations) are the Kronecker delta $\delta_{ij}$, the Levi-Civita epsilon $\epsilon_{ijk}$ and various combinations of their tensor products. While it is easy to check that $\delta_{ij}$ and $\epsilon_{ijk}$ are indeed invariant under rotations, I would like to know if there exist any proof by construction that they are the only (irreducible) tensors with this property.
Comment: @QiaochuYuan In physicist's notation, I would like to construct all tensors $T_{i_1 i_2 \ldots i_n}$ that satisfy the following equation: $O_{ij} T_j = T_i$ for a rank one tensor $T_i$, $O_{ij} O_{kl} T_{jl} = T_{ik}$ for a rank two tensor $T_{ij}$ etc. Here $O_{ij}$ is an arbitrary orthogonal matrix. Now, the claim is that for the case of three dimensional rotations all such tensors can be expressed as a combination of the Kronecker delta and Levi-Civita tensor (the totally antisymmetric symbol). I have never seen a really convincing proof of this.
Comment: It is not clear to me exactly what this question means; the way mathematicians and physicists use the word "tensor" is slightly different, and I can't figure out what the Levi-Civita symbol actually describes as a tensor in purely mathematical language. Are you familiar with the purely mathematical language? My interpretation of the question is the following: let $V$ be a finite-dimensional real inner product space. Say that an element of the tensor product $V^{\otimes n}$ is an invariant tensor if it is invariant under the action of $\text{O}(V)$. Then you are asking whether...
Comment: ...invariant tensors are generated under tensor product and contraction by the inner product, which is an invariant tensor in $V^{\otimes 2}$, and a second tensor, perhaps the "determinant" in $V^{\dim V}$? Or are you only interested in the $3$-dimensional case?
Comment: (It looks to me from a quick google search like the Levi-Civita symbol is not actually a tensor, but I can't really make heads or tails of this.)
Comment: You might like: http://mathworld.wolfram.com/IsotropicTensor.html
Comment: related: https://math.stackexchange.com/q/881571/532409 https://math.stackexchange.com/q/4028138/532409 https://math.stackexchange.com/q/2457561/532409
Answer: This is somewhat late in the day / year, but I suspect the author is asking about representations of isotropic Cartesian tensors, where "isotropic" means "invariant under the action of proper orthogonal transformations" and "Cartesian" means the underlying space is Euclidean $R^n$ ($R^3$ is a case of great practical interest).
The proofs for the two cases asked here are non-trivial, and given in
Weyl, H., The Classical Groups, Princeton University Press, 1939
Constructions for higher-order isotropic Cartesian tensors are also given there.
Comment: By "invariant" I mean invariance of the components, of course.
Answer: $\mathtt{Definition:}$ $T$ is an isotropic tensor of type $(0,n)$ if  $\;T_{i_1i_2...i_n}=R_{i_1j_1}R_{i_2j_2}...R_{i_nj_n}T_{j_1j_2...j_n}$ whenever $R$ is an orthogonal matrix i.e $R^TR=RR^T=I$.
$\mathtt{n=2:}$See my answer here.
$\mathtt{n=3:}$For tensors of type $(0,3)$ we can mimick the proof for $n=2$ to deduce skew-symmetricness. Suppose $T_{pqr}$ is an isotropic tensor. Let $R$ be a diagonal matrix whose diagonal entries are $1$ except for $R_{ii}$ and $R_{ii}=-1$. $R$ is diagonal and its own inverse hence it's orthogonal.
$$T_{ijj}=\sum_{p,q,r}R_{ip}R_{jq}R_{kj}T_{pqr}=R_{ii}R_{jj}R_{jj}T_{ijj}\text{( using the fact that R is diagonal)}\\
\Rightarrow T_{ijj}=-T_{ijj}=0$$
Using the symmetry of this argument we can show that the only nonzero components of $T$ are those whose indices are a permutation of $(1,2,3)$. Suppose $i\neq j$. Define
$$R_{lm}=\begin{cases}
                  -\delta_{jm} & \text{if } l=i\\
                  \delta_{im} & \text{if } l=j\\
                  \delta_{lm} & \text{otherwise}
         \end{cases}\\
(R^TR)_{lm}=\sum_{n}R_{nl}R_{nm}=\sum_{n\neq i,j}R_{nl}R_{nm}+(-\delta_{jl})(-\delta_{jm})+\delta_{il}\delta_{im}\\
=\sum_{n\neq i,j}\delta_{nl}\delta_{nm}+\delta_{jl}\delta_{jm}+\delta_{il}\delta_{im}=\sum_{n}\delta_{nl}\delta_{nm}=\delta_{lm}\\$$
So $R$ is orthogonal. Suppose $k\neq i,j$.
$$T_{ijk}=\sum_{p,q,r}R_{ip}R_{jq}R_{kr}T_{pqr}=\sum_{p,q,r}-\delta_{jp}\delta_{iq}\delta_{kr}T_{pqr}=-T_{jik}$$ So $T$ is skew-symmetric in its $1$st two indices. Symmetry of this argument shows that $T$ is fully skew-symmetric. Therefore $T$ is a multiple of the Levi-Civita tensor.
Answer:
Harold Jeffreys (1973). On isotropic tensors. Mathematical Proceedings of the Cambridge Philosophical Society, 73, pp 173-176.

The proof given is a lot more concrete and "hands on" than Weyl's proof linked to by user_of_math.

Rotation invariant tensors


Display list of SSRS reports in a dropdown list, and allow users to select which report to display

Question: Our company has about 10 different SSRS reports. We would like to allow users to navigate from one report to another simply by selecting the report from a dropdown list. Is this possible?
Answer: Reports should be stored in the Catalog table in the SSRS database, you should be able to create a report based off the contents of the Catalog table...
Comment: This is the correct answer. I did this before using a "Report Index" that would generate off of the catalog views. It's pretty trivial to do.
Answer: Yes. You would need to write your own custom web app to interact with each SSRS instance.
You would do all of this using the .NET library around SSRS, it includes methods and such for interacting with reports in SSRS. A small/basic example: http://www.aspsnippets.com/Articles/Local-SSRS-Report-in-ASPNet-Tutorial-with-example.aspx


Does the Deligne-Mumford space module $S_{n}$ action have a fundamental chain?

Question: Does the Deligne-Mumford space (without ordering for marked points) $\bar M_{g,n}/S_{n}$ has fundamental chain in signular simplicial chains? (because I read Costello's paper GW potential to TCFT, as a orbifold,what's the fundamental chain?)
Comment: Your question is not very well written. You should try to improve it. For example, you might want to explain what you mean by "fundamental chain" on $\overline{M}_{g,n}/S_n$. You might also want to explain the $S_n$ action on $\overline{M}_{g,n}$ -- presumably you mean the action which permutes the marked points.
Comment: In any case, it sounds like you should read about moduli spaces of stable curves, and moduli spaces of stable maps, and virtual fundamental classes. The book "Mirror Symmetry and Algebraic Geometry" by Cox and Katz has a good overview of all of this material from both the algebraic geometry and the symplectic geometry perspectives.
Answer: A compact orbifold without boundary will have a fundamental chain in rational singular homology if and only if it is orientable.  The fundamental chain will satisfy the same sorts of properties as for a manifold.  In particular, collapsing the complement of a small disc will send the fundamental chain to the generator of $H_n(D^n,\partial D^n)$.  The reason that closed oriented orbifolds have fundamental chains in rational homology is essentially because, to the eyes of rational homology, they look like manifolds.
So the first part of what you are asking amounts to the question of whether $\overline{\mathcal{M}}_{g,n}/S_n$ is orientable or not.
Just so we're clear, $\overline{\mathcal{M}}_{g,n}$ is the moduli space of stable curves of genus $g$ with $n$ marked points labelled $1 \ldots n$.  The action of the symmetric group $S_n$ is by permuting the labels of the marked points.  Before taking the quotient by $S_n$, the space $\overline{\mathcal{M}}_{g,n}$ is a complex orbifold, so the complex structure induces a well-defined orientation just as for complex manifolds.
So the question is now whether the $S_n$ action preserves the orientation or not.  The answer is that it does indeed.  The symmetric group action is in fact algebraic, so it preserves the complex structure and hence the orientation.
As an aside: There is a homotopy equivalence between the moduli space $M^{rib}_{g,n}$ of metric ribbon graphs (that thicken to a genus $g$ surface with $n$ labelled boundary components) and the uncompactified moduli space $\mathcal{M}_{g,n}$.  The action of $S_n$ on $M^{rib}_{g,n}$ is not orientation preserving.  This is because, via Strebel differentials (or Penner's Lambda lengths) one can show that $M^{rib}_{g,n}$ is homeomorphic to $\mathcal{M}_{g,n} \times \mathbb{R}_+^n$ and under this homeomorphism the symmetric group action corresponds to the usual action on the first factor and the permutation action on the coordinates of the second factor.  Thus it doesn't act in an orientation preserving way.
Answer: A pseudomanifold is a finite-dimensional topological space $X$ (say Hausdorff and locally compact) that admits a closed subspace $Y$ of dimension $\dim X-2$ such that $X-Y$ is a manifold (see e.g. Goresky-MacPherson, Intersection homology 1, Topology 19, 135-162). If in addition to that $X-Y$ is connected and orientable, then there is a fundamental (cellular) chain: the homology long exact sequence inplies that the $H_{\dim X}(X,\mathbf{Z})=\mathbf{Z}$; take any representative of any of the two generators and this will be a fundamental chain. If $X$ is a CW-complex and $Y$ is a subcomplex, then a cellular fundamental chain can be constructed as follows: take the sum $[X]$ of all cells of the highest dimension with the orientation induced by some orientation of $X-Y$. This is a cycle since any cell of dimension one less will occur twice in $\partial [X]$, once with a plus and once with a minus.
The above conditions are satisfied if $X$ is an irreducible compact complex algebraic variety and $Y$ is a closed subvariety, since by Lojasiewicz's theorem one can triangulate $X$ so that $Y$ is a subpolyhedron. If $X$ is complex algebraic but not compact and $Y$ is still closed, then the above construction still works but the number of simplices will no longer be finite, so the fundamental class will live in the Borel-Moore homology.
If you have a finite group acting biregularly on an irreducible complex algebraic variety, then the quotient is not necessarily algebraic: it may happen that some orbits do not lie inside an affine open subset. But the fundamental class exists nonetheless: take the union of the singular locus and all points with nontrivial stabilizers. This is a subvariety whose real codimension is at least 2. Using the homology long exact sequence again one can see that the highest homology group is $\mathbf{Z}$, so any representative will ba a fundamental chain
Remark: the argument in the above paragraph is not really necessary in the case you are interested in. The quotient of the Deligne-Mumford compactifications of the moduli spaces of curves by the symmetric groups are algebraic and are coarse moduli spaces for the functor ``a family of smooth or nodal curves plus a set-valued section that does not intersect the nodes''.


in_array - 'in_object' equivalent?

Question: Is there such a function like in_array, but can be used on objects?
Comment: Why do you need to do this? Objects aren't supposed to be treated as arrays.
Comment: What about dealing with a SimpleXML object or simply an object of values? What's the recommended way to see if a value exists within an object?
Answer: Nope, but you can cast the object to an array and pass it into in_array().
$obj = new stdClass;
$obj->one = 1;
var_dump(in_array(1, (array) $obj)); // bool(true)

That violates all kinds of OOP principles though. See my comment on your question and Aron's answer.
Answer: First of all, arrays and objects are quite different.
A PHP object can not be iterated through like an array, by default. A way to implement object iteration is to implement the Iterator interface.
Concerning your specific question, you probably want to take a look at the ArrayAccess interface:
class obj implements ArrayAccess {
    private $container = array();
    public function __construct() {
        $this->container = array(
            "one"   => 1,
            "two"   => 2,
            "three" => 3,
        );
    }
    public function offsetSet($offset, $value) {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }
    public function offsetExists($offset) {
        return isset($this->container[$offset]);
    }
    public function offsetUnset($offset) {
        unset($this->container[$offset]);
    }
    public function offsetGet($offset) {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }
}

Now you can access your object like an array in the following manner:
$object = new obj();
var_dump(isset($obj['two'])); // exists!
var_dump(isset($obj['foo'])); // does not exist

Before you go crazy on this though, please consider why you are actually trying to do this and take a look at the examples at php.net.
Option 2: when you are simply trying to see if a property exists, you can use property_exists() for this:
class foo {
    public $bar = 'baz';
}

$object = new foo();
var_dump(property_exists($object, 'bar')); // true

Answer: You could cast the object to an array:
$obj = new stdClass();
$obj->var = 'foobar';
in_array( 'foobar', (array)$obj ); // true

Answer: function in_object($needle, $haystack) {
    return in_array($needle, get_object_vars($haystack));
}

Answer: It's unbelievable how all the people miss the point of the usefulness of an in_object PHP method! Here is what I came up with, it is very useful, and you will see why!
Here is a simple function I wrote which will check if a value can be found within an object.
<?php
  // in_object method
  // to check if a value in an object exists.
  function in_object($value,$object) {
    if (is_object($object)) {
      foreach($object as $key => $item) {
        if ($value==$item) return $key;
      }
    }
    return false;
  }
?>

This is very useful if an object has been created dynamically (especially from external code, which you don't control, as in an application-plugin, CMS, etc), and you don't know the object's properties.
The above function will return the property, so you will be able to use it in your code later on.
Here is a very good basic example of how useful this function is!
<?php
  class My_Class {
    function __construct($key, $value) {
      $this->$key = $value;
      // As you can see, this is a dynamic class, its properties and values can be unknown...
    }
  }

  function in_object($value,$object) {
    if (is_object($object)) {
      foreach($object as $key => $item) {
        if ($value==$item) return $key;
      }
    }
    return false;
  }

  function manipulate_property($value,$object) {
    if ($property = in_object($value,$object)) {
      // value found. I can now use this property.
      // I can simply echo'it (makes no sense, as I could instead simply echo "value")
      echo "
I found the property holding this value: ".$object->$property;
      // or (here comes the good part)
      // change the property
      $object->$property = "This is a changed value!";
      echo "
I changed the value to: ".$object->$property;
      // or return it for use in my program flow
      return $property;
    } else {
      echo "Value NOT FOUND!
";
      return false;
    }
  }

  // imagine if some function creates the class conditionally...
  if ( 1 == 1) {
    $class = new My_Class("property","Unchanged Value");
  } else {
    $class = new My_Class("property","Some Other Value");
  }

  // now let's check if the value we want exists, and if yes, let's have some fun with it...
  $property = manipulate_property("Unchanged Value",$class);
  if ($property) {
    $my_variable = $class->$property;
    echo "
This is my variable now:".$my_variable;
  } else $my_variable = $some_other_variable;
?>

Just run it to see for yourself!
Comment: What if someone is looking for the number `0` and expects to get a boolean value?
Answer: I don't recommend it, because it's very bad practice but you can use get_object_vars.

Gets the accessible non-static properties of the given object according to scope.

There are other limitations you should refer to the documentation to see if it is suitable for you.
if(in_array('find me', get_object_vars($obj)))

Answer: This is the most efficient and correct solution. With some modifications it could be applied to check any data type present in any object.
if(gettype($object->var1->var2) == "string"){
echo "Present";
}

Comment: what if its a number, boolean, float, ...?

in_array - 'in_object' equivalent?


A word that describes someone who has an intention to ridicule another person by questioning everything they say?

Question: Looking for a word that describes someone who has a subtle intention to ridicule the other person by questioning everything they say? They act slightly hostile and hypersensitive and make expressions in response to what is being said as if to try and make the other person's question seem silly or invalid.
Answer: dismissive (or one of the synonyms given below)

dismissive /dɪsˈmɪsɪv/
adjective
feeling or showing that something is unworthy of consideration.
  ...
synonyms: contemptuous, disdainful, scornful, sneering, snide, scathing, disparaging, negative, unenthusiastic, offhand, perfunctory; More
  informal - sniffy, snotty
Google Dictionary
Answer: I've been called-out on this a lot... I don't necessarily intend to make the other person look stupid, (in most cases) I'm just fascinated by strange thought-processes.
The behavior of argumentative questioning is often called: "playing The Devil's advocate".
Comment: Yeah, I don't really mean to describe it as trait that perpetuates a persons regular demeanour. It's more of a mood or disposition that comes across as inconsistent with their normal behaviour. I really like the word 'dismissive' - it captures what I am trying to express, however there is an air of sensitivity and judgementalism to their dismissiveness due to them deciding to take comments personally.


What is generating Similar Posts and Related Posts on my blog?

Question: I checked in my list of plugins, and I have nothing that seems like Related Posts or Similar Posts. Yet, at the end of my posts I find two very similar sections titled as such. Any idea how to turn one of them off, and how to understand what plugins are responsible for generating them?
Answer: Similar posts section has following comment in page source
<code><!-- Similar Posts took 18.313 ms -->
</code>
which quick search identifies as belonging to Similar Posts plugin.
Nothing to identify "Related" section by. I'd try to search sources for that heading.
Comment: The silly problem was that I was searching using "Ctrl-f" on the plugin page, and missed the fact I had several more pages of plugins :)


electrical fixture replaced now lights dont go on/off

Question: I installed a new track light to where the old fixture was.I have power to the light track but the on/ off switch does not work anymore and the lights stay on, unless I turn off the circuit breaker. I replaced the switch thinking it was faulty, but did not help. There are 2 cables at the fixture box with a black and white and ground from each cable.
I attached black to black ,white to white, ground to ground wires from track just like it was before.
Any suggestions?
Thanks,
Comment: It sounds like you took apart more than just the 2 wires that went to the old lamp.  Did you match color to color?
Comment: Can you post a photo of how the switch is wired, and photos of the insides of the boxes as well?
Answer: Wires are NOT color coded as well as you think.  However, black-white pairs are grouped into cables. That's important.   (I'll disregard grounds; all grounds are ground and all go to each other).
One of the black-white pairs in the ceiling is supply power.  Black is always hot, white is neutral.
The other black-white pair is a switch loop.  When the switch is on, the two wires are shorted to each other. The white is supposed to have a marking on it to indicate that it is not a neutral wire, but that was skipped.  This kind of lazy installation is what makes color coding so meaningless.
Disconnect the wires from each other and check which are energized with the power on.  Alternately, you can look for the pair whose resistance changes a lot when you throw the switch, but only check resistance with the power off!
The switch-loop white needs to be marked with black tape etc.  Code requires we use that one for always-hot.  The remaining switch wire (black) will be switched-hot.  That goes to the lamp black.
So join the black supply wire and the white-tagged-black switch-loop wire with a wire nut, push it into the back of the box, and never touch it again.  These two wires never went to the lamp, and would have been joined just this way, so there was never any reason for you to touch it.  I understand the urge to learn electrical by dismantling things, but position information is very important in lazy wiring where nobody marks anything.
If you want to be the opposite of this, I am a huge fan of marking all wires as necessary so their function is clear, and all like colors can simply be joined to each other. In my world, an unmarked white is neutral, an unmarked black is always-hot.  Switched-hots are red, unless there's 2 or more in the same box, then blue and yellow.  Two yellows in the same cable are the 2 travelers in a 3-way switch circuit. (travelers are interchangeable and there's no need to distinguish them from one another).
The remaining white (from supply) is real neutral to the lamp. The remaining black (from switch) is switched hot to the lamp.
Answer: I presume that you just disconnected the 2 wires from the old light, and connected the 2 wires from the new light.  Did you do anything to the switch?  That sounds like where the problem is.  Remember, the switch just breaks the hot wire.  "ON" connects the flow in the hot wire, "OFF" cuts that flow.  I am presuming you have a basic working knowledge of electricity so you know when to turn the breaker off and on or you know how to work with a hot wire.
At the switch box---Isolate your black and white wires that come from your circuit box.  These should give you about 120 volts when you put your meter on them.
Circuit off-connect your black wire from the circuit box to the bottom screw and secure.  Now, secure the black wire going to the light to the top screw and tighten.  Now you have the neutral wire from the circuit breaker and the one from the light.  Bug these 2 white wires together.  Everything should work.  Note if this is a 3way, you have a runner wire to deal with.  Jim
Answer: At this point I think your next step is to verify your wiring, because something does not add up.
I was thinking you might actually have an end of the line switch loop here.  If that's the case it wasn't simply three blacks spliced, three whites spliced, three grounds splice in the ceiling box originally.  If you put it back together that way, it would be on when the breaker's on, but it would trip with a dead short when the switch is closed, so that part doesn't make fit with an end of the line switch loop;  however the switch wasn't working before, so if there's a broken wire in the switch loop, it could make sense.
I'd say the next step is to disconnect and cap all the hots, turn on power, and see which is hot - verify whether the feed comes into the switch box or the ceiling box.


Eclipse user library variables and jar export to WEB-INF/lib

Question: I have a workspace with nearly fifty web projects in it.  In an effort to streamline classpath entries, I have created a user library variable and added all required jars to it.  Next, I removed the individual classpath (build) entries from each of the fifty projects and replaced them with my single user library variable.  Everything was going great until I deployed one of my projects from Eclipse to Tomcat and discovered the list of jars on the user library variable were not being copied to the WEB-INF/lib folder.
Does anyone know of a way to specify that these libraries get copied to the deployment source?  I experimented with the Java EE Module Dependency tab, but the jars were not copied even after selecting the name of the user library set.
Answer: Try FatJar
From my experience, Eclipse is not good at packaging all external Jars for you, but FatJar will do the trick.


Does BOSS OS-2 / Behringer OD-300 really contain two effects?

Question: BOSS OS-2 and it's copies have knob that allows to partially regulate between overdrive and distortion tone. How does it work. Does it have two signal paths internally and mix on the end or just has some adjustable element that makes it more like overdrive or distortion?
Answer: By all accounts the OS-2 incorporates two different distortion circuits, and the 'color' knob allows you to adjust the mix between them. If you need more information on circuits, freestompboxes and diystompboxes are good places to look - e.g.
http://www.diystompboxes.com/smfforum/index.php?topic=92158.0 talks about the blend in the OS-2.
Answer: Looking at the schematic (which can be found here or here) it appears your first assumption is correct. The OS-2 works by splitting the signal into two diffent paths, each with its own way of "clipping". These paths are then combined in a simple mixer and put through an active filter (tone control).
Answer: I have a hard time assigning any meaning to your question.  A stompbox gets an electronic signal in, manipulates it using electronic circuits, and puts an electronic signal out.  In that context, what does it even mean to "just emulate" an effect?
My guess is that the control knob manipulates the behavior/parameters of a single signal path rather than have two separate signal path and a blend-over between them.  And, mind you, a single signal path would usually be very much preferable since it leads to a single, consistent result.
Comment: "And, mind you, a single signal path would usually be very much preferable since it leads to a single, consistent result." - why?
Comment: Sad too hear that my question is hard to understand. See edit


I've booked a hotel on Booking.com using an empty debit card. Can the hotel still enforce their no-show/cancellation charge?

Question: Just today, I booked a hotel in Hong Kong through Booking.com using a prepaid debit card which has zero balance. My reservation was confirmed; however, I changed my mind as I found a cheaper place to stay.
I chose to cancel the first booking within the same day, and when I received the confirmation email for the cancellation, I was shocked that they were charging 600 HKD for such kind of transaction.
What should I do now? Should I consider the booking cancelled already, just like the email they sent me, and not think about the charge anymore? Or do I have to put money in the card to cover the fee which, honestly, I find outrageous?
Comment: Was it in their terms and conditions - the cancellation fee? If so, and you agreed to them, the outrageous or not there's not much you can do, I'd imagine...
Comment: I have booking.com `genius` status and I use it quite a lot. They do advertise the cancellation fee, and also shows the amount when you cancel.
Comment: Can you post a follow-up? I'd assume they cannot charge an empty debit card?
Comment: @user1073075 It depends on the bank account contract . Many banks allow accounts to have negative balance up until certain value, even using debit cards, as they charge higher fees for lending you money. Likewise, the answers here stating the payment did not go through with a 0 balance card might be wrong
Comment: Related: http://travel.stackexchange.com/questions/50631/how-does-booking-com-enforce-cancellation-fees-when-booking-without-a-credit-car
Comment: I think you don't need any balance after cancel the hotel booking.
Comment: Sometimes just calling the hotel and asking them kindly to cancel on their side may work.
Answer: I don't quite understand why you're "shocked" at the cancellation fee or why you find it "outrageous"?  When you reserve a hotel, you make a promise to show up, and the hotel promises to give you a rate that's cheaper than usual.  If you cancel, the hotel gets no money from you and is left scrambling to fill that room, which is why cancellation fees are used to mitigate the damage.   If anything, it's not unusual to have fully prepaid rates, meaning that once you've booked, you're charged the entire fee, even if you cancel within 5 minutes.
But in any case, as Burhan says in his answer, since you have no balance on the card, what happens next is mostly up to your bank and you may well get away without paying a cent.  But if the bank does decide to charge you, I don't see what grounds you would have to contest the charge, you were almost certainly notified about it (albeit in small print) when you made the original booking: Booking.com promises "no cancellation fee" on "most", but not all, rooms.
Comment: Most hotels let you cancel without penalty usually up to the day right before you booking.  Also your assertion that the hotel is left scrambling to fill the room is dishonest as well.  That might be true for a last minute cancellation but almost certainly not if the reservation is still three months away.  Its true the hotel does have such a strict policy but I doubt it would stand up for far out reservations.  How would they justify taking the OPs money AND a new guest that got the room?
Comment: @Andy I frequently book non-cancellable rates at hotels. Maybe 1/3 of the time it goes onto my card then. Another 1/2 it'll be charged within a week of the booking, probably because the hotel processes them in batches. Remainder they don't charge until checkout, despite being a non-refundable rate, but they have my details to charge me if I no-show
Comment: @Andy Whether cancellations are allowed or not usually depends on the prices, the cheapest deals usually do not.  And it's simple math, not dishonesty: if the cancellation fee is 10%, and the hotel fills the room after cancelling 90% of the time, they make (90% * 100%) + (100% * 10%) = 100% or exactly the same as they would have if everybody who booked had actually showed up, no more, no less.
Comment: Its also odd they allowed the booking without charging the card but now want to when the op wants to cancel.
Comment: @Gagravarr I don't doubt hotels will charge you, I doubt how successful they will be in a dispute (and especially a lawsuit).  Of course it depends on how far out the reservation is, day before is quite different than three months prior.
Answer: Assuming they charge the fee, since you have zero balance the charge won't be successful.
I believe booking.com does not control this, but the individual hotels do. You might want to check with the hotel (and the room/rate combination) you selected.
Some rooms which are discounted are either pre-paid or have a minimum night charge, or a hefty cancellation fee. I think you may have selected such a room+rate combination.
Either way, what happens depends on what kind of card it is and what kind of agreement you have with your bank.  You can contact the hotel to contest the charge (although, I am not sure how far that would go to be honest - I have not had much success in this department).
Regarding your booking:

They may charge you a minimum night charge if the booking is not cancelled (that is, they have not received the cancellation fee/penalty).
They may try to charge the cancellation fee again.

You can also choose to call your bank and refuse the charge.
Comment: Calling the bank and refusing the charge would be an act of fraud. Refusing a charge is only to be used when the seller would be obliged to give a refund (e.g., they charged the wrong amount, charged for goods that were faulty and refused to replaced them, or charged for goods or services they didn't deliver). It is _not_ to be used when the buyer has simply changed their mind (e.g., decided they didn't want the goods or didn't want to pay something they'd contractually agreed to pay, such as a cancellation fee).
Comment: @GeorgeY. How many times do I have to point out that refusing to pay something you agreed to pay is in no way comparable to getting a refund for a parcel that got lost in the post? Everything you have argued is already covered by my first comment, back in January.
Comment: @GeorgeY. Simply refusing to pay would be breach of contract, yes. But we're not talking about a refusal to pay: we're talking about telling your bank to retract a payment that was legitimately made. The only way you can get the bank to do that would be to tell them that the payment was not actually legitimate, which is a lie. I believe that lie would constitute fraud.
Comment: @GeorgeY. It is in no way legitimate to charge somebody for goods or services they did not receive. Come on, you know exactly what I mean. Disputing card payments requires the seller to do something wrong. It's not there to allow the customer to renege on a contract by not paying something they had agreed to pay.
Comment: @DavidRicherby he hasn't been charged yet. Refusing to pay a fee you are contractually obliged to pay is not fraud (which is a crime). It is breaking the terms of a contract (which is a civil suit). Of course the other party can go to court and ask it to enforce the contract. But the court can also declare the contract invalid (for example due to "small font").
Comment: @DavidRicherby you cannot "refuse" past payments on credit card, only dispute them. My bank allows to dispute as "I did not receive the goods or service I paid for" - so they do allow disputes even in case the charge is legitimate.
Comment: This happens quite often (lost packages) as charges almost always happen before shipping. And with hotel reservation, you can also claim that you did not receive the service (i.e. did not stay) - the bank/court might not agree with you, but claiming so is definitely not fraud.
Answer: Always read the fine print. People rush into making a room reservation based solely on the rate or the pictures. When you reserve that room, you are entering into a legally binding contract. You are agreeing to the terms and conditions on that site and for the hotel.
Try contesting the charges in court or with the bank and good luck to you. Whether you think it's fair or not, or whether you like the terms and conditions is  irrelevant after the fact. Once you've  "confirmed" that you agree by hitting the reserve button And sending the merchant your order you are required to uphold your end of the contract.
Saying you didn't see the information on the website or vendors advertising pages is not a good argument either. The burden of proof is on the accuser. Be prepared to provide proof that the information was not provided BEFORE the purchase was made. Usually the information on reservation pages is right next to the reserve button. Sometimes it is before the checkout page.
My advice is to just stay away from the prepaid reservations since the savings are not nearly all that much lower. 3 party websites like Expedia, booking.com etc, are travel agencies. They will get a fee for sending your reservation to the hotel. If you have an issue at the hotel, you will need to go back to the 3rd party to resolve the billing issue.
Call hotels in the morning hours and ask for a manager (GM) to get answers to your booking questions. Also ask for discounts from the manager rather than the desk staff. Ask about the policy for refunds and anything else you think you should know. Last, take names of the person you spoke to, their positions and get confirmation or cancellation numbers. I can't count how many people don't do this and find out that they've been charged as a no show for a reservation they cancelled, but can't provide a cancellation number or name of the person they spoke to. Other show up with no reservation at a sold out hotel and having no confirmation number means you have no grounds for recovery.
Comment: My personal experience with booking.com hotel booking in Hongkong: booked, fully refundable till last three days, one month before hotel sent an email that pay us via paypal or we cannot guarantee the room. I did not pay, compained to booking.com, no answers. So, few hotels also might not be very keen to uphold their end of contract.
Comment: Strange that booking.com didn't take action, as the hotel tried to rip booking.com off (they'd cancel your reservation there as no-show and keep the booking fee). Unfortunately this seem to be quite typical for cheaper HK hotels.
Answer: Now i am not sure about Hong Kong law but in some countries exist an international archive that states if you are a bad user of credit/debit instruments (Europe, Asia, North and Central America, and Oceania).
Now if the Hotellier find out that you have tried to contest the payment he got 3 options: 1st loose the credit, 2nd contact the bank (for free) and give explanations (takes a lot of time), 3rd contacting the national archive and paying a fee for official comunications to the autorities and even showing the "contract"(this is the evil path and is even the less known).
You have "signed" a contract with booking.com and they did with the hotellier, the hotellier has the right, in case you use an instrument like the debit card without the plafond, to ask this international archives to place your name on them, and now the bad news, what does imply? The Bank is obliged to prevent you from using any of those instruments from 6 months up to 5 yrs.
At this point I'll say I will be happy to pay the fee needed.
Comment: What are you talking about? It sounds as if you are describing US-style credit reports but even those are certainly not as powerful as to outright *ban* you from using *any* credit card for a single disputed/fraudulent/bad charge and I am not aware of any remotely similar *international* system. There is actually nothing like that in most European countries, AFAIK, even at the national level. Could you provide a specific example or name names to clarify your answer?
Comment: @Relaxed OP asked about debit cards. In the US market, debit cards are tied to a bank account, and doing what OP proposes would overdraw the bank account. If the owner simply refused to pay the bank, the bank would flag them in ChexSystems, and they would not be opening any bank accounts for the next 7 years.  So yes, a significant burn is possible.
Comment: @Harper-ReinstateMonica That's not quite the scenario described in this answer. I assumed from the question that the OP did not have (or turned off) any overdraft facility. Isn't the point of debit cards that the transaction would then simply be refused? Still very unclear and full of assumptions in any case.
Comment: Note that there are systems like the one you describe in Europe as well but you wouldn't be banned from opening a bank account following a minor contractual dispute with a hotel, only if you did actually use a credit instrument like a cheque or, indeed, overdraft facility to pay for it. The whole point of the question is to understand what happens when there isn't any charge or any direct involvement of the bank, otherwise the answer is obvious.
Comment: @Relaxed yeah, at least in the US, they don't have "always-online instant verification", so charges *can* post to a zero balance account without OD protection.  They overdraw it and you must cover. You won't get a ChexSystems ban for a contract dispute with a hotel -- you'll get it because you did not cover the overdraft.  In the US you must front the money during a dispute, and you get it back if you win.  I don't like debit lol.


ICANN Violation and Trademarks

Question: I'm trying to register a domain name with a .eg(i live in egypt) as the top-level domain. However, the local registrant told me to register a domain with the .eg extension i need to have a registered trademark. I dont think this makes much sense, is this a violation for any ICANN regulations, and if yes where i can find such documents?
Comment: What do you mean by "local registrant?"
Answer: [All links to English versions.]
The requirements for registering an .eg domain name are here.
Various TLDs have their own sets of requirements; there's no obvious violation of anything ICANN-related here. It looks like what you've been told might be half-true, depending upon exactly what name you're trying to register, and under what second-level domain, although I'm not so sure about use of the term "trademark" here. The .com.eg domain requires "commercial registry & taxation card" which I don't read as being the same thing.
Overall, the best thing for you to do would be to ask them directly and get an official response. There's a FAQ page that might cover your question, but I can't seem to get at the English version for it; if you can read it, give that a shot also.
Comment: well in the _Terms for second level domain_ registration, there are point
 3 and 4 that are relevant:

3- The institution should have a trademark registered in Egypt regionally or internationally.
4- The institution should provide the trademark possession documents.,

but this is just plain restrictive, what do you think i can do about?
Comment: Whether the requirements are restrictive or not is interpretation; they manage the TLD, they set the rules. Either fulfill them, or pick another TLD. (I don't mean to be harsh, but that's just the actual answer to your question.) In the case of some other TLDs, I've seen registrars that do something like set up some kind of fake-but-official company for you, etc. but it's predictably *expensive* and I don't know of any for your case; I've never dealt with .eg or such services so can't really comment any further. I suppose you could look around for something similar.

ICANN Violation and Trademarks


Do changes made inside a hook persist after the hook has finished evaluation?

Question: Let's say I am setting a variable to a value inside a hook. I'm hooking the hook to the minibuffer-setup-hook so that it runs whenever the minibuffer opens. Will the changes made by the hook persist after I close the minibuffer? Or will they revert back to their original state?
Answer: It depends on what kind of changes you make. There's nothing special about code invoked from a hook.
If you set a global variable it remains set until something sets it differently or makunbounds it.
Your question is general, so the answer is general. If you pose a specific question, e.g. with some code, specific answers can likely be given.


Even though the signal gets low several times a second why our eyes are only able to see the bulb glowing all the time

Question: I was learning Pulse Width Modulation and it told me that it just the technique to change the amount of time the signal gets high in one wave, but why am I able to see the bulb glowing at all the time even if the duty cycle is set to 40%.
Comment: Can you see the propellers on an aircraft engine when it is flying? Can you read words printed on a spinning disc?
Answer: It's due to the response of the eye and brain to rapid variations of light intensity.

Persistence of vision traditionally refers to the optical illusion that occurs when visual perception of an object does not cease for some time after the rays of light proceeding from it have ceased to enter the eye. The illusion has also been described as "retinal persistence", "persistence of impressions", simply "persistence" and other variations. According to this definition, the illusion would be the same as, or very similar to positive afterimages. Source: Persistance of vision.

There is more in the linked article.
If you move the PWM display across your field of vision while looking straight ahead you should be able to see the strobing effect. I've also managed to see it during humming while looking at a multiplexed LED display. You need to vary the pitch of your humming until your eyeballs vibrate at a multiple of the strobe frequency. It's quite weird!
Answer: Depends on PWM rate (frequency) and what light source you use. It also depends on the ability of the person to detect the blinking as it varies.
If you apply 10 Hz PWM to a LED to turn it simply on and off at 40% duty rate, you will see it being on and off, at least when moving it. People don't have a fixed "flicker fusion threshold" so the point where it can or cannot be seen varies between people. If you apply high enough PWM rate like 10 kHz, nobody will be able to see it blinking any more.
If the light source is an incandescent bulb, the filament stays glowing hot even when it does not receive power, so 10 Hz PWM rate will be fine.
Answer: At frequencies above the flicker fusion frequency, pulsing light is perceived as steady light at an average intensity.
Note that the minimum frequency varies with light intensity and where the light is in your field of vision (peripheral vision is more sensitive to flicker) and other factors, as described in the linked Wiki article.
If there is relative motion between the light source and your eyeball you can perceive something like the a multiplexed LED display or indicator "breaking up" into dots characters because the light hits different receptors in your eye. For this reason it's good to keep the frequency well above the minimum, especially where vibration is involved. More like 1kHz than a few tens of Hz.
An interesting parlor trick (courtesy of John Larkin) is that if you look at the screen of an old-fashioned analog oscilloscope with the trace sweeping at an appropriate rate, and whack yourself on the top of the head, you will see a trace representing the control system tracking response of your eyeball.
Comment: Damn. I have to try that idea from John L. You better be right, because I'll be using a big, heavy book and obviously will have to repeat this until I get "the right rate" on the scope. So my head is going to hurt a lot and I'll be saying something to you if this is just a way to see how stupid I am!! ;)


Application refused

Question: Can someone else copy, use and sell or import the subject-matter contained in la refused app? Is a refused app part of prior art?
Comment: Define "refused." Do you mean the application was rejected? And if so, was it then abandoned? Furthermore, which country (or countries) are we talking about?
Comment: Epo stated "refused", not "rejected". Prior to this the same application was also called "closed"
Comment: The application was not "abandoned" by nobody. An Appeal was raised against the decision of EPO to "close "the application with the EPO Boatd of Appeal. This appeal was initially accepted and further on considered as "inadmissible " by the same Board of Appeal
Comment: I would suggest that you add to your question (1) the area of the application (2) any references if possible (3) the reason (if possible) given for the refusal (4) the country for which you applied -- patent law varies between countries, and some subject matter is not patent-able is some countries, but there are usually ways around that
Answer: Only a granted patent provides any right of enforcement and everything published is potentially prior art. A magazine article, a newspaper story,a blog entry, a granted patent, a published application that went abandoned.

Application refused


What are the units for the force output by nstfout, the velocity output by nstvout, and the coordinates output by nstxout in gromacs?

Question: What are the units of force, velocity, and coordinates output by gromacs trajectory? In .mdp, they are specified by nstfout,nstvout,nstxout.
Answer: nstxout, nstvout and nstfout are the number of steps between coordinates, speed and forces written in the output trajectory (Output control documentation).
As for the units present in your trajectory files (say a .trr):
coordinates are in nm, speeds in nm.μs⁻¹ (so in mm.m⁻¹) and forces in kJ.mol⁻¹.nm⁻¹. These should be consistent through all GROMACS files (Definitions and Units documentation).
Note that .xtc files multiply coordinates by 1000 to compress them, so they are stored in pm (see GROMACS xtc documentation). Given MDAnalysis documentation on the subject, I believe .xtc files can only store coordinates, no speeds or forces.
I would be wary of softwares used to analyze your trajectory results (MDAnalysis, VMD, etc), as they may automatically do the conversion of these units, and for example show you coordinates in Å.
Comment: This was a great answer O.Laprevote! We have a [few unanswered GROMACS questions here](https://mattermodeling.stackexchange.com/questions/tagged/gromacs?tab=Unanswered), are you able to help us out at all with those? I'm trying to help take care of the unanswered queue.


Connect domain different cities

Question: How can i connect three server (domain controller) with a single one . These server are in different cities. And how to sync folder if i change file in one server automatically file change in other server
Comment: This question is very broad.  The short answer to your first question is probably "with a VPN" but there are lots of ways to accomplish that.
Answer: Create a site-to-site VPN to connect your sites -> make sure each site is in a different subnet -> set your DCs to use each other as DNS -> set up your sites in AD -> let replication begin -> done.

Connect domain different cities


No WiFi in Xubuntu 12.04

Question: I recently installed Xubuntu 12.04 on my Toshiba Satellite.  To my dismay, I could not get a WiFi connection.  I know the computer has WiFi, because it worked before.  I can get a wired connection.  I've even tried putting in a WiFi adapter and letting it connect over night.  It still didn't work.  It just keeps asking for my WiFi password.  Why is this?
Comment: See if http://docs.xubuntu.org/1204/internet-networks.html#network-troubleshooting-wireless is of help to you.
Comment: i have had the same problem before. if there are no drivers for your wifi card, get `ndiswrapper` and use windows drivers.
Answer: Have you rebooted your Toshiba any time recently?  I had a similar issue with my ASUS netbook and realized that it only happened after it had been on for a long time.  My settings were to lockscreen when the laptop lid is closed so it ran for long periods of time.  I changed my power settings to suspend when the lid is closed and rebooted and this resolved my issue.

No WiFi in Xubuntu 12.04


Fetching Tiles for Zoom Level from Data Base

Question: I have 6.7 million tiles of 200 x 200 meter each stored in a remote database, Can i plot them on the web dynamically as my zoom level changes or i move towards a new area my DB is queried and files matching this zoom level are fetched, Using GeoServer.
Comment: Yes of course, geoserver does that easily. Where exactly are you stuck? ;)
Comment: files are in tiff format and are GeoRefrefrenced
Comment: please guide me toward the respective documentation or tutorials, also. The database i am talking about is folders and files on a remote server
Comment: Well, what kind of format are those tiles in? Are they georeferenced? If so, how? Metadata?
Answer: If they are plain files, you use the Image Mosaic Plugin: https://gis.stackexchange.com/a/268648/51035
If they are in a PostGIS raster database, you can use the Image Mosaic JDBC Plugin: https://docs.geoserver.org/latest/en/user/data/raster/imagemosaicjdbc.html


Do I need to file US tax forms if I'm outside US the whole year but received an award money?

Question: I was previously an international PhD student in the USA on F1 visa, and I graduated in August 2022 (was a resident alien in 2022), and moved to Germany late 2022. Then in May 2023 I received an award money of $5000 from my graduate school due to excellence of my PhD work. But I've never been in USA the whole year of 2023, do I still need to file tax forms for year 2023 reporting this award money? My school didn't withhold any tax for this award, do I need to pay tax for it (if so, how to pay for that?)?
Answer: This income is taxable. It is considered FDAP (Fixed/Determinable/Annual/Periodical) income and is taxed at flat 30% (unless a tax treaty provides anything else).
See the IRS page on FDAP:

Tax at a 30% (or lower treaty) rate applies to FDAP income or gains from U.S. sources, but only if they are not effectively connected with your U.S. trade or business. The 30% (or lower treaty) rate applies to the gross amount of U.S. source fixed or determinable, annual, or periodical gains, profits, or income. Deductions and netting are not allowed against FDAP income.
The following items are examples of FDAP income:
...

Scholarships and fellowship grants
Other grants, prizes and awards

...

Since the income is in 2023, after you've left already, you'll probably be filing the non-resident 1040NR form.


preconditions and exceptions

Question: Suppose you have a method with some pre and post-conditions.
Is it ok to create an exception class for each pre-condition that is not accomplished?
For example:
Not accomplishing pre1 means throwing a notPre1Exception instance.
Answer: Why wouldn't you want to define PreconditionFailedException(string precondition)?  Throwing a different exception type for each failed precondition is overkill.
Answer: Yes and no.
Yes - Violating a precondition is certainly an appropriate time to throw an exception.  Throwing a more specific exception will make catching that specific exception simpler.
No - Declaring a new exception class for every precondition in your program/api seems way overkill.  This could result in hundreds or thousands of exceptions eventually.  This seems a waste both mentally and computationally.
I would recommend throwing exceptions for precondition violations.  I would not, however, recommend defining a new exception for each precondition.  Instead, I would recommend creating broader classes of exceptions that cover a specific type of precondition violation, rather than a specific precondition violation.  (I would also recommend using existing exceptions where they fit well.)
Comment: Additionally, your generic precondition exception type could take a parameter (say, a string or enum) that still allows you to easily set exactly which condition failed.
Answer: A failed precondition should throw an AssertException, or something similar. Before invoking a method, it's precondition must hold. If the caller doesn't do this check, it's a bug in the program, or an incorrect use of the method (API).
Answer: Only if not accomplishing the pre-conditions would be a rare exceptional occurrence.
Answer: Sounds like a useful use of exceptions to me. It certainly allows more fine-grained logging and debugging than just a general 'precondition failed' although you could also have a single 'preconditions failed' exception and put what preconditions have failed into the exception message.
Answer: I think it's ok to create a different exception for all your exceptions as long as you plan on using and handling them.
I have found that the better the error/exception handling the easier it is to debug software in the later stages.
For example:  If you have a generic excpeiton to handle all bad input then you must look at everything that was passed into the method if there is an error.  If you have an excpetion of all the types of bad conditions you will know exaclty where to look.
Answer: It looks possible to me, but if you want to continue this way of dealing with preconditions, you'll end up with N exception classes per class method.  Looks like an explosive growth of 'non functional' classes.
I always liked code where the 'core' functionality didn't handle violation of preconditions (apart from asserting them - a great help!).  This code can then be wrapped in a 'precondition-checker', which does throw exceptions or notifies non-satisfaction otherwise.
Answer: As a very very general way to determine if you should ever create a class or not (and an exception is a class), you should determine if there is some code that makes this class unique from all other classes (in this case exceptions).
If not, I'd just set the string in the exception and call it a day.  If you are executing code in your exception (perhaps a generic recovery mechanism that can handle multiple situations by calling exception.resolve() or something), then it might be useful.
I realize that exceptions don't always follow this rule, but I think that's more or less because exceptions provided by the language can't have any business logic in them (because they don't know the business--libraries always tend to be full of exceptions to the OO rules)
Answer: I think Ben is on target here. What's the point in throwing different exceptions if you're not going to catch them? If you really want to throw a different one I would at least have a common "PreconditionFailedException" base class that they all derive from, and try to organize them into some sort of heirachy so you can catch groups of them. Personlly, I'd not have different ones and just have a common exception you throw with the details of the failure in each one.
Answer: No, you should not create a specific exception for each precondition because it will go against the principles of the Design-by-Contract.
The corollaries of implementing pre-conditions is that they should be part of the documentation and that you should provide the necessary methods for the caller to check that all the preconditions are valid. (i.e. if a method execution is relying on the status of an object, the method to check the status should be available to the caller).
So, the caller should be able to check if all prerequisites are met before calling your method.
Implementing specific exceptions for each violated pre-condition would/could encourage the caller to use the try/catch pattern around the method call, what is in contradiction with the philosophy of the Design-by-Contract.
Answer: I would say it's okay as long as you make them unchecked exceptions (subclass of RuntimeException in Java).  However, in Java it is better to just use assertions.
Answer: If you do this, make sure they all inherit from another common custom exception.

preconditions and exceptions


Core data: Is there any way to efficiently query a model using implied relationships instead of real ones?

Question: Lets say I have the following kind of strange core data schema:

In this model, there are Accounts, and Activities which share a parent entity of Item. In addition there is a Relationship entity that models the relationships between objects instead of letting core data model the relationships using "real" relationships. In other words, the Relationship entity is being used as a kind of "join table."
Given this model, how can I fetch objects based on related objects? For instance, how would I fetch all the Accounts that have an Activity that occurs today?
There doesn't seem to be any way to do this in a single fetch request. The best thing I can think of so far is to first fetch the activities that occur today, then the relationships where the toId matches the ids of those Activities, and then finally the accounts where the id is matches the fromId in the relationships.
3 fetch requests to do this is suboptimal. We're going to need to support account and activity counts in the hundreds of thousands and doing all that fetching will potentially be really slow. It's also awkward to use NSFetchedResultsController with this kind of model.
Yes I know this isn't how Core Data likes to do things, but for a variety of reasons involving our server architecture and cross platform support we would like to use this data model and Core Data due to all the nice things it provides. Thanks in advance for your help.
Answer: Give both your Account and Activity a relationship to Relation, ie. called relations, and set appropiate inverse relationships (called account/activity). So, all your items, including Account and Activity can have multiple "Relation"s.
To link an account to an activity, create a new Relation object and set its account and activity property, then add it to the relations set of both the account and the activity.
Now, if you want to fetch all accounts that have an activity, you fetch the relations property of your activity and, for all items in this set, retrieve the account property. It should be possible to integrate this into a single query.


Looking for a book; YA novel about twins separated

Question: YA novel about a world where art, music, etc is totally forbidden. The story follows a pair of twins who are separated in their youth because one draws a picture in the dirt, I think the other twin reported their brother to the authorities? The artistic twin is saved from death/punishment by a resistance (i think) and lives in a safe, magical world. The story follows the twins as they grow up and train for the day when the artistic world will be attacked by the unartistic. At some point they realize the other is alive (i think they both assume eachother to have died?) and impersonate them.
Answer: Nevermind!! I found it :) It's a newer book called The Unwanteds
Comment: Funny forget to come back and accept your answer by clicking on the checkmark by three voting buttons. Also, please explain the book and why it matches so that this will show up when others search for it.


How can I deal with an employee that always arrives late?

Question: I supervise a group of 5 employees and one of them is consistently late like 20 to 30 minutes.  We are expected to arrive at 8am and don't have the option of working late to make up coming in late.  I have spoken to this employee and asked what is the reason for his tardiness but he constantly comes up with different excuses.  He does a really good job so I don't want to let him go. Any ideas?
Comment: Possible duplicate: http://workplace.stackexchange.com/q/35519/14043
Answer: You need to talk to your local HR about what options you as a manager have to deal with this. Policies will vary from company to company. When I worked for the federal government if you were late, you took an hour of vacation time. That will solve the issue very quickly for most people but it depends on your local labor laws and HR policies if this is an option.
In HR terms usually you start with a written warning. Then escalte through various steps. You need to be careful about giving your good worker leeway that the others don't get. If you want to fire someone else for being consistently late, you can have a legal problem if you allowed someone else to be consistently late.
If you don't want to bring up this particular person's performance to HR's attention, then go talk to them in general terms about what you need to know as a supervisor about how to handle varous employee problems so you can be prepared when they come up.
Comment: Thank you, what you say about fairness is very true.  Since it's the one employee that is late and not the others I need to speak with the employee that's late and make that clear that everyone else is arriving on time and I need to treat everyone equally so if it continues I will need to write him up.  We do have the option of starting at 8:30 and leaving at 5:30, I'm going to offer that.
Answer: Well, you don't necessarily have a problem.  You have a difference in expectations.
Here's the real question:  Does his late arrival directly impact anyone else?  You say there is no option to work late to make up the hours?  Is this a contractual requirement on a client site, or an arbitrary policy put in place by some HR wank?
If it's a site requirement, you say to him:  "Jim, our contract specifies explicitly that we are onsite from 8 to 5.  We don't have the option, so you don't have the option.  Either you arrive on time from now on, or you need to look for other work. I'd really appreciate it if you can tell me what your decision is as soon as possible."
If it's an HR thing, you need to go to HR and tell them, "This policy is hurting my team.  My top contributor needs some flexibility, and honestly, the rest of them would really appreciate it, as well."
I worked a contract site a couple of years ago who had a 9-4 Core hours requirement.  I'd often come in at 7 to beat traffic both directions, and it worked great.  Others came in at 9 and left at 6 for the same reason.


Rank correlation with spearman and kendall

Question: While interpreting the correlation between ranks, should I use the rho value (for spearman method), tau value (for kendall's tau method), w value ( for kendall's w method) or should I take in consideration the p-value?

And does having NaNs values in the ranks impact the interpretation of the correlation?
Answer: The correlation score is the "rho" or "tau" value. This is a normalized score in $[-1,1]$:

the direction of the correlation is indicated by the sign of the score.
the strength of the correlation is indicated by the absolute value of the score.

This value is directly interpretable. For example a value 0.1 means a very weak (probably insignificant) positive correlation, a value of -0.8 means a strong negative correlation.
The p-value is an additional information indicating whether the correlation score is significantly different from 0. In other words, it represents how likely this score is due to chance or not. Naturally a non-significant correlation score should be interpreted with caution.
NaN values cannot be taken into account in any correlation score. They are probably ignored in your implementation, otherwise you would obtain an error message.
Comment: Thank you @Erwan for your answer!