Is dark matter around the Milky Way spread in a spiral shape (or, in a different shape)?

Question: Dark matter doesn't interact with electromagnetic radiation, but it, at least, participates in gravitational interactions as known from the discovery of dark matter. But does dark matter exist in a spiral shape around our galaxy?
Comment: Wild guess: Probably not.  As I understand it, the arms themselves aren't all that much denser overall than the gaps between them; they're just richer in young bright stars.  I wouldn't expect the mechanism that creates and maintains the arms to affect dark matter.
Answer: In current cosmological models, the Milky Way resides in a 'halo' of dark matter.  Halo is a technical term - in this case, it means a spherically symmetric collection of dark matter.  Since dark matter is not self-interacting and does not interact with other matter, it doesn't experience any sort of collisions or friction, and therefore never flattens out into a disk the way normal (baryonic) matter does.  So, dark matter does not trace out a disk and does not follow spiral arms.
Comment: A spinning mass only flattens down to a disk because of self-interaction.  Galaxies end up disk-shaped because of both gravity and hydrodynamics - the gas (and dust) interact with other gas and dust.  They are able to fall under gravity unless supported by some other force.  Pressure forces are too weak to prevent them from falling in, but angular momentum is enough to keep a disk formed.  Galaxies do generally also have a spherical component consisting of stars because stars rarely interact with each other, so if stars formed in a sphere they stay there.
Comment: I would think it wouldn't be spherical. Dark Matter (DM) responds to gravity, and the fact that the normal matter of the galaxy is greater along its equatorial plane, means the normal matter will attract dark matter towards it (as well as vice versa). So there should be a bit more DM in the equatorial plane than a spheroidal model would suggest. Since the DM outweighs the normal matter, it is likely a subtle effect.
Comment: Omega - Yes, the disk gravity is moderately greater, but because the dark matter doesn't interact with any of the disk matter, it doesn't collect there.  Dark matter particles may accelerate faster towards the disk because of the enhanced gravity, but they'll go right through it and out the other side.
Comment: Does that mean that spiral galaxies are disk shaped (as opposed to spherical) because of non-gravitational interactions?  Wouldn't a spinning mass of gas and dust form a disk even without self-interaction?
Comment: It might be worth clarifying that dark matter does interact gravitationally. There are also some models of dark matter where dark matter self-annihilates and interacts with baryonic matter and dark matter very weakly.
Answer: Disclaimer: I don't do dark matter, I don't work with anyone whose does and I haven't read enough papers to make an difference. I have seen a colloquium and a couple of seminars by people who do do dark matter.
Take what follows with that in mind.

Dark matter either not having been observed or having served up exactly one unconfirmed observation there is no widely agreed theory of its behavior yet.
There are models of cosmological evolution that posit certain traits for the dark matter and when run forward from the presumed conditions of the early universe give something that resembles the universe we see today.
In those models, the dark matter distribution is roughly spherical and rather larger than the luminous portions of the galaxy.
Answer: The 'spiral arms' do not contain a lot more matter than the 'not spiral arms'.  Rather we pick these out as they glow bright with new star formation.  The density distribution is fairly constant throughtout the disc.
According to the latest modelling the dark matter component is a spherical shape on small scales but forms threads between conglomerations centered on galaxy clusters.  Given dark matter forms 5x the mass of light matter it makes sense to reverse this and say light matter congregates within dark matter structures.
Answer: The main way I know of for studying dark matter distribution (I actually just wrote a grant application for research relating to it! :P) is gravitational lensing. Depending on the geometries involved, one can fairly precisely model dark matter distributions by looking at distortion of "nearby" (as far as arc-seconds on the sky, not actual physical distance in space) galaxies by weak gravitation lensing. A nice example (with a pretty picture) is available here.
Answer: Since dark matter is 96% of the matter in the universe, the question is complicated. In fact we're distributed around dark matter, if anything. That's a bit in general, and is covered a bit in analysis of Millennium I and II (which are incredible search for Cosmography of the Universe and stick with the twenty minutes video). Schneider More appropriately there has bee work to constrain the model of the exact subject of your question   [Vera-Ciro][2].
The shortest version is no, the shape of dark matter halos is for the most part elliptical, with the eventual relaxation into a spherical halo as time runs.
Disclaimer: this is not my particular field, but I've been reading recent papers on it because it provides quantitative data for something I'm thinking about.
cheers
[2]: http://arxiv.org/abs/1304.4646 "
Answer: The best estimate of the shape of a dark matter halo from the dynamics of the Milky Way is that its dark matter halo is rugby ball shaped with the long axis of the rugby ball like a stake running through Sag A* perpendicular to the plane of rotation.
In general, efforts to describe the shape of dark matter halos favor what is called an "isothermal" profile as opposed to the NFW profile which is what you would naively expect doing essentially a statistical mechanics type analysis.


Range of square root of rational function

Question: How can I determine the range of the function $$f(x)=\sqrt{\frac{-x^2+2x+3}{18x-3x^3}}$$ without using limits or derivatives? I have factorised numerator and denominator, but nothing simplifies. I tried solving $y=f(x)$ for $x$, because the domain of the inverse function is the range of the initial function, but I am somehow stuck. My guess is that the range is all non-negative real numbers. How can I be sure that we reach all of them? If we have it for the fraction, we will also have it for the whole root. Can someone help me here? Thanks!
Comment: Can you show that, for each $M>0$, there exists an $\varepsilon \in (0, \frac{\sqrt{6}}{2})$, such that $f(\sqrt{6} - \varepsilon) > M$? This is cheating a bit, because it's essentailly finding the limit at $\sqrt{6} - 0$, but that's the only way to deal with infinity.
Answer: Let $M \in (0, +\infty)$. $M=0$ is obviously hit, for example by $x = 3$.
We want to solve the equation $$\sqrt{\frac{x^2 - 2x - 3}{3x^3 - 18x}} = M.$$Squaring and then transforming the expression gives us $$3M^2 x^3 - x^2 + (2-18M^2)x + 3 = 0.$$For $M > 0$ this is a cubic equation, so it has at least one real root. Let $x_0$ be such a root. Obviously $x_0 \notin \{0, \sqrt{6}, -\sqrt{6}\}$, so $$\frac{x_0^2 - 2x_0 - 3}{3x_0^3 - 18x_0}$$ is a well-defined number equal to $M^2$, so it's positive. Therefore, its square root is defined and equal to $M$.
Comment: I showed that for every $M>0$, the root $x_0$ satisfies $f(x_0) = M$.
Answer: First the denominator has degree 3 while the numerator has degree 2.  For very large x, this is close to 0 so the minimum is 0.  The denominator is 0 for x= 0, $\sqrt{3}$, and $-\sqrt{3}$ while the numerator is not 0 for those x values so the function value can be arbritrarily large.  (I hope I haven't come too close to "limits" for you?)
Answer: $$\frac{(x+1)(3-x)}{3x(\sqrt6-x)(\sqrt6+x)}$$ must be non-negative. Notice that for $x$ in
$$(-\sqrt6,-1]$$ this fraction takes all possible non-negative values, as the signs are
$$\frac{-+}{-++}$$ and the denominator tends to $0$ on the left, and the numerator to $0$ on the right.
Hence, $$\mathbb R^+.$$
Answer: Find an interval in which the radicand, and thus $f$ itself is continuous (for example, for all $x$ such that $-\sqrt 6<x<0$).
In this interval, show that $f$ vanishes. This happens for example for $x=-1.$ Then the result follows immediately.


How to use TikZ in Lyx

Question: How do you use TikZ efficiently in Lyx?
I understand I have to go to Insert->Tex code, which opens a box where I can type actual Tex code. But it's really difficult, there is no indentation, everything I type is in one color only. (Note: I'm using Lyx on Mac)
Is there any easier way to do this?
Comment: why no indentation? Tab does not work for you? If you're referring to pasting, make sure you do Edit > Paste Special > Plain Text
Answer: Write your tikzpicture in a separate plain text file, then include it in your LyX document, using the menu item Insert | File | Child Document.
You have to make sure that you use the Include type: Input here.
Comment: Isn't there a tikz GUI editor on Lyx?.  Working directly, without importing is very important, specially when dealing with diagrams, you may need to connect some parts of your already made content.
Answer: You could use a Latex editor and copy paste the code once you're done. Or use a Latex editor, save file and import it to lyx.
lyx is supposed to be a text editor, somewhat like MS word, and indeed using ERT is not fun.
btw, you can use ctrl+L to open the ERT box

How to use TikZ in Lyx


Is there a way to set the symlink attribute for a file in Linux?

Question: I have a directory that I moved from a Linux file system to an NTFS file system and broke all of the symlinks. Moving them back didn't fix the problem because all the symlinks are now very small files without the attributes that made them links. Lesson learned. Is there a way to reset the symlink attribute and convert these files back, or do I just need to write a script to find these files and batch recreate the links?
Answer: What I would do is look at those small files. Symbolic links are simply files with a special mode whose contents are the path they are linked to. I don't know how the file system was moved to/from NTFS, but it's possible these small files still contain the contents of the link.
With that in mind, it might be possible to re-create them with a script.
Comment: The content is still there, just not the flag that makes it a link. I actually already fixed my problem by reinstalling the programs, but the problem still exists for the next person.


Number of possible paths

Question: On a $xy$ plane how many $2n$-move paths can be made that begin and end on $(0,0)$ but pass from $(k,n-k)$ with $0\leq k\leq n$?
I can't think of a way to solve it, because every move is allowed and the number of moves is specific.
Comment: can you explain what you consider to be a path?
Comment: @ForeverMozart For example two paths from (0,0) to (1,1) are
i)one that passes from (0,1)
ii)one that passes from (1,0)
Comment: so you have to go along the rectangular grid? Does the path have to pass through every $(k,n-k)$? And what is a move?
Answer: Notice that the shortest way to get to $(k, n-k)$ takes $n$ steps and the same is true of the return journey. Since we are allowed only $2n$, we must take a shortest path to $(k,n-k)$ and a shortest path on the way back.
The shortest path from $(0,0)$ to $(k,n-k)$ is a permutation of $k$ east moves and $n-k$ north moves. There are $\binom{n}{k}$ such paths. There are many ways to see this (edit: see @vonbrand's comment below for an alternative proof). There are $n!$ ways to order $n$ items, but since we don't care about how the north moves are ordered among themselves, we divide by $(n-k)!$ and since we don't care about how the east moves are order among themselves, we divide by $k!$. The total number of paths from $(0,0)$ to $(k,n-k)$ is $\frac{n!}{k!(n-k)!} = \binom{n}{k}$.
The number of paths coming back can be computed to be the same quantity. Hence the total number of paths is $\binom nk ^2$.
Comment: Simpler: On each trip there are $n$ moves in total, $k$ of which are east (west) moves, there are $\binom{n}{k}$ ways to select the positions of the east (respectively west) moves; in all $\binom{n}{k}^2$.
Comment: @vonbrand: Thank you. Yours is definitely easier to state and it's how I would prove it to someone in a hurry. Even after many years, I still think of the argument I wrote above as the "real reason", even though that is a matter of opinion. For completeness, I have referred to your comment in my answer.
Answer: We assume that a move is $1$ unit in any of the directions North, South, East, West.
If we return to $(0,0)$ in $2n$ moves but pass through the specific point $(k,n-k)$ we must in our first $n$ moves go $k$ moves East and $n-k$ moves North. There are $\binom{n}{k}$ ways to choose when among the first $n$ steps we take our $k$ steps North.
For every trip to $(k,n-k)$ there are $\binom{n}{k}$ return trips, for a total of $\binom{n}{k}^2$.
Remark: Suppose now that $k$ is unspecified. Then the number of paths is $\sum_{k=0}^n \binom{n}{k}^2$.
Call a move good if it is East on the outward trip or South in the inward trip. Then there are $n$ good moves, and the trip is completely determined by when a good move occurs. So the number of possible trips is $\binom{2n}{n}$.  This gives  another proof of the well-known combinatorial identity  $\sum_{k=0}^n \binom{n}{k}^2=\binom{2n}{n}$.
Comment: Does this mean we are going to cross the point $(n,n)$ on the xy plane once...to satisfy the conditions given?
Comment: @Freelancer: We are supposed to leave the origin, make a total of $2n$ moves, and be back at the origin, while having reached a point $(k,n-k)$.  We certainly do not reach the point $(n,n)$ in our travels, for that would all by itself take $2n$ moves.

Number of possible paths


How to get UTXOs Data from the network Using python?

Question: I want to have the Bitcoin Network UTXOs only for a data analysis project and the purpose is visualization of the time series of 1>BTC wallets . how can I do it using python ? ( or is there any easier and convenient way to reach to such data ? )
Comment: If you want to also do historical data, the UTXO set will not be sufficient since it only has the current UTXOs. You would need to parse the entire blockchain and record every time when a transaction creates or spends an output greater than 1 ₿. Could you clarify whether that's what you're trying to do?
Comment: I want to have a historical time series Data set of +1 BTC balance addresses ,, for example suppose that we have two columns named : Date and NumberOFAddresses ,, then for each we have for example : 8/1/2015   120 , 8/2/2016 123 , ..... 8/1/2023 10000...
Comment: In your example is 120 the number of outputs created on/before 8/1/2015 that remain unspent today? Or is it the number of UTXOs in the UTXO set on 8/1/2015? Or something else?
Comment: I mean for example in 8/1/2015 we had 120 addresses that had +1BTC balance in 8/1/2023 we have 10000 addresses ( for example ) that has +1BTC .. I want this Time Serie
 @RedGrittyBrick   like this link : https://www.lookintobitcoin.com/charts/addresses-greater-than-1-btc/
Answer: As Murch suggested in a comment, you will have to process the entire blockchain, maintaining a UTXO set throughout and at each time interval, calculate address or equivalent for each UTXO, aggregate by address then output the block date and value for each address.
Block dates are not accurate and are not always in ascending order even if you manage to sort blocks by height and get them in chronological order, so you may have to apply some suitable averaging or heuristics.
Addresses are not defined for many types of locking scripts, so you may have to invent your own definition and method for many types.
There is no way, or no simple way, to determine if two addresses belong to the same wallet. Even if there were, you can't assume people only have one wallet each. So you need to be careful how you interpret and present results.
You may want to exclude provably unspendable outputs.
I would tackle this by using Bitcoin core to obtain the data, then write a program to fetch the data, either by API or by parsing the blk*.dat files. YMMV.


Data on benefits of show password reset form

Question: Most UX designers are clear that having 1 new password field with a mechanism to show the password is a better user experience than using 2 fields for 'New password' and 'Confirm password'. Is there any data available to indicate a reduction in helpdesk calls or similar with implementing a single field approach?
Comment: "Most UX designers are clear that having 1 new password field with a mechanism to show the password is a better..." - Can you provide references to backup this statement? This practice has serious security consequences.
Comment: Struggling to see where in that post there is evidence of the reduction in the number of calls - can you be more specific?
Comment: You're just after raw data? Good luck with that, comment deleted.
Comment: Not raw data, analysed data ideally. We have a lot of UX claims that a show/hide approach is better; I'm just looking for someone to say 'We tried it and it was better / worse because ...'. There's surely some research that's been done into this.
Comment: I agree with @Izhaki.  I've not heard claims that `show password` provides better UX.  Single-field password inputs are popular because they reduce UX friction.  When single-fields are implemented, they very rarely have a show-password button.
Comment: There's a lot of literature on it, e.g. Jakob Nielsen at http://www.nngroup.com/articles/stop-password-masking/; Lukew at http://www.lukew.com/ff/entry.asp?1653; Bruce Schneier ar https://www.schneier.com/blog/archives/2009/06/the_problem_wit_2.html.
Answer: I'm gonna answer this with some information that @Peter provided in the comments:
Like he said, there is a lot of information widely available about why you should not use Password Masking and how it has a negative spin on UX. Here are some resources from people who really know their stuff in terms of UX.
Jakob Nielsen has an article on why you should stop password masking.

Usability suffers when users type in passwords and the only feedback they get is a row of bullets. Typically, masking passwords doesn't even increase security, but it does cost you business due to login failures

Luke Wrobelski has an article in which he talks about the usability issues of passwords on web and especially mobile.

The situation is even worse on mobile where small screens and imprecise fingers are the norm

Bruce Schneier article provides his opinion on why password masking is bad.

Of course, a truly skilled criminal can simply look at the keyboard and note which keys are being pressed. So, password masking doesn't even protect fully against snoopers

Ux Movement has an article on why password masking can hurt your sign up process.

When users sign up on a website, they expect a no-hassle, worry-free form to fill out. But masking their password could prevent that.

Smashing Magazing provide an article in which they explain the problems with password masking and how you could improve password masking.

Displaying their password in plain text that one time when they are alone is probably not as a significant security risk as we tend to think

Albeit you could take this information with a bit of salt but I respect the writers of these articles and believe they know what they are talking (writing) about so I would cherish the information.


Anyone gotten 10.7.2 to bind properly to Active Directory in a multi-domain environment?

Question: I work for an international non-profit that has Active Directory with multiple domains. (A bunch of them.) We can't get Lion (10.7.2) to bind to it properly. Has anyone been successful in getting AD to work in Lion 10.7.2? We have a bunch of new Macs and can't get them on the network. We'll be testing AdmitMac this week, but would rather not pay more than $100 a machine to get them hooked up.
Comment: http://support.apple.com/kb/HT4767 says a change in 10.7.2 was to ' Improve Active Directory and LDAP integration.'. I guess you need to try to find what exactly changed.
Comment: As I understand it, the first beta for 10.7.2 fixed it, but then they broke it before release. It works in single-domain networks, but not multi-domain networks. It's beyond me. I'm a photo editor, not an IT guy. :)
Comment: What resources do you need on the domain that you need to actually join for?
Comment: Single sign-on. Logging into network shares. Share Point. Exchange Server. It's a mostly Windows-based company with thousands of PCs, and about 65 Macs.
Answer: MacWindows has a lot of good feedback about this issue.  In my own testing I've found that 10.7.3 has certainly improved network logins on AD2003-bound Macs, though its still not as reliable (or fast) as I'd like.
As always, contact your SE and leave feedback about your issues.
Comment: Yes, my advice would be to upgrade them all to 10.7.3 or even better up to 10.8 where AD binding started working better again. My favourite has always been 10.6.8 where it was a dream.


How to get a a graphical BASH prompt?

Question: I want something that looks like this:

Is there any way to achieve this?
If so, how can I do this?
NOTE: I use Kubuntu Disco in case that is important.
Comment: Check this out: https://ohmyz.sh and https://ohmybash.github.io/
Comment: And https://yalneb.blogspot.com/2018/01/fancy-bash-promt.html as well as search the 'net for fancy bash prompts.
Comment: The default bash prompt is specifically designed to be useful for scp/sftp commands - may want to consider that before changing it.
Answer: For Kubuntu 19.04, install fonts-powerline using sudo apt install fonts-powerline. Your system should also have fonts-hack.
Visit this site and copy the entire script, all 348 lines as on 20190906, to ~/bin and save it as powerline.sh or whatever. Use the file manager to make the script executable.
(Note that ~/bin is by default in your system's path and so you do not need something like $HOME/bin/.powerline.sh.)
Open konsole and, from your home folder, run
echo "source powerline.sh" >> ~/.bashrc

Doing so will add
source powerline.sh

as the last line of your ~/.bashrc.
From your still open konsole window, run
source .bashrc

to reload .bashrc and use powerline.sh in the existing konsole window.
If you want to go back to the default prompt, comment out the source powerline.sh line  in ~/.bashrc by placing a # mark at the beginning of the line.
Read the contents of ~/bin/powerline.sh if you want to modify some aspects of the prompt.

Konsole, whether in Kubuntu 19.04 or Kubuntu 18.04, doesn't need fonts-powerline installed. But other terminals such as lxterminal and gnome-terminal need the package to get the triangles and the prompt to display nicely.
Comment: Could be. I had to install the fonts to have a good outcome.
Comment: Nice! However, you do need fonts-powerline for the triangles.
Comment: @vanadium I thought so as well but I checked again, I don't have `fonts-powerline` installed on Kubuntu 18.04 and still have the triangles. I also checked Lubuntu 19.04. There too, `fonts-powerline` is absent and the triangles are present. I don't know how the triangles are still being generated.
Comment: @vanadium, even `apt list --installed | grep -i powerline` comes up empty. Maybe it's needed on a GNOME-based system?
Answer: The appearance of the Bash command prompt is controlled by the environmental variable $PS1. By changing this environmental variable, you change the appearance of the prompt.
You can see the current setting of this variable with the command:
echo $PS1

The prompt can be changed with the command
PS1="<string representing new format>"

To change permanently, change the definition of PS1 in the file .bashrc in your home folder. That script is run automatically when you open a terminal, and includes a section where PS1 is defined.
man bash may instruct you about the syntax of the string that defines the prompt format. It may be easier, though, to start with some tutorials like here on How-To Geek or nixcraft.
To implement effects as appear in your screenshot, you may want to consider Powerline, a set of script developed to provide a more fancy look to the vim editor, but including scripts to change among others the bash terminal. Powerline can be installed with sudo apt install powerline, and can then be used according to the documentation.
For more details regarding installation and use, refer to How can I install and use powerline plugin?, and in particular the answer of Schycken, because earlier answers have become obsolete.
Comment: I think OP wants something like powerline which apparently requires `fonts-powerline` installed.
Comment: @steeldriver Thank you for the comment. I updated the answer
Answer: Visit synth-shell and follow the instructions there
in Ubuntu:
mkdir ~/bin
chmod +x ~/bin
cd ~/bin
sudo apt install fonts-powerline
git clone --recursive https://github.com/andresgongora/synth-shell.git
chmod +x synth-shell/setup.sh
cd synth-shell
./setup.sh

and then follow the prompts in your terminal. restart your terminal emulator. If you're not seeing the coloured arrows in your prompt then you may need to change your terminal's font to something like hack-ttf and check your locale is using UTF-8
Answer: The simplest way: https://ohmyz.sh/
And choose a theme like this one: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster
Comment: How does installing a *Zsh* theme help getting a graphical *Bash* prompt?

How to get a a graphical BASH prompt?


Is installing a gable fan worth the investment?

Question: We have 2 gable vents in our roof (approx 2' high or so), one at either end, and upon inspection it does not appear that there is really enough overhang in the roof for soffits.  I still have to inspect it closer from the outside, but they are for sure not installed at this time.  The roof is also slate, so going in through that is not really an option we'd like to pursue.  If we install a attic gable fan on one end, will there be enough air flow through the attic to make this project worth our while in terms of heating/cooling costs, or should we go another route?
Comment: I don't think the fan would help with heating costs. As for cooling, ideally you'd first invest in more insulation on the attic floor.
Comment: @DA01 true, it is mostly cooling.  However, we are using the space for storage now and there is plywood floor cover.  So I'd ideally want to take all that off to find out what's there first before doing that.. which is a bit of a chore.
Answer: I can tell you from experience in my house  a slate roofed colonial, it will make a difference. Even with the fan mounted in an attic window that is that is 3 inches off the floor of my walk-up attic the temperature drop in the attic was 30 degrees.Most fans will have a spec sheet telling how many square inches of ventilation opening they require. It is important to remember that you are calculating square inches of unimpeded opening so subtract for louvers and other obstructions. In my case I have a large peak where hot air tends to get trapped. If we have several days of very sunny and hot weather I place a small table fan on the attic floor. With the small fan pointing up it circulates the air to remove the hottest air trapped at the ridge.
Answer: In terms of most efficient usage of money, I suspect weather stripping will have a bigger impact on an older home. Sealing all the gaps around doors and windows will cut down on drafts. If fixing a window involves replacing it with a new energy efficient model, all the better.
Once the drafts are solved, insulation is usually next. But that can be expensive, especially in an older home where blown insulation is about the only way to get it in the wall, and that also has a habit of settling over time.
A fan in the attic will be a lot cheaper than insulation, and I'm betting that it will be a net positive. If I were to install it in your situation, I'd do the following:

Check the predominant wind direction in your area, particularly during summer evenings. You want to supplement the wind, not fighting it.
Use a GFCI in the circuit. I would consider the attic fan as exposed to the elements just as a garage area is.
Next, include a timer switch in the chain. You only need to run the fan at in the evening. In the middle of the day, you'll be spending money to run a fan that's pulling in hot air.
Finally, include a thermal switch in the chain. If the attic is 100°F, you want to run the fan, but not if it's 80°F.

For the timer switch, I'd install that somewhere easy to access, such as near the attic entrance inside your home or close to your thermostat. This way you can turn it off completely when the forecast calls for cooler weather.
Here's my ascii art of the layout:
<code>power  --- W ---  GFCI  --W---+------ Thermal --W-- Attic
source --- B --- Outlet --B-+ | +-R-- Switch  --B--  Fan
                            | | |
W = white (neutral)         Timer      R = red (switched)
B = black (hot)             Switch
</code>
For the GFCI/thermal switch, you can probably get both of those in a double J-box next to the fan for a clean looking install.
Comment: Running the fan in the heat of the day may also be beneficial. While it may be pulling in hot outside air, it's likely the outside air is still much cooler than the air in the attic.
Comment: @Tester101 very true, I just don't know how efficient the fan is over natural circulation when you factor in the electricity and wear and tear on the fan. The reason for the timer is that thermal switches don't work on a temperature difference between inside and out, only an absolute temperature of the inside. So if it's 100°F outside and in, the fan would run needlessly.
Answer: If my attic temperature was only 100 degrees or so I wouldn't even think of
adding a ventilator fan. In Texas in July the outside air temperature can get up
to 110 degrees or more on a hot afternoon. The temperature in the attic can
get up to 130 degrees+ easily. Using the fan to blow out the 130 degree air and
replace it with cooler air from the outside is a smart move. I installed a fan
with a temperature switch to cut it off at 100 degrees when it cools off at night. It helps!!!        Jack T. Palestine, Texas
Answer: Do you have continuous eave vents and continuous ridge vents? It is recommended to actually close off gable vents if you have continuous vents because it messes with the convection flow along the underside of the sheathing.
Comment: Continuous eave vents would be soffit vents, which Aaron doesn't have. And since he doesn't want to disturb the slate roof, that would imply no ridge vent.
Comment: Not disturbing the slate doesn't mean there isn't a ridge vent there already.
Comment: Fair enough, I may have been basing my assumptions on external knowledge: http://chat.stackexchange.com/transcript/message/4975658#4975658
Answer: There is way more radiant  heat being put into a roof that one or two little attic fans can ever pull out of the attic to be effective. They would have to be about 4 feet in diameter  or more to effectively remove that amount of heat radiated into the attic. There is just too much surface area heated by the sun on a typical roof for any small fan to handle. The heat dumped is more then made up for because of this simple fact.


Convert objects to short lines

Question: I am new in Inkscape.
I need to know how convert objects (any: lines, cyrcles, free drawn by pen, ets) to object consists from small lines (1.5 - 2 mm (need to specify)).
Please look to example on the picture.
Answer: You can achieve this in a few steps:

If not a path already, convert the object to a path (Path -> Convert to path).
Add nodes to your path with Extensions -> Modify Path -> Add Nodes (doc here)
Now you need to break your path into individual segments: Select the path, select the path tool (F2), and select all nodes (ctrl-A). With all nodes selected, click on the "Break path at selected nodes" button in the path edit toolbar.
Now you need to break your path (that contains several segments) into individual paths so you can color them. Do this with Path -> Break Apart.
Comment: Perfect! Thank you! But cycle still is cycle. Is it possible to change lines to strict direct lines? Circle should be like a polyhedron.
Comment: @InkscapeQ - then use the Polygon tool instead of the Circle tool, and break that apart. Juancho's method works with any shape you want to start with. It's not limited to straight lines and circles.
Comment: @InkscapeQ You could also select all the nodes of the circle, then hit the "Make Selected Nodes Corner" button twice.  That will remove all the curves.
Comment: You may need to convert the circle to a path before you add nodes.

Convert objects to short lines


How to retrieve an image which is gone yet still present in the document?

Question: In my document I used images which are now gone (files were deleted) but yet they are still in my document. When packaging the document, InDesign says links are missing though. I don't understand this, if they're missing (I know they are) then how come they are displayed in the document? And what can I do if I don't remember where I found them initially?
Comment: ".. yet they are still in my document" -- InDesign will clearly tell you they are *not* if you check the Links panel. And in operations such as exporting to PDF (I don't think you can opt to ignore that warning).
Answer: The files in your InDesign document are previews of the images you placed. You can't retrieve the originals from within your InDesign document if you deleted the original files.
To prevent losing or accidental removing images, its best to work with versions and to package each version.
Comment: Because previews in InDesign are just the image scaled down to 72 ppi, if your image was saved at 72 ppi or less, the full resolution is embedded in the document. You could then export as PDF with no image modifications (scaling, cropping, color, etc.) and extract it from there.
Answer: I am not familiar with inDesign too much, but you could try the following in case you initially found the picture on the Internet...
Take a screenshot of the pictures in your document and use Google Reverse Image Search to find similar or the exact same picture. In case you got it from the Internet, you are most likely to find it doing so.
Here is an article on how to use Google Reverse Image Search.
Answer: The images in your indesign document are a small copy of the images which are stored else where, the link is telling the document where it is, this keeps the indesign file small and quick to work with.  But if you move the images or delete them, then the link is lost. My system is to store the image files and other input material, text or graphics in one file, named to the job so it can not be lost or deleted by mistake.
Answer: Another tip is that if the images have been scaled down in size, their 72dpi original resolution gets increased by the same percentage. For example, the original file might be missing but if the 72 dpi preview has been scaled down to 24%, the preview will actually become 300dpi and you can definitely get away with printing this.
To relink it, select the image with the content tool and copy. Then go to Photoshop and make a new document based on the clipboard contents. Paste it in, save the image and relink it to Indesign.
Alternatively, if you think you might still have the original images on your system but don't know where, try using the following AppleScript that can get Indesign to search for missing images through multiple subdirectories of a nominated folder:
http://www.drscripto.com/?p=8


Is it efficient to defend and counterattack simultaneously?

Question: There are theories that claim that defending and counterattacking at the same time is superior due to its speed advantages. But will it divide one's power and accuracy, causing a decrease in efficiency? Is it recommended to defend and counterattack separately in a real-life situation? And will that decrease the chances of being able to counterattack at all?
Answer: As a matter of fact, fighting does not work without defensive options. But at the same time, a sequential application of defensive and offensive moves does leave you with two options because your opponent typically does not stop with their attacks if not forced to do so:

You are faster than your opponent, so much so that you can squeeze in an offensive move between two defenses
You are more or less equally fast, so you end up defending and defending endlessly without ever getting an advantage

Since the latter does inevitably end up in an eventual mistake by you and thus being hit and even more of a tactical disadvantage, sequential application obviously is not an option. You could try to be the first to attack and keep them busy with defending all the time but truth be told, how realistic is that? Apart from being the first to go into the offensive obviously can cause legal problems in self-defense.
Therefore, you have no other option than doing both at the same time if you are to ever get out of the defense once an attack is coming at you.
This can take two forms:

You defend and attack in the same move, e.g. shifting sidewards and forwards and deflecting to avoid a cross and gripping/kneeing/hooking from your new, better position.

You use your defensive move in a way that offers you a strategic advantage, ie. you do not exactly attack at the same time but enable attacks, for example by pushing a low-kick-block out forwards and thereby breaking the opponent's balance. Or by evading a roundhouse and giving it a bit of extra-inertia with your hand to mess up your opponent's positioning and balance. Or by moving with a roundhouse or swinger to dampen the impact and blocking plus catching the limb for throws or joint manipulation. Endless options.

The way you posed your question seems to imply that the first option would basically overcharge us cognitively. That is not true. If you train both aspects as one move, your body learns the thing as one movement and acts accordingly, no matter whether you only move and deflect or move in and attack with the same move.
Therefore, just train to do both at the same time and that is exactly what you will be able to do when attacked for real.
Answer: Your question can evolve into a philosophical discussion very quickly, and each person's viewpoint will depend largely on what and how they were taught.
The point of view I am about to put forward is based on philosophies taught in karate, where it is expected that you will "win" the "fight" as soon as possible - this philosophy can still apply in part to ring combat but might be harder to execute due to rules and equipment.
I was taught very early on that there was no point defending, if you defend then you haven't progressed the fight at all. The opponent attacks, you defend, you're now both back to where you started - what is better is if your defense is actually an attack.
In a subsequent school I was taught there is no such thing as "defending". Our defensive moves - i.e. "blocks" or uke in karate parlance - were in fact attacks. Once I reached a belt level where bunkai was taught, I started to understand how a block was actually an attack. From that point on I never defended.
So going back to your question:

Is it efficient to defend and counterattack simultaneously?

I would answer that no, it is not efficient and there should only be counterattack, no defense.
Think of it this way: when an opponent throws a punch or a kick, they are extending an arm or leg towards you. My response will be to move and use a "block" against the incoming limb - i.e. like my description of the application of soto uke in this previous answer. When "blocking" most people initially think that you're only using the striking hand or forearm, but there's more than that - what do you think the other hand is doing? In most cases it is catching or parrying and it is an integral part of the "block". It could be argued that the parry/catch is a defense, but when executed with the rest of the move it is all attack, not defense. Your attack is the defense.
Comment: I think this answer can easily be misunderstood: While it may be correct that there should ideally be no purely defensive move, both not moving out of the way of a powerful kick and not shifting and deflecting a cross while moving in and attacking seems to be pretty lunatic to me. I guess this is rather meant to mean that *if* you do block/parry/evade, it should result in a strategic advantage (loss of balance, covering distance, producing an opening), no?
Comment: @PhilipKlöcking You raise a good point, I've updated my answer.


Can I add rigging bones to a model imported from Blender inside Unity?

Question: I created a model in Blender but recently I stumbled upon a video claiming that you can add rigging to a model in Unity. So instead of rigging in Blender, is it possible to do it in Unity?
Comment: If you have seen a video that does this, does that not answer your question with a "Yes, it is possible"?
Comment: Linking the video you're talking about would help here, so we can see the context.
Comment: https://www.youtube.com/watch?v=Htl7ysv10Qs&t=331s
Answer: 3D packages provide a number of ways to create joints for your humanoid rig. You must  use an external 3d modelling software to manually rig and add weights, you cannot do it in Unity.
But before we explore what's with the new animation rigging let's see how animation layers work in unity. Unity uses Animation Layers for managing complex state machines for different body parts. An example of this is if you have a lower-body layer for walking-jumping, and an upper-body layer for throwing objects / shooting. It's an easy way to override and map different animations at once. But this has its own constraints. What if you want to add an animation where you want your character to pick up something while walking you need an animation for walking and picking up and then add a interactables layer and override the top part of the body to use the pick up animation. This requires you to make many animations.
Using layers require pre-made animations and it enables overriding certain parts of the rig. This is a great feature, but what if we could override certain parts of rig to work procedurally? That would lead to amazing possibilities. Unity made a clever decision by combining procedural animation with layer rig overriding. Complete procedural animation doesn't look that good but combining it with pre-made animation, we can create some amazing stuff. Imagine being able to control certain parts of the rig using code and remaining using the pre-made animations.
The Animation Rigging package for Unity enables to set up procedural motion on animated skeletons at runtime. You can use a set of predefined animation constraints to manually build a control rig hierarchy for a character or develop your own custom constraints in C#. This makes it possible to do powerful things during gameplay such as world interactions, skeletal deformation rigging, and physics-based secondary motion.


Interval Notation - What is the purpose?

Question: I understand that you can write an inequality:
$$
x \leq 3
$$
as
$$
x \in (-\infty,  3 ]
$$
in interval notation, but, I don't understand the practicality of doing this. When is this used? How does it help?
Comment: That's not true. $x\le3$ is a claim about $x$, while $(-\infty,3]$ is just a set. It doesn't *claim* anything, certainly not about $x$.
Comment: @AndreOseguera: No! The notation $(-\infty,3]$ _does not tell anything about $x$_! It is the name for a _set_, and that set does not have anything to do with $x$ or any other variable. You can combine that set with $x$ and write $x\in(-\infty,3]$ (which is true exactly when $x\le 3$), but the point of intervals is that you can use them in situations where there is _not_ any $\in$ immediately in front of them.
Comment: Yes, it's interval notation. x = $-\infty$ to 3.
Comment: $x \leq 3$ will be written as $x \in (-\infty,3]$, and not simply as the set $(-\infty,3]$. Can you clarify the question?
Comment: Could someone else edit it? I don't want to go about asking incorrectly.
Answer: In general, the interval notation is cleaner to use. E.g. $x \in [2,3] \cup [5,10]$ is slightly more concise than the statement: "$2 \leq x \leq 3 \text{ or } 5 \leq x \leq 10$". As other answers will most likely point out, the interval notation seems closer to set theoretic notation.
Comment: Perfect. Thank you very much.
Answer: As the commenters have mentioned, $(-\infty, 3]$ is a set; it says nothing about any variable until you declare $x \in (-\infty, 3]$ or perhaps $x \notin (-\infty, 3]$.
This notation can be much more easy to read and write sometimes, but more importantly the notation stresses that $(-\infty, 3]$ is, indeed, a set, and that its nature as a set may matter.
For instance, the domain of a function may be $(-\infty, 3]$, and when you construct topological arguments about that function, you often want to be dealing with a subset of the extended real numbers.
Similarly, the $[a,b]$ means the set of all numbers between $a$ and $b$ inclusive; if you have a function acting on this set, it is much better to write $f : [a,b] \to \Bbb R$ rather than $f : \Bbb R \to \Bbb R,\ a \le x \le b$ (the latter notation is actually awful; there is nothing about $x$ in the function statement, and so it is unclear when it need not be so).
This notation also puts useful topological properties on the outside of the notation, rather than somewhere in between. $(a,b)$ is an open set, $[a,b]$ is closed. This helps reinforce the notions of openness or closedness. The other way to write this set would be $\{ x \mid a < x < b \}$ or $\{ x \mid a \le x \le b\}$. It is easier to overlook that the set is opened or closed with the set notation.
This notation also has uses in other areas: defining the support of a random variable; defining the region of convergence of a series or algorithm; defining stability intervals for parameters; etc.
Answer: You can express the fact that $x\leq 3$ by saying that $x\in(-\infty,3]$. What are the advantages of the latter method?
One reason behind using the $\in$ symbol and intervals is that in modern mathematics we like to express mathematical objects and relations between them in the language of set theory.
Other reason comes in some sense from the first one: expressing inequalities in terms of the set theoretic notions make operating on them easier. For example instead of saying that $x$ satisfies inequality A, inequality B, and so on you can just take intersections of sets associated to those inequalities. So the connective "and" between inequalities is replaced with the intersection of sets. The connective "or" between inequalities is replaced with taking the union of appropriate sets.
When you are visualizing the system of inequalities on an axis you see that basicly you are just marking sets of elements satisfying them on an axis.
Those two methods complement each other when working with inequalities. The latter method make visualizations straightforward.


Why does the Habitat sample solution have a Sitecore rocks connection for each project

Question: When browsing through the Habitat solution, I noticed that every project in the solution has a csproj.sitecore file (I assume this is for Sitecore Rocks?). So where we have Sitecore.Feature.Media.csproj we also have Sitecore.Feature.Media.csproj.sitecore this is repeated for every project in the solution as far as I can tell. This seems a bit unnecessary and is annoying when you want to change it to use a different connection as you then get prompted for every single project in the solution. Surely just one connection is enough?
Comment: You can raise an issue here https://github.com/Sitecore/Habitat/issues or even try to resolve this and create a pull request with your fix.
Answer: This is actually done by design. If you read http://helix.sitecore.net/principles/visual-studio/index.html. You will see that by having one Sitecore Rocks reference, it would create one huge reference, not allowing for the projects to be opened separately. This goes against the approach that Habitat is promoting of "your architecture should always have higher priority than any tools or technology". If we were to take the Habitat design approach and implement it into a large scale enterprise environment, with 60 modules, Visual Studio solution would become sluggish. Habitat is promoting separation of concerns into groupings of business functions.
To solve your specific need of connecting to the full Sitecore instance in a single instance Sitecore Rocks connection, you can still do that while leaving the other csproj.sitecore files in tact.


Quieter drilling into concrete

Question: I need to drill some 1/2 inch holes in a 4 to 5 inch slab.  A typical hammer drill is going to give us 90-92DB.  I'd like to knock that back maybe 8-10DB to around 82-84DB.  is that possible?  Are there certain types of [hammer] drills or methods to drill that can help here?
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/136654/discussion-on-question-by-westcoastprojects-quieter-drilling-into-concrete).
Answer: Two options:

SDS rotary hammer. That'll make a lot of noise, but it will be short.

Diamond core drill:

This doesn't use impact, it abrades and grinds the material. So it's pretty silent, and it works very well to make holes in brittle material like tile without cracking it. It will go through your concrete. That will take a while. You need to pour water down the hole and use a steady speed on the drill. Unlike a SDS drill, it won't make an exit crater on the other side, in case that matters. It will also grind through rebar, with water and a bit of patience. It doesn't make any dust, instead it makes mud.
You need a drill with a gearbox, and then use first gear. That way the motor can run fast and not overheat because the fan turns fast, while the drill turns slow and doesn't overheat the tool.
The core drill is hollow, so unlike a SDS drill, it doesn't have to grind away the material at the center. So this is usually the best choice for large holes (like 2" and above).
I usually take a piece of wood and drill a hole in it with a hole saw, to use as a guide. Then fasten that to the surface you want to drill (or just stand on it) and the hole in the wood will hold the diamond drill against the material. Otherwise, it will try to slip away when turning.
Comment: I do have those types of drill bits, will try it out
Comment: The question got downvoted. I'm v experienced on StackExchange: 52K with over 1K questions on SOF, 3 to 4K on couple other sites, and meaningful activity on a number of others.  This site has the most critical (and sometimes surprising ) downvoting anywhere I've been.
Comment: Yeah I don't understand the downvote. It's a legit question.
Comment: thx for the 'help' here.  i'm going to be trying out that bit tomorrow
Comment: There are a few folks running around the site who DV (non-blatanly bad questions/answers) without saying why. I try to ignore them = hecklers. I assume they don't give reasons to remain anonymous hecklers. Have some upvotes on me. Another bit of the local culture which I've been quietly trying to offset is that you'll have a a question that's good enough to get answers with 25 or 30 upvotes, but the question gets like 3-5...

Quieter drilling into concrete


What are the benefits of reducing the size of scope or no. of story points in an iteration?

Question: In convincing management of the benefits of working on smaller scopes in more iterations. Have you seen this make a difference in speed, quality or ability to adapt to change in requirements?
Answer: My team has been paying special attention to story size for the last few iterations and we've noticed several benefits of breaking down features into smaller stories:

We are better able to judge how much we can get done in an iteration.
We reduce doubt and uncertainty around a story by breaking larger stories down into small, well-defined stories. Doing so requires extra research and extra thinking upfront that pays off in the end.
If something happens during an iteration that makes us unable to complete everything we scheduled, it's a lot easier to push off small stories that weren't started than to try and roll over parts of bigger stories to another iteration.

On the flipside, we have found it harder to swarm on smaller stories, but overall keeping the stories small allows my team to keep delivering completed features or parts of features more reliably.
Answer: There are a few:

You get something sooner. Less = Quicker
Your developers are more focused. 1 thing to think about, 1 thing to ponder, 1 thing to get right at a time. The more fragmented your focus the more mistakes / errors you will have.
Each small sprint provides the ability to adjust priorities. In business this is critical, if they are committed to a single path for too long, you will have people trying to break in and say "can you just get my thing done on the side" ...

Selling it to business:

Do you really want to be locked in for a long time?
If client X jumps up and wants something new which will make you an additional $500,000, do you want to make them wait 2 weeks or 6 months?

Each feature has an ROI, which is the time it saves someone over the old way of doing it by the number of people doing X. Using this you can show that releasing small things sooner will have an ROI starting in 2 weeks and continually paying off more and more with each sprint.
The graph for the other case has "nothing for 6 months" then you start with the payoff at the high point, the saving is the difference between the 2 weeks and 6 months ... Plus the Risk involved in the 6 months is a much bigger gamble ... Haven't got a good ROI for it but discussions around risk usually have the desired result.
Answer: Honestly, "only over the long run"
I've seen huge benefits in being more predictable.  (usually a team can get very predictable after 2-3 iterations).  Once you have that down, you can take on (productively) the things people are noticing that slow the team down or cause quality issues.
Keep in mind that smaller iterations are -only- beneficial (IMHO) if you get -customer- feedback on the release at the end of the iteration.  This is tough to understand until you have a customer who actually reviews and cares about the output, then you get a whole new understanding about requirements change and customer needs!


Do the conditions of skins I put in the trade-up-contract affect the condition of the resulting skin?

Question: Are the conditions of the skins I put into the arms-deal-contract or trade-up-contract affect the condition of the resulting skin?
Answer: No, they do not.
I have personally invested in 10 Factory New skins, only to get a Battle-Scarred skin as a result.
The only thing guaranteed in a trade-up contract is the Item's Quality going up by one "tier", to a max of Covert (from Case Collections).
Answer: It is impossible, or there is a very very low chance of getting a BS skin from a FN trade up. Putting in factory new skins gives a relatively high chance of getting MW or FN with a low chance of getting FT.
The skins used in trade up contracts do affect the output's wear. Here is a link where 1000 skins of different wear were traded up and you can view the results:
http://steamcommunity.com/sharedfiles/filedetails/?id=420402033


Plot of $f'(x)$ against $f(x)$

Question: What does the plot of $f'(x)$ against $f(x)$ represent?
Comment: This is not a physics question.
Comment: Describe? A portal to undefined profundity? How did you define "describe"?
Comment: FWIW, it can be quite illuminating to plot speed vs displacement. Try it with a body in an elliptical orbit. Feynman has a nice discussion about this (maybe in *Six Easy Pieces*).
Comment: In one-dimensional motion, take *x* to represent time, and *f* position, so you are discussing a plot of velocity versus position.
Comment: I understand that, but what exactly does the velocity against position plot describe?
Comment: A plot of velocity against position tells you what the velocity was when the position was in different places or vice versa.
Answer: In conservative and non-conservative dynamical system analysis such as ( Limit cycles, Van der Pol equation of oscillation, Lissajou's figures involving vibration in two directions/frequencies etc.) DEs of two, three variables are together considered coupled or decoupled. They  occur in mechanical or electrical dynamic systems.
They can be represented as phase portraits which are displacement/velocity plots. We  see how much deviation is there from simplest harmonic model situation (ellipse) due to oscillations in-phase, out of phase or partial offset at start points of prescribed boundary values.The plot can visually display effects of stiffness or damping.
In Lyapunev Stability $( \dot x, \ddot x) $ of state variables  we see elliptic points, saddle points etc., characterizing the dynamics coming out of the governing ODE or transfer function.

Phase portraits are a characteristic of the entire dynamical process.
Van der Pol Oscillator
Answer: It represents the derivative in terms of the original function. Without context, that's as much as I can answer.
Comment: Lets suppose $f(x)$ is displacement and $x$ is time.
Comment: Well assuming that  the displacement vs time function is either monotonically increasing of decreasing, then $f$ vs $f'$ would represent the linear position vs velocity graph. I say monotonically because if your function $f(x)$ increases then decreases, then for the same displacement, it will have 2 different possible values of velocity. So you'd have to figure out which speed you need.
Comment: I see! That makes sense. Thank you.
Answer: In general, the only thing you can tell from a velocity-displacement graph is what the velocity is given the displacement, and vice-versa (although if the graph isn't one-to-one, then we may have various different values of displacement for a given value of velocity).

Plot of $f'(x)$ against $f(x)$


How do I force Postgres to use a particular index?

Question: How do I force Postgres to use an index when it would otherwise insist on doing a sequential scan?
Comment: +1 I would love to see this feature. It's not a matter of simply disabling seq scan, as other answers say: we need the ability to force PG to use a **specific index**. This is because in the real word stats can be [completely wrong](https://dba.stackexchange.com/q/260817/66756) and at that point you need to use unreliable / partial workarounds. I agree that in simple cases you should first check the indexes and other settings, but for reliability and advanced uses on big data we need this.
Comment: MySQL and Oracle both have it... Not sure why Postgres' planner is so unreliable.
Comment: Duplicated, see http://stackoverflow.com/questions/14554302/postgres-query-optimization-forcing-an-index-scan
Answer: Assuming you're asking about the common "index hinting" feature found in many databases, PostgreSQL doesn't provide such a feature. This was a conscious decision made by the PostgreSQL team. A good overview of why and what you can do instead can be found here. The reasons are basically that it's a performance hack that tends to cause more problems later down the line as your data changes, whereas PostgreSQL's optimizer can re-evaluate the plan based on the statistics. In other words, what might be a good query plan today probably won't be a good query plan for all time, and index hints force a particular query plan for all time.
As a very blunt hammer, useful for testing, you can use the enable_seqscan and enable_indexscan parameters. See:

Examining index usage
enable_ parameters

These are not suitable for ongoing production use. If you have issues with query plan choice, you should see the documentation for tracking down query performance issues. Don't just set enable_ params and walk away.
Unless you have a very good reason for using the index, Postgres may be making the correct choice. Why?

For small tables, it's faster to do sequential scans.
Postgres doesn't use indexes when datatypes don't match properly, you may need to include appropriate casts.
Your planner settings might be causing problems.

See also this old newsgroup post.
Comment: With over 30 years of experience on platforms such as Oracle, Teradata and MSSQL, I find the optimizer of PostgreSQL 10 not especially smart. Even with up-to-date statistics it generates less efficient execution plans than forced in a special direction. Providing structural hints to compensate these issues would provide a solution to allow PostgreSQL to grow in more market segments. IMHO.
Comment: I hate to revive an old question but I see often in Postgres documentation, discussions and here, but is there a generalized concept for what qualifies for a *small table*? Is it something like 5000 rows, or 50000 etc?
Comment: Agreed, Forcing postgres to do it your way usually means you've done it wrong. 9/10 Times the planner will beat anything you can come up with. The other 1 time its because you made it wrong.
Comment: @waffl Have you considered benchmarking? Create a simple table with an index and an accompanying function for filling it up with *n* rows of random junk. Then start looking at the query plan for different values of *n*. When you see it start using the index, you should have a ballpark answer. You can also get sequential scans if PostgreSQL determines (based on statistics) that an index scan isn't going to eliminate very many rows, too. So benchmarking is always a good idea when you have real performance concerns. As an off-hand, anecdotal guess, I'd say a couple thousand is usually "small."
Comment: I think it is a good idea for checking really operator classes of your index hold.
Answer: Probably the only valid reason for using
set enable_seqscan=false

is when you're writing queries and want to quickly see what the query plan would actually be were there large amounts of data in the table(s). Or of course if you need to quickly confirm that your query is not using an index simply because the dataset is too small.
Comment: this short reply actually gives a good hint for testing purposes
Comment: @BrianHellekin Better, `SET SESSION enable_seqscan=false` to only affect yourself
Comment: No one is answering the question!
Comment: SESSION is the default so it's equivalent to set enable_seqscan=false
Comment: @IvailoBardarov The reason all these other suggestions are here is because PostgreSQL doesn't have this feature; this was a conscious decision made by the developers based on how it's typically used and the long term problems it causes.
Comment: A nice trick to test: run `set enable_seqscan=false`, run your query, and then quickly run `set enable_seqscan=true` to return postgresql to its proper behaviour (and obviously don't do this in production, only in development!)
Answer: TL;DR
Run the following three commands and check whether the problem is fixed:
ANALYZE;
SET random_page_cost = 1.0;
SET effective_cache_size = 'X GB';    # replace X with total RAM size minus 2 GB

Read on for further details and background information about this.
Step 1: Analyze tables
As a simple first attempt to fix the issue, run the ANALYZE; command as the database superuser in order to update all table statistics. From the documentation:

The query planner uses these statistics to help determine the most efficient execution plans for queries.

Step 2: Set the correct random page cost
Index scans require non-sequential disk page fetches. PostgreSQL uses the random_page_cost configuration parameter to estimate the cost of such non-sequential fetches in relation to sequential fetches. From the documentation:

Reducing this value [...] will cause the system to prefer index scans; raising it will make index scans look relatively more expensive.

The default value is 4.0, thus assuming an average cost factor of 4 compared to sequential fetches, taking caching effects into account. However, if your database is stored on an SSD drive, then you should actually set random_page_cost to 1.1 according to the documentation:

Storage that has a low random read cost relative to sequential, e.g., solid-state drives, might also be better modeled with a lower value for random_page_cost, e.g., 1.1.

Also, if an index is mostly (or even entirely) cached in RAM, then an index scan will always be significantly faster than a disk-served sequential scan. The query planner however doesn't know which parts of the index are already cached, and thus might make an incorrect decision.
If your database indices are frequently used, and if the system has sufficient RAM, then the indices are likely to be cached eventually. In such a case, random_page_cost can be set to 1.0, or even to a value below 1.0 to aggressively prefer using index scans (although the documentation advises against doing that). You'll have to experiment with different values and see what works for you.
As a side note, you could also consider using the pg_prewarm extension to explicitly cache your indices into RAM.
You can set the random_page_cost like this:
SET random_page_cost = 1.0;

Step 3: Set the correct cache size
On a system with 8 or more GB RAM, you should set the effective_cache_size configuration parameter to the amount of memory which is typically available to PostgreSQL for data caching. From the documentation:

A higher value makes it more likely index scans will be used, a lower value makes it more likely sequential scans will be used.

Note that this parameter doesn't change the amount of memory which PostgreSQL will actually allocate, but is only used to compute cost estimates. A reasonable value (on a dedicated database server, at least) is the total RAM size minus 2 GB. The default value is 4 GB.
You can set the effective_cache_size like this:
SET effective_cache_size = '14 GB';   # e.g. on a dedicated server with 16 GB RAM

Step 4: Fix the problem permanently
You probably want to use ALTER SYSTEM SET ... or ALTER DATABASE db_name SET ... to set the new configuration parameter values permanently (either globally or per-database). See the documentation for details about setting parameters.
Step 5: Additional resources
If it still doesn't work, then you might also want to take a look at this PostgreSQL Wiki page about server tuning.
Comment: I even had to set random_page_cost = 0.1 in order to make index scan work on large (~600M rows table) in Pg 10.1 on Ubuntu. Without the tweak, seq  scan (despite being parallel) was taking 12 mins (Note that Analyze table was performed!). Drive is SSD. After the tweak, exec time became 1 second.
Comment: You saved my day. I was going crazy trying to figure out how the exact same query on the same database was taking 30 seconds on one machine and less than 1 on another, even after running analyze on both ends...
To whom it may concern : the command
'ALTER SYSTEM SET random_page_cost=x'
sets the new default value globally.
Answer: Sometimes PostgreSQL fails to make the best choice of indexes for a particular condition. As an example, suppose there is a transactions table with several million rows, of which there are several hundred for any given day, and the table has four indexes: transaction_id, client_id, date, and description. You want to run the following query:
SELECT client_id, SUM(amount)
FROM transactions
WHERE date >= 'yesterday'::timestamp AND date < 'today'::timestamp AND
      description = 'Refund'
GROUP BY client_id

PostgreSQL may choose to use the index transactions_description_idx instead of transactions_date_idx, which may lead to the query taking several minutes instead of less than one second. If this is the case, you can force using the index on date by fudging the condition like this:
SELECT client_id, SUM(amount)
FROM transactions
WHERE date >= 'yesterday'::timestamp AND date < 'today'::timestamp AND
      description||'' = 'Refund'
GROUP BY client_id

Comment: Nice idea. However, when we disable current index usage with this method - postgresql query optimizer fallbacks to next suitable index. Thus, no guarantee that optimizer will choose `your_wanted_index`, it can be so that postgresql engine will just perform a sequence / primary key scan instead. Conclusion - there is no 100% reliable method to force some index usage for PostgreSql server.
Comment: What if there is no `where` condition but two tables or joined and Postgres fails to take the index.
Comment: @Surya the above applies to both WHERE and to JOIN ... ON conditions
Answer: One thing to note with PostgreSQL; where you are expecting an index to be used and it is not being used, is to VACUUM ANALYZE the table.
VACUUM ANALYZE schema.table;

This updates statistics used by the planner to determine the most efficient way to execute a query. Which may result in the index being used.
Another thing to check is the types.
Is the index on an int8 column and you are querying with numeric? The query will work but the index will not be used.
Comment: This is bar far the best answer or at least the first thing to try when an index is not being used.
Answer: The question on itself is very much invalid. Forcing (by doing enable_seqscan=off for example) is very bad idea. It might be useful to check if it will be faster, but production code should never use such tricks.
Instead - do explain analyze of your query, read it, and find out why PostgreSQL chooses bad (in your opinion) plan.
There are tools on the web that help with reading explain analyze output - one of them is explain.depesz.com - written by me.
Another option is to join #postgresql channel on freenode irc network, and talking to guys there to help you out - as optimizing query is not a matter of "ask a question, get answer be happy". it's more like a conversation, with many things to check, many things to be learned.
Answer: There is a trick to push postgres to prefer a seqscan adding a OFFSET 0 in the subquery
This is handy for optimizing requests linking big/huge tables when all you need is only the n first/last elements.
Lets say you are looking for first/last 20 elements involving multiple tables having 100k (or more) entries, no point building/linking up all the query over all the data when what you'll be looking for is in the first 100 or 1000 entries.  In this scenario for example, it turns out to be over 10x faster to do a sequential scan.
see How can I prevent Postgres from inlining a subquery?
Comment: Nice trick. Although a good optimizer should of course optimize away the offset 0 :-)
Answer: Indexes can only be used under certain circumstances.

For example the type of the value fits to the type of the column.
You are not doing a operation on the column before comparing to the value.

Given a customer table with 3 columns with 3 indexes on all of the columns.
create table customer(id numeric(10), age int, phone varchar(200))

It might happend that the database trys to use for example the index idx_age instead of using the phone number.
You can sabotage the usage of the index age by doing an operation of age:
 select * from customer where phone = '1235' and age+1 = 24

(although you are looking for the age 23)
This is of course a very simple example and the intelligence of postgres is probably good enough to do the right choice. But sometimes there is no other way then tricking the system.
Another example is to
select * from customer where phone = '1235' and age::varchar = '23'

But this is probably more costy than the option above.
Unfortunately you CANNOT set the name of the index into the query like you can do in MSSQL or Sybase.
select * from customer (index idx_phone) where phone = '1235' and age = 23.

This would help a lot to avoid problems like this.
Answer: Apparently there are cases where Postgre can be hinted to using an index by repeating a similar condition twice.
The specific case I observed was using PostGIS gin index and the ST_Within predicate like this:
select *
from address
natural join city
natural join restaurant
where st_within(address.location, restaurant.delivery_area)
and restaurant.delivery_area ~ address.location

Note that the first predicate st_within(address.location, restaurant.delivery_area) is automatically decomposed by PostGIS into (restaurant.delivery_area ~ address.location) AND _st_contains(restaurant.delivery_area, address.location) so adding the second predicate restaurant.delivery_area ~ address.location is completely redundant. Nevertheless, the second predicate convinced the planner to use spatial index on address.location and in the specific case I needed, improved the running time 8 times.


Why iAd doesn't display ads?

Question: I recently launch a n iPhone app, with iAd on it. I simply dragged a banner to the app, which should be supposed to work. However, after several hours of app being in app store, the app cannot display adds on my testing iPhone. Anyone encounter similar problem?
Answer: Please verify that you have properly filled up the Bank and Taxation details and also agreed to Paid application license of the Developer account.
These are the common issues with iAd not displaying on app store application.

Why iAd doesn't display ads?


Would you advise against having a fictional continent as the setting for a Science Fiction story?

Question: Let me elaborate. In things such as Game of Thrones and Lord of the Rings (so, high fantasy), fictional continents are quite often the setting. I don't recall ever seeing this in Science Fiction. My world does include both modern technology (cars, computers) as well as futuristic technology such as advanced aircrafts and exo-suits. The reason for wanting to set it on my own fictional continent is so I can create a unique world including a huge technologically advanced city to the North (technology is scarce in the rest of this world), deadly forests, and creatures that live in the wilds all on one land mass. I considered setting the story in a post-apocalyptic version of an existing country, but I don't think the world I envisioned would be quite as dynamic if I had to build it within a 'template'.
Comment: What is the setting that you want? Earth, alt-Earth, or an entirely different planet?
Answer: There's nothing wrong with doing so, and I can think of several examples where a sci-fi setting has been humans on a fictional world (or worlds). Typically but not always it's either explicit or implied that humanity has come to the world at some point from Earth but it's not essential. Often even where the Earthly origin of humanity is expressly stated it's little more than a footnote.
Bottom line is that if the story you want to tell is better told on not-Earth then set it there.
Answer: The examples cited by you of Game of Thrones and Lord of the Rings are both set in what are usually called Secondary Worlds. These are worlds essentially similar to our own, but with different yet still similar histories and geographies. So they can have lands and continents that do not exist in our own world. In secondary worlds inventing your own continents is simply par for the course.
Historically we have imaginary lands such as Atlantis, Lemuria and Hyborea. These fantasy lands were created at times when peoples understanding of geography and geological history was impoverished compared to the present era.
Fiction set in worlds which are ostensibly versions of ours can contain smaller imaginary bodies of land such as Treasure Island and Skull Island (as in King Kong). There is also the Soviet Union era novel set on the imaginary island of Crimea. Alas, I don't remember the author's name or the title of the novel.
Closest equivalent to what you ask is the British literary novel Continent by Jim Crace. This is set on a purely fictional continent. So what you want to do is not without precedent.
In principle there is nothing to stop an author from writing about a fictional continent. It's about time we had the new genre of alternative geography top match the well-established one of alternative history. Have fun with writing it.
Comment: _Alternate_ history, not alternative history.  Alternate history is what could've happened, but didn't.  "Alternative history" is claiming that something that didn't happen _actually did_ (or vice versa), like the "LBJ shot JFK!" quacks.
Comment: @Vikki Definitely not. Alternative history is what could have happened, but didn't. Stories involving it usually give a reason what makes it different, therefore an alternative to history as we know it. Alternate history is a synonym of alternative history, and vice versa. Your version of alternative history is one I have never seen used anywhere except for your comment. I would call that pseudohistory not alternative, and that's being kind to the lunatics who peddle it.
Answer: Take a moment to consider the most famous Sci-Fi series that you can think of.
Is "Star Wars" one of them?  How about "Firefly"?  "Dragonriders of Pern"?  Even - to a lesser extent - "Star Trek".
Sci-Fi not only regularly has fictional continents, but also fictional planets and galaxies, all with associated geography/cartography and political landscapes.  Often these have semi-human inhabitants (to make it easier for the viewer or reader to comprehend), some of which have sometimes originated on Earth, but others haven't.
Answer: If you do not recall seeing fictional continents in Sci Fi, you should read more. They have been used extensively for several centuries, or even millennia. Perhaps, being more flexible with the definition of what Sci Fi is, might help you. No, I would never advise an aspiring author against using any tool they deem viable! Fictional anything is fine in fiction. This is the definition of fiction: fictional things, fictional concepts, fictional characters. If it's fictional, if fits in fiction. Wikipedia has a list of fictional continents, for starters. Power to you!


Determine whether a function is injective, surjective, or bijective.

Question: I have been asked to determine whether-
$h : \mathbb{N} \rightarrow \mathbb{N}$ defined by $h(x) = x^3$ is injective, surjective or bijective. And why?
Comment: And which of the three (injective, surjective, bijective) do you suspect to be true? Having a guess is a good start.
Comment: Ok. That's a start. I claim that it is not surjective. Do you have any idea why?
Comment: I do not know how to approach it.
Comment: I suspect it's bijective
Comment: Why? Because the range of the function h(x) equals its codomain.
Comment: Check whether different $x$ give same $h(x)$ (injectivity), and whether all real numbers are reached by $h$ (surjectivity).
Comment: h(1) = 1, does that make it injective?
Comment: And @user328442 why do you think it isn't surjective?
Comment: @Tobari see my answer
Answer: The function here is injective but not surjective and therefore not bijective.
To see that it is injective, note that $h(x)$ is strictly increasing on $\mathbb{N}$. So, if $n,m \in \mathbb{N}$ and $n \neq m$ then either $n>m$ or $m>n$. Without loss of generality, assume that $n>m$. Then we have $n^3 > m^3.$ So, if $n \neq m$ then $h(n) \neq h(m).$
To see that it is not surjective, consider $2 \in \mathbb{N}$ and note that there does not exist a natural number $x$ such that $x^3 = 2$.
Comment: Thank you very much for your detailed answer, could you please tell me how to prove that a function is surjective?
Comment: @Tobari a function is surjective if and only if every element in the range has a corresponding element in the domain that maps to it. In this case, we would need that for any $n \in \mathbb{N}$, there would need to exist some $m \in \mathbb{N}$ such that $h(m) = n$. The problem is that I have found an $n$ (I chose the natural number $2$) with no $m$ such that $h(m) = n.$
Comment: Thank you for your response, I get it now.
Answer: Make sure you know what the definition of injection, surjection, and bijection are before answering these questions. Note that there are several equivalent definitions of what it means for a function to be invertible, one of which is that it is one of the above three definitions, another is that
$f(a) = f(b)$ implies $a = b$
You can use the given function to directly prove that.
Now as for surjectivity. The $h:\mathbb{N} \rightarrow \mathbb{N}$ restriction is important. Can you think of a natural number that, when cubed, equals 2?
Answer: To show a function is injective, you want to show that If $f(x) = f(y)$ then $x = y$
So let $h(x) = h(y)$ Then $x^3 = y^3$ and when we cube root each side we get $x = y$. Therefore it is injective
To show a function is surjective, for any element in the codomain we have to show their is an element in the domain that maps to it. Is there an natural number that when we cube it we get 10? No. So clearly this function is not surective over the natural numbers.
To be bijective it has to be injective and surjective, so we know its not a bijection. Thus it is just an injection.
Comment: Thank you, but what if you have something like this: f: { -1,0,1} --> {-1,0,1} defined by f(x). Is it injective as well because x^2 = y^2?
Comment: @Tobari Do you mean if $f(x) = x^2$? In that case no, because the square root gives you two values, a positive and a negative, so in that case dont have to be equal. For example $x=2, y=-2$ but $f(x) = f(y)$


ExpressionEngine Safecracker Guest Thank you email

Question: Is it possible after submitting a safecracker form to send a thank you email to the guest?
Answer: I suggest you look at the Postmaster add-on - it allows you to send fully-customizable email notifications after entries are submitted and/or edited (among other events).
(You'll have to make sure you collect the guest's email address as a custom field in your Safecracker form of course.)
Comment: You can certainly write your own extension that utilizes the [safecracker_submit_entry_end hook](http://ellislab.com/expressionengine/user-guide/modules/safecracker/development.html#safecracker-submit-entry-end), extracting the entry info from the passed Safecracker object, then assembling and sending an email programatically ... but I'm betting that will take more than $65 of your time. :)
Comment: Thank you for your reply! This seems like a great solution, but it is quite expensive. Is there no free way to do the same thing? Thanks


WiFi Location Tracking

Question: I got a question about pinpointing devices on one WiFi network. Let's say for example I sit at my home and I bought that big beefy WiFi antena and use it to connect to local cafe 100m down the street. And let's say someone is looking for me, when they track my location  will my address or the address of local cafe show up ?
Comment: What address are you talking about? Street address? IP Address? MAC Address? In that order : They wouldn't find your address without throwing a lot of time/money into locating you; it would be their public IP address and the IP their AP handed to you; it would be your computer's MAC address.
Comment: [OT but hopefully a little bit relevant:] Are you familiar with the fact that your mobile phone could be location tracked even if it is switched off?
Answer: If somebody is looking for you, he could find out your public IP address (by for example sending you a link to a web page on a server that he hosts, or even a known public forum post with an embedded image that is hosting on his server). In your case that IP address is actually the IP of your Cafe. That would bring him close to you, but too close you.
Your computer has just a private IP address assigned by the Cafe to which you connect, but that IP address would not tell anything about your location.
But based on the strength of the WiFi signal that is being sent from your computer, it would be possible to identify your location, in case someone has the right tools and has identified your appriximate location or the locatinf of the Cafe to which you connect.
I assume that you do not share your GPS data of course.
If you would use TOR, it would be much harder to find you or the IP of the Cafe you are connecting to.
Comment: re TOR: Harder maybe, it depends who is looking for you and, to a degree, what country/locality you are in.
Answer: If you were to use a directional antenna then an attacker would need to be located close enough to the directional signal in order to physically locate you. Even then, they would only get the direction. By moving upstream, they would be able to see the signal strength increase - maybe - there are quite a few variables involved including your height above street level and how many residences there are in the locality.
An attacker would, of course, know that you are within signal reach of the cafe assuming they could track your IP address back to that particular spot. Something that would normally be possible, at least to a national-level organisation with government ties.
Without significant investment in time and manpower, they would only know your IP address and maybe some other information leaked from your PC depending on what you are doing online.
Some of the info that would be leaked from your PC is the MAC address that would potentially identify the network card you are using and maybe the PC. Also browser parameters that again may reveal the PC type in use.
Answer: As the previous replies has pointed out, your public IP would be traceable to the cafe, without any issues. Beyond that the network administrator could probably trace your more exact location with help of the access point(s), because most access points today have the ability to register in which direction a connected client is and the approximate distance to said client.
However, there are a few more unique identifiers on your machine, like your mac-address, and if you're very unlucky, the net-bios name of your PC gets registered as well outside of the cafe network. There are ways to use a website to "spoof" the net-bios name, OS version, web browser and etc, of any connected client. But the net-bios name (and other info) is really only as traceable in this situation as your mac-address, so I wouldn't worry too much about it.
This does give someone the opportunity to trace your movements over time, by cross-referencing your mac-address and net-bios name. If another client appears, let's say at your home network with said network's public IP, with the same net-bios name and mac-address, one can assume it's most likely you. Thus you can technically be traced around if someone is interested in you.

WiFi Location Tracking


how to save cached data to sqlite DB (android)

Question: hey , I want to cache google maps, and put them into the memory, using sqlite DB,so that I don't have to always use the internet connection! is that possible? and if it is possible I would like to know how?
thanks
Answer: As noted previously, this is a violation of the terms of service.


Does there exist a $1$-form $\alpha$ with $d\alpha = \omega$?

Question: Let $\omega := dx \wedge dy$ denote the standard area form on $\mathbb{R}^2$. As the question title suggests, does there exist a $1$-form $\alpha$ with $d\alpha = \omega$?
Comment: $d(x dy) = ?$   ${}{}{}$
Answer: Well, $\mathrm d\omega = 0$ and $\omega$ is defined everywhere, so the answer to your question is yes.
You probably want to see such a 1-form, though. You can either make some educated guesses such as John Ma's suggestion and try them out, or compute an antiderivative directly. I'll do the latter here since it's a simple illustration of the method.
Step 1. Substitute $x^i \to tx^i$ and $\mathrm dx^i\to x^i\,\mathrm dt + t\,\mathrm dx^i$; $$(x\,\mathrm dt + t\,\mathrm dx) \land (y\,\mathrm dt + t\,\mathrm dy) = tx\,\mathrm dt\land\mathrm dy + ty\,\mathrm dx\land\mathrm dt + t^2\,\mathrm dx\land\mathrm dy$$
Step 2. Discard all terms not involving $\mathrm dt$ and move it to the left in the remaining terms:$$tx\,\mathrm dt\land\mathrm dy - ty\,\mathrm dt\land\mathrm dx$$
Step 3. Treat the result as an ordinary integrand w/r $t$ and integrate from $0$ to $1$:$$\int_0^1 (tx\,\mathrm dy - ty\,\mathrm dx)\,\mathrm dt = \frac12(x\,\mathrm dy-y\,\mathrm dx). $$ This form might look familiar to you.
Note that, just as there's an arbitrary constant of integration in elementary calculus, you can add $\mathrm df$, where $f$ is a real-valued function, to this and get another antiderivative of $\omega$. E.g., taking $f(x,y)=\frac12xy$ gives $x\,\mathrm dy$.

For the curious, here's what's going on above (asserted without proof, following Bamberg & Sternberg in A Course In Mathematics For Students of Physics).
Let the $k$-form $\omega$ ($k>0$) be defined in a star-shaped region $Q$ of $\mathbb R^n$. Define a function $\beta$ on $[0,1]\times Q$ that for each $p\in Q$ maps the interval $[0,1]$ to the line segment joining $p$ to the origin. For any function $g$ defined on $Q$, $(\beta^*g)(t;x^1,\dots,x^n)=g(tx^1,\dots,tx^n)$.
The pullback $\beta^*\omega$ is a sum of two types of terms: $$\tau_1(t)=A(t;x^1,\dots,x^n)\,\mathrm dx^{i_1}\land\cdots\land\mathrm dx^{i_k} \\ \tau_2(t)=B(t;x^1,\dots,x^n)\,\mathrm dt\land\mathrm dx^{i_1}\land\cdots\land\mathrm dx^{i_{k-1}},$$ i.e., terms that don't involve $\mathrm dt$ and those that do. Define a linear operator $L$ as follows: $$\begin{align}
L\tau_1 &= 0 \\
L\tau_2 &=\left(\int_0^1 B\,\mathrm dt\right)\,\mathrm dx^{i_1}\land\cdots\land\mathrm dx^{i_{k-1}}
\end{align}$$ This operator has the property that $$\begin{align}
\mathrm dL\tau_1+L\mathrm d\tau_1 &= \tau_1(1)-\tau_1(0) \\
\mathrm dL\tau_2+L\mathrm d\tau_2 &= 0.
\end{align}$$ So, type $\tau_2$ terms can be ignored in $\mathrm dL(\beta^*\omega)+L\mathrm d(\beta^*\omega)$ and since $\tau_1(0)=0$ because of the factor of $t$ that accompanies each $\mathrm dx^i$, we have $$
\mathrm dL(\beta^*\omega)+L\mathrm d(\beta^*\omega) = \omega.
$$ If $\mathrm d\omega=0$, this becomes simply $\mathrm dL\beta^*\omega = \omega$.
The process at the top of the answer computes $L\beta^*\omega$. Step 1 is just forming the pullback; step 2 is some bookkeeping; and step 3 computes $L\tau_2$. The $\tau_1$ terms can be discarded at any point and the first two steps can of course be combined if you're careful. This procedure can be extended to work for any region that's the image of a star-shaped region under a smooth one-to-one mapping.
Comment: @mandella I'd also caution you against calling the result **the** antiderivative. It's _an_ antiderivative (a.k.a.) primitive of $\omega$, one of an infinite number. Since any two primitives differ by a closed form, they can look quite different, unlike the antiderivative of a simple scalar function, to which you generally just slap on an arbitrary constant.
Comment: I think this answer would be more enlightening (for me at least!) if you explained the reasoning behind these substitutions and other steps.
Comment: @AlexProvost The reasoning follows the fact that $\Bbb R^n$ is contractible to the origin, in fact it is convex, so every point $x$ can be joined to say the origin $0$ by the line $tx$, $0<t<1$. This motivates the construction of a "chain contraction" of the deRham complex, which gives when $d\omega=0$ a form $\alpha$ for which $d\alpha= \omega$.
Comment: @AlexProvost What he said :) I felt that I was already going a bit afield, so didn't want to clutter the answer further. I've updated it with a brief descriptions of what's going on.
Comment: @amd Thanks, this is great!
Comment: @mandella I learned it from Bamberg & Sternberg's _A Course In Mathematics For Students of Physics_. I expect that there's a more rigorous treatment in Loomis & Sternberg's _Advanced Calculus_. There's not much to prove, though, I think. Most of the assertions are pretty self-evident. Pedro Tamaroff's comment above gives a nice motivation of the process in terms of cohomology.
Comment: I really like this method to determine the antiderivative. Do you have any literature that involves a proof for your above statement?
Answer: $\newcommand{\dd}{\partial}$If $f$ and $g$ are real-valued functions of class $C^{1}$, and $\alpha = f\, dx + g\, dy$, then
$$
d\alpha = \left(\frac{\dd g}{dx} - \frac{\dd f}{dy}\right) dx \wedge dy.
$$
Consequently, $\omega = d\alpha$ if and only if
$$
\frac{\dd g}{dx} - \frac{\dd f}{dy} \equiv 1.
$$
The pleasure of finding as many $\alpha$ as necessary is left to you.


Windows 10 upgrade listed as "insider preview"

Question: I reserved my windows 10 upgrade using the system tray popup. Now, windows update shows the windows 10 insider preview is available for download. Is that the full version/release of windows 10, or truly just the latest version of the discontinued insider previews?
Comment: I require some information to provide you the correct information..  Do you have [this update installed](https://support.microsoft.com/en-us/kb/3035583)?  What version of Windows are you running exactly?
Comment: Sorry for being a little vague. I'm running windows 7 home premium. I do have that update installed.
Comment: The screenshot does not seem accurate.  You have pending updates.  Can you provide what is contained with the window "check your upgrade status"?
Comment: If you have the "Get Windows 10" icon still visible, and even if you don't it likely will work, you can run the command `wuauclt.exe /updatenow` to get a window that will walk you through getting the update.  You might also have to delete the existing hidden directory, which contains the Windows 10 files, check their date the folder should have recently been modified in the last 48 hours.
Answer: Windows 10 Insider Preview is not the full version/release of Windows 10. The insider preview is pre-release of product, you can see more information about this program here: https://insider.windows.com/
Comment: **This answer is not 100% correct.**  The Insider Preview actually is the full version of Windows 10.  Microsoft has plans to continue the program through the lifespan of Windows 10 ( in other words for the next 10 years at least ). Your link even says that.
Comment: Thanks mate! Any idea when they will release the full version? I had the insider preview installed at one point but reverted later.


WiFi Drivers for Kali Linux

Question: I'm new to Linux operating system and I have Kali Linux installed along Windows on my Laptop. I don't know how to connect to WiFi in Kali Linux. When I press the network settings I get Wired Connection, Proxy settings and all but no WiFi. What should I do? I read some answers here and over Google but I can't understand a bit. So please can anyone help step by step?
Answer: Most likely your wireless adapter requires firmware. Firmware is not always free software, and if it is not then it cannot be distributed together with main software.
Since Kali is a Debian-derived system, inspect your /etc/apt/sources.list. As an example, you may see a line (the path may differ in your case):

deb http://pubmirrors.dal.corespace.com/debian/ testing main
Edit the line to read:

deb http://pubmirrors.dal.corespace.com/debian/ testing main contrib non-free
(i.e. add contrib non-free).
Save, run your package manager (does Kali have synaptic?) and tell it to reload the repositories. Then within the package manager search for the model of your wireless adapter. Chances are a package from the non-free group will contain the firmware you need, so install it and reboot.

WiFi Drivers for Kali Linux


Are there any problems in $\mathsf{BPP}$ that are known to be $\mathsf{RP}$-hard or $\mathsf{coRP}$-hard?

Question: It's suspected that probabilistic complexity classes such as $\mathsf{RP}$ or $\mathsf{BPP}$ don't have complete problems. Of course, their promise counterparts have complete problems, but I am not asking about promise problems. So, I have relaxed the restriction of completeness.
Comment: I doubt there are natural such problems known, just because we know so few natural problems in BPP \ (RP union coRP) at all (see https://cstheory.stackexchange.com/q/11425/129). But can one build such a problem unconditionally (even if "unnatural")? Interesting Q.
Answer: It would be a very interesting result if one were able to present a language in BPP that is hard for RP (equivalently, for co-RP) under poly-time Turing reducibility (aka Cook reducibility).  I'm quite sure that no such language is known (natural or artificial).  If one can present such a set, then this would yield an enumeration of bounded-error probabilistic machines (BPP machines) that captures all of RP; this would be quite interesting, and I'm sure that no such enumeration is known.
However, note that many (perhaps most?) complexity theoreticians think that BPP = P, and thus the Circuit Value Problem is very likely hard for BPP under AC^0 reductions.


Offered job but still awaiting offer letter, follow-up then informed that it will be issued based on the result after after a 3rd interview

Question: I have went through the 2nd interview and was being offered the job verbally. They told me will receive the offer letter within a week and there will be a 3rd interview (just formality) according to procedure.After a week when I follow-up then they informed me that the offer letter could only issued after the result of the 3rd interview. The 3rd interview will be after 3 weeks more but not confirmed. Please advise the reason they are delaying my hiring ? are they interviewing another candidate?
Comment: You haven't been hired nor has an offer been extended. While it's likely you will get the formal job offer, until you sign it and actually show up for the first day, it can be withdrawn in most cases.  You should take the third round of interviews like they are the first.
Answer:
Please advise the reason they are delaying my hiring

They've already done that: An offer is issued after three interviews
The 3rd interview requirement might be a formality, or they're stalling to interview other candidates, or any number of things, none of which matter. You don't have an offer letter so you don't have a job offer. Keep calm and keep looking for a job.
Comment: More importantly, don't resign from your current job (if you have one) until you have the offer letter in hand! Nothing is definite until you have that letter.
Comment: thank u for all the advise. so it's not been confirmed anyway...really has to keep looking but it's hard nowadays where I'm currently quite desperate.