Historical Crypto Data

Question: I'm looking for for historical data on crypto currencies that tracks down to at least the hour if not 5 minutes for each day for at least the past year. I need OHLV price, and volume at a minimum for each interval, but further trade data would be a great plus. I would prefer to get this from an API if one is available, but at least some csv's would help to start with, all the historical sources i see only track on a once per day basis.
Comment: maybe dublicate: https://stackoverflow.com/questions/16143266
Answer: Free version to the previously proposed paid version:

Actually, you CAN get the whole Bitcoin trades history from Bitcoincharts in CSV format here : http://api.bitcoincharts.com/v1/csv/
it is updated twice a day for active exchanges, and there is a few dead exchanges, too.
EDIT: Since there are no column headers in the CSVs, here's what they are : column 1) the trade's timestamp, column 2) the price, column 3) the volume of the trade

Please search first.
Answer: ClueDex Offers the online data you need. For OHLCV data, all markets are returned in a single query. You can specify the number of periods you wish, as well as the period interval. Additionally, you can create your own period interval, such as 25-seconds, 47-seconds, or whatever, in addition to the standard period intervals, 1M, 5M, 30M, etc. Cluedex doesn't cache the data either, and they don't impose a delay; you get the data as they receive it. It is a premium service, however.
Answer: I would recommend historicalcryptodata.com. Used it before, their pricing is quite cheap and good.

Historical Crypto Data


How to make Kubuntu automatically switch between the laptop monitor and the external monitor when it's plugged in?

Question: My installation of Kubuntu 12.04 does not switch to the default external monitor when I plug in nor does it switch back to the laptop monitor (Intel HD 3000) when the external one is plugged out. Both are recognized in the System Settings -> Display and Monitors -> Size and Orientation. I can set the settings manually, but I want it to happen automatically. The hardware key doesn't work if the machine woke up without the external monitor. Any ideas?
Answer: I have the exact same problem and would like to know if theres a workaround for this. Its one of the reasons preventing me from switching unfortunately. I have been told that it is possible using xrandr but i am not sure how...
Edit:
Im actually appalled at how hard it is to get Kubuntu (or any other linux distro as far as i can tell) to just "work" as you would expect it to.
The best option i have found till now is to run the xrandr command using the --auto option at startup. This will automatically enable all available displays to their preferred resolution/rate etc
In Kubuntu, this can be run at startup in ~.kde/share/config/krandrrc
<code>[Display]
ApplyOnStartup=true
StartupCommands=xrandr --auto
</code>
There are still a few problems however.

If for example you want to enable only your external monitor if it is available and enable your laptop display if it is not available, this appears to be quite hard to do without writing some bash script to parse the output of the xrandr command.
Another problem which i really find annoying is that xrandr (or kubuntu/linux) does not adjust itself well when you remove a display on the fly. If i have my external monitor plugged into my laptop and decide to remove it while kubuntu is running, all i seem to get is error messages and i cannot seem to find a way to automatically make it switch to the laptop display (as you would naturally expect it to).

I really really hope theres a better alternative to this setup. It must put a lot of users off to create such a complicated an elaborate setup just to get external monitors working.
I might post this reply as a new question in the hopes that someone would be able to point out better options.
EDIT2: I also noticed that gnome session automatically performs this switching so its deffinatly functionality that is available.
Why does Kubuntu not have such a standard feature?
EDIT3: Kubuntu 13.04 actually has this automatic switching feautre. It has been implemented as part of kde 4.10. The only problem is that i find Kubuntu 13.04 really really buggy compared to 12.04
EDIT4: Kubuntu 13.10 has been released and I can honestly say that it is a very stable version which you should change to. It contains the support for switching automatically between different display configurations as you plug in and out monitors. Highly recommended!


SOM clustering for nominal/circular variables

Question: Just wondering if anyone is familiar with clustering nominal inputs. I've been looking at SOM as a solution but apparently it only works with numerical features. Are there any extensions for categorical features? Specifically I was wondering about 'Days of the Week' as a possible features. Of course it is possible to convert it into a numerical feature (i.e. Mon - Sun corresponding to nos 1-7) however then the Euclidean distance between Sun and Mon (1&7) would not be the same as the distance from Mon to Tues (1&2). Any suggestions or ideas would be much appreciated.
Comment: Cyclic variables are best thought of as elements of the unit circle in the Complex plane.  Thus, it would be natural to map the days of the week to (say) the points $\exp(2 j \pi i / 7)$, $j=0, \ldots, 6$; *i.e.*, $(\cos(0), \sin(0))$, $(\cos(2 \pi/7), \sin(2\pi/7))$, ... $(\cos(12\pi/7),\sin(12\pi/7))$.
Comment: would i have to code up my own distance matrix then specific to cyclic variables? just wondering if there were already existing algorithms for this type of clustering. thx
Comment: @Michael: I believe you will want to specify your own distance metric that is appropriate for your application, and that is defined over _all_ the dimensions in your data, not just the DOW. Formally, letting x, y denote points in your data space, you need to define a metric function d(x,y) with the usual properties: d(x,x)=0, d(x,y)=d(y,x), and d(x,z) <= d(x,y)+d(y,z). Once you've done that, creating the SOM is mechanical. The creative challenge is to define d() in a way that captures the notion of "similarity" appropriate to your application.
Answer: Background:
The most logical way to transform hour is into two variables that swing back and forth out of sync. Imagine the position of the end of the hour hand of a 24-hour clock. The x position swings back and forth out of sync with the y position. For a 24-hour clock you can accomplish this with x=sin(2pi*hour/24),y=cos(2pi*hour/24).
You need both variables or the proper movement through time is lost.  This is due to the fact that the derivative of either sin or cos changes in time whereas the (x,y) position varies smoothly as it travels around the unit circle.
Finally, consider whether it is worthwhile to add a third feature to trace linear time, which can be constructed as hours (or minutes or seconds) from the start of the first record or a Unix time stamp or something similar.  These three features then provide proxies for both the cyclic and linear progression of time e.g. you can pull out cyclic phenomena like sleep cycles in people's movement and also linear growth like population vs. time.
Example of if being accomplished:
# Enable inline plotting
%matplotlib inline

#Import everything I need...

import numpy as np
import matplotlib as mp

import matplotlib.pyplot as plt
import pandas as pd

# Grab some random times from here: https://www.random.org/clock-times/
# put them into a csv.
from pandas import DataFrame, read_csv
df = read_csv('/Users/angus/Machine_Learning/ipython_notebooks/times.csv',delimiter=':')
df['hourfloat']=df.hour+df.minute/60.0
df['x']=np.sin(2.*np.pi*df.hourfloat/24.)
df['y']=np.cos(2.*np.pi*df.hourfloat/24.)

df

def kmeansshow(k,X):

    from sklearn import cluster
    from matplotlib import pyplot
    import numpy as np

    kmeans = cluster.KMeans(n_clusters=k)
    kmeans.fit(X)

    labels = kmeans.labels_
    centroids = kmeans.cluster_centers_
    #print centroids

    for i in range(k):
        # select only data observations with cluster label == i
        ds = X[np.where(labels==i)]
        # plot the data observations
        pyplot.plot(ds[:,0],ds[:,1],'o')
        # plot the centroids
        lines = pyplot.plot(centroids[i,0],centroids[i,1],'kx')
        # make the centroid x's bigger
        pyplot.setp(lines,ms=15.0)
        pyplot.setp(lines,mew=2.0)
    pyplot.show()
    return centroids

Now let's try it out:
kmeansshow(6,df[['x', 'y']].values)

You can just barely see that there are some after midnight times included with the before midnight green cluster.  Now let's reduce the number of clusters and show that before and after midnight can be connected in a single cluster in more detail:
kmeansshow(3,df[['x', 'y']].values)

See how the blue cluster contains times that are from before and after midnight that are clustered together in the same cluster...
You can do this for time, or day of week, or week of month, or day of month, or season, or anything.
Comment: Helpful (+1). This is one application where graphs being square not oblong really is important. I don't know your software but I imagine you can set aspect ratio to 1, away from the default.
Comment: That's true @NickCox. Or you can just perform the linear transformation in your head ;-)
Answer: Commonly nominal variables are dummy coded when used in SOM (e.g., one variable for with a 1 for Monday 0 for not Monday, another for Tuesday, etc.).
You can incorporate additional information by creating combined categories of adjacent days.  For example: Monday&Tuesday, Tuesday&Wednesday, etc.  However, if your data relates to human behaviour it is often more useful to use Weekday and Weekend as categories.
Answer: For nominal variables, the typical encoding in a neural network or electrical engineering context is called "one-hot" -- a vector of all 0s, with one 1 in the appropriate position for the value for the variable. For the days of the week, for example, there are seven days, so your one-hot vectors would be of length seven. Then Monday would be represented as [1 0 0 0 0 0 0], Tuesday as [0 1 0 0 0 0 0], etc.
As Tim hinted, this approach can be generalized easily to encompass arbitrary boolean feature vectors, where each position in the vector corresponds to a feature of interest in your data, and the position is set to 1 or 0 to indicate the presence or absence of that feature.
Once you have binary vectors, the Hamming distance becomes a natural metric, though Euclidean distance is used as well. For one-hot binary vectors, the SOM (or other function approximator) will naturally interpolate between 0 and 1 for each vector position. In this case, these vectors are often treated as the parameters of a Boltzmann or softmax distribution over the space of the nominal variable ; this treatment gives a way to use the vectors in some sort of KL divergence scenario as well.
Cyclic variables are much trickier. As Arthur said in the comments, you'd need to define a distance metric yourself that incorporates the cyclic nature of the variable.
Answer: Assuming day of week (dow) goes from [0, 6], instead of projecting data onto a circle another option is to use:
dist = min(abs(dow_diff), 7 - abs(dow_diff))

To understand why, consider the dow as a clock
  6  0
5      1
4      2
    3

diff between 6 and 1 could be 6 - 1 = 5 (going clockwise from 1 to 6) or 7 - (6 - 1) = 2. Taking min of both options should do the trick.
In general you can use: min(abs(diff), range - abs(diff))
Answer: I have successfully encoded Days of the week (and Months of the year) as tuple of (cos,sin) as whuber highlighted in his comment. Than used Euclidean distance.
This is an example of code in r:
circularVariable = function(n, r = 4){
 #Transform a circular variable (e.g. Month so the year or day of the week) into two new variables (tuple).
 #n = upper limit of the sequence. E.g. for days of the week this is 7.
 #r =  number of digits to round generated variables.
 #Return
 #
 coord = function(y){
   angle = ((2*pi)/n) *y
   cs = round(cos(angle),r)
   s = round(sin(angle),r)
   c(cs,s)
 }
 do.call("rbind", lapply((0:(n-1)), coord))
}

Euclidean distance between 0 and 6 is equal to 0 and 1.


Will the 3.3V regulator on an Arduino Leonardo work when powered from USB?

Question: Will the 3.3V regulator produce 3.3v when the Arduino is powered from the USB port?
Answer:
Will the 3.3V regulator on an Arduino Leonardo work when powered from USB?

Yes, provided that

it is an "official" Leonardo or a competent clone and
as long as you do not load the power supply excessively with external loads.

Official circuit diagram here
The USB supply feeds the 3V3 regulator via MOSFET T1 at the bottom of the sheet and U3, an LP2985 LDO regulator. If your board has the same circuitry as this it should provide 3V3 from USB.
Answer: The 3.3V regulator is fed by the 5V, whatever that comes from. If you don't use a separate power supply like a wall-wart, the 5V switches automatically to the USB's 5V. That feeds the regulator for the 3.3V.
So yes, it will produce 3.3V.


Why does current remain same in a series circuit?

Question: Current is the rate of flow of charges with time. When passing through each resistance in a series circuit, charges lose energy and "slow" down due to collisions with atoms (metal cations). When time increases, current decreases. I agree number of charges remains same but what about time?
Comment: Does this answer your question? [Why is current the same in a series circuit?](https://physics.stackexchange.com/questions/269640/why-is-current-the-same-in-a-series-circuit)
Comment: Current doesn't decrease with time.  Current decreases when the potential difference driving that current decreases.  Individual electrons accelerate and stop when hitting atoms in the conductor, but current represents the sum total of all electrons moving through a conductor.
Comment: Indeed it does as well @Buraian
Answer: If the current in a series circuit diminished with each resistive device, you'd wind up with a pileup of electrons further down the circuit. If the circuit had a 10A flow at the start of the circuit and a 1A flow at the end, you'd have 10C worth of electrons arriving somewhere and only 1C worth leaving - you'd have 9C worth of electrons piling up somewhere every second! Complete circuits do not spontaneously accumulate charge somewhere in the circuit.
You can think of it like a garden hose - water entering one end will come out the other end at the same rate, otherwise something is very wrong with your hose.
Comment: Electrons won't accumulate because they'd repel the incoming electrons. Battery would have to do more work to push them, that's resistance. With increased resistance, current decreases.
Comment: @ShahzebCheema You're correct, electrons *don't* accumulate, because the current is determined by the resistance of the entire series circuit. I think you just answered your own question - if electrons *did* accumulate, it would slow the upstream flow of electrons until it matched the downstream flow of electrons (the battery can't push any harder than it already is). Hence, current is identical everywhere in a series circuit.
Comment: Indeed that's true. Thanks alot...
Answer: Imagine a scenario. Take a battery having a potential of $V$. The ends of the battery is connected by a wire that is resistance less(an ideal approximation). In that case, the electrons in the wire are offered no 'resistance' and hence, they are free to move from the negative end to the positive end of the battery. From simple application of Ohm's law $$I=\frac{V}{R}$$ we see that the current is not defined, but in the limiting case of $R\rightarrow 0$, $I\rightarrow \infty$. Though the Ohm's law is an approximate law and we need a better treatment of the scenario to understand what is happening, we as of now know that the electrons don't travel through the resistance less wire instantaneously. There are electrons all along in the wire which just 'drift' towards the positive end of the battery without any obstruction and so quite fast(not instantaneously).
Now, if we include a resistor of resistance $R$ in this scenario, the drift of the electrons are no doubt restricted and this restriction of the motion of charges through the resister is indeed what causes the potential drop across the resistor, and the drift through the resistor occurs at a smaller rate, hence the smaller current.
For two resistors in series, this drift is slowed by both of the resistors(hence lesser current as compared to the single resistor case). However, the drift velocity through the entire wire has to remain the same as electrons can't accumulate anywhere in the wire if there are non regular speeds of their drifts as pointed out by @Nuclear Wang and the OP wrote in the comments. Also, electrons do lose energy due to collisions and that loss appears as heat that reduces the potential in due time and hence the current all in all deceases. But the current can't have various values in such a series circuit.
Comment: Thanks alot ! That's great explanation. I just have this query in mind that whether electrons are "accelerated" in moving through a circuit or whether they move with uniform "drift" velocity? Does resistance slow down charge carriers so that instead of accelerating, they move with uniform drift velocity?
Comment: The electrons do accelerate from rest when a potential is applied, however they repeatedly collide with lattice atoms and loose energy. Hence, in a crude sense, we take up that the elecrtons move at a constant drift velocity (which is in fact an approximation) given the applied potential $V$ and the resistance $R$.
Comment: Thanks alot ! @quirkyquark


Can I store ether and ERC-20 tokens in one contract?

Question: I am trying to create a contract to store ether and two ERC-20 tokens. People will transfer ether and the other two ERC-20 tokens to this contract and when the time comes, the owner of this contract will transfer these ether and ERC-20 tokens back to them. I don't know how to make this contract.
Currently, I can make an ERC-20 token contract and it can only store the ether and this ERC-20 token itself like below.
Suppose this contract can store 3 kinds of tokens. When people transfer these tokens to the contract, how the contract itself knows which token was sent?
contract WalkDogToken is ERC20, ERC20Burnable, Ownable {
    constructor() ERC20("WalkDogToken", "WDT") {}

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }

    function decimals() public view virtual override returns (uint8) {
        return 8;
    }

    receive() external payable {}
}

Answer:
Suppose this contract can store 3 kinds of tokens. When people transfer these tokens to the contract, how the contract itself knows which token was sent?

Tokens are transferred using IERC20(address).transferFrom(). Your contract differs between different ERC-20 tokens by their smart contract address.


If $x$ is in $A$ then is $\{x\}$ an element of the power set $A$ or a subset of the power set of $A$?

Question: If $x \in A$ then is $\{x\} \in \wp{A}$ or is $\{x\} \subseteq \wp{A}$?
I know that since $x \in A$ then $\{x\} \subseteq A$ but what does that make $\{x\}$ in relation to $\wp{A}$?
Comment: Indeed, $\{x\} \subseteq A$, while $\{x\} \in \wp{A}$
Comment: The power set is one whose elements are sets themselves.
Answer: By definition the elements of $\wp(A)$ are the subsets of $A$. If $x\in A$, then $\{x\}\subseteq A$, so $\{x\}$ is a subset of $A$ and therefore an element of $\wp(A)$. In short, $\{x\}\in\wp(A)$.
For a little more practice:
Let $X=\{x\}$. Then $X\in\wp(A)$, so $\{X\}\subseteq\wp(A)$, and therefore $\{X\}\in\wp(\wp(A))$. In other words, $\{\{x\}\}\subseteq\wp(A)$, so $\{\{x\}\}\in\wp(\wp(A))$. In fact,
$$\underbrace{\{\{\{\dots\{}_nx\underbrace{\}\dots\}\}\}}_n\in\underbrace{\wp(\wp(\wp(\dots\wp(}_nA\underbrace{)\dots)))}_n\;.$$
Answer: Let $A=\left\{1,2,3\right\}$. Then, $2\in A$. Now,
$$
\wp(A)=\left\{\emptyset,\{1\},\{2\},\{3\},\{1,2\},\{1,3\},\{2,3\},\{1,2,3\}\right\}.
$$
This implies that $\{2\}\in\wp(A)$.
Comment: +1.  I think an example is clearest here.  It should also be noted that we could write  $\{2\} \subseteq A$ and $\{\{2\}\} \subseteq \mathcal{P}(A)$.
Answer: Saying that $B \subset A$ is the same as saying that $B \in \wp{A}$. In your case it means that $\left\{x\right\} \in \wp{A}$.
Answer: The previous answers are excellent and give the right picture, but I'd like to point out that we can have both $\{x\}\in\mathcal{P}(A)$ and $\{x\}\subseteq\mathcal{P}(A)$ for $x\in A$. As an example, consider $A=\{\emptyset,\{\emptyset\}\}$ and $x=\emptyset$. We now have
$\mathcal{P}(A)=\{\emptyset,\{\emptyset\},\{\{\emptyset\}\},\{\emptyset,\{\emptyset\}\}\}$
and both $\{\emptyset\}\in \mathcal{P}(A)$ and $\{\emptyset\}\subseteq \mathcal{P}(A)$.
In fact, there are sets $A$ such that both of your options hold for every element $x\in A$; such sets $A$ are called transitive.


Ubuntu Logs to Diagnose Hardware Issues

Question: Recently, my laptop has started turning off for no apparent reason; it's an old laptop and the problem is likely to be a hardware issue, but I was wondering if there were any Ubuntu logs that might shed some light on the issue?
Answer: As there is a brief delay before the logs are written to disk, nothing may have been recorded, however something of general interest concerning the power management of your laptop may be found by using dmesg:
dmesg | grep -i acpi

To go back further in time and to show dates alongside the results, you could grep all the kernel logs for acpi messages:
grep -i acpi /var/log/kern*

which will give a lot of messages, but may perhaps show any issues to do with power management.
Answer: One cause of a machine turning off is that the CPU is too hot and has reached a critical trip point and the machine is powered off, so it could be that.
With this kind of power-off situation you may not get any logs to look at because the machine is powered off before the log messages are flushed to disk.
Comment: Yes, that's a possibility; do you know what I can check to see if something was logged before the shutdown?

Ubuntu Logs to Diagnose Hardware Issues


Functional equation: $R(1/x)/x^2 = R(x) $

Question: The following can be shown without much hassle.

Suppose $R$ is a rational function satisfying the following functional equation.
  \begin{align}
   \frac{1}{x^2} R\left( \frac{1}{x} \right) = R(x) \qquad \forall \: x \in \mathbb{R} \backslash \{0\}
   \tag{1}
\end{align}
Then
  $$
    \int_0^\infty R(x) \cdot \log x \,\mathrm{d}x = 0
$$
  if it converges.

The proof is done by splitting the integral from $0$ to $1$ and $1$ to $\infty$. And then map $[1,\infty) \to [0,1]$ by $u \mapsto 1/x$. There are many rational functions satisfying this equation. A few examples below
$$
    R(x) = \frac{1}{x}\,,\ \frac{x}{(1+x^2)^2} \,,\ \frac{1}{x^2 + x + 1}\,,\ \frac{1}{x^2+1}
$$
My question is: Can one find groups or families of functions satisfying $(1)$?
Comment: Is it a conjecture or easily proven?
Comment: Sorry, I fixed the statement!
Comment: Well, your example of $\frac{1}{x}$ is already outside that group, isn't it?
Comment: Writing $\forall x \in \mathbb R$ in (1) would include $x=0$, right?
Comment: If $R$ is a solution, then so is $aR$ for any real number $a$.
Comment: Check your work on the second example.
Answer: Observation: $R(x)$ satisfies $xR(x)=x^{-1}R(x^{-1})$ iff $A(x):=xR(x)$ satisfies $A(x)=A(x^{-1})$.
The map $\overline{p(x)}=x^{-\deg p}p(x^{-1})$ satisfies the following three properties:
$$\overline{\overline{p(x)}}=p(x)\quad{\rm and}\quad \overline{p(x)q(x)}=\overline{p(x)}\,\,\overline{q(x)} \quad{\rm and}\quad \overline{\lambda}=\lambda.$$
Suppose that $\overline{\wp}=\lambda\wp$ for some scalar $\lambda$. Then $\wp=\overline{\overline{\wp}}=\overline{\lambda\wp}=\lambda\overline{\wp}=\lambda^2\wp$, so $\lambda=\pm1$. Suppose we have a rational function $A(x)\in F(x)$ invariant under $x\leftrightarrow x^{-1}$. As $F[x]$ is a UFD, $A$ factors as
$$\begin{array}{ll} A(x) & =x^n\left[\prod_\pi \pi(x)^{e(\pi)}\left(x^{\deg \pi}\pi(x^{-1})\right)^{\ell(\pi)}\right]\prod_\wp \wp(x)^{h(\wp)} \\ & = x^{-n}\left[\prod_\pi \pi(x^{-1})^{e(\pi)}\left(x^{-\deg \pi}\pi(x)\right)^{\ell(\pi)}\right]\prod_\wp \wp(x^{-1})^{h(\wp)} \\ & = \pm\, x^{\large\left(-n-\sum\limits_\pi [e(\pi)+\ell(\pi)]\deg \pi-\sum\limits_\wp h(\wp)\deg\wp\right)}\left[\prod_\pi \pi(x)^{\ell(x)}\left(x^{\deg \pi}\pi(x^{-1})\right)^{e(\pi)}\right]\prod_\wp \wp(x)^{h(\wp)}\end{array}$$
$$\begin{array}{ll} \iff & e(\pi)=\ell(\pi),\quad n=-\sum_\pi e(\pi)\deg\pi-\frac{1}{2}\sum_\wp h(\wp)\deg\wp,\quad \prod_\wp(\underbrace{\wp^{-1}\overline{\wp}}_{\pm1})^{h(\wp)}=1 \\ \iff & A(x)=\left[\prod_\pi \left(\pi(x)\pi(x^{-1})\right)^{e(\pi)}\right]\prod_\wp \left(x^{-(\deg\wp)/2}\wp(x)\right)^{h(\wp)}\end{array} $$
up to rescaling. Here we have grouped terms so that $\pi,\overline{\pi},\wp$ exhaust all irreducibles (up to scaling) each exactly once, and $\wp$ covers all irreducibles with $\overline{\wp}=\pm\wp$. Clearly the $\wp$ and their exponents $h(\wp)$ must be chosen in such a way that $\prod_\wp(\wp^{-1}\overline{\wp})^{h(\wp)}=1$ and $\sum_\wp h(\wp)\deg\wp$ is even.
Now let's narrow our focus down to $F={\bf R}$. The irreducibles are all linear or quadratic. One quickly checks that the only irreducibles with $\overline{\wp}=\wp$ are $x^2+ax+1$ with $a\in(-2,2)$ or $x+1$, and the only irreducible with $\overline{\wp}=-\wp$ is $x-1$, up to scaling. Thus all $A$ are of the form
$$\lambda\times\left[\prod_{i=1}^n(x^2+a_ix+b_i)^{e_i}(x^{-2}+a_ix^{-1}+b_i)^{e_i}\right]\times\left[\prod_{j=1}^m(x+c_j)^{f_j}(x^{-1}+c_j)^{f_j}\right]$$
$$\times\left[\prod_{k=1}^r(x+u_k+x^{-1})^{g_k}\right]\times(x+1)^s(x-1)^tx^{-(s+t)/2}$$
with $a_i^2-b_i<0$ and $b_i\ne1$ for each $i$, $c_j\ne\pm1$ for each $j$, $|u_k|<2$ for each $k$, and $s+t$ even.
Note that $x(x+1)^{-2}$ is not an example of an $R$ satisfying $xR(x)=x^{-1}R(x^{-1})$, but it is easily checkable that the other three examples derive from the final form above.
(We have worked entirely with elements from an abstract algebraic structure, thereby circumventing the need to pay attention to domains of rational functions.)
Comment: Amusingly, in an alternate branch of the multiverse I simply wrote "Hint: F[x] is a UFD" for an answer.
Answer: A few remarks:
As noted by the other posters, if $R(1/x)/x^2 = R(x)$ then $f(x) := xR(x)$ satisfies $f(1/x) = f(x)$. All solutions have the form $R(x) = (1/x)f(x)$ for such an $f$.
If $f(x)=f(1/x)$ for all $x$ then $f(x) = \frac{1}{2}(f(x) + f(1/x)$). Conversely, if $h(x)$ is a rational function then $f(x) := h(x) + h(1/x)$ has the property that $f(x) = f(1/x)$.
Therefore, all the solutions are of the form
$$R(x) = \frac{1}{x} (h(x) + h(1/x))$$
for some rational function $h$. More interestingly, you can generate solutions by defining
$$R(x) = \frac{1}{x} g(h(x) + h(1/x))$$
for any rational functiond $g$ and $h$. For example,
$$R(x) = \frac{1}{x}\frac{1}{1 + x + 1/x}$$
is on your list, with $h(x) = x$ and $g(x) = 1/(1+x)$. This does give an answer to your question, but anon gives a less obvious classification of all possible solutions in the answer above.
Finally, notice that the set of all $f$ satisfying $f(x) = f(1/x)$ forms a subfield of $\mathbb{R}(x)$. In other words, you can combine any two such $f$ by multiplication, divison, addition, subtraction and scalar multiplication, and you will get another such $f$, and another possible choice of $R$. There is probably a tidy handwavy description of what this field is in terms of schemes, but I don't know enough algebraic geometry to say.
Answer: I have been thinking about your problem again and came up with an alternative characterisation.
Notice that in each of your examples, the numerator and denominator have coefficients that read the same backwards as they do forwards. For example,
$$\frac{1}{(1+x)^2} = \frac{1}{1+2x+x^2}$$
and the coefficients in the denominator are $(1,2,1)$; a palindrome. Call a polynomial $p(x)$ a palindrome of index $k$ if
$$p(x) = x^k p(1/x)$$
For example, $p(x) = x^4 + 3x^3 + 3x^2 + x$ is a palindrome of index $5$. Then I claim that all the rational functions $r(x)$ which satisfy $r(1/x)=r(x)$ have the form
$$r(x) = p(x)/q(x)$$
where $p$ and $q$ are palindromes of the same index. It follows that your functions are precisely those of the form $p(x)/q(x)$ where $p(x)$ is a palindrome of index $k$ and $q(x)$ is a palindrome of index $k+2$, for some $k$. For example, $1/(1+2x+x^2)$ is a palindrome of index $0$ divided by a palindrome of index $2$.

To prove the claim, suppose that $r(x) = p(x)/q(x)$ satisfies $r(1/x)= r(x)$ and work over $\mathbb{C}(x)$ so that $p(x)$ and $q(x)$ may be assumed to have no common linear factors. Choose $k$ to be the smallest possible power so that $x^k p(1/x)$ and $x^k q(1/x)$ are both polynomials. Let $P(x) = x^kp(1/x)$ and $Q(x) = x^kq(1/x)$. Then
$$r(x) = p(x)/q(x) = P(x)/Q(x).$$
The polynomials $P$ and $Q$ have no common factor, since if $P(a) = Q(a) = 0$ then $a^kp(1/a) = a^k q(1/a) = 0$. But then either $a=0$, in which case $P$ and $Q$ have a common factor of $x$, which contradicts that $k$ is as small as possible, or else $p(1/a)=q(1/a)=0$, which contradicts that $p$ and $q$ have no common factor.
Then from $p(x)Q(x) = q(x)P(x)$, by factorisation into linear factors it follows that $p(x) = c_1P(x)$ and $q(x) = c_2Q(x)$ for some constants $c_1$ and $c_2$. But then $c_1/c_2=1$ and so $p(x) = cP(x)$, $q(x)=cQ(x)$. But by putting $x=1$, it follows that $(c-1)p(1) = (c-1)q(1) = 0$. Since $p(1)$ and $q(1)$ cannot both be zero, it follows that $c=1$ and therefore $p(x) = P(x) = x^kp(1/x)$ and $q(x) = Q(x) = x^kq(1/x)$ are palindromes of index $k$, as claimed.

Now you can write down all the functions satisfying $(1)$ by just writing down palindromes, for example
$$R(x) = \frac{x^4 + 3x^3 + 3x^2 + x}{2x^7 - x^4 - x^3 +2}$$
satisfies $R(1/x) = x^2R(x)$ and you can get them all this way.
Answer: Let us, first of all, look for solutions for $x>0$, and hope that they extend to the wanted solutions. In that case we can substitute $x=e^t$, and the equation becomes $$e^{-2t}R(e^{-t})=R(e^t),$$
or $$e^{-t} R(e^{-t})=e^t R(e^t).$$
We see that $e^t R(e^t)$ is even, and therefore has the form
$$e^t R(e^t)=\varphi(|t|), $$
In terms of $x$ we find
$$R(x)=\frac{1}{x} \varphi(|\log x|)$$
You should look for functions $\varphi$ such that the resulting $R(x)$ is rational for $x>0$, and extended it for $ x \in \mathbb R \setminus \{ 0 \}$.
Answer: If
$\frac{1}{x^2} R\left( \frac{1}{x} \right) = R(x)$,
$x^2 R(x) = R(1/x)$.
If $R(x) = A(x)/B(x)$,
where $A$ and $B$ are  relatively prime polynomials
of respective degrees $n$ and $m$,
$A(1/x)=a(x)/x^n$ and
$B(1/x) = b(x)/x^m$,
where $a(x)$ and $b(x)$
are the reciprocal polynomials of
$A$ and $B$, respectively.
Then
$\begin{align}
x^2 A(x)/B(x)
&= A(1/x)/B(1/x)\\
&= (a(x)/x^n)/(b(x)/x^m)\\
&= (a(x)/b(x))x^{m-n}\\
\end{align}
$
so
$x^{2+n} A(x)b(x)=a(x)B(x)x^m $.
If the degrees of $a(x)$
and $b(x)$ are the same
as $A$ and $B$
(i.e., the constant terms of $A$ and $B$ are non-zero),
the left-hand side has degree
$2+2n+m$
and the right-hand side has degree
$n+2m$,
so
$2+2n+m=2m+n$,
or
$m = n+2$.
In this case,
$A(x)b(x)=a(x)B(x) $.
If, in addition,
$A(x) = a(x) = 1$,
so $n=0$ and $m=2$,
$B(x) = b(x)$,
so $B$ is a symmetric polynomial of degree $2$.
Conversely,
if $R(x) = 1/B(x)$
where $B$ is a quadratic symmetric polynomial,
$R(1/x) = 1/B(1/x) = 1/(B(x)/x^2)
=x^2/B(x) = x^2R(x)$.
I will leave it at this for now,
and possibly work out later
the cases when
$a$ and $b$ are not the same degree as
$A$ and $B$.


If I say time is the fourth dimension am I wrong?

Question: As far as I know the prevailing view is that time is the fourth dimension, but I've read there is also a spatial fourth dimension and even higher spatial dimensions after that so I hesitate to say that time is the fourth dimension. So, if I say time is the fourth dimension am I wrong?
Comment: No. It also wouldn't matter which number you gave it. Time could be the 1st-dimension and then we could have 3+ other dimension. 3 of which we call spatial dimensions.
Comment: Higher spatial dimensions have not been observed, but if you think of them, then the best way would be to think of time as the first dimension followed by space. This way the metric signature is [+ - - ] with real time-like intervals. This way is most physically meaningful, but mathematically equivalent to the more common and convenient way of putting time last like [+ + + -].
Comment: In common currency (as well as much physics theory), time is represented as a fourth dimension, so I'd say you are not wrong. Most people are accustomed to thinking and reasoning in 4 dimensions in principle - for example, specifying an appointment place and time, and reasoning about when they need to depart on a spatial journey to arrive on time.
Answer: The "sort" of dimensions is really arbitrary.
What is true is that in classical mechanics time is another label to distinguish events, and special relativity enhances this point of view because there are some reference transformation that "mix" time with space (they are Lorentz transformations).
In general relativity there are more reference transformations allowed, and time is more indistinguishable (only locally you can identify the time "direction"), and it puts in the idea of curved spacetime. In this framework is possible interpret the curvature of spacetime as we live in a curved hypersurface of a 4D space.
So the fourth space dimension in this framework is fictitious: imagine to live in 2D on the surface of a sphere, you are 2D, but the sphere is embedded in a 3D space.
Finally, if you don't consider any more complicated theory you live in a 4D spacetime: 3 space dimensions and 1 temporal.
Answer: Whatever you say you are almost certainly wrong (this is nothing personal). If history teaches us anything, it is that (despite our tendancy to be enamoured with our more recent achievements) any given theory is sooner or later proven to some extent "wrong".
Probably including that one, (but neglect that for now :-) )
Anyway I suppose a less pedantic answer would be that if a theory is useful, then its paradigms are supportable, at least in its area of application. General Realtivity, in which time is treated as a 4th dimension is pretty useful, for example.
Clearly, though, there is more to time than just the dimensional aspect - a proper understanding requires consideration of "the flow of time" - the relative rates of interactions between particles in this hypothesised temporal dimension, and of entropy and its relevance to the irreversibility of time.
Answer: You can invent any number of mathematical spaces. There's no reason why time can't be the first dimension of the one you invent, nor why it couldn't be the seventh or that you just have no time dimensions, and infinite other dimensions.
All that matters for whether it makes physical sense to do so or not is whether you can use it to obtain useful [and hopefully at some point falsifiable] results.


Send email with multiple related object information via email template

Question: Is it possible to send email with multiple object information such as we have connection between contact and account object so we want to send email via template using some fields from account object and some from contact object?
Thank you
Answer: Yes you can.
If you need complex logic that pull information from several objects you can create visualforce email template and inside use visualforce component.
The visualforce Component can have apex controller that will retrieve all the relevant data that you need.
Comment: With the basic emails template you might be able to use data that have relation.If your email related to contact, then you can access contact merge fields, Account fields (for example {!Contact.Account.Type}) and also related list for the contact, but if you need more complex logic then yes you will need to write code.
Comment: So I need to include custom coding for that? Is it possible through standard email templates?
Comment: If it's not a huge amount of fields, you could also create formulas field on the Contact (or any child) object referencing the required fields from the Account (or any parent) object that can be referenced in the email template


Display all nodes posted on a certain month and day between 1990 and 2014

Question: I want to display all nodes created on lets say, March 30 (between 1990 to 2014). Views contextual filters seems to display nodes posted on March 30 this year, how do i make the contextual filters include content posted on March 30 between lets say 1990 till 2014?
Answer: The custom module method is:
<code>$nodes = node_load_multiple(db_query("SELECT nid
    FROM node
    WHERE MONTH(FROM_UNIXTIME(created)) = 3 AND DAY(FROM_UNIXTIME(created)) = 30 AND
    YEAR(FROM_UNIXTIME(created)) BETWEEN 1990 AND 2014")->fetchCol());
</code>
As far as I'm aware this isn't possible using the views UI so you would have to use hook_views_query_alter to get this working using views.


delete export record from which table?

Question: for some reason, I have to delete this record from the table, (it is stuck, cannot download or delete)
anyone know this record belongs to which table? so I can delete it by sql query

Thanks
Answer: I found out it is a folder created at /var/export/email
after delete and it will gone
Answer: I think this is not save any database table but you remove the   .csv file in automatically generated <code>/var/export/your .csv</code>.
And backup the csv file and after you want to delete.
May be help you..
Helpful this answer so accept..

delete export record from which table?


Answer deleted for no real reason

Question: Given that fdisk -l shows 16 ram disks /dev/ram0 ... /ram15 asks "If not, how can I get rid of that fdisk output?" Perhaps you could explain why the one answer that actually deals with the OP's question gets deleted AND includes 2 other possible options, while the answer that remains makes no attempt to do so?
Comment: How does it deal with the OP's question?
Answer: You're right, upon re-reading the question and the answer it is an attempt to answer the question. I have undeleted it.
Answer: You've got a point there: I too think the answer shouldn't have been deleted, as it kinda answers the question (meaning: the first method is theoretically a perfect method to accomplish what OP is clearly after, although it's badly implemented).
That being said, your answer should have been downvoted / edited: it misses all the devices not handled by the sd_mod module.
All in all since that is improveable through an edit, I think it should be undeleted.

I'm putting this separately since it strays from the answer to the question.
Since only stating negatives always seems critical, to tell the full story: moderators are right 99% of the times: that answer was really borderline, since it was correct in its gist but wrong in its implementation.
Comment: -1 it doesn't even answer the question "technically".
Comment: @muru "Is it safe to delete them? If not, how can I get rid of that fdisk output?": it seems to be answering the question to me, although not in a good way. What am I missing?
Comment: Really guys? 43 comments? I am disappoint. Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackexchange.com/rooms/33493/discussion-on-answer-by-kos-answer-deleted-for-no-real-reason).
Comment: @Seth Aw, I was just getting started. Ok, chat it is.

Answer deleted for no real reason


Solve the differential equation: $\dot{x}(t)^2+x(t)=\sin(x)^2$

Question: I am unable to solve this nonlinear differential equation:
$$\dot{x}(t)^2+x(t)=\sin(x)^2$$
I tried with Maple without success.
Is it possible to solve it without the use of numerical methods? Thanks.
Comment: I suspect that a closed formula is out of reach. You can make some phase-plane analysis, however.
Answer: If $x(t)$ is of class $C^2$ you can differentiate the equation to get $$2\dot{x} \ddot{x}+\dot{x}=\sin(2x) \dot{x} $$
$\dot{x}=0$ gives constant solutions $x(t)=x_0$, which by the original ODE must satisfy $x_0=\sin(x_0)^2$, thus reducing to $x_0=0$ alone.
Other solutions satisfy $$2 \ddot{x}=\sin{2x}-1 $$
and this equation seems to be within the capability of Maple (an implicit solution can be obtained).
Another approach could be separating the variables: $$\dot{x}^2=\sin^2 x-x \\\dot{x}= \pm \sqrt{\sin^2{x}-x} \\ \frac{dx}{\sqrt{\sin^2 x-x}}=\pm dt \\ \int \frac{dx}{\sqrt{\sin^2 x-x}}=\pm(t-t_0)$$
Which also gives an implicit solution.
Answer: Note that $\sin^2x -x\geqslant0$ if and only if $x\leqslant0$ hence one can rewrite this as $\dot x=\varepsilon u(x)$ on every interval where $x\lt0$, with $u:\xi\mapsto\sqrt{\sin^2\xi-\xi}$ and $\varepsilon=\pm1$.  Thus, assuming that $x(0)=x_0$ with $x_0\lt0$,
$$
\int_{x_0}^{x(t)}\frac{\mathrm d\xi}{u(\xi)}=\varepsilon t,
$$
for every $t$ such that the LHS yields $x(t)\lt0$. This defines implicitely $x(t)$ for every $t$ such that $x(t)$ exists.
Two cases arise. If $\varepsilon=+1$, then $x$ is increasing and $x(t)\to0$ when $t\to\tau(x(0))$, where, for every $y\lt0$,
$$
\tau(y)=\int_{y}^{0}\frac{\mathrm d\xi}{u(\xi)},
$$
thus, $x$ is defined on $[0,\tau(x_0))$. If $\varepsilon=-1$, then $x$ is decreasing and $x(t)\to-\infty$ when $t\to+\infty$ because the integral
$$
\int\frac{\mathrm d\xi}{u(\xi)}
$$
diverges at $-\infty$. Both cases are actually the same, since the maximal interval of definition of $x$ is $(-\infty,\tau(x_0))$ when $\varepsilon=+1$ and $(-\tau(x_0),+\infty)$ when $\varepsilon=-1$. Thus, one follows the same and unique solution, starting at some point given by $x_0$, either in the direction where the solution stops to be defined after a finite time or in the direction where it is defined forever.
Said differently, there exists a unique increasing function $\gamma:(-\infty,0)\to(-\infty,0)$ such that $\gamma(0-)=0-$ and $\gamma(-\infty)=-\infty$, and, for every $x_0\lt0$ and every $t$ such that $x(t)$ exists, $$x(t)=\gamma(\varepsilon t+\gamma^{-1}(x_0)),
$$
either with $\varepsilon=+1$ or $\varepsilon=-1$. And an explicit formula for $\gamma$ is
$$
\int_{\gamma(t)}^0\frac{\mathrm d\xi}{u(\xi)}=-t.
$$


Is it worth it to install VMWare Tools on a non-graphical Linux guest (Red Hat 7 hosting an Oracle server)

Question: This came up because I was not able to activate the time synchronization function from the VCD. Most of what I've seen that discussed the benefits of installing VMWare tools looks like it applies to Windows machines, and perhaps also graphical Linux machines. I wonder if it will be worth it to install on this particular Red Hat Oracle Server, which also is mission critical to the point that my client is very apprehensive about making changes and restarting it. However, perhaps it does them a disservice by not having them installed. Thanks.
Answer: Install VMware tools wherever possible.
This is for ease of monitoring, management and consistency. You have an option to use open-vm-tools. Thant would make the most sense for your setup.


How to create a "match result" data type?

Question: I'm building a football match table which contains one column "match result",
which should consist of data like "3-1","0-0"... I'm wondering what kind of data type is best appropriate for it, varchar or else?
I'm thinking of creating a new data type for this column, using CREATE TYPE statement, whose form is like "integer"+"-"+"integer",
is it possible?
Comment: As someone who has previously built a football related database, I'd recommend you store home score and away score as two separate `int` fields.
Comment: As Mark states, this sounds like a poor design choice.  It may not be, but storing this as a string means you can't do anything useful with it.
Comment: I think you can choose varchar for this
Answer: Maybe erical already has two columns that keep the "home score and away score as two separate int fields", as Mark and Phil already commented. Then, the remaining part of the question would be whether it is possible to create a user-defined type for a separate string column that stores the match result for faster printing.
So, the answer in this situation would be that yes, it is possible. If unsure about the syntax of the CREATE TYPE statement, it is documented at the following URL:
https://msdn.microsoft.com/en-us/library/ms175007.aspx
The following would be an example of how to do it:
<code>CREATE TYPE MatchType
FROM [VARCHAR](5);

DECLARE @Draw [MatchType];

SET @Draw = '00-00';

DECLARE @Final [MatchType];

SET @Final = '02-01';

SELECT   @Draw  AS [Draw Match]
       , @Final AS [Final Match Sample];

-- Draw Match   Final Match Sample
-- 00-00        02-01
</code>
Or, maybe erical was thinking about a composite user defined type. Instead of creating an alias based on an already existing type, what if it were possible to mix two already existing types into a brand new compound?
Microsoft SQL Server does not support that. Instead, Oracle comes with a RECORD type. An example would be the following:
<code>-- Define a user type to hold (HomeScore, AwayScore)
TYPE MatchType IS RECORD
(  HomeScore VARCHAR(2)
 , AwayScore VARCHAR(2));
</code>
Comment: Why bother suggesting an Oracle solution to an MS-SQL problem?
Comment: One never knows when the environment might be switched. Otherwise, it could be a situation similar to the one when a C++ software developer would always avoid sample Java code. It doesn't hurt, does it?


Time evolution of state in rotating $B$-field spin system

Question: I'm given a state $|\psi(t)\rangle$ that solves the time dependent Schroedinger equation with the Hamilton operator $\hat{H}(t)$. $\hat{H}(t)$ describes a Spin-$\frac{1}{2}$ in a rotating magnetic field ($\vec{B}(t) = B_1[\cos(\omega t)\vec{e_1} + \sin(\omega t) \vec{e_2}] + B_3 \vec{e_3}$)  rotating around the z-axis with frequency $\omega$. Furthermore I have a transformed state $|\widetilde{\psi}(t)\rangle = \hat{D}(t) |\psi(t)\rangle$ with $\hat{D}(t)$ being the rotation operator $\hat{D}(t) = e^{i\omega t \hat{\sigma_3} /2}$. I have calculated that therefore the Hamiltonian solving the SG in this case becomes:
\begin{align}
\hat{\widetilde{H}}(t) = \frac{\hbar \Omega_1}{2} \hat{\sigma_1} + \frac{\hbar(\Omega_3-\omega)}{2}\hat{\sigma_3}, \quad \Omega_1 = -2\frac{\mu_0 B_1}{\hbar}, \quad \Omega_3 = -2\frac{\mu_0 B_3}{\hbar}
\end{align}
The task is to calculate the two time evolution operators $\hat{\widetilde{U}}(t)$ and $\hat{{U}}(t)$ given by $|\widetilde{\psi}(t)\rangle = \hat{\widetilde{U}}(t) |\widetilde{\psi}(0)\rangle$ and $|\psi(t)\rangle = \hat{{U}}(t) |\psi(0)\rangle$. I plugged in the standard formula for time evolution and tried to get a result by simply puttung in the Hamiltonians, but I don't get any further. I seem to have a blackout how to deal with this problem
Answer: The D operator you have accounts for a rotation of your state "around" the $\sigma_3$ matrix: if you think of this just as with vectors, you can see that D therefore accounts for the $B_x$ and $B_y$ components of your field. Therefore, you can use the $B_z$ part to solve the evolution of your rotating state.
In fact your problem is reduced to treating a linear magnetic field, if I understood correctly


How can I unlock drive without the password or recovery key of Bitlocker?

Question: Is it possible to unlock my drive without the password or recovery key of Bitlocker? If so, how? I tried Elcomsoft forensic software but I'm not able to decrypt it without using the password or recovery key.
Answer: Simply put: You can't
Bitlocker uses AES-XTS 128 or AES-XTS 256.
As long as the drive is not mounted and unlocked (whereas you could just disable bitlocker or export the password/recovery key) there is no way of bypassung this.


Punycode converter at C#

Question: I need a punycode converter for Silverlight. For WPF have such an opportunity in the standard libraries. I need a ready-made library or code of functions (punycode encoding and decoding) {C#, Silverlight}.
Answer: I am not sure if Silverlight has access to this namespace but take a look at these IdnMapping fuunctions which are built into the .net framework.

Punycode converter at C#


Can I mix OpenGL and swing?

Question: I'm working on a small game library for me and some people I know that just handles the window and nothing special that we weren't gonna use. I know how to use OpenGL and stuff I just don't like having to deal with more then one library at a time like OpenGL and Swing so I want to combine them into something basic. Anyway my question is, is there any way I can use OpenGL's rendering onto Swing? I need a simple answer. I also don't want to have to include other libraries into my library, I just want it to be the only jar in the program that isn't program specific.
Answer: Yes, JOGL (Java™ Binding for the OpenGL® API) allows exactly that. See also this post for more information about OpenGL and Swing interoperability. Also see XTrans demo on JOGL demos page.
Mixing Swing and OpenGL has a little performance penalty though, so you should consider other options if realtime 3D is your primary feature and Swing is just a small user interface in the game.
Comment: Yes, at least everything except the native binaries (.dll files on Windows)
Comment: Can I pack everything into 1 jar so it contains all the OpenGL stuff when I build it?
Comment: @msell Are JOGL and [LWJGL](https://www.lwjgl.org/) equivalent? JOGL is external library. Is there any solution built into JDK for this?
Comment: @iamcreasy No they are not equivalent. No there is no built in OpenGL API in JDK.

Can I mix OpenGL and swing?


Forces on a rigid system of point masses free in space

Question: Over the last few days, I've been trying to understand how applying forces to a system of point masses will effect the system's linear and angular velocity in 3 dimensions. I came across this answer that described a solution for a rigid bar in 2 dimensions. From this I believe I could figure out the velocities that I need, however with my relatively limited knowledge of physics, I'm having difficulties translating the solution into 3 dimensions. How could I go about doing so?
Answer: So you mean, you are having your masses lying on a three dimensional space on one 3-d position vector $r$. Easy. Just break up the vector into its components using trigonometry, break up the masses, or rather, break up the effective inertia of the total mass, and then you solve for any variable you want. In case you're wondering how the heck angular momentum gets broken, remember it is just a perpendicular vector and it can be broken up into components perpendicular to the position vector's components easily.
Comment: If this is wrong , please correct. I have just written what was roughly in my mind.
Answer: For linear acceleration you can always use Newton's second law, assuming relativistic effects can be neglected,
$$
\sum \vec{F}_\textrm{external} = m\,\vec{a}. \tag{1}
$$
For the rotation you could use Euler's equation of rotation,
$$
\dot{\vec{\omega}} = I^{-1}\left(\sum M_\textrm{external} - \vec{\omega}\times(I\cdot\vec{\omega})\right), \tag{2}
$$
with $I$ the moments of inertia tensor, $\vec{\omega}$ the angular velocity vector and each moment is calculated around the center of mass of the (rigid) body.
Comment: How would I differentiate the torque from the linear force? Would the torque just be the component of the force that's perpendicular to the vector going from the center of mass to the point, and then the linear force would be whatever of that force is left?
Comment: @Juddily The linear external force is just literally the sum of all external forces, so you do not need to subtract any perpendicular component. Each external torque can be found by taking the cross product between an external force and the (position) vector between the center of mass and the point at which the force is applied. The reason why you do not need to reduce for example the (linear) force is because as the body also starts rotating the distance over which this force has done work also increases and would explain the additional form of (rotational) kinetic energy.


Are fantasy RPG races racial/cultural analogues to reality?

Question: Prior to a recent game, our group had a great discussion on culture/race and it's relation to RPG races.  While it is fairly established that Tolkien based some of the iconic aspects of his fantasy races on stereotypes of various cultures from his era, has there been any indication (interview, designer notes, etc) that a similar style of thinking has been purposefully interjected into fantasy RPG races (ala D&D, Earthdawn, etc)?  And as a follow-up, is there any discussion (within the related rules) on how to handle this overlap respectfully and without coming across as "corny"?
Comment: This is a bit too vague, don't you think?  There are approximately 10,000 fantasy races of various types (including human cultures) in various games, many if not most of which are obviously derived from real world cultures.  Your follow-up is the more legitimate question, I think.
Comment: I think the name of this question is misleading - it sounds to me (based on your comment) that what you're really asking is for examples of fantasy races which were *explicitly* based on a *single* specific real-world culture, whereas I read the title as asking if fantasy races, broadly speaking, *necessarily* draw from real-world culture(s).
Comment: I'm voting to close as I'm concerned this can just result in argument over stereotypes about real cultures and fanatic interpretation of non-real culture.
Comment: I disagree-the question is: has there has been a fantasy RPG race that has been based on a real world culture as indicated by the designers?  For example, I've heard it proposed that D&D dwarves are based, intentionally, on Scottish culture.  While I see the possibility, I'm not aware of this ever being cited as intentional.  Hence the curiosity around if there has been a documented instance of a fantasy race based around a real world race/culture.  I'm not asking for a catalog of the origin of all 10K+, but rather has there been an instance where the designers created an intentional analogue.
Answer: There are a few where it's been explicit that certain aliens or demihumans have been modeled after particular cultures.
The MekPurr, from Space Opera, are Scots in Felinoid bodies, for example.
Certain Human-aliens in Traveller are specifically based upon certain cultures (Sword Worlders and vikings, Jonkerer on desert nomads),  and some of the Alien aliens originate in clear stereotypes (Aslan as Samurai Cats).
The Orks of Orkworld are clearly Bretons (A pre-roman Celtic culture in what is now England). The humans are Romans... but Gurtha isn't Earth by the maps.
The Warhammer world is explicitly a parallel earth... the Empire is essentially the Holy Roman Empire; Tilea is italy; Bretonia, France and England; Kislev is Kyiv. The Orcs are east of Germany and Kislev, where the Rus and Slavs lived on earth. The Slann, in older editions, were the Aztec and Inca. The Undead Hordes are in lands that were under Islam on earth... And in early editions, the North were chaos hordes... but aside from Bretonia, the Empire, Kislev, and Tilea, which are all human, the non-humans are not identified with the earth cultures of their spots. Those human cultures are parodies as much as anything.
None of these, however, talk about the sources as anything other than sources. Once you establish your race, it's different, if only because of player ignorance.
Comment: The K'Kree are not islamists... When they were initially presented, they were based upon extrapolation of cattle to sentience, not extant cultures (read the designer's notes). The Zhodani have only vague resemblances to Communists; their utopianism is strongly capitalist, BTW, disproving your theroy. The Vargr are based on Wolves because they are wolves with hands and speech; No Sioux needed. Droyne are not hindu based, either; the only similarity is a caste system, but their caste system is linked to gender, not social place, and there is little other resemblance. MGT doesn't match prior eds.
Comment: You are the master of all things RPG. This answer is great, and cuts through PC in the quest for accuracy.
Comment: Aslan: Samurai cats.  K'kree: Islamist cattle.  Solomani: Nazi humans.  Zhodani: "Communist" Russian humans.  Vargr: Sioux dogs.  Droyne: Hindu birds.
Answer: I've never seen it called out explicitly in a game text, but you can see signs of it in globetrotting or cosmopolitan settings like Eberron and Al-Qadim, or anthropomorph settings like Ironclaw. My homebrew setting (for who doesn't have one?) does it quite a bit; my advice is to make sure that the research is done, and make sure that the fantasy folk are compelling and interesting even if someone comes in unaware of the historical/cultural shorthand of being "like the Ancient Egyptians" or "like Borgia's Venice."
Comment: I started to write a response and it was exactly like yours, so have a +1 instead :)
Answer: IMO the proper approach is for fantasy cultures to be influenced by, but not analogous to, real ones. No caricatures, no implied values structures, but not completely alien to our world.
So "These Halflings are known to worship the Sun, to which they bow five times daily." entirely good, we can got a tidbit of learning about these Halflings. "These elves are cave-dwellers, and are suspicious of outsiders" makes me more curious about them.
But "These Halflings speak in gruff accents, drink mead, and wear horned helmets" is already groan-worthy, because there's nothing mysterious about it, and I'm already assuming, right or not, that they are coastal raiders who arm wrestle each other every night.
So if you need to describe their accent or buildings or art or weaponry, think it through well, make it mysterious and not label-able as "They are like the people who live in (real place)"
Answer: Most of the classic D&D races (elves, dwarves, halflings, orcs) are derived from a mix of sources, not necessarily directly with real world races or cultures. I dont think Tolkien drew his races that much from real world races or cultures either. Tolkien was a professor of Anglo Saxon literature. All of these races have qualities that can come across as "recognizable", possibly to stereotyped personalities or appearances that you may know - that makes a lot of sense because they embody tropes within a northern European / Western cultural framework in European/ Western literature.
Answer: In the games that have these overlap, it typically explains the perception of the game world of these real-world inspired cultures.  Like when a setting has an exotic asian locale, or the like.
Perhaps I'm not following the question entirely, but, in general, I don't believe that most games put race->real-race/culture relations in the game rules.  Any such nonsense is usually a holdover or a player trying to bring discussions that don't belong at the game table to the forefront.
Comment: I can't for the life of me parse the phrase "race->real-race/culture relations". Could you maybe try and clarify, if only for my sake?


Return True or False Randomly

Question: I need to create a Java method to return true or false randomly. How can I do this?
Answer: The class java.util.Random already has this functionality:
public boolean getRandomBoolean() {
    Random random = new Random();
    return random.nextBoolean();
}

However, it's not efficient to always create a new Random instance each time you need a random boolean. Instead, create a attribute of type Random in your class that needs the random boolean, then use that instance for each new random booleans:
public class YourClass {

    /* Oher stuff here */

    private Random random;

    public YourClass() {
        // ...
        random = new Random();
    }

    public boolean getRandomBoolean() {
        return random.nextBoolean();
    }

    /* More stuff here */

}

Answer: (Math.random() < 0.5) returns true or false randomly
Answer: This should do:
public boolean randomBoolean(){
    return Math.random() < 0.5;
}

Answer: You can use the following code
public class RandomBoolean {
    Random random = new Random();
    public boolean getBoolean() {
        return random.nextBoolean();
    }
    public static void main(String[] args) {
        RandomBoolean randomBoolean = new RandomBoolean();
        for (int i = 0; i < 10; i++) {
            System.out.println(randomBoolean.getBoolean());
        }
    }
}

Comment: This is a little redundant. `randomBoolean` could just be `new Random()`, and instead of `getBoolean()` have `nextBoolean()`. The code above is just adding a pointless class wrapping.
Answer: You will get it by this:
return Math.random() < 0.5;

Comment: Where possible try to only add answers which add information. This answer is near identical to MichaelBorgwardt's answer
Answer: ThreadLocalRandom.current().nextBoolean()
To avoid recreating Random objects, use ThreadLocalRandom. Every thread has just one such object.
boolean rando = ThreadLocalRandom.current().nextBoolean() ;

That code is so short and easy to remember that you need not bother to create a dedicated method as asked in the Question.
Answer: You can use the following for an unbiased result:
Random random = new Random();
//For 50% chance of true
boolean chance50oftrue = (random.nextInt(2) == 0) ? true : false;

Note: random.nextInt(2) means that the number 2 is the bound. the counting starts at 0. So we have 2 possible numbers (0 and 1) and hence the probability is 50%!
If you want to give more probability to your result to be true (or false) you can adjust the above as following!
Random random = new Random();

//For 50% chance of true
boolean chance50oftrue = (random.nextInt(2) == 0) ? true : false;

//For 25% chance of true
boolean chance25oftrue = (random.nextInt(4) == 0) ? true : false;

//For 40% chance of true
boolean chance40oftrue = (random.nextInt(5) < 2) ? true : false;

Comment: I don't know, but I  would read better something like: `//For 40% chance of true
boolean chance40oftrue = (random.nextInt(100) < 40);`
Answer: Java's Random class makes use of the CPU's internal clock (as far as I know). Similarly, one can use RAM information as a source of randomness. Just open Windows Task Manager, the Performance tab, and take a look at Physical Memory - Available: it changes continuously; most of the time, the value updates about every second, only in rare cases the value remains constant for a few seconds. Other values that change even more often are System Handles and Threads, but I did not find the cmd command to get their value. So in this example I will use the Available Physical Memory as a source of randomness.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public String getAvailablePhysicalMemoryAsString() throws IOException
    {
        Process p = Runtime.getRuntime().exec("cmd /C systeminfo | find \"Available Physical Memory\"");
        BufferedReader in =
                new BufferedReader(new InputStreamReader(p.getInputStream()));
        return in.readLine();
    }

    public int getAvailablePhysicalMemoryValue() throws IOException
    {
        String text = getAvailablePhysicalMemoryAsString();
        int begin = text.indexOf(":")+1;
        int end = text.lastIndexOf("MB");
        String value = text.substring(begin, end).trim();

        int intValue = Integer.parseInt(value);
        System.out.println("available physical memory in MB = "+intValue);
        return intValue;
    }

    public boolean getRandomBoolean() throws IOException
    {
        int randomInt = getAvailablePhysicalMemoryValue();
        return (randomInt%2==1);
    }

    public static void main(String args[]) throws IOException
    {
        Main m = new Main();
        while(true)
        {
            System.out.println(m.getRandomBoolean());
        }
    }
}

As you can see, the core part is running the cmd systeminfo command, with Runtime.getRuntime().exec().
For the sake of brevity, I have omitted try-catch statements. I ran this program several times and no error occured - there is always an 'Available Physical Memory' line in the output of the cmd command.
Possible drawbacks:

There is some delay in executing this program. Please notice that in the main() function , inside the while(true) loop, there is no Thread.sleep() and still, output is printed to console only about once a second or so.
The available memory might be constant for a newly opened OS session - please verify. I have only a few programs running, and the value is changing about every second. I guess if you run this program in a Server environment, getting a different value for every call should not be a problem.

Return True or False Randomly


CSS Animation on hover

Question: I need a little help with CSS animations. How can I make this http://jsfiddle.net/nmsdvid/TdnVs/ just with CSS. So, when I hover over the krab div a css animation will start and going to switch images (vws02.png than vws01.png than vws02.png) while I'm on hover.
Comment: you are doing it well (first image static, second image with animated gif), CSS can't start and stop nothing.
Answer: The example of krab you have given is done with the css only. On image hover they have just changed the image form http://nmsdvid.com/images/vws01.png to http://nmsdvid.com/images/gif.gif. If you see the second image is already a .gif image(animated image).
Answer: here you check
#krab {
        width:335px;
        height:345px;
        background-image:url(https://www.planwallpaper.com/static/images/desktop-year-of-the-tiger-images-wallpaper.jpg);
    }

#krab:hover {
background-image:url(https://image.winudf.com/v2/image/Y29tLnp6d3BuZXcudGlnZXIzRF9zY3JlZW5zaG90c18wX2NhZWNhNzYz/screen-0.jpg?h=355&fakeurl=1&type=.jpg);
    }
demo: http://jsfiddle.net/TdnVs/4/

CSS Animation on hover


How did 参った come to mean 'defeated' from 参る?

Question: I've heard the phrase 参った and understood it to mean something like 'I/we lost' or 'knocked out'. How did this come from 参る, to visit or go by? I read in a dictionary that it's some phrase said by a the defeated person in a judo or kendo match but I don't fully understand.
Comment: Is it so strange for a word to have multiple meanings?
Comment: @l'électeur Is it so strange that people have curiosity about where words and their meanings originate? ;) Anyway, I don't think it's strange, but what is strange is when a word has two meanings that are opposite of each other. Speaking in general about words in all languages.
Comment: One of the meanings of the Kanji (like in 降参 : surrender, give up) might have rubbed off on the original japanese verb. Or the other way around...
Answer: (I failed to identify the authoritative article about this, so the following story is based largely on my speculation.)
You probably know that 参る is a humble form and means to visit someone with higher status than ourselves.
And I think your dictionary also said that 参る can specifically mean "to visit a shrine/temple/grave." (=参拝) The noun お参り always means "a visit to a shrine/temple/grave and offering prayers." See the result of Google Image Search for お参り, and you can understand that Japanese 参る means not only "going", but also "showing the highest respect" for Gods, or someone else.
This, I suppose, explains why 参った also came to mean "I lost." By saying 参った, you admits your opponent is stronger than you, and deserves your respect. (In judo and kendo, showing such respect is especially important.)
There's a blog post about this topic.
By the way, this お参り pose (putting hands together in front of you) is also a gesture of surrender, or begging for one's life.
Comment: was about to ask this question, came across this answer. if you ever find the authoritative source, I'd love to read it :)
Comment: @psosuna -- Check out Shogakukan's 国語大辞典 entry [here](https://kotobank.jp/word/参-512745#E7.B2.BE.E9.81.B8.E22.214.171.124.E6.97.A5.E6.9C.AC.E5.9B.BD.E8.AA.9E.E5.A4.A7.E8.BE.9E.E5.85.B8), search specifically the line 「[三] (敬語性が失せて) 相手に優位を占められる。また、屈するの意を表わす。」.  This is cited to a text from around the end of the Muromachi period, late 1500s.
Answer: In a judo context, 参った is used to mean "I surrender" when submitting to an opponent (usually due to an armlock, strangle, or hold down).
According to Wikipedia this meaning is first noted in the 1500's and stems from the older meaning of "to go [to a superior]":

to be overcome, to cede to a superior person or superior circumstances (by extension from the older "go to a superior" sense)

[from late 1500s] (intransitive) to lose to an opponent
参{まい}ったな。 ― maitta na. ― You got me.


How to say "eat out", e.g. at a restaurant?

Question: English has got an expression to eat out, meaning eating but not preparing the meal for yourself (i.e. restaurant, fast food, kebab etc.). What are ways to express the same in German?
Comment: https://dict.leo.org/englisch-deutsch/eat%20out
Comment: I suggested to edit the title, to avoid confusion with the slang term...
Answer: A standard phrase (see DWDS) here in Germany is

essen gehen

(i. e. to go somewhere to eat as opposed to prepare the meal oneself).
Comment: @PaulFrost "zum Essen rausgehen" is not suitable. It means "to go outside (of where you are) to eat", there is no hint someone goes to a restaurant or other place. You could cook on your own and go outside to eat because the weather is fine. You can even only go out of a room to eat for a reason, not necessarily out of the house.
Comment: Varianten sind "zum Essen ausgehen" und "zum Essen rausgehen".
Comment: @puck It may in fact be confused with "draußen essen" oder "zum Essen nach draußen gehen". But it is not unusual to say "zum Essen rausgehen" in the context of the question. Beispiel. "[Also zum Essen rausgehen lohnt nicht](https://www.tripadvisor.de/ShowUserReviews-g651918-d1038131-r170808019-Felsentor-Hauenstein_Rhineland_Palatinate.html)".
Comment: The website you linked to indeed uses this phrase, but to me this is a slightly different situation. This is an unspoken comparison. They say *it doesn't pay to go out of the hotel to eat*, meaning you can stay in the hotel to eat - where "in" isn't "inside" because they mention the terrace right after ;-) It means *within the hotel's restaurant*. But to express you don't eat at home it would be odd to say "ich gehe zum essen raus" because primarily that says you go outside to eat. It's better to say "ich esse auswärts".
Answer: It is

auswärts essen

Möchtest du heute daheim essen oder auswärts?
Would you like to eat at home or out today?

The adverb auswärts has three meanings:

to the outside

Versuchen Sie, Ihre Füße etwas weniger auswärts zu drehen wenn Sie laufen.
Try to turn your feet a little less outwards when you run.

not at home, somewhere else

Ines hat letzte Nacht auswärts geschlafen.
Ines slept out last night.

in another town (mainly in sports)

Der FC Unterhausen hat auswärts 1:0 gewonnen.
FC Unterhausen won 1:0 away.
Comment: Though "auswärts essen" has a bit of an "official" ring to it. You might find it in the PR material of a restaurant trade association rather than in every day talk. For the latter, "essen gehen" as mentioned in another answer sounds more natural.
Comment: @HenningKockerbeck: I think this is a question of personal opinion and maybe regional usage. I do hear any "official" ring when my wife says she wants "auswärts essen".


HDMI sound config in Ubuntu 18.04

Question: Like many others, I'm trying to get sound through HDMI to work, using my HDTV as my monitor and running Ubuntu 18.04 on a Cherry-trail Z83V mini-pc.   I've put a lot of research and time into this and am missing "something" in my configuration and understanding.
At this point I'm just trying to play a music sound file, to test.
It "seems" like my issue is that the default sound card is hw:0,1 but if I try speaker-test -c 2 -r 48000 -D hw:0,2 I do hear the white noise alternating from each speaker and see that the test is running correctly.
Pulseaudio has never worked correctly as far as I can tell (much of the time reported via CLI as not running), and at this point is removed.
In the graphical "settings" menu, under sound, there is nothing showing under outputs or inputs - I've assumed this is somehow pulseaudio derived.
My questions are:  How can I make the default ALSA card hw:0,2 and how are the sound cards (I have 2) automatically found by Linux?  Maybe the
question concerns "device" and not "card" ?
UPDATE:  Have installed pasystray which appears to have pulseaudio back which has populated the devices in system settings - sound.  I've proved that I can get sound over HDMI by opening terminal and typing "speaker-test -c 2 -r 48000 -D hw:0,2" which correctly outputs white noise first in the left speaker then in the right etc until I issue CTRL-C to end the command; however I can't get audio from either a downloaded test music file or from any browser-visited websites (youtube or online courses etc).
I have been able to get audio via the physical audio jack on the miniPC now but would like to be able to use HDMI as intended.  What am I missing in my configuration?
Answer: The answer here: Ubuntu 16.04 HDMI Audio Not working, speaker-test works still works for me. I use a Zotac (not cherry) running 18.04 and had the same issue. No HDMI sound, but speaker-test (as your example) did gave me the noise.
So as mentioned in the answer (in link) edit /etc/pulse/default.pa with the two lines.
Comment: Thanks!  This answer solved my issue and note that I'm currently running Ubuntu 18.04 with kernel 4.18.

HDMI sound config in Ubuntu 18.04


How to use Office 365 credentials to login on domain joined computers?

Question: My company wants to use Office 365 user credentials to logon on computers. I went as far as creating an on-premise Domain Controller and installed Azure AD Connect. But Office 365 users are not being created in the Domain.
Answer: If you want to login on workstation using Office 365 account, you need a Windows 10 Operating System
Azure Active Directory and Windows 10: Bringing the cloud to enterprise desktops!
http://blogs.technet.com/b/ad/archive/2015/05/13/azure-active-directory-and-windows-10-making-the-enterprise-cloud-a-reality.aspx
Azure AD Join on Windows 10 devices
http://blogs.technet.com/b/ad/archive/2015/05/28/azure-ad-join-on-windows-10-devices.aspx
If you already have an Active Directory on Premise, you can synchronize AD Account into Azure AD. You can also use only Full Cloud AAD users to login (with Windows 10)
hth
Stanislas
Comment: people can we PLEASE stop just slapping links in answers cause surprise neither of those exists any longer.
Answer: Because your looking at this the wrong way. Azure AD connect is design to sync your internal domain users up to Azure/Office 365 so you can login into these service with these credentials, not to go the other way.
Most Azure/Office 365 already have on premises domains and want to ensure consistent credentials with the online services.


Magento 2 - the frontend works, but admin shows "This site can't be reached 127.0.0.1 refused to connect."

Question: In Magento 2, why can I go to frontend and access the pages, but not to admin. In env.php the adin url is set correctly.
Answer: One thing that could be causing it is your directory path. Make sure your directory path in your apache config file points to the Magento install directory
Answer: This error is caused by firewall protection or proxy network settings for web secure urls.
You can fix this issue with web secure urls in admin panel by changing core_config_data table field web/secure/use_in_adminhtml value 1 to 0.
Clean the cache and then your admin panel will work again.

Magento 2 - the frontend works, but admin shows "This site can’t be reached 127.0.0.1 refused to connect."


How to connect this Relay Module to printer port (LPT1)?

Question:
Hello,
have this relay board, how can i connect this board to a printer port (LPT1) and can this port cope with the amps needed to drive the board?
I am not an electrician, so please take notice of this fact in your answer.
This relay is needed to switch a router motor on and off, the signal is send from "Mach3" (Milling software) through the printer port (LPT1).
The motor is 1050w 5a 230v AC.
Comment: You have to supply some information about the relay and the transistor (Q1). Otherwise it is impossible to tell if the power from the LPT1 port is sufficient for driving the relay.
Comment: @Burgy, this won't be too difficult. The LPT1 port will output a 5 V signal for on/off, we'll use that to energise the relay and the relay will switch the router. Can you provide a model and link for the relay board?
Comment: @Transistor, here the link to produckt: http://www.ebay.de/itm/321938290957?_trksid=p2057872.m2749.l2649&var=510881470908&ssPageName=STRK%3AMEBIDX%3AIT
Comment: HC-11 433MHz Wireless Serial Port Modul  Betriebsspannung: 5V DC
    Schaltleistung: Gleichspannung: DC - 28V 10A
    Wechselspannung: AC - 250V 10A
    Stromverbrauch : 20mA - 85mA (Je nach Zustand, nicht geschaltet, geschaltet)
Comment: @Burgy: OK. I understand the schematic now. We're going to need to pick up a +5V supply somewhere. I presume that you're using the LTP port for Mach3 already to control the stepper or servo motors. Can you figure out if there's a 5V power supply on that interface that we can use?
Comment: @transistor, i have a +4.86v power supply from the stepper power supply board.
Answer:
PC parallel port pinout.

simulate this circuit – Schematic created using CircuitLab
Setup

Connect the relay board ground to a parallel port ground AND to the stepper board GND or negative.
Connect the relay board Vcc to the stepper board +5 V.
Check the Mach3 software and assign a parallel port output pin to the router.
Connect that pin to IN1 on the relay board.
Power up and run the software. If all is well you will hear the relay click when the router is supposed to be on. It looks as though you have an indication LED as well.
Switch your multimeter to continuity check and you should get continuity between the outside two terminals of relay K1 when the LED is on. If so, they're the contacts to cut into your router live wire.
Wire up the mains as shown in the schematic. Don't skip the fuse or the earth / ground.

Good assembly practice

Mount all the boards properly with screws or PCB standoffs. You don't want live PCBs swinging around in your control panel.
Keep the mains wiring well separated from the low-voltage wiring by sensible orientation and layout of the boards and routing the wiring separately.

How it works
Mach3 will pull the port output pin low causing current to flow through D1 and D2 lighting them both up. D1 is half of an optocoupler and it turns on transistor Q1 allowing some current to pass through. This turns on Q2 allowing current to pass from the +5, through the relay and through Q2 to the negative. This energises the relay. Relays are notorious for giving a high-voltage kick from the coil when switched off. This puts Q2 in danger. D3 prevents the high-voltage kick and protects the transistor.

Note that the two GND terminals are connected.
Comment: Thank you, time to get some standoffs and the correct connector/plug, ph2.0 4-pin i think so that the PCB gets mounted properly.  Best regards, Burgy
Comment: the pcb has GND twice, are they to be joined?   pin1(JD-VCC) connected to pin2 (VCC) with a Jumper, pin3(GND) ,pin4 (GND), pin5(IN1), pin6(IN2), pin7(VCC).
Comment: @Burgy, the schematic you posted doesn't show it but the two GNDs are probably connected by PCB traces. Check for continuity with your multimeter and have a look at the traces to be sure. If I've found the right images for the board then they are connected. See my updated answer. If this all works out for you then please accept this as the correct answer.
Comment: @ŧransistor, Thank you, your answer is 100% correct.Best regards, Burgy


What are the known classes of undirected graphs such that every graph belonging to that class is guaranteed to have a Hamiltonian Path?

Question: One trivial class of graphs is the class consisting of complete graphs or complete bipartite graphs with equal sized partitions.
I would love to know if more such classes exist.
Comment: The wikipedia article for Hamiltonian path gives some sufficient conditions (mainly the Bondy–Chvátal theorem and special cases as well as the fact that any 4-connected planar graph has a Hamiltonian path).
Comment: I checked the wiki article. The question intends to know about more such classes which have this property.
Comment: It's a (fairly) well-known open question as to whether every Cayley graph is Hamiltonian. [Pak & Radoicic 2008](https://www.math.ucla.edu/~pak/papers/hamcayley9.pdf)
Answer: A good resource to answer questions like this is graphclasses.org.  You find the graph class you care about -- in this case, Hamiltonian graphs.  Then check the maximal subclasses section, and possibly forward-search from there.
Comment: All but one of these classes explicitly includes Hamiltonicity in their definition.
Comment: Thanks. That was quite helpful tip.


How do I get 64 bit ids to work with Sphinx search server 0.9.9 on Mac OS?

Question: I've been using Sphinx successfully for a while, but just ran into an issue that's got me confused... I back Sphinx with mysql queries and recently migrated my primary key strategy in a way that had the ids of the tables I'm indexing grow larger than 32 bits (in MYSQL they're bigint unsigned). Sphinx was getting index hits, but returning me nonsense ids (presumably 32 bits of the id returned by the queries or something)..
I looked into it, and realized I hadn't passed the --enable-id64 flag to ./configure. No problem, completely rebuilt sphinx with that flag (I'm running 0.9.9 by the way). No change though! I'm still experiencing the exact same issue. My test scenario is pretty simple:
MySQL:
create table test_sphinx(id bigint unsigned primary key, text varchar(200));
insert into test_sphinx values (10102374447, 'Girls Love Justin Beiber');
insert into test_sphinx values (500, 'But Small Ids are working?');

Sphinx conf:
source new_proof
{
type                = mysql
sql_host            = 127.0.0.1
sql_user            = root
sql_pass            = password
sql_db              = testdb
sql_port            =
sql_query_pre       =
sql_query_post      =
sql_query           = SELECT id, text FROM test_sphinx
sql_query_info      = SELECT * FROM `test_sphinx` WHERE `id` = $id
sql_attr_bigint     = id
}

index new_proof
{
source          = new_proof
path            = /usr/local/sphinx/var/data/new_proof
docinfo         = extern
morphology      = none
stopwords       =
min_word_len    = 1
charset_type    = utf-8
enable_star     = 1
min_prefix_len  = 0
min_infix_len   = 2
}

Searching:
→ search -i new_proof beiber
Sphinx 0.9.9-release (r2117)
...
index 'new_proof': query 'beiber ': returned 1 matches of 1 total in 0.000 sec

displaying matches:
1. document=1512439855, weight=1
(document not found in db)

words:
1. 'beiber': 1 documents, 1 hits

→ search -i new_proof small
Sphinx 0.9.9-release (r2117)
...
index 'new_proof': query 'small ': returned 1 matches of 1 total in 0.000 sec

displaying matches:
1. document=500, weight=1
id=500
text=But Small Ids are working?

words:
1. 'small': 1 documents, 1 hits

Anyone have an idea about why this is broken?
Thanks in advance
-Phill
EDIT
Ah. Okay, got further. I didn't mention that I've been doing all of this testing on Mac OS. It looks like that may be my problem. I just compiled in 64 bit on linux and it works great.. There's also a clue when I run the Sphinx command line commands that the compile didn't take:
My Mac (broken)
Sphinx 0.9.9-release (r2117)

Linux box (working)
Sphinx 0.9.9-id64-release (r2117)

So I guess the new question is what's the trick to compiling for 64 bit keys on mac os?
Answer: Did you rebuild the index with 64 bits indexer?
Comment: I did a clean build that included passing --enable-id64 to ./configure... Is that correct? And afterward, yeah I completely deleted the indexes and ran the indexer from scratch.


If the potential difference across the ends of a conductor is 2 Volts then does that mean that the current flowing through the conductor is 2 Ampere

Question: According to Ohm's law, the current flowing through a conductor is directly proprtional to the potential difference applied across its ends. So if the pd is 2 V then the charge flowing through the conductor at any Cross section of it should be equal to 2 Couloumb per second or 2 Ampere.
Comment: What you've described is if they are equal, however as you state they are directly proportional, and this is different from being equal.  Do you know what the constant of proportionality is?
Answer: When two quantities are directly proportional, a "constant of proportionality" is required to form an equality.
It is true that according to Ohm's Law, the current thru a conductor is directly proportional to the PD across. The constant of proportionality in this case would be (R), the resistance of the conductor in ohms (symbol: Greek letter Omega).
Only when R = 1 ohm would the current thru the conductor be 2 A. For all other values of R, the current would be (V / R).
Comment: Thanks but can you please like explain briefly what a constant of proportionality is and why why it is dropping over here in Ohm's equation out of nowhere.
Answer: Consider the linear equation: y = 3 x. The slope of this line is 3.
Mathematically, we can say that y ~ x. [y is proportional to x]. If we wish to express the proportionality as an equation, we need to insert a "constant of proportionality".
In this specific case, the constant of proportionality is the slope, (3).
Now we can write the equation as: y = 3 x.
In the case of Ohm's Law, (I) ~ V [NOTE: this was the original format, as Ohm did it. We have switched it around to V ~ (I) because it's easier to manipulate (V) in the lab.]
Applying the requirement mentioned above, to make an equation out of V ~ (I); we need a constant of proportionality. It so happens that the constant in this case is (R); the resistance of the material being used.
Ohm's Law then is rewritten as: V = R (I).
Notice that this differs from the normal way we write Ohm's Law [V = (I) R]. What caused this alteration? Historically, Ohm showed that [delta V / delta (I) = slope = R].
Comment: Thanks this helped.... A lot. I'm a 10th grade kid... I dont know who are but still thanks a lot


Question that needs a selection

Question: What do you call a question that needs a selection? For example:

Is an argument true until proven false or vice-versa?
Answer: I'd call that an "either-or" question, or if there are more than two choices, a "multiple-choice" question.
Answer: A question that invites the reader to choose one of two propositions, especially where those propositions are mutually exclusive, might be called a dichotomous question.
A dichotomous question might require a yes or no response, which would make it a closed-ended question but a defining attribute of a dichotomy is that it poses two choices, or "selections" to use your word.

Question that needs a selection


Exporting video from compositing

Question: So I've only just started blender, and the first thing I did was use compositing to change a greenscreen to something else. I followed a tutorial, but when it got to saving the file, it got more vague. I set it to an FFmpeg video file where it says "file for..." and MPEG-4 as the container, which is what the video said to do, but I don't know what to do now. I rendered it, but from there it only let me save as still images. What do I do?
Comment: Hello, do you prefer to render a video or a series of images? Generally it is recommended to first render a series of images (PNG is better quality than JPG) then import the images in another blend file and render as video
Answer: When you run a "Render Animation" (I.E. by pressing ⎈ CtrlF12 or using the menu Render > Render Animation), Blender will write files as per your scene's output settings.
If you set a FFmpeg-encoded video, unless you had invalid encoding parameters (which should have canceled your render), you should see the video file in the folder you asked to be saved.
If you are unsure where that is, you can always hit the folder icon next to the file output path, which will open the folder in Blender's File Browser:

When using Compositing nodes
Make sure you output your node tree to the Composite node, this node is what is sent to the scene's file saving process:

Alternatively, if you want more complex file output (I.E. saving different versions of your compositing in different files, saving passes and whatnot), you can also use a FileOutput node. Although, it can only save image files, and Blender will still use the scene's render settings to output a file in addition to what you set up in the File Output node.

Exporting video from compositing