Creating palette from irregular sprites in Unity

Question: I want to create a palette based on a number of PNGs in Unity 2D. I am struggling to understand the slicing logic. Let's say I have a sprite 588x547, and I set PPU to 128. So obviously the sprite cannot be divided into 128-parts:

So the right and the bottom part are not going to appear on my palette.
Now I would like the grid to start in the center. The tiles on the sides are not "full" tiles, but I still want them on my palette in the end, so I kind of want Unity to fill up the border tiles for me with void till they reach the 128x128 size:

Is there a way to achieve this? Or am I conceptually misunderstanding something? Given a bunch of PNGs, all of them different pixel sizes, none dividable by 128, how do you create a palette from them to paint on a 128 PPU grid?
I had a look at external tools like TexturePacker and Showbox, but did't manage to achieve a nice 128-dividable grid from my sprites.
Comment: It seems to me that you could do this by dragging out your desired sprite rectangles manually, and editing the numeric fields to snap them to your exact 128 stride target. Have you had any trouble making that work?
Comment: What do you mean by "dragging out"? In the Unity slicing editor? Or in an external app? My last resort would be loading it all into Inkscape and puting sprites into right places on a 128 grid, then loading the sheet into Unity and slicing it. But I was hoping there might be an automatic way..
Comment: Yes, Unity lets you draw whatever bounding rectangles you want for your sprites inside its own editor.
Answer: The easiest way to do this by using a tile palette or just resizing the image by not cutting it up. So you can change the image to Point (No filter) instead of Bilinear. After that you choose (Grid by cell size). Then you get a series of cut p parts (Also, you should probably choose a power of 2 or a multiple of two). Then click create, 2d, tile map. Then, you can go to Window, 2d, and Tile Palette. Click create tile palette and select the series of images that you want to be to create the image. Then you can place the correct part at the correct place. Hope this helps! (also, you can use the original image and create a box collider if that's what you want. you can do that by just choosing Automatic instead of Cell by Grid size). Let me know if you want more help.
Comment: can someone please upvote my answer, I would really appreciate it!
Answer: Well, I could not figure it out with Unity, so I ended up resizing all my sprites to 128-divisible sizes by adding transparent borders, so that to be able to cut them with Unity nicely.
For this I used ImageMagic and the following command:
convert {file} -background transparent -gravity center -extent {targetW}x{targetH} {outputPath}

In order to go through all the files in the directory and calculate the next best 128-divisible size I wrote a small app in C#:
class Program
{
    static void Main(string[] args)
    {
        var sourcePath = @"d:\png";
        var targetPath = @"d:\png\output";

        var files = Directory.GetFiles(sourcePath);
        foreach (var file in files)
        {
            var img = Image.FromFile(file);
            var w = img.Width;
            var h = img.Height;
            var targetW = FindNextSize(w);
            var targetH = FindNextSize(h);

            Process.Start(
                @"...path to ImageMagic...\convert.exe",
                $@"{file} -background transparent -gravity center -extent {targetW}x{targetH} {Path.Combine(targetPath, Path.GetFileName(file))}");
            Thread.Sleep(200);
        }
    }

    private static int step = 128;

    private static int FindNextSize(int actualSize)
    {
        var result = step;
        while (result <= actualSize)
        {
            result += step;
        }

        return result;
    }
}

Not too pretty all of it, but it did what I wanted.


Should I sell shares to buy a home so I avoid a mortgage?

Question: I'll be retiring next year, and I want to be in my own home (aging-in-place).  Should I sell stocks to buy it outright and thus avoid a mortgage as I move to a fixed income.  But what about capital gains? Would a trust help?
Comment: Look at it in reverse. If your home was paid off and you didn't own those stocks, would you take out a mortgage on your home to buy them?
Comment: What country are you in, please edit and place a country tag, as tax and other laws differ from country to country.
Comment: Look at it this way, if a 50% drop in dividends can still fund your lifestyle, why would you have dormant equity?
Answer:
Should I sell stocks to buy it outright and thus avoid a mortgage as I
  move to a fixed income

No.
Stocks on the whole has outperformed fixed income in terms of returns and the last thing you want to do is kill the golden goose which lays the eggs.
With interest rates at record low and set to stay that way for the next couple of years , you should borrow from the bank to finance the purchase of the house. You can use the dividends from the stocks to pay for the monthly housing installment.

But what about capital gains? Would a trust help

I am guessing you are talking about the tax on capital gains , sorry but I am unable to help you in these area as it is outside my area of expertise
Answer: I assume that this a question for a US taxpayer.
You do not avoid capital gains on the sale of assets such as stocks by
setting up a trust.  If you are currently living in a house that you own
(possibly with a mortgage on it) and will be selling the house
and trading down to a cheaper house for your retirement life, the
capital gains on the sale of the current house will be nontaxable
(subject to some conditions). In any case, since capital gains
are taxed at lower rates than income, worrying about taxes on them is less
useful than worrying about taxes on your fixed income during retirement.
Does the income include Social Security payments
which, as many people have pointed out, can make some income be taxed
at a marginal rate of as much as 46%?
Is it taxable income from a pension plan or Traditional 401k or IRA? Or
did you make a killing in your Roth accounts and will be living
entirely off the tax-free distributions from those?
With regard to avoiding mortgages, one concern is whether you can
get a mortgage. Some lenders don't view pension payments the same
way they do salaries, and so you may need to put down a more
substantial down payment and choose a duration for the mortgage that
is smaller than your life expectancy etc. to be able to qualify for
a mortgage.
Answer: Its questions, and insightful answers, to this type of question that make me scratch my head when a kid boasts: "I will never have to do a math word problem outside of school!"
There are many variables to consider here.

Traditional mortgages are obtained at a cost beyond interest rates, consider closing costs when doing your analysis.
If you need to borrow only a "small" amount, perhaps you can do a no closing cost HELOC rather than a traditional mortgage.
Are the stocks reliable dividend payers?  It might be wise to use the income from stocks to pay the mortgage, although you are assuming risk in doing so.

For myself, I would not want to have a mortgage (or any other debt) and be in retirement.  Would it be possible to work a couple of more years to purchase the home for cash?
Comment: The third comment is a salient point that bullish stock investors fail to understand.  Stock is not a steady income stream unless you've got other resources to cover when a slump in the economy tanks your quarterly dividend payouts.  We are also talking about retirement.  Which implies few years are left to wait out a bad investment choice or the fallout of a bad economy.  Life on a fixed income focuses on `RELIABILITY` vs `POTENTIAL GROWTH`.  It all comes down to tolerance for risk.


What should I consider regarding recessed lighting above kitchen sink?

Question: I'm planning to replace the million year old florescent light (I think it was the first one ever made) above my kitchen sink with a couple recessed lights.  Is there anything specific I should be thinking about when selecting the type of fixture / bulbs?
Answer: If you've got insulation in the ceiling, you'll need to get IC (insulation contact) rated fixtures -- they're also known as closed-can.  I have a small soffet built over my sink; if yours is similar, make sure that the fixture you select will fit.  Other than that, don't exceed the wattage for the fixture and you'll be OK.
EDIT: On second thoughts, use an IC rated fixture regardless of whether or not you have insulation.  Over a sink, you're likely to have a lot of steam and if it's an open-can fixture, the stack effect is going to draw much of it up into the space over the ceiling.
Comment: Good point about the IC fixture.
Comment: What about the lights themselves incandescent, compact florescence, LED, something different?
Comment: Use a flood that fills the opening.  It can be whatever type you like (maybe not halogens though).  Wattage ratings are for incandescents, so a CFL or LED is going to be OK.  I use a daylight CFL flood.


What is the point of Python egg files?

Question: When I run python setup.py install django, it generates an egg file.
What is the usefulness of Python egg files?
Answer: The "egg" is Python's binary distribution format. It's basically a zipped file with some extra metadata that you can give another Python user. He can "install" and use them. For details on what they are, please refer to http://peak.telecommunity.com/DevCenter/PythonEggs.
Since it's a "native" format, Python can employ custom importers and the like.
For details on how to use them, check this out.
I've been out of touch with the packaging world for a while now. There was some talk of discontinuing support for binary distribution formats. The relevant documents that I know of are at http://bitbucket.org/tarek/distutils2/src/tip/docs/design/wiki.rst
Answer: the egg file is an archive which holds a module (django in your case) and gives you the ability to import something_from_egg. Read more here

What is the point of Python egg files?


Commercial AGPL application

Question: I'm developing an application using iText. iText, unless a commercial license is purchased, forces you to abide by the AGPL. My plan is to sell commercial pre-compiled copies of my software at a small cost, while leaving the source code on github for those technically adept to compile it themselves. Is this legal? Also, am I permitted to distribute iText binaries?
Comment: The answers are "yes" and "yes". For a more elaborate answer, can you explain what makes you think this is *not* legal? Did you read the license?
Comment: Have you tried to find answers in the FSF's FAQ for their licenses?
Answer: If you are the sole developer or if you hold the copyright on all the code for other reasons, you can do with it as you please.
The model you mentioned is using a strong copy-left license and selling exceptions to it.  People who want to use your code in non-free software have to pay for this exception and they then get your code under a different license.
If you accept contributions from others, this becomes more difficult because they may contribute under the AGPL.  In this case, you would also have to comply with the AGPL unless you ask for a copyright assigment or something similar.
In any case, you are free to not distribute binaries to the general public.  The requirement of the AGPL is to give the source code to people who have a binary copy (or use one over a network), but not the other way around.  The reason is that the source code enables you to exercise the four freedoms.
Everyone else is free to use your source code and compile it, though.  They may even decide to then distribute those binaries and that would also be legal as long as the comply with the AGPL.
Answer: "My plan is to sell commercial pre-compiled copies of my software at a small cost, while leaving the source code on github for those technically adept to compile it themselves."
When your application includes iText, and you licensed it under the AGPL, you need to abide by the license conditions, especially section 6 of the AGPL (Conveying Non-Source Forms). The form 6d is essentially what you suggest:

d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.

"Am I permitted to distribute iText binaries?"
When you received iText under the AGPL, you can distribute binaries when you also include the sourcecode or a written offer to provide the sourcecode if asked to do so.
When you bought a commercial license, the conditions are explained in the proprietary license agreement.

Commercial AGPL application


How should I play as White if Black Defends the Tartakover QGD without ...h6?

Question: This question is related to another I just posted, but it is actually a different question: if Black Defends the Tartakower QGD without an early ...h6, and I am an Anti-Tartakower–Makogonov–Bondarevsky vartiation player (5... h6 6. Bxf6 Bxf6), should I take an early Bxf6 nonetheless, by my own initiative, or should I keep my Bishop on g5?
Answer: It depends on your own tastes, but I'd recommend not taking. Taking after ...h6 is justified because it essentially costs Black a tempo (i.e., playing ...h6). If you take without provocation then no one's losing tempi, you're just making an exchange.
If you really like trading on f6 then go ahead, but objectively you shouldn't have any advantage.
Answer: Be careful that you don't end up a tempo down in a known line, otherwise it is good to keep all your options open. h6 can benefit Black in giving luft to a castled king but overall it is a slight weakening of his position, so you should be encouraged to wait for Black to ask the Bishop it's intentions.
Overall, unless you have a concrete reason to take the knight you should keep the Bishop.
Answer: I think what's important here is a conceptual understanding of the openings involved. What you're essentially asking is whether or not Bxf6 is worth considering in something like the Orthodox Defense variation of the QGD or some Semi-Slav variation, and what are its differences compared to the the Bxf6 move featured in the Anti-Tartakower variation of the Neo-Orthodox.
Firstly, one of the key reasons for which people may play the Neo-Orthodox rather than the Orthodox (or Semi-Slav) is that the latter ends up being more passive and cramped than the former, while still being solid. However, it features a key weakness: it uses a tempo to move the h-pawn. Even though White generally prefers to maintain the bishop (at least for a while) and to maintain the pressure in the position, the Anti-Tartakower nevertheless becomes coherent in light of this, as it takes advantage of a "wasted" tempo. Additionally, it avoids some of the more theoretical lines of the Tartakower. However, despite this, it's still generally considered a slightly worse try for White compared to the main line with Bh4.
In the Orthodox Defense, however, Black generally plays 5...O-O or 5...Nbd7. If Black plays 5...Nbd7, then 6.Bxf6 is a poor move, as it reduces White's pressure on Black's position, it makes Black's position less cramped, and it improves Black's knight on d7, all of that without even needing to invest a tempo on the h-pawn. If Black plays 5...O-O, then 6.Bxf6 is transposing to the Anti-Tartakower (which, as discussed, is already regarded as arguably not being the best try for White) but where Black has an extra tempo (as h6 wasn't played). Therefore, you can quickly tell that it must be an objectively poor choice for White. And this allows us to also address the differences between Bxf6 in the Orthodox and Bxf6 in the Neo-Orthodox: Black having an extra (and highly valuable) tempo to get his queen-side minor pieces out. Therefore, typical Anti-Tartakower plans such as playing Qb3 and trying to put pressure on the queenside will not be as effective. Therefore, while Bxf6 in the Orthodox is probably not outright losing, it almost certainly sacrifices White's opening advantage.
It's also worth noting that the same applies in the Anti-Meran Gambit of the Semi-Slav (1.d4 d5 2.c4 c6 3.Nf3 Nf6 4.Nc3 e6 5.Bg5). If Black plays the Moscow Variation (5...h6), then 6.Bxf6 is a good continuation for White. If, however, Black opts for something else (e.g. the Cambridge Springs Defence starting with 5...Nbd7), then 6.Bxf6 is no longer considered as good.


The difference between living by and walking by the Spirit

Question: Galatians 5:25 (NASB) says:

"If we live by the Spirit, let us also walk by the Spirit."

What is the difference between living by the Spirit and walking by the Spirit?
Answer: In Galatians 5:25, "live" is "live" as in "live or die" rather than "live" as in "the way I live my life". In other words, "If the Spirit is what saves us from death, let us allow that same Spirit to direct our steps"
This is reinforced in chapter 6 with a different metaphor:

8 For the one who sows to his own flesh will from the flesh reap corruption, but the one who sows to the Spirit will from the Spirit reap eternal life.    NASB
Answer: To be very succinct:
Living in the spirit is about faith, walking in the spirit is about what we practice.
Living in the Spirit
Fortunately, Paul did us a great service of defining the terms!
Early in the letter to the Galatians, we see this passage:

Galations 2:19-20 (NASB)
19 For through the Law I died to the Law, so that I might live to God. 20 I have been crucified with Christ; and it is no longer I who live, but Christ lives in me; and the life which I now live in the flesh I live by faith in the Son of God, who loved me and gave Himself up for me.

What Paul is saying here that life in God (or, as he later refers to it, living in the spirit) is still living in the flesh (meaning living in our current bodies), but living by faith in the Son of God.
Walking in the Spirit

Galations 5:16-21 (NASB)
16 But I say, walk by the Spirit, and you will not carry out the desire of the flesh. 17 For the flesh sets its desire against the Spirit, and the Spirit against the flesh; for these are in opposition to one another, so that you may not do the things that you please. 18 But if you are led by the Spirit, you are not under the Law. 19 Now the deeds of the flesh are evident, which are: immorality, impurity, sensuality, 20 idolatry, sorcery, enmities, strife, jealousy, outbursts of anger, disputes, dissensions, factions, 21 envying, drunkenness, carousing, and things like these, of which I forewarn you, just as I have forewarned you, that those who practice such things will not inherit the kingdom of God.

The idea in this passage is that if we are walking in the flesh, then we practice desires of the flesh.  When we walk in the flesh, we will practice immorality, practice jealousy, we will have outbursts of anger, we will practice drunkenness, etc.
Summary
Essentially, "living in the spirit" comes down to having faith in God (that is, having an active belief and trust in God).  "Walking in the spirit" comes down to what we focus on and what we practice (ie, the acts that we continually think about and commit).
Answer: The following  answer comes from the Recovery Version of the Bible:

To live by the Spirit is to have our life dependent on and regulated by the Spirit, not by the law. This equals the walk by the Spirit in v. 16 but differs from the walk by the Spirit in this verse.
To walk Lit., walk according to rules. The Greek word means to observe the elements , to walk according to the elements, e.g ., to walk in line, to march in military rank, to keep in step; and, derivatively, to walk in an orderly, regulated manner (cf. 6: 16 ; Acts 21: 24 ; Rom. 4: 12 and note ; Phil. 3: 16 and note 4 ).
Both the walk in v. 16 and the walk in this verse are by the Spirit and are regulated by the Spirit. The former refers to a general, daily walk; the latter, to a walk that takes God's unique goal as the direction and purpose of life, and a walk that follows the Spirit as the elementary rule, the basic principle. Such a walk is cultivated by living in the new creation ( 6: 16 and note 2 ), by pursuing Christ in order to gain Him ( Phil. 3: 12 and notes ), and by practicing the church life ( Rom. 12: 1-5 ; Eph. 4: 1-16 ), thus fulfilling God's intention in Christ for the church.

Reference: Recovery Version of the Bible footnotes
Comment: Welcome to Stack Exchange, we are glad you are here.  When you get a chance, be sure to check out the [site tour](http://hermeneutics.stackexchange.com/tour) and read up on  how this site is [a little different](http://meta.hermeneutics.stackexchange.com/questions/653/how-can-we-educate-new-users-about-our-site-distinctives#803) than other sites around the web. *This is not a comment on the quality of your answer, but rather a standard welcome message.*
Answer: Jack Douglas' answer is correct. The point refers to the distinction between ontic (or ontological) holiness and moral holiness, and can be easily seen, in Catholic and Eastern Orthodox theologies, in the case of a baptized baby: he lives by the Spirit because he has been made "partaker of the divine nature" by baptism, but he does not walk by the Spirit because he does not walk at all (in the sense of having use of reason and free will).


Why do accelerating bodies have an event horizon?

Question: I read in a book named "Three Roads to Quantum Gravity" written by Lee Smolin that any accelerating body always have some hidden region of space-time from which light is never able to catch up with them, thus they develop some sort of an Event Horizon for themselves. Since any object possessing mass can never reach the speed of light, how is it possible for an accelerating object to never catch up with a ray of light?
Comment: It's not a property of the body, it's a property of the observer or frame of reference.
Comment: You might find this reading helpful:  [Hyperbolic motion (relativity)](https://en.wikipedia.org/wiki/Hyperbolic_motion_(relativity))
Comment: A technical comment for those with enough background: you should say "horizon", which leaves it more vague, rather than "event horizon". There are many different types of horizon in relativity, see e.g. Visser (2014). I will comment on Rindler acceleration in Minkowski spacetime specifically. The lightlike hypersurface $x=t$ does not meet most definitions of horizon, for instance light rays are not converging there.
Comment: ...While it is a "horizon" of "events" in a sense, it is not an "event horizon" as this bounds all events which cannot signal to infinity. It is a Killing horizon, if we take the Killing vector field which matches the 4-velocity field of the Rindler worldlines, though it would seem more natural to take the Killing vector field corresponding to time in an inertial frame.
Answer: The horizon that forms for a constantly accelerating frame in flat spacetime is a beautiful thing; it teaches all sorts of helpful lessons about G.R. I think the nicest way to appreciate it is to take a long look at the following diagram and the commentary that follows it:

These two diagrams show the same region of spacetime. It is flat spacetime, so Special Relativity applies. On the left you have the usual way to treat it, using the $x,t$ coordinates of an inertial frame. The $t$ axis is vertical, the $x$ axis horizontal and we take $c=1$. On the right is shown the same events but using coordinates
$ h = (x^2 - t^2)^{1/2}, \;\;\;\;\;\;\; \theta = \tanh^{-1}(t/x) $
Various worldlines have been plotted. Lines at 45 degrees on the left diagram are photon worldlines; an example is the one setting out from $(0,0)$ and travelling to the right. The vertical line is the worldline of an object in constant velocity motion; think of it as a probe. It is sending out light signals which move away to its right. The curved lines with tick-marks are hyperbolas. Each one is the worldline of a particle moving at constant proper acceleration. The set of these particles can be thought of as the body of a rocket accelerating to the right. Notice that the photon emitted from $(0,0)$ never catches up with this rocket.
The straight lines with slope less than 45 degrees are lines that indicate sets of events that would be considered to be simultaneous for an observer sitting in the rocket.
Now look at the right hand diagram. It shows the same region of spacetime, but in the $(h,\theta)$ coordinate system. Each hyperbola from the first diagram is now straightened out into a vertical line, and each of the lines of simultaneity we just mentioned are now horizontal. It follows that, to an observer seated in the rocket, this diagram shows a natural way for him to interpret his surroundings. The various parts of the rocket are at a fixed 'distance' (i.e. $h$ coordinate) from one another (the straight vertical lines). The $\theta$ coordinate is a suitable measure of time passing, but notice the tick marks: a clock at a given height $h$ gives more ticks per unit change of $\theta$ when $h$ is large. This is the "gravitational time dilation". The tick marks show proper time, an observer low in the rocket considers that clocks at higher heights are ticking faster.
Finally, let's look at the signals sent out by the probe. This is where the discussion of the horizon comes in. The worldline of the probe is shown by the thicker curved line moving towards $h=0$ as $\theta$ increases. The photon signals have worldlines that are curved in the $h,\theta$ system (this illustates the effect of gravity on light). Look at the signals received by the observer sitting in the rocket at $h=1$. As time ($\theta$) goes on, the signals come more and more infrequently. And indeed, he never receives the photons sent out by the probe after the probe passes the right-going photon that we noticed in the first diagram. It is this photon worldline which marks the location of a horizon. No event to the left of this horizon can influence events to the right of it, nor can anything cross from left to right, not even light.
In the $h,\theta$ coordinate system, an infinite time $\theta$ has to pass before the probe actually reaches and crosses the horizon as the probe falls in, but this does not change the fact that the number of photons sent out before arriving at the horizon is agreed in the maps. The rocket observer thus agrees that the amount of proper time passing on the probe is not infinite, but the gravitational time dilation approaches infinity as the probe approaches the horizon. This is simply a statement about the relative calibration of two ways of keeping track of time: the proper time way and the $\theta$ way; both have their uses. Notice also that nothing special happens to the probe when it crosses the horizon. The horizon is itself a perfectly ordinary region of spacetime.
Finally, you should be thinking, "but doesn't this horizon appear and disappear, depending on choice of reference frame, whereas surely the horizon around a black hole is absolute?" This reservation is partially correct; it is to do with the difference between curved spacetime and flat spacetime. Even near the horizon of a black hole, I can if I like adopt an inertial frame---it is the frame of an object freely falling into the hole---and in this frame there will be no horizon. But such a frame cannot be extended very far in space and time; its 'map' of spacetime is rather local.
The singularity at the middle of the black hole is absolute, and so is the fact that a horizon encloses it in any coordinate frame able to extend through a spatial region that both contains the singularity and extends far from it.
The above diagram, and the ideas, are from "Relativity made relatively easy" (fig 9.20) , A. M. Steane (OUP 2012); this is an undergraduate physics textbook.
Comment: I haven't mentioned the Unruh effect, but, briefly, the second diagram yields a way of mapping spacetime which permits the effect to be conveniently calculated. These coordinates are called Rindler coordinates.
Comment: Okay so I think I got most of your answer, still I failed to understand the significance of the second diagram provided, does it explain the Unruh Effect in a real world taking into account the relativistic effects like gravitational time dilation and lensing whereas the first frame explains it in a simplified way?
Answer: I've addressed this as a footnote to the question What is the proper way to explain the twin paradox? but since you are specifically asking about this point I'll post an answer here as well.
You need to know the equation that describes the trajectory of a uniformly accelerating object. The derivation isn't very illuminating so I'll content myself with quoting the result. For more details see Gravitation by Misner, Thorne and Wheeler chapter 6. There is also a summary in Phil Gibbs' excellent article on the relativistic rocket.
Anyhow, suppose you are accelerating with a constant proper acceleration $a$. Note that constant acceleration means the acceleration you feel in your rest frame is constant e.g. you feel a constant $1g$. The acceleration in the rest frame of the inertial observer watching you obviously can't be constant because that observer cannot see you exceed the speed of light. Suppose also that you start at the point $x = c^2/a$ at time $t=0$. In this case your distance as a function of time is given by:
$$ x = \frac{c^2}{a}\sqrt{1 + \left(\frac{at}{c}\right)^2} $$
We take a factor of $at/c$ out of the square root to get:
$$\begin{align}
 x &= \frac{c^2}{a}\frac{at}{c}\sqrt{1 + \left(\frac{c}{at}\right)^2} \\
   &= ct\sqrt{1 + \left(\frac{c}{at}\right)^2}
\end{align}$$
Now at time zero we send off a light beam from the origin $x=0$, so the light beam starts off a distance $c^2/a$ behind you. What we're going to show is that as long as you keep your constant acceleration $a$ the light beam can never catch you, and that means there is a coordinate horizon at the distance $c^2/a$ behind you.
To start with we'll simply reuse the last equation. We're interested in what happens at large times $t$, and when $t \gg c/a$ we have $c/at \ll 1$ so we can approximate our equation using the binomial theorem:
$$ x \approx ct\left(1 + \tfrac{1}{2}\left(\frac{c}{at}\right)^2\right) $$
Now the light starts at $x=0$and moves at a constant speed $c$, so the trajectory of the light is given by:
$$x_\text{light}=ct$$
And we get the distance between you and the light beam by subtracting the position of the light from your position:
$$\begin{align}
 x - x_\text{light} &\approx ct\left(1 + \tfrac{1}{2}\left(\frac{c}{at}\right)^2\right) - ct \\
                    &\approx \tfrac{1}{2}\left(\frac{c}{at}\right)^2
\end{align}$$
So what we find is that the light beam is always a distance $\tfrac{1}{2}(c/at)^2$ behind you i.e. the light ray can never catch you. This is why there is a horizon for a constantly accelerating observer.
Comment: The prediction, as I understand it, is that Unruh radiation is observable in a finite time, but it only attains the exact thermal distribution for an observer who has accelerated for an infinite time. For shorter periods of acceleration, an accelerating detector able to interact with the electromagnetic field will still pick up internal energy (compared to the ground state of an inertially moving detector). The calculation of this effect can be done in any chosen reference frame, with or without a horizon.
Comment: @lurscher Doesn't the answer say "as long as the observer is accelerating, there is a horizon at c^2/a"?
Comment: @kutschkem, what lurscher is saying is that the (conventional) derivation of the Unruh effect and the explanation giving in the answer above assume eternal acceleration. It does not (directly) tell us anything about what happens during a temporary acceleration. Thus lurscher's point was a very good one especially since the answer said "as long as the observer is accelerating". The answer is drawing a conclusion that it hasn't shown. That sentence should read "as long as the observer keeps accelerating forever with the same (or monotonically increasing) acceleration."
Comment: @AjinkyaNaik if you accelerate for a sort time your acceleration would be approximately constant, but only approximately. If your acceleration in your frame is $a$ then your acceleration in the frame of the inertial observer on Earth is $a_E = a/\gamma^3$, where $\gamma = 1/\sqrt{1 - v^2/c^2}$. So if your velocity, $v$, changes (which it obviously does because you are acclerating) then your acceleration $a_E$ as measured on Earth also changes.
Comment: this explanation seems to suggest that horizons arise *only* for constant eternal accelerating observers. If that is true then the Unruh temperature is unobservable, since all observers accelerate for a finite time
Comment: @lurscher don't know enough about Unruh radiation to comment, but doesn't the same apply to Hawking radiation? Black hole event horizons take an infinite time to form for external observers, yet external observers are predicted to see Hawking radiation.
Comment: Of course, it is hypothesized that you still feel Unruh radiation during a finite acceleration. One justification for this is the fact that what you feel on one moment of time should not depend on whether or not you continue to accelerate afterwards.
Comment: @JohnRennie, But the acceleration in the rest frame of an inertial observer will only be variable if I keep accelerating forever, but if I do accelerate for a finite time my acceleration would be constant in his frame of reference.


Are there any differences in the drop system for Free and Premium accounts?

Question: So recently I got a premium account in tf2. Does that change what type of items I get now in the weekly random drop? If so, what type of items should I expect?
Comment: *Hats*... Hats **and MOAR HATS**... Okay. I exaggerated a little. (Chance is about 1 in every 200-or-so normal drops on average) | But you also get better items too, like [rares; non-set/some purchase-only items as Uniques](https://wiki.teamfortress.com/wiki/Crafting#Rare_items). Also, there isn't much details on what actually drops; only the category of items.
Comment: https://wiki.teamfortress.com/wiki/Account_types
Answer: According to the Free2Play FAQ, Free users can only obtain Standard items (in item drops, these are just simple weapons and crates), whereas a Premium user can obtain Standard along with Rare and Cosmetic items, such as hats/miscellaneous cosmetics, a certain limited range of Paint Cans and tools.
A full list of obtainable items and more information can be found on this page of the TF2 wiki.
Answer: Actually, yes, there are slight differences.
Premium account types can get hat drops alongside the usual weapon drops, along with paint can drops, name tag, and other misc. items.
Answer: No, the only difference in the accounts are that premium accounts means that you can trade TF2 items from your weekly drops, but in the free accounts that is not possible. Also, you get a Mann Co. hat for getting a premium account.
Comment: Wrong, actually. The item drop system differs between free and premium accounts.
Comment: As Texenox said. See his answer as a two-way learning experience - you learn more about TF2's account and drop system, as well as how an answer should be written - with a source to cite that isn't based on how little you may actually know.


Scrum crooked feed

Question: I noticed that, for a long time now, the crooked feed became the norm in international rugby. When did this practice start? Why is it not policed by the refs?
Answer: It has been a problem in the international game since at least the 2007 world cup, when just before the world cup an edict was sent to the IRB referees to police the feed.
However they have taken the decision that the straightness of put in falls so low down the priority order that it gets ignored, with only the most outrageous examples being penalised.
The argument is that the scrum is a restart and a slightly crooked feed is 'immaterial' in the grand scheme.
As referees in general we are asked to think about can I not blow my whistle not can I blow my whistle to improve the game for players and spectators.

Update
In the World Rugby law changes for 2017-18 the scrum half was allowed to stand with their foot on the mid point of the scrum so that their body was nearer their own team.  This gives an advantage to the putting in side and has generally reduced the extremes of putting the ball into the second row.
Comment: Good point about the refs.  Scrums are a slow enough part of the game at the moment without stopping every time the ball isn't quite straight.
Comment: I played college ball in the late 90s in the US.   We would get a stop for the slightest alignment issue - some refs were just crazy with it.   But I will say - I played wing -  I loved when the opposition got tilted away and I was on the short side.   I am in the open field and have to beat two guys max for a try.    I do understand the issues with the tilt - our front line for sure would come over and discuss this if they saw I had a matchup that was favorable.  And sometimes they would just keep tilting until ref gave up (ala seahawks/patrioits PI in nthe NFL)

Scrum crooked feed


What is the difference between 勺子 and 调羹?

Question: Which word should I use for "spoon", as a noun or as a measure.
Comment: To me (from Southern China) however, 勺子 means something larger than 调羹 (actually my vocab is 瓢羹), that is, suppose you have a big pot of soup, and you use a 勺子 (such as a ladle, called 瓢 in my hometown vocab) to distribute the soup into small bowls for everyone at the table, and then each person uses a 调羹 (tablespoon) to pass the soup into his mouth.
Comment: To be safe, say 汤匙 for tablespoon but it sounds a bit formal; widely used in recipes though, a tablespoon of sugar = 一汤匙糖
Comment: I've also heard 汤勺 get used for spoon ...
Comment: They're just two names of the same object. It's just a matter of regional usage and individual preference.
Comment: I would say 调羹 for china spoon and 汤匙 for both china and metal tablespoon.
Answer: It should be 勺子 (or just 勺 as a measure).
调羹 has similar meaning with 勺子, but is partial to the spoon used for eat soup.
And 调羹 usually used in southern dialect.
Answer: form the function point of view, 勺子, 瓢 and 调羹 are the same, they are a sort of object used to get water.
from the use cases point of view, 瓢 is used to get water only and not suitable to be appear on a table since it's too large, and 勺子 is used to get soup, 调羹 is used to get whatever food in your bowl. so typically in size 瓢 > 勺子 > 调羹, BUT, there's no limitation that you must use 勺子 to get soup, it's just the table manner.
BTW, 瓢 originally stands for an tool made of very old calabash which is used to get water. when a calabash gets old, it will be very hard, so people cut it in the middle and a calabash  becomes two 瓢.
Answer: Beijing dialect:

勺儿 sháo er
勺子 sháo zi4
You can both use it as the name of a tableware or other instruments resembling the shape of a spoon.
You can also use it as the a measure.

Formal Chinese

勺 sháo
匙 chí
You can also use these two in the scenarios you mentioned. However, they are more formal, and normally used in written or in a setting formal oral language are required (e.g. TV program).

Mandarine spoken in southern and mid China:

勺子 sháo zi3


How do planetarium apps and software calculate positions?

Question: In the most general terms (I'm not asking for the actual calculations), how do popular planetarium apps and software calculate the positions of celestial objects? Planets, for example. Do they use Keplerian formulas with their associated elements and rates, or do they calculate long series of periodic terms as outlined in chapter 32 "Positions of the planets" in Meeus? I'm assuming positions of comets and other small bodies would be calculated from Keplerian orbital elements? I'm also assuming they don't use some sort of numerical integration to calculate positions (as do JPL Horizons)?
Comment: They generally use VSOP87 due to "good enough" accuracy over a long time period.  Meeus has a shortened version in his book.  Implementations of the full (and truncated) versions in many languages are available here: https://github.com/gmiller123456/vsop87-multilang
Comment: @Peter, yes VSOP87 is more accurate.  Kelperian elements are only useful over a short period of time because it does not account for small effects of other bodies.  Planetarium apps use kelperian elements for comets because no better integration exists.  For an accurate position they need recent observations, and a file with the latest elements is downloaded from the Minor Planet Center (and some other sources).
Comment: @GregMiller - So does that mean VSOP87 is more accurate than using Keplarian orbital elements? How about comets, other small bodies and spacecraft? Would they use Keplarian orbital elements for those? Thanks.
Comment: Simple Kepler orbit calculations only work for simple Kepler orbits. ;) You need a more sophisticated approach if you want accurate results when there are more than two interacting bodies.
Answer: There are quite a few different types of methods of computing the position of celestial objects, and the method used to compute the position generally depends on the type of object and how accurate the application needs to be.  I'll list a few types and methods below.
Nebula
These are large, distant objects.  They generally don't move fast, and are large enough that highly accurate positions are unnecessary and/or difficult to define.  So these are generally just static positions from a catalog like the NGC or Messier catalogs.
Stars
Distant stars are pinpoints of light, and easy to agree on a location and measure movement, so a star catalog generally includes the position of the star at some epoch, and includes proper motion fields to show how the star moves over time.  The exact data is catalog specific.  For example, the HIPPARCOS catalog contains the star positions for epoch 1991.25, and proper motion fields specifying their change in RA/Dec from that time.
Planets
Lots of methods for computing the planets' positions have been developed because of their importance and popularity.
Keplerian elements are one way, but become inaccurate rather quickly. But the Explanatory Supplement to the Astronomical Almanac supplies elements, and some extra terms to help with accuracy over time.  An implementation is here.
VSOP87 is probably the most popular method as it provides good accuracy over a long period of time and doesn't require much storage.  Implementations are available in a wide array of languages.  This is likely the ephemeris used by pretty much all applications you can download to your PC or phone.
JPL Development Ephemeris are highly accurate, in fact the most accurate available to the public.  They are generally produce by the JPL as needed for specific missions.  They use Chebyshev polynomials to represent the positions which are only accurate for a very short period (the longest is 32 days), so to cover long time ranges, a lot of these need to be stored.  E.g. DE422 covering 3000BC to 3000AD is 500Mb in binary form.  Due to their size, and lack of need for such high accuracy from a planetarium program, they are usually only used for specialized applications.  I have written an article Format of the JPL Ephemeris explaining how to use them to implement your own, and provided implementations in a few languages.
Artificial Satellites
Many planetarium programs also include artificial satellites.  These are based on Keplerian elements, but quickly go out of date, so a more complex model is used to adapt the positions called SGP4/SDP4 (and SGP8/SDP8).  The algorithm was made public as source code from NORAD in the 80's, and code is available in a multitude of programming languages, but the most thourough ones are available at Celestrak.  The elements also need to be updated regularly, and Celestrak provides some of those, but Space-Track is the official source.  Programs have to update this file on at least a daily basis to stay up to date.
Comets/asteroids
Minor solar system bodies are of enough interest that they are tracked, but not important enough to generate the effort the JPL DE requires.  Instead, new Keplerian elements are generated and distributed by the Minor Planet Center.  Again, these have to be updated quite regularly, but not necessarily daily, so most apps leave it up to the user to request an update.
Moons
The Earth's moon is included in the VSOP87 and JPL DE.  And the moons of most planets have chaotic enough orbits that their importance/difficulty tradeoff doesn't justify a specialized ephemeris.  But you will find algorithms for some of Jupiter's and Saturn's moons in Meeus' book.
Earth Orientation Parameters  are something you didn't ask about, but are quite important to determine where an object will appear in relation to an observer on Earth.  Meeus' book covers some of these such as precession, and nutation, and other effects like aberration.  But the Explanatory Supplement to the Astronomical Almanac provides a more complete and updated explanation.  The USNO provides an example implementation as NOVAS.
You can learn more by looking at the source code for some planetarium programs like Stellarium or Xephem.
Comment: I belatedly found the Stellarium user guide, which states that planetary positions are found using VSOP87, and lunar positions using something called ELP2000-82B. Google tells me that "ELP 2000-82B is a theory built at the BDL by M. Chapront-Touze and J. Chapront to compute lunar ephemeris." Thanks for your excellent answer.
Comment: The ELP2000-82B is included in VSOP87A, it was also created at BDL.
Answer:
How do planetarium apps and software calculate positions?

The generic answer is that they use some form of ephemeris. The VSOP87 is an example of an ephemeris. So is JPL Horizons, which uses ephemerides rather than numerical integration. While the ephemerides used by JPL Horizons are calculated using numerical integration, once the data are placed into the form of an ephemeris, numerical integration is no longer needed. JPL Horizons uses ephemerides calculated by other groups at JPL. That they're using ephemerides is why JPL Horizons is so fast.
Comment: I suspect some sites simply use the RESTful interfaces provided by JPL Horizons.
Comment: I can get my head around how software/apps could use VSOP87 to find the positions of planets. But how would they find the positions of other things. Is there some sort of equivalent for small bodies? Or do they just calculate a comet's position, for example, by knowing the comet's  orbital elements (eccentricity, inclination, semi-major axis, etc)?
Comment: @Peter Keplerin elements are a last resort, but an easy resort. It's very easy to calculate the position at any point in time given Keplerian elements at some epoch time. JPL has multiple ephemerides for the planets and for small bodies in the form of time-based series of Chebyshev polynomial coefficients. Find the right set, and bingo. The calculation is very fast. The lookup and retrieval for the right set will not be as fast, but it still is far faster than integrating the entire solar system from some epoch time.
Comment: @Peter Using Kepler elements for comets has a slight problem: if the comet passes close to a major body (apart from the Sun) it will be perturbed. And if its perihelion is close to the Sun it will lose volatiles, which can affect its trajectory. FWIW, Horizons has multiple files for Halley's comet.  https://ssd.jpl.nasa.gov/api/horizons.api?format=text&MAKE_EPHEM=NO&COMMAND=Halley
Comment: @Peter From https://ssd.jpl.nasa.gov/horizons/manual.html#select "Small-bodies have their statistically estimated position and velocity at one instant compactly stored in a database as initial conditions and are then numerically integrated on-demand by Horizons, to other times of interest". Note that they're *only* integrating the small body, so it's fairly quick. The necessary major body position are just pulled from the ephemerides.
Comment: I should have been clearer in my question I understand that JPL Horizons is super accurate. I was asking about stand-alone apps such as Stellarium, Sky Map and Sky Safari. How (in general terms) would they calculate, for example, the orbit of a comet? I'm assuming these apps don't "ask a friend" in the sense of asking JPL Horizons for the correct data? Thanks.
Comment: @Peter [GregMiller's answer](https://astronomy.stackexchange.com/a/50991/7982) addresses comets and asteroids, including ones recently discovered and those that will then only pass near the Sun once. The software will likely use an internet connection to check either the  Minor Planet Data Center website itself, or some other site that draws from the MPDC to update its internal [ephemerides](https://english.stackexchange.com/q/370655/217285) for the new objects.
Comment: @DavidHammen VSOP87 is not an ephemeris; DE438 is one, calculated by JPL. VSOP87 (and VSOP2000 and 2010 and 2013 after it) is an analytical solution; it's a set of mathematical terms to add, from multiplications of sines and cosines. It's really a calculation that has to be done, whereas with DE438 you just lookup the date in the database and find in there the position (maybe there's some interpolation to do, I'm not 100% sure).


C# Rounding 2 decimals: Truncate vs Round

Question: I would like to know which are the advantages and disadvantages using Truncate or Round when rounding a float to 2 decimals:
float number = 3.4567070
Math.Round(number, 2)
Math.Truncate(100 * number) / 100

Which is the best and eficent one? When to use round and when truncate?
Comment: in your example, your using truncate to act as the round function..
Answer: Truncate is marginally more efficient, but these are very different functions.

Math.Round computes the nearest number to the input to a specified degree of accuracy.

Rounds a value to the nearest integer or to the specified number of fractional digits.

Math.Truncate effectively discards the any digits after the decimal point. It will always round to the nearest integer toward zero.

Calculates the integral part of a number

Which function you should use is entirely dependent on the logic you're trying to implement.
Here's a quick sample output of each function:
Input | Round | Truncate
------+-------+---------
 -1.6 |    -2 |       -1
 -1.5 |    -2 |       -1
 -1.4 |    -1 |       -1
 -0.5 |     0 |        0
  0.5 |     0 |        0
  1.4 |     1 |        1
  1.5 |     2 |        1
  1.6 |     2 |        1

Answer: If you are trying to round to 2 decimals, I highly recommend using Round() instead of Truncate(), if for no other reason than readability & maintainability.  Your example is a bit confusing at first glance, and it takes some analysis to understand that it is effectively using some fancy footwork to get the Truncate() method to perform a rounding operation.
In general, when writing code, you should use the "correct" method first, and if benchmarking shows a performance issue, only then should you attempt optimizations such as your "tricky" code example.
Answer: That depends on your purpose.  I don't think one is more effecient than the other.  It's like saying "Should I use a nail or a screw?"  They do different things.


Is it possible to not have Mario as your leader?

Question: For most of the game (that I've experienced so far) you're required to always have Mario as your party leader. While he's a great character, sometimes I'd just much rather not have him in my party. Does this ever happen throughout the story?
Answer: It seems to depend on what game mode you are playing.  If you are playing story mode alone, Mario seems to be required in the party.  According to one GameFAQ, if you are playing coop, you may choose your leader.

In the story mode campaign, Mario's always on the team, as he's the team leader. Whenever I play co-op with a friend, it's the two of you working together, and you each choose your own character, so in co-op, you can use anybody and Mario's not restricted.

Another article for the game mentions that he cannot be swapped out:

Mario, who cannot be swapped out of your roster, is more of an all-rounder: he carries a blaster, a hammer, and can stomp on his enemies.

I would try out the coop mode if you have another person to play with, otherwise, it seems like Mario is always going to be there.
Comment: Shame. This is the same conclusion I came to as well, having just tried coop for the first time last night.


How to recognize clockwise and anti clock wise rotating?

Question: I am using hmmer.js.
Trying to rotate image on android by multi touch.
I just want to increase or decrease the rotation angle of image.
In that case I need to have events for clock wise and anticlock wise.
Can anyone tell me, how to recognize that is element being rotated in clock wise or anti clock wise?
Answer: The event object given by Hammer contains a rotation property which is the angle of rotation in degrees. It ranges from -180 to 180, and is negative when the rotation is anti-clockwise and positive when it's clockwise.
You can test for yourself in this plunker: https://plnkr.co/edit/uVCYoytxc12llL74oyOI?p=preview
Comment: actually i think it goes from -360 to 360


How to wire a portable generator to a irrigation pump

Question: I have a portable gas generator that I want to connect to a 1hp, 240 volt irrigation pump. The pump is out in a field and not connected in any way to power at the house. I want to use a twist lock extension cord from the Generator to the pump. The generator has a floating neutral. Do I need to bond the neutral and ground wire in the extension cord together? Thanks
Comment: Does the pump even *need* a neutral to begin with? (I suspect not, but I could be wrong about its controls -- if you could post some sort of wiring diagram or nameplate labeling for it, that'd help)
Comment: The pump is a 1HP red lion jet pump. I have run it on 2 hots and a ground and it worked fine. I do not believe it need a neutral but I am confused about the floating neutral on the generator. This concept of bonding the neutral wire to ground confused me. Should I just wire it with 2 hots and a ground and forget about the neutral. I am not sure of the safety of this set up.
Answer: Your pump doesn't use neutral.  So there's no need or reason to modify anything.
Regardless... You would never modify an extension cord like that, because then it'd be dangerous to use anyplace else.  If you must violate Code, you can do it more sanely by getting a NEMA 5-20 plug, and jumper it internally neutral to ground with a #12 wire, and just plug it into the generator in an unused 5-20 socket.
A 5-20 plug looks like a common 5-15 but with a sideways neutral.  The beauty of it is the generator will take it, but few other sockets will.
Comment: So just by plugging in a 5-20 (regular 3 prong plug) plug with the jumper between the ground and neutral in a unused 120 outlet on the generator and then using the twist lock extension cord from the 240 volt outlet on the generator and connecting the 2 hot wires and the  ground wire to the pump takes care of the bonding? Would connecting the ground wire and the neutral wire in the 240 volt extension  cord at the grounding screw on the pump also take care of the neutral bonding?
Comment: @old54 You don't need to do anything with neutral. Your pump does not use neutral.  You can ignore it entirely.


Composting Question at at Gardening SE

Question: I posted a question relevant to sustainability over at the gardening SE site. Is this the best way to solicit input from members of this SE?
Answer: There is indeed some overlap between Gardening SE and Sustainability SE.
Your question is related to both topics and in my opinion it can be posted on either website. It's up to you on which site you think your question fits best.
One thing to keep in mind is that questions posted here that are tagged with gardening are automatically also posted in the chat of Gardening SE. Unfortunately Gardening SE does not have a 'sustainability' tag so the reverse is not possible. If you want attention from the people here I recommend posting a link to your question in our chat room.

Composting Question at at Gardening SE


How to substitute a value of an exposed filter for views?

Question: I have a view with an exposed filter with taxonomy tree. Each term can be selected or unselected. If some parent term is selected but every of its child terms isn't selected then all the children terms also should be added to view filter.
But if I select one children term after it, the view should be filtered only by this children term (not by all children terms).
I decided to solve this problem trying to add children terms in the view parameters. By my idea, the view should use this parameters for its execution.
But, unfortunately, I can't understand where to add these params. I tried to use different view hooks, having tried to add them in vars $view->exposed_data, $view->exposed_raw_input, $view->exposed_input. No result.
I also tried to add them in the submit function of the exposed filters form. No positive result also.
Could you clarify me, where can I add new params into the view ?
For example, a user selected term1. In this case term2 and term3 should be added to the view parameters programmatically. And after it, views should use parameters term1, term2 and term3.
I hope, I've described the problem clearly
Answer: I solved a similar issue using hook_views_pre_render(&$views).


What is Null 0 interface?

Question: In which case is
ip route 10.1.0.0 255.255.255.0 null0 used?

Thanks in advance.

This question is a repost of the same question in The Cisco Learning Network; however, the answers are unique to Stack Exchange.
Answer: Null 0 is a virtual interface that's used to guarantee routes make it into the RIB; remember, routes must have a next-hop in order to make it into the RIB.  When a packet arrives at a device that has a route to Null 0 and nowhere else, it will discard it similar to how an ACL would.  Think of this as the virtual interface where packets go to die efficiently.
Most routing protocols, such as EIGRP, automatically generate a Null 0 route when summarizing addresses.
Comment: `Null 0` can also be a good alternative to an Access Control List(s) with the benefit of lower CPU overhead (depending on the complexity of requirements).
Answer: It drops all the traffic that doesn't have a more specific route. It is used to prevent routing loops and to put routes in the routing table permanently so they can be announced with BGP.
Comment: Not quite.  I can make a loopback interface on a router (Loopback0, for instance) and make it reachable from a remote network.  Loopbacks are just virtual network interfaces.  Null0 is more like the vast emptiness of space; data sent to Null0 is discarded and never thought of again.
Comment: is that null0 networks are like loopback network?
Answer: The null 0 interface can be seen as the same bitbucket as a /dev/null device in UNIX/Linux. Everything that ends up there will just be dropped.
Answer: The Null0 "interface" is a virtual bit-bucket. Meaning it's a trash can to route things to. There's automatically a Null0 route (called a Discard Route) created when you do a summary-address or area-range or things like that with routing protocols.
The idea behind this is that you are creating a summary address manually to tell other routers about. If you are therefore expecting to receive packets for anything within that summary range, what will your router do about it? if it has more specific routes, packets will get routed perfectly fine.
Anything not matching more specific routes would get sent to the discard route and therefore destroyed in a flash of Null0 mayhem. Without the discard route, your router would be either trying to look things up or possibly sending to a default route (0.0.0.0/0) it has in its table. This in turn, may cause a routing loop where the router with the 0/0 route contains the summary you manually advertised and so packets bounce needlessly until the TTL expires!
It's a protection mechanism.
You may also use Null0 as a destination in static routes if you would like particular packets to die a horrible death as well! also u can see the site below exactly from Mr.Rafael A Couto Cabral
http://blogbt.net/index.php/2014/03/routing-to-null0-interface/
Worood Naif :)

What is Null 0 interface?


How many mutants were there on Earth at one time, in Marvel comics?

Question: When Genosha was attacked by Sentinels, it had become a large population centre for mutantkind, with sixteen million residents killed in the attack. I assume there were at least a few million who didn't live there. What is the largest number of mutants living on Earth there ever was at one time?
Comment: I have a faint recall of a comic where was stated that roughly one in ten thousand people are mutants, but cannot remember where
Comment: [Loads!](https://en.wikipedia.org/wiki/List_of_X-Men_members) Then [loads divided by ten or a hundred or something](https://en.wikipedia.org/wiki/Decimation_(comics)).
Answer: In New X-Men #116, immediately following the Genosha attack, we actually see an answer to this:

Genosha's population was about 16 million, and the news reports that it contained "over half" of the mutant population, which means, at most the accepted world estimate was 32 million.  I've seen numerous reports that the actual world population, pre-Genosha-attack, was around 30 million (the news report said over half, after all, not exactly half), although I can't find a source of it (most articles which cite the figure cite New X-Men #115, and the only number I could find there was the population of Genosha itself).  Still, it's a good estimate.
Was this the largest number of mutants living on Earth?  Signs point to yes.  This occurred during the Morrison run, and in the first issue of that, both Beast and Xavier comment on how there are so many more mutants now (Beast specifically refers to it as a mutant baby boom).  Morrison's run was also the first to include "Mutant Town" (a neighborhood in New York City with a majority mutant population) and widely expanded the school from what we knew.  It's very possible that the X-Men were ahead of the news reports, and so they knew of more mutants and the "over half" estimation by the media was an overly-high percentage based on a lowball count of the overall mutant population, but at this point that's speculation.
Not too long after the Morrison run, of course, we had the House of M event, which ended in Decimation, in which the vast majority of mutants became normal humans.  At this point, the mutant population of the world went down to the hundreds (although sources were not consistent on what percentage were wiped out or how many remained and some even conflict the pre-Genosha estimates) and it looked for a time that no mutants would ever appear again.  Although that gloom and doom scenario seems to have changed in recent years, mutants still aren't anywhere near the population they were at the height of Morrison's run.
If you count moments in which the Earth's reality has been temporarily changed by entities like the Scarlet Witch, it's quite possible that the ACTUAL point at which there were more mutants on Earth than ever was during House of M, because in the modified reality the Genosha attack hadn't happened and mutants were dominant enough that they weren't being randomly exterminated.  Or perhaps there was some obscure plot where every human became a mutant for a few seconds.  Or, the universe being full of powerful beings and time travel adventures and all sorts of other shenanigans, there might plausibly have been, off-panel and unchronicled, some other reality shift that happened briefly and left the world with a much higher mutant population, but was reversed with nobody is aware of it, until some writer decides to retcon it in.
But in history as most people know it, it looks like Morrison's run was the height, and somewhere in the neighborhood of 30 million.
Comment: While I agree it wasn't necessarily correct, post-Decimation the "official" count of remaining mutants was 198.
Comment: @RDFozz Yeah, that was Marvel's line at first, then they changed it to "198 was an early count that stuck with the media as a recognizable number to talk about the tragedy, like 9/11 (which, could just as easily be 11/9)... if you talk about 'the 198' you're obviously talking about the remaining mutants, whereas if you say 'the 300' they might think you're talking about a movie about Sparta or something.


multistep testing with Junit

Question: I'm working on a simple compiler for class that takes input from a higher-level language and produces quasi-assembly code that runs on an emulator. I'm trying to set up test cases for the program that compare the expected output of the emulator with the actual output, but I've been having issues since running code on the emulator requires two stages of processing. In stage one I run my compiler and in stage two I run the output code in the emulator (which I run as an external tool in Eclipse by clicking this button: . I've gotten to the point where I can test the output of the compiler (i.e. the assembly language) in JUnit, but I'm not sure how to take that final step to run the emulator from within JUnit.
Answer: You could programatically run the emulator using Runtime.exec() from within the body of your test method.
But normally you wouldn't want to resort to something like this. Unit tests should try to test one thing in isolation - your compiler in this case. It sounds like your test cases should consist of the HLL input and expected assembly output; leave the emulator out of it.
Comment: What should the argument of exec() be? Is it the path of the emulator's .exe in my project directory?
Comment: Path and file. Something like this: `String script = "/path/to/script.sh arg1";    try { Process p = Runtime.getRuntime().exec(script);...`
Answer: Yes, you can run the command which would like to execute in different process using Runtime.exec. you can wait until the process get completed.

multistep testing with Junit


Whose games should I collect for Benoni?

Question: I have been adopting the Benoni opening against 1 d4 recently with some moderate success. I would like to know whose games should I look at to have a good understanding. I see that Tal, and to a lesser extent Fischer, have practiced this opening in the past.
Answer: I would start with Vugar Gashimov and Veselin Topalov.
Answer: I agree with Evargalo; Topalov made some novel contributions.  Even Kramnik popped out a Benoni in recent times.  Three time US Champion Nick De Firmian played it a lot as well.
You might consider this book by Marian Petrov: "Grandmaster Repertoire 12: The Modern Benoni".


What is the origin of the minhag of kapparot?

Question: What is the origin of the minhag of kapparot? What if one chooses not to do the minhag? Is one less favoured by God? Is there a certain benefit to doing kapparot?
Comment: Quite much related: https://judaism.stackexchange.com/q/20370/15256
Answer: The origin is unknown outside of when it is first mentioned. The earliest mention of the practice comes from Rav Sheshna Gaon who lived in 660 C.E.
One of the reasons given for why a chicken is used is that the Hebrew and Aramaic words for one another mirror each other.
The Aramaic for Chicken is Gever. The Hebrew for man is Gever. The idea is you're taking a chicken to atone for a man and so it's a symbolic play in language.
You aren't required to use a chicken for the practice. While many Jews still continue to use chickens for the practice, there are those who instead use money to gain the same spiritual benefit.
There is actually a long back and forth in Jewish history regarding the practice. While many Jews consider it acceptable and continue to do it, there has been a suggestion it's problematic because the practice is very similar to non-Jewish Amorite practices which existed historically. For this reason many notable voices in Jewish history rejected the practice and argued against its continued use.
Rabbi Yosef Karo was one of the more famous examples of a respected Rabbi who rejected the practice. While many of his opinions and positions are endorsed by many in modern Judaism but his opinion on this practice wasn't one of them. Hence it has remained an active part of sin ritual in Judaism.
You can read about this in more detail from this article on Chabad.
Answer: The origin is based on a pun: גבר can mean both 'man' and 'rooster', so the Geonim (the Amram Ga'on I think) concluded that a rooster could stand in for a human being when it came to repentance. It's not a commandment so there's no obligation to do it, and God is unlikely to mind.
Benefit... that's about what's spiritually fulfilling to you. I suspect the animal rights lobby would criticise those who choose to do it, however.


How to merge layers by name in QGIS?

Question: This is the scenario: I have thousands of shapefiles organized in different folders. My purpose is to merge all the shapefiles with the same name into a new single shapefile. I know I can import all of them into QGIS and merge them manually with MMQGIS plugin, but I was thinking if it would be possible to automate the operation with a script, as doing it manually would be extremely time consuming...
Comment: does it have to be inside QGIS? otherwise you could use ogr2ogr and a script
Comment: @iant I never used ogr2ogr so if it's possible to do the same thing with a script in QGIS I would prefer...
Comment: Personally I would just search with your file browser and copy the found files into a new folder and merge them. You could also use a union VRT to merge them which works quite nicely even on vectors.
Comment: @Sethinacan I'm looking for a faster way to do this operation cause I have to do this with thousands files...
Comment: Not just thousands of files but lots of sets with the same name? then a recursive script is definitely a better bet.
Comment: @Sethinacan you hit the point... the files with the same name are part of an original dataset which was splitted, so my final purpose is to rebuild the datasets...
Answer: I guess it's totally possible using python scripting in QGIS but it may not be the fastest solution (or at least my answer, involving some nested loop isn't probably the more efficient answer, as there is probably a way to merge directly two (or more) layers in QGIS).
Anyway, if it can helps :
- in a first time it walks in your folders, fetching the path of each file with the same name.
- in a second time its create a new shapefile, regrouping the features of each shp with the same name.
import os

seen_name = {}  # Instanciate a dict, the key will be the name and the value each real path
for dirpath, dirnames, filenames in os.walk('/tmp/geo'):
    for filename in filenames:
        if '.shp' in filename:
            if filename in seen_name:
                seen_name[filename].append(os.path.join(dirpath, filename))
            else:
                seen_name[filename] = [os.path.join(dirpath, filename)]

os.chdir(Your_new_clean_folder)

for unique_name, list_filepath in seen_name.items():
    ref_lyr = QgsVectorLayer(list_filepath[0], unique_name, 'ogr')
    features = []

    for nb, unique_file in enumerate(list_filepath[1:]):
        lyr = QgsVectorLayer(unique_file, unique_name+str(nb), 'ogr')
        features.extend([ft for ft in lyr.getFeatures()])

    ref_lyr.dataProvider().addFeatures(features)
    QgsVectorFileWriter.writeAsVectorFormat(
        ref_lyr, unique_name, "UTF8", ref_lyr.crs(), "ESRI Shapefile")

I tested on a folder containing some nested folders (at various levels) randomly containing a bunch of shapefiles with the same name dispatched in these folders, its seems to work fine (I edited for an answer taking slightly less time, but if you have many layers, with many features it will take long as it loops on each features..).
Otherwise you might have a look to the processing module and the 'qgis:mergevectorlayers' alg. it provides (but it seems to only take two layers).
Comment: what folders does the script walk through? Every folder in my drive? Furthermore I was thinking if it could be a better approach to import all the layers I would like to merge into QGIS and then launch a script that scans the imported layers list to create an array of unique names, and then invokes the MMQGIS merge layers plugin for any index of the array, selecting the layers with the same name of the index value from the imported layers
Comment: The `os.walk` function is aimed to traverse the whole directory tree starting from the path you give to it (ie. here it only walks in `/tmp` and its subfolders). However, the steps you are mentioning are basically what this script is doing (without MMQGIS though).
Comment: This is a lifesaver! I was looking for a script for this kind of operation. Thank you!

How to merge layers by name in QGIS?


Trip to India from Abu Dhabi for an UAE residence

Question: I am living and working at Abu Dhabi and I want to have a tourist trip to India. My passport is from Greece and is valid until 2020. How long will take to obtain a tourist visa ?
Answer: You don't need a visa for India, but can apply for an electronic entry Permit here (called "e-Tourist visa"), which has to be applied for at least 4 days before travel.
You present the E-Mail confirmation you get, as well your passport, at Indian border control.


How to remake this typographic map?

Question: I found these wonderful typographic maps on Etsy (https://www.etsy.com/shop/SilkeSpingies?section_id=15207850&ref=shopsection_leftnav_1) where city names are placed in the correct location, and font size is based on population size. She has maps of Korea in Korean, Japan in Japanese,  Thailand in Thai, etc. Because of this,  I don't think it is completely done by hand. I would like to make maps like these for other countries. What would be the easiest way to go about this?

Comment: Have you tried some [cloud generator](http://www.tripwiremagazine.com/2012/12/12-cool-word-cloud-generators.html) with constraints? See also [here](http://stackoverflow.com/questions/342687/algorithm-to-implement-a-word-cloud-like-wordle).
Answer: The software to use is Adobe Illustrator.
A what I would do is:

First of all create a list of cities and give each the desired size (before you start placing them on the map)
Find a map with all the cities, paste it on your artboard and lock it there.
Start to move your cities and order them around them map, always playing with kerning and the font size that doesn't have to be 100% according to the rule.
Now you have to start faking a bit, otherwise it won't work: fake the locations, sizes, etc. Remember that in the end the overall look is the most important thing.
Unlock the background map and delete it
Comment: i.e. "completely done by hand"
Comment: +1 If these were easy for anyone to make with a magic script or tool, everyone and their dog would be making these, they'd become a maligned cliche like word clouds (["mullets of the internet"](http://www.niemanlab.org/2011/10/word-clouds-considered-harmful/)), and Ms Spingies wouldn't be able to make a living by crafting them and selling prints for £25 on Etsy. They require care, skill, craft and good judgement.
Answer: There is a very sophisticated InDesign-Script that is based on and inspired by Wordle, called "Wordalizer". See: http://www.indiscripts.com/category/projects/Wordalizer
While it looks like it cannot do exactly what you need to do (since you need to place specific words at a specific geographic position), maybe it can help you do develop a look or give you a starting point, to work from.
Answer: Generally speaking these graphics are generated, not manually designed. Thought I don't have any experience with generating so called "word clouds", I can imagine that it can be achieved by feeding the right script with weights for the terms you'd like to emphasize in the diagram, desired locations and shape it needs to be fit into to.
After some googling:

Wordalizer  (indesign) Wordalizer site
Tagcloud script (processing) Tagcloud Github repo
Tagul service at tagul.com
Answer: Use a photo mosaic application. For example, I use Shape Collage to load hundreds (if not thousands) of unique, transparent PNGs. In your case, one PNG will be a City Name. Then the software lets you control the shape sizes, randomness, and how close to proximity each shape is (with or without overlapping). The application re-adjusts all the pieces every time you tweak a setting and gives you a preview before the final SAVE.
It takes a handful of tries to get the formula just right.
Comment: Hello jhurley, welcome to GDSE. I couldn't help but noticing that two of your answers are praising the same software. Although there's nothing wrong with that if the software is a good tool for the job, we do ask that you mention any affiliation you might have. Thanks for your time & effort and keep contibuting!
Comment: Coincidentally, it's a good tool for the job. I have no affiliation to the freeware that I mentioned.
Comment: In that case, no worries. Keep contributing and have fun on the site. If you like, you can always pop round in [chat] to say hello.
Answer: I have done this and uploaded a video
You can watch this on how its done
https://www.youtube.com/watch?v=fO2Q0EvKCRQ
Comment: Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

How to remake this typographic map?


Best UX for interacting with a grid that auto-updates on an interval

Question: I have a grid that auto updates every 30 seconds.  Each row has a checkbox in the first column where the user can select multiple rows and apply an action to it. They can also apply an action to an individual row. While the user is interacting with items or hovered over the grid, I'm planning on stopping the auto-update so they don't end up selecting a row they didn't intend to if it happens to update the second before they click. Any suggestions on best UX or sites that do something similar to this?
Comment: Does the system have locking semantics. i.e. If one user is changing a row, then another is prevented from making updates?
Comment: No locking semantics but statuses and once an item gets to certain statuses they can't go back.  So if a user tried to update a row to an illegal state they would get an error, but this is very unlikely.
Answer: I've struggled with a similar problem and fought against the auto update feature simply due to development cost and potential confusion for the users. When the user is hovering are there updates being queued up? When they un-hover will all of the updates happen at once?
What I see most in live update situations is an indicator showing the number of updates that are queued up for a user, perhaps row by row, and allowing them to choose when to show them by clicking an update button. Twitters "20 New tweets" is the only example I could think of off the top of my head. Facebook does it as well I believe.
Answer: You have a choice in strength of UX vs. cost of implementation
As @Benny Skogberg said a near seamless solution would be an in-grid update. Take a look at Google sheets as an example - it hints what fields other users will change. You could animate changes coming into the grid. Providing rows are independent you would only need to freeze data per row. You could also flag rows that have become out of date.
A lower cost solution is to show user when the next refresh will happen. e.g. countdown or progress bar. This will also be used to show when data updates are paused - which is critical.  The user will quickly learn to avoid blocking data updates and selecting exactly on an update.
About cheapest implementation is if the full grid reload is a reasonably disruptive visual event. Assuming that rows are reasonably distinct for the user, then it will be sufficient that when a row is selected the data does not update after that.  In the unlikely event of miss-selection, a user will be able to see when they have not selected the expected initial row, they can simply change selection.  Similarly for a single row interaction should clearly show the state of data that actually started working with.
Answer: I like stopping the auto-update on hover/interaction. You could add an "AUTO-UPDATES PAUSED" notification, perhaps with a count of the number of new rows that will be added once updating resumes.
Where you put that depends on the specifics of your site.
I like this idea because it gives clear feedback that the updates have paused and people will quickly figure out why (though perhaps the messaging could be specific about the hover to drive the point home). It would be a bummer to sit there waiting for things to update and not know that your mouse position is preventing it.
Thinking on this more, you could have a place where you say explicitly "AUTO UPDATING" (maybe with a lil' spinner). Then change to "AUTO UPDATING PAUSED". That way you're clearly communicating the two states at hand.
Answer: It seems, you are trying to apply non-real-time interaction style (selecting and then applying) to a near-to-real-time events system. The issue is at the the bad compatibility between the both styles.
Still, I interpret checkboxes as Apply buttons, as semantically they are equivalent. At the moment of checking, a user is agreed with the current row's value:

So probably changing checkboxes with Apply buttons could solve the problem. This solution doesn't require auto-update stopping. The overall interaction will remain the same, though undo (uncheck) action is impossible (but could be implemented with a bit tricky logic).


how do you install laminate flooring with multiple rooms at one time with click flooring (since you can only put it in one way)

Question: how do you install click laminate flooring when it can only click in one way?
in the picture every room is getting done that doesn't have an x. the red lines are which way the boards are going. only that room is done. the hallway and 2 other small rooms would be going the right way, but how can you do the big awkward sized room with all of it going together right, because going backwards they wouldn't click in?
Comment: It's a bit like chess. You have to think several moves ahead.
Answer: We did this and cheated; at some doorways we stopped and covered the join with a rather smart strip of brass.
This makes it a lot easier, especially if:

your house is not quite square
the floors are not quite flat
you have big temperature variations
you want to have different rooms not running the same way
you want the doors to close snugly
Answer: I did this in my house.When installing the laminate you click the boards together from the top.When you change direction you have to turn the board around and click it in from the bottom.Its not real easy to do, but it worked for me.
Answer: You can do this without major transitions strips but this requires that the center room is square.  I would start in the top right opening of the center room.  Do the center room.  After completing the center room you have a choice to make in each room.
Are the strips parallel enough to the first wall of each room?  If so just keep going.  If no, you will need a t-strip.
Answer: When I did my flooring (Harmonics flooring, from Costco), I bought the installation kit.  It came with a pull bar and a tapping block, which were really useful.
The block was intended to do what you are asking about.  It has contours to protect the edges while tapping the flooring plank with a hammer.  The edges which lock together have just enough give to them that you can force them together.
So, when placing a board on the "wrong" edge of the installation, you simply lay it flat, use the block, and gently tap it until the edges overlap and come together.
I assume it can be done with other brands...

By the way, your house is almost certainly not square.  If you install a single floor throughout all of your rooms, you will have to choose which wall will run perfectly parallel to the boards, and the rest might be off by a few degrees.
In my case, it was important for me to match parallel lines against the tile of a fireplace hearth.  But I started on a different wall which turned out to be slightly non-parallel to the tile.  I had to remove the edge boards against the wall, push the whole one-piece floor around until it lined up with the tile, and then re-cut the original boards!
Answer: Do the large, long room til you get to the doorway and then spend some time on that first awkward strip in the corridor to connect both rooms.
However, like someone else said the house is almost certainly a little out somewhere and I think you might have trouble laying it all in one run.
If you're not particularly bothered by discrete threshold strips at the doorways, I'd go for them, better in the long run to manage movement etc.


Alternative way to move windows around screen

Question: In X (Xfree86 on Linux or UNIX) I could move a window around the screen by holding down a modifier key (the CTRL key if memory serves me correctly) and move a window around the screen by dragging it from anywhere in the window (not limited to the title bar.) Is there a similar functionality available in OS X?
Comment: possible duplicate of [What Window Management Options exist for OS X?](http://apple.stackexchange.com/questions/9659/what-window-management-options-exist-for-os-x)
Answer: MercuryMover
Although it's a paid-for utility (which comes with it's own PrefPane etc), this is a great tool for chucking around your windows. You can also set it up to force windows to certain sizes on a shortcut, which is handy if you want to check out your web pages in a browser at 800x600, etc.
By default, you jut press CtrlCommandup-arrow and you get a little black pop-up window that helps you to move/resize the window that had focus when you pressed the shortcut. (the screen grab includes the PrefPane too).
Answer: No, there isn't. The only thing that's possible is to drag a window that doesn't have focus using the Command key. In this way you can move windows in the background without changing focus.
Comment: To be clear: you need to drag _on the title bar_. You can't drag just anywhere in the window.
Answer: Have you looked at BetterTouchTool?
It boasts lots of other features, most notably complex trackpad gestures that can be used to call all sorts of built-in functionality, but does provide the ability to press and hold Ctrl to move a window with the mouse, without even holding left-click down.
The site says its only for Snow Leopard, but a Lion version is in the works (alpha is available, I think as of 0.73). Your particular feature, if that's all you enable, works fine in Lion.
Comment: BetterTouchTool is really great, even isn't the same that sticky wondows, with the help of Spaces feature is enought to beat with your windows mess!!
Answer: It's not exactly what you are looking for but in Lion you can now hold your mouse over the edge of a window and your cursor will turn into either a vertical or horizontal resize cursor (a new feature so you don't always have to use the bottom corner to resize).  However, if you click and drag your mouse in the opposite direction of the resize cursor, the entire window will move with no need to use the top title bar.
Answer: Also Check these answers for other interesting OS X WM alternatives.
Answer: I got annoyed that the only options for this aren't free and come bundled with a bunch of other features that are useless to me, so I wrote my own.
metamove
A utility for emulating XFree86-style Meta+click and drag window movement. The default bindings are Cmd-Shift-Click for window movement, and Option-Shift-Click for window resizing.


Repeated measures with binary data

Question: I've deigned an experiment in which participants read 24 narratives and guess if they are written by men or women and rate their own confidence. I thus have 24 binary repeated measures. I have the following predictors: participant gender and response to a scale about gender identity (participant based), and also 6 narrative content ratings of the narratives (vary by narrative but not by participants) and finally participants' confidence (varies by participant and by narrative). I've been using GEE in SPSS because my reading suggests this is the most accessible way for me to run what is effectively a repeated measures logistic regression. But I may have a mediation between confidence and some of the narrative variables. Should I be using a different approach? Is structural equation modelling appropriate here? I have access to STATA and AMOS, but no experience with either.
Comment: This is sometimes handled by Natural Effect Models.  You can read more about this here:  https://arxiv.org/abs/1912.01200
Answer: To get at questions of mediation, structural equation modeling is probably your best bet. To account for the clustering of data within participants, you can use multilevel structural equation modeling (MSEM). Level 1 would contain narratives and their descriptors (e.g., content ratings and confidence levels), whereas Level 2 would contain participants and their descriptors (e.g., gender).
You can read more about mediation in MSEM in this article:
Preacher, K. J., Zyphur, M. J., & Zhang, Z. (2010). A general multilevel SEM framework for assessing multilevel mediation. Psychological Methods, 15(3), 209–233.
I have conducted MSEM before using the Mplus program. Not sure about STATA/AMOS.

Repeated measures with binary data


Make the order available in checkout pane callback when viewing

Question: I've overridden the payment pane callback in the checkout page (using hook_checkout_pane_alter), and I want to modify the form inputs in the pane based on the order total. However, the order object is empty when the callback is called with the "view" operation parameter.
How do I make the order available in the callback function?
Answer: You might need to use an order pane instead.


How to speed up construction in Tropico 4?

Question: It seems due to some logistic issues construction is very slow in tropico 4 (most of the time builders are idle with a long list of jobs). Is there any tips how to improve their productivity?
Answer: Make your workers spend less time walking.

When expanding to a new area, build a garage there first. Your workers take a construction truck out to the build site, but they walk back. This is particularly problematic when building mines or farms in remote places. But if you build the garage first, they'll build the mine and then drive back.
Make sure your workers' other needs can be satisfied quickly. Build Garages so that your workers can get to food, entertainment, churches, doctors, work, and their homes quickly. This means they'll spend less time away from the job (or at least their breaks will be shorter).

Have skilled builders.
A skilled builder puts up structures much faster than a neophyte builder.

Select traits and a background that increase worker training.
Enable the Literacy Program edict, set your Ministry to Council of Ministers, and have a TV Station set to Learning with Larry.
Pay your builders more, so your skilled builders won't walk off and take different jobs. If there's a factory job available, then your builders may well decide to get an education and take that job. Make sure the job satisfaction of being a builder is better than the job satisfaction of other available jobs. (There's no good way to keep them from taking a college job, other than manipulating the open slots in the job — make sure there are no open slots, then make them all available and hire foreigners a split-second before the freighter arrives. The job satisfaction of college-education jobs is so high – usually 80-plus – that it's really not worth trying to compete with that.)

Rushing the actual construction.

Send El Presidente to oversee construction. Alas, there is only one El Presidente, so make sure that the building he's supervising is on the highest priority, and that nothing else will be built first. (At equal priorities, Construction Offices build the thing that's closest to the office.) You may have no idea which end of a hammer to swing, but your workers don't know that; they'll build faster just too see your backside that much sooner.
Spend real world money to buy the Quick-dry Cement DLC. If you wait for a Steam sale, you can get this at 75% off. This allows you to build a Cement Factory, which makes your construction workers build things faster (and exports cement, which doesn't sell for much but doesn't require any input goods to make). You may build up to five Cement Factories, and each one will accelerate construction further. Side note: you don't need to buy blueprints to make the Cement Factory.
Grit your teeth and throw money at the problem with the "Quick Build" button on the thing being built. It doubles the price of the building, but this can be worth it for cheap buildings (like, say, Garages that make your builders spend less time walking) or if you think it'll eventually pay for itself (for anything that makes you money).

Did I mention that building Garages will help?
(If you have the Modern Times DLC, a network of Metro Stations can help, but those get expensive pretty quickly; they're much better for tying together two different "towns" than getting your people from one block to the next.)
Answer: The obvious solution is to build more construction offices.  Whilst this doesn't actually improve the efficiency of them (which I agree is pretty terrible, lazy lazy workers) it does in my experience get building work completed faster.  It is especially effective if you build them at opposite ends of your settlement.  Ensure that the work mode of the construction office is set to 'sweat shop' (default work mode) rather than 'take it easy' to make sure that they work a full day.
Another problem I noticed in my latest run through of Tropico was that construction appeared to regularly get stuck and not progress when workers were being dispatched from certain construction offices.  I eventually traced this to the road that the offices were attached to was so congested with traffic that the workers were stuck in the building rather than moving to the site.  It is important therefore that your construction offices are not on main roads (perhaps build them up tracks instead).  This is particularly important if you keep the original pre-built construction office that is likely to become your city centre.
I've just noticed that a more thorough review was given in this question.
Answer: If most of your workers are idle with a long list of jobs, then there probably aren't enough trucks in your city to transport all of the goods and people. Build some garages to remedy the situaiton.
In addition, some other things that could speed up construction:

Putting a higher construction priority on buildings you want done first
Send El Presidente to a building you want to be built faster
Comment: it does not seem to be relevant, when there is not enough cars (or garage is just too far away) the builders just walk to the construction site
Comment: @BanditoBunny True, but they need to get to the construction site first to get their tools. If there are no trucks and their homes are not near the construction offices, they won't get anything done. In addition, I've also heard that if they are darting across town a lot to get the basic necessities of their lives handled (food, religion, etc), they won't spend as much time at work. Building necessities near where they live would mitigate that.
Answer: Most of the construction time is not in building time, but in transportation. Builders get there quick, but they may get back slowly. Or they might be sick and hungry or spend a lot of time away.
Build garages in faraway areas, especially for things like oil and mines which tend to be far away from the city. Construction will slow to a halt if they're walking back from all the way across the island!
Place construction offices near your city center. That is, make sure that there's enough housing for builders right behind the office. Try to place the church, clinic, market/farm nearby as well.
Quick build your construction offices and garages. Both are relatively cheap, and the production boost is almost worth it. There are plenty of faraway buildings which are not worth the transportation time as well, such as farms and fishing. Builders aren't cheap either; they're a lot of mouths to feed, so later in the game when you're making a lot of money, you should consider rushing cheap buildings instead of building a third construction office.