host, dig and nslookup can be used to lookup DNS names from the command line. However, they query the names from the DNS server directly, instead of using nsswitch to resolve host names. This means /etc/hosts and mDNS aren't used.  Is there a command line tool that looks up the name by the standard way (honouring mDNS and /etc/hosts)?  There is a , but it seems to be specific to OS X.
I want to test in a script whether a hostname resolves to something other than 127.0.0.1 as a pre-flight test for an install script. The tools I know (dig, nslookup) specifically query DNS. In my situation a correct entry in /etc/hosts is a valid configuration. So the question is:  Is there a dig-like tool, ideally already on the system, that does the full name-resolution process via nsswitch.conf, like (for example) ping does?  dig my-test-server-that-only-exists-in-etc-hosts    returns NXDOMAIN.
I have Ubuntu 14.04 and two monitors. When I open applications I need some of them to be on the primary monitor and others On the secondary. At the moment, apps always open in the primary monitor.   I have dash icons only on one (left) display, so I can't launch apps using the cursor or active window setting from Compiz. Evaluating the product $\prod\limits_{k=1}^{n}\cos\left(\frac{k\pi}{n}\right)$ Recently, I ran across a product that seems interesting.  Does anyone know how to get to the closed form:  $$\prod_{k=1}^{n}\cos\left(\frac{k\pi}{n}\right)=-\frac{\sin(\frac{n\pi}{2})}{2^{n-1}}$$  I tried using the identity $\cos(x)=\frac{\sin(2x)}{2\sin(x)}$ in order to make it "telescope" in some fashion, but to no avail. But, then again, I may very well have overlooked something.  This gives the correct solution if $n$ is odd, but of course evaluates to $0$ if $n$ is even.   So, I tried taking that into account, but must have approached it wrong.   How can this be shown? Thanks everyone. What is the MIME equivalent of uuencode for sendmail? e.g., I've got files I want to send by sendmail but the receiving mailbox (for posting pictures to my blog) will not accept uuencode files a la   $uuencode file | sendmail user@domain  I'm guessing it'll accept MIME though. So what command can I use instead? Filling HTML  dropdown list in JSP with values fetched from database in Servlet Cannot get 2 raster files of same cell size to align ArcMap 10.2 We denote the s value of an ECDSA signature $(r, s)$ on a message $m$ as: $s=\frac{H(m)+xr}{k}$  Assume two ECDSA signatures sharing the same nonce $(r, s_1) , (r, s_2)$ on two messages $m_1, m_2$, that verify under two pubkeys $x_1G, x_2G$.    If the two public keys are equal then the secret keys should be equal $x_1 = x_2$ and we can easily recover the $k$ using the standard attack on nonce reuse. Once we know $k$ we can recover the secret key.  $\frac{H(m_1)-H(m_2)}{(s_1 - s_2)} =\frac{k(H(m_1)-H(m_2))}{H(m_1)-H(m_2)+x_1r - x_2r}$  $x_1 = x_2 \rightarrow x_1r - x_2r = 0$  $\frac{H(m_1)-H(m_2)}{(s_1 - s_2)} =\frac{k(H(m_1)-H(m_2))}{H(m_1)-H(m_2)} = k$  My question is can this attack be made to work if the secret keys are not equal i.e. $x_1 \ne x_2$:  $\frac{H(m_1)-H(m_2)}{(s_1 - s_2)} =\frac{k(H(m_1)-H(m_2))}{H(m_1)-H(m_2)+x_1r - x_2r} = \frac{k(H(m_1)-H(m_2))}{H(m_1)-H(m_2)+ (x_1 - x_2)r}$  If you know either $x_1 - x2$ or $\frac{x_1}{x_2}$  you should be able to compute $k$ as long as $s_1 \ne s_2$.  You can calculate $x_1 - x_2 = \frac{H(m_2) - H(m_1)}{r}$ in case where $s_1 - s_2 = 0$. However this case seems to reduce to the hardness of ECDSA since anyone can compute the pubkey for a new message $m_2$ that verifies under first signature $(s, r)$ using public key recovery.  If $s_1 \ne s_2$ you can compute $\frac{x_1 - x_2}{k}$ which allows you to convert $s_1$ into $s_2$ and vice versa. How is the amplitude of light related to number of photons? If you increase the number of photons leaving a light source you increase the brightness/intensity, so it could be said that intensity is directly proportional to number of photons. However intensity is directly proportional to amplitude squared, so this leads me to wonder that if you increase the amplitude of a light wave, are you just creating more photons rather than affecting each individual photon in some way? $P[X=x]=0$ when $X$ is continuous variable I know that for continuous variable $P[X=x]=0$.   But i can't visualize that if $P[X=x]=0$, there is infinite number of possible $x$'s. And also why do their probabilities get infinitely small ? In a USB cable, is it OK to swap the D+ and D- wires? I heard that D+ and D- are differential signals, does it matter if I swap them when connecting a USB device to the computer? Weighting features prior to SVM I think I'm being the victim of a bug here. Sometimes while I'm working (I still don't know why), my network traffic goes up to 200 KB/s and stays that way, even tough I'm not doing anything internet-related.   This sometimes happens to me with the CPU usage. When it does, I just run a top command to find out which process is responsible and then kill it. Problem is: I have no way of knowing which process is responsible for my high network usage. Both the resource monitor and the top command only tell me my total network usage, neither of them tells me process specific network info.  I've found questions here about monitoring total bandwidth usage, but, as I mentioned, that's not what I need. Is there another command I can use to find out which process is getting out of hand?  The command iftop gives results that disagree entirely with the information reported by System Monitor. While the latter claims there's high network traffic, the former claims there's barely 1 KB/s.  I've already tried killing all the obvious ones (Firefox, update-manager, Pidgin, etc) with no luck. So far, restarting the machine is the only way I found of getting rid of the issue. I wish to display a map in QGIS (world country shapefiles) showing all countries but centered on the Pacific area.   I am not familiar with Proj4, so is there any way this can be done in QGIS? Python Implementation of Track-to/aim constraint Why is the word 'number' abbreviated to 'No.' in UK English and '#' in American English? Combining multiple textures with a white background I'd like to sort of "overlay" these shaders, but the only options are mix and add. Allow me to explain.  I made two images, both white background, one with red scribbles and one with blue scribbles, both 1920x1080. Image textures plugged into diffuse was my node setup. I want both scribbles to be added to the plane while the background stays the same color.  If I mix them I get the following:  The red and blue scribbles are now 50% dimmer than they would be on their own, and the white color hasn't changed in intensity.  If I add them I get the following:  The red and blue scribbles are still 50% dimmer than they normally would be (since the white background is being added over each). But the white background is now 2x brighter than normal.  Can I get a result where the white background is normal brightness and both the blue and red scribbles are at normal brightness? How to read value of variable, where the name of variable is the value of another variable I Need to Shrink My Database - I just freed a lot of space This question is asked in various forms here but the question boils down to:  I know shrinking a database is risky. In this case, I've removed so much data and I'll never use it again.   How can I shrink my database? What files do I shrink?  What should my considerations be while doing this?  Should I do anything after? What if it is a large database? Can I shrink it in smaller increments? Why does correlation matrix need to be positive semi-definite and what does it mean to be or not to be positive semi-definite? I have been researching the meaning of positive semi-definite property of correlation or covariance matrices.   I am looking for any information on   Definition of positive semi-definiteness; Its important properties, practical implications; The consequence of having negative determinant, impact on multivariate analysis or simulation results etc. Decode escaped Url without using HttpUtility.UrlDecode Is there any function that converts an escaped Url string to its unescaped form? System.Web.HttpUtility.UrlDecode() can do that job but I don't want to add a reference to System.Web.dll. Since my app is not a web application, I don't want to add a dependency for only using a function in an assembly.  UPDATE: Check  about the same issue. If two functionals have the same kernel, then one is a multiple of the other I would like some help with this exercise.  Suppose that $f_1,\ f_2 \in V^*$ and that $\text{Ker} f_1 = \text{Ker} f_2$. Show that $f_1 = k f_2$ for some scalar $k$.  I expect your suggestions.  Thanks!