Generating random biconnected graph

Question: Is there a straightforward algorithm for generating a random undirected biconnected graph (given a number of vertices as input)? I understand how to determine if a given graph is biconnected, but I'm struggling to generate one programatically.
Comment: At Stack Overflow, we answer questions but we don't write your code for you.
Comment: @StilesCrisis Apologies if the wording in my question was misinterpreted, but I didn't actually ask for anybody to write code for me. I asked for suggestions of an algorithm that I can use to solve this problem. My question is, "is there a straightforward algorithm for generating a random undirected biconnected graph?" I'm happy to reword the question if you think that it is necessary.
Comment: Should it be an efficient algorithm or can it be any strange thing as long as it works?
Comment: And do you care about the distribution?
Comment: @dingalapadum preferably efficient, since I'll be generating very large graphs. I don't care about the distribution. What I'm currently doing is using a sort of brute force approach with the algorithm to _discover_ biconnected components. Essentially, I'm randomly adding nodes and edges until the graph is considered biconnected, then stopping. This is repeated for the desired number of biconnected components. Whilst it works, it is very slow. Any suggestions to improve this?
Answer: You can do a very simple probabilistic approach:
1. Create an empty graph with n nodes
2. For each pair of nodes:
 -Flip a fifty-fifty-coin to decide whether to put an edge in there or not

You have O(n^2) pairs of vertices (i.e possible edges) and this will also be the expected running time of this algorithm, since the random graph generated by this procedure will be bi-connected with high probability.
Hence, in the end to make sure your graph really is bi-connected you just run the regular procedure which you already know.
For the (very unlikely) scenario where the check returns "graph is not bi-connected", just repeat the procedure.
The really intriguing question is "why will I get a biconnected graph w.h.p.?". I will omit the formal proof which is a bit tedious and by how you are asking, I assume you just want something that works and you don't care too much about why it works. If I'm wrong and you actually need a proof I suggest you either ask on mathoverflow or you drop me a comment - maybe I'll try to make it formal if I find the time.
For the moment, just to give you an intuition for why this will work, consider the following approach of how a proof could go:

Note that the number of graphs which is not bi-connected is equal to the number of graphs with at least one articulation-vertex.

Let us roughly compute the probability of a single vertex of being an articulation point: The idea is that if v is an articulation vertex then it splits the n  vertices into two disjoint sets of size k and n-k such that there is no edge between those sets. Now intuitively it should be more or less clear that k*(n-k) coin flips which all have to result in "no-edge" is not very probable (basically (1/2)^(k*(n-k))). We still have to multiply by n (since for each node) but this will still not make a significant difference, and as you might see now it is very unlikely for graph with large enough 'n' to not being bi-connected.

(What's still missing is to consider "for each possible partitioning", i.e. for the different choices of k, and then maybe be more careful since it would actually be ((n-1)-k) and k, rather than (n-k) and k because the vertex under consideration is not part of any of the 2 sets... I'm just saying these things to illustrate the kind of details one would still have to worry about for a formal proof...)
Comment: In the trivial case of 3 vertices you would need all 3 adjacent edges to make the graph bi-connected and this will only happen with a probability of 1-in-8. With a 4 vertex graph there is a 1-in-2 chance that a given vertex has zero or one incident edge so is highly likely not to be biconnected. I understand that the probability of non-biconnectivity will drop rapidly as the number of vertices increases but do you have a guide as to what a reasonable minimum number of vertices is where this will work with high probability?
Comment: @MT0 : w.h.p. is not a fixed number. I linked to the wikipedia article it is an expression with very well defined meaning - have a look at it. It means that you can get arbitrarily close to 1 with enough vertices. Also, as it goes with probabilistic algorithms you simply repeat the procedure.... As you noted: for 3 vertices we expect to repeat the procedure 8 times. For 4 we expect 2 times. If you have more vertices than that you will usually get it already after the first try... The more vertices you take the more probable it gets: that's what w.h.p. means.
Comment: This algorithm is not O(n²) - one iteration of the algorithm is O(n²) and if it happens to not produce a biconnected graph then you will have to run it again (and again and again) - the worst-case (which is what Big-O notation denotes) running time for this algorithm is O(Infinity) [but this is unlikely to occur]. You can however state that the **expected** run time is proportional to n².
Comment: @MT0 Expected runtime is what I actually meant... I mean we are talking about randomized algorithms, right? :) Anyway, thanks for noticing. I edited my answer.
Answer: A simple way to is to create a random maximal planar (tri-connected) graph:

Start with 3 vertices connected in a cycle which forms 2 triangular faces (interior and exterior of the cycle).
To add each subsequent vertex pick a random face and trisect it with a vertex and 3 edges.

You could stop here - since the graph is tri-connected it is also bi-connected.
However, if you want to remove edges and ensure that you still have a biconnected graph then only remove edges where both incident vertices are degree 3-or-more and test each edge prior to removal using Hopcroft & Tarjan's Depth-First Search Algorithm to find Biconnected Components to check for biconnectivity without that edge.
Note - this will always create a planar graph.
Comment: This does not sound like a very *random* biconnected graph, but rather like quite a *specific* kind of biconnected graph... There are bi-connected graphs which are *not* planar (in fact I think most of them probably aren't). With your algorithm you can *never* get a non-planar biconnected. Hence you are sampling from a true *subset* of biconnected graphs. Which means that the graph you get is not a random biconnected graph but rather biconnected one which is conditioned on being planar to...
Comment: As I stated in the last line of my answer - this will always create a planar graph. If the OP (or anyone else looking at this question) is happy with this restriction then it can generate all possible biconnected planar graphs (in a truly random manner). Given that for a maximal planar graph |e| = 3|n|-6 then a maximal planar graph can be generated in O(n) and random edges removed to reduce it to be biconnected in O(n²) for time and memory (since each edge only needs to be tested to see if it can be removed or not at most once and H&Ts DFS algorithm is O(n)).
Comment: How is your algorithm ever going to produce a complete graph? It is bi-connected - hence if an algorithm produces "random bi-connected graphs" it should be able to also produce the complete graph with non-zero probability... I could give you tons of other bi-connected graphs which your algorithm will never produce.... You are only sampling from a *true* subset of the required class.... For that I could go and say "just take the complete graph and remove a random edge"... this will also bi bi-connected for n>3....
Comment: As I stated in the last line of my answer - this will always create a planar graph. So this will create a random biconnected graph within the sub-set of planar graphs. I have never claimed this will create a non-planar graph but it will always create a biconnected graph.
Comment: Yes, I perfectly understand. I also see, that you never claimed it will produce a non-planar graph. What I'm saying is that it *should* be possible to get a non-planar one and the algorithm you proposed fails to do so. Hence, your algorithm is not sampling from the set of *biconnected graphs* but only from a subset, which happens to lie inside this set. An analogy "Q: I want to get the number of the side of a die at random" and  then you answer "A: well, flip a coin, head is 1 tails is 2, 1 and 2 are on a die, hence you get a random number from the die (restricted to a subset)".
Comment: If you really want you can take the biconnected planar graph and add random edges to it - you can then get a non-planar graph that will be guaranteed to be biconnected. The planar biconnected graph can be generated in O(n²) and additional edges can be added in O(e) [and since |e| < |n|² the total time will be O(n²)] - if you add enough edges you will get a complete graph.
Comment: I agree. Changing your algorithm and fixing it might get the job done. From the procedure I propose you get a bi-connected graph uniformly at random among all bi-connected graphs.. Can you tell me something about the distribution you get? I guess it depends on how you decide the nr. of edges you are going to add and where to add them - by the way, how do you plan to those 2 things exactly? Oh, and H&T is linear in the number of edges, not in the number of vertices.... Also, you will need quite a bunch of structures (for instance how do you keep track of the faces)...
Comment: H&T is linear in the number of edges but |e| = 3|n|-6 for a maximal planar graph so it is also going to be linear in the number of vertices as well.
Comment: The algorithm doesn't need fixing - it works. Keeping track of the faces is easy - a face is just a triplet of vertices in cyclic order around the face and these can be trivially stored in an array; each time a face is randomly selected to be trisected you can replace that face with one of its new sub-faces and add the other two new sub-faces at the end of the array - you know how many faces there will be by Euler's formula so you can pre-allocate all the memory.
Comment: Well, the algo as you proposed works - if you want to solve a different problem than what was asked. It needs fixing if you want *all* biconnected graphs to be possible results. As you said in your comments you will need a phase where you *add* edges. That's what I meant with fixing: "adding new steps not mentioned originally in order to adhere to the specification.". This is what the question is asking for, right? I never saw something about planarity in the question. Or that it is ok to only produce a sub-set. I mean otherwise "create cycle; add some random edges" done in O(n). Cheers!

Generating random biconnected graph


How can a WW-II style bunker be hidden?

Question: Besides the obvious steel entry doors, I am most concerned about air-inlets and exhausts. Electricity for essential things like lighting, ventilation or pumping water is generated by diesel generators. These must have an exhaust somewhere.
Wouldn't it be obvious for the enemies to find the spot where exhaust fumes come out of the ground? What's to keep them from pouring some cement down that hole?
While we are on in, if  this is in a sparsely populated area, would it be sensible to instruct enemy soldiers to shove some dirt into any unknown pipe sticking out from the ground, blocking potential intakes?
Comment: I think this question would be improved with a picture of said bunker. There are many types of bunkers.
Answer: Hide from what, exactly?
In and beyond the WWII timeframe, there were different kinds of hidden bunkers.

Hide from long-range reconnaissance and attack.
The idea with these bunkers is to stay hidden from enemy (photo) recon aircraft and bombs. In WWII, examples include B8 Bergkristall, an underground factory dug by concentration camp prisoners to build jet aircraft. After WWII, with a completely different purpose, think of the bunker under the Greenbrier hotel. These are not supposed to survive with enemy troops camped on top, instead the idea was to defeat the sensors and weapons of the time.
Camouflaged fighting positions.
Some smaller installations were supposed to remain secure from attack by nearby enemy forces. Being camouflaged into the landscape helped, but often the site was also supposed to fight. Hiding completely would defeat the purpose. An example would be the Maginot fortifications in France or the Swiss reduit. Again, the bunkers were not supposed to remain hidden with enemies directly on top, but here the camouflage was supposed to complicate attack by nearby troops.
Hide from close search
That's what you are looking for, right? These were quite unusual. I can think of two interesting British examples. One is the bunker for Operation Tracer, the plan to hide a few observers on Gibraltar if the Germans or the Spanish ever took "the Rock." The other are the bunkers of the Auxiliary Units, constructed in the UK in case the Germans invaded. Neither one had to be used in action.

As you can see, the larger the installation, the less likely it was to remain hidden with enemies directly on top. The smaller ones would rely on being quiet, and having their air pipes, exhausts, etc. in places where the enemy would not search.
Answer: The Art of Concealment:
Are you trying to hide one from random guys, or people seeking out bunkers? A lot of effort went into this kind of physical secrecy in WWII, more than I can even reasonably discuss. You'll need to do some research to get a good feel for it. But remember this is a major war zone, and there is a lot of stuff sitting around. Abandoned buildings, abandoned wells, destroyed vehicles, etc. mean it's a complex environment to be randomly pouring cement or dropping grenades at everything you can possibly imagine as a bunker.
A large pile of brush is semi-impassible and fairly easily allows air exchange. A pipe amidst one would be easily overlooked. How about a pipe made to look like a dead tree trunk (complete with open top or large 'rotten' holes? Make it look partly burnt, and a casual observer might not realize smoke wasn't from the tree burning (a smart one would tell by the smell...). A 'rock' made of concrete would only be obvious up-close, and might just seem like someone poured out excess concrete in a pile. A pile of rocks might be big enough to allow air exchange around the rocks.
Then there's the hidden in plain sight stuff. Decorative brick work with openings might not be noticed as an air intake. Or maybe it's the intake for the building it's next to, not a bunker. And why not just fix a smokestack into an actual smokestack of a surface building? I have this picture in my mind of a cabin in the woods with an elderly couple living there, and there always seems to be smoke coming out all the time. An old boarded-up well house without a roof is an air intake, and if you break into it, why there's just a hole in there going down.
The point is, there are as many ways to conceal these things as there are clever people. In most urban environments, most people don't know what every little thing is, and aren't going to be randomly blowing up EVERYTHING unless they are true vandals or are systematically rooting out bunkers. In rural areas, distance and relative lack of reason to suspect bunkers will make finding them unlikely. Bunkers are hard to make, and they usually had a special reason to make one. Most weren't intended to be concealed, but instead to protect from bombing.
So if the enemy controls an area, they'll eventually find a large bunker in operation - the bunker would need regular supplies in any case, so it would be eventually moot. If not, you would have either no reason to look, or be too occupied fighting the guys in front of you and not worrying about a possible secret bunker.
Comment: Two key issues you haven't addressed and probably need to. First - the size of the bunker. Secondly and related - its purpose.  For example the Germans built 'Mittelwerk' an entire underground factory to house major components of their V2 program from Allied attack. That 'bunker' was actually an entire series of reinforced tunnels and work spaces.  Big difference between that and say one of the local command bunkers in the German defense line at Calais in 1944 that might just have contained 1-3 small rooms e.g a radio operators room, a command/map room and a bunk room.
Comment: @Mon No disputing. I considered editing the question, mentioning the Viet Cong, but been busy, left some meat on the question. Feel free to add an answer. It sounds like you have something to contribute!
Answer: Bunkers were mostly just armored, not hidden. Typically without even a door, as by the time the enemy has reached that far, a mere steel door will barely slow them down much less stop them.
But let's consider the case of a hidden bunker that is not just a tunnel system such as was very common in Vietnam.
These bunkers are huge, and have hundreds of meters of tunnels. There is no reason for the air intake and exhaust to be anywhere near the main complex, they can be many hundreds of meters away, and disguised as other entryways into the ground. Storms drains, water well, etc.
You could reroute the exhaust vent through the apparent chimney of a house out of sight from the bunker location. Even if the house is seen, the presence of smoke from a chimney will not be unusual. Being well off the ground as a chimney should be, there is not reason for the different smoke composition to be smelled from the ground.
Any diesel exhaust can easily be filtered through a basic carbon filter to remove particulates and smell, then run through a bit of water to cool it down, leaving the exhaust appearing as mere cold air from some foul cave.
NO, with even a modicum of effort the air and exhaust from a hidden bunker can be disguised quite well. The same for water source and effluent. (can be stored, if need be). What is more likely to give away a bunker's location are the access roads that were used to construct the bunker, drive away the dug out earth, and bring in supplies and personnel.
And while those cannot be hidden well, as it is very hard to tracelessly vanish a road, they can be trivially disguised as roads leading elsewhere.
If you need to discover a hidden bunker, you need to go high-tech, or patient.
Patience, because inevitably at some point today, or tomorrow, or next week or next month people will enter and exit.
Or high tech, if you are in a hurry. Thermal imaging, as any operating bunker will cause a hot spot in the ground around it.
Or a ground microphone network, which will detect any operating engines, machinery, or clumsy humans inside your bunker.
Hidden bunkers are hard to find, that is why there were still dozens of abandoned WW2 style German bunkers being discovered all over Europe, decades after the war.
And some manned Japanese bunkers that were not discovered until several years after the war! Seems they did not quite get the message that the war was over.
Comment: Could you add references to the Japanese bunkers? Were they in inhabited areas?
Comment: Not in inhabited regions, out on islands mostly. But start with https://en.wikipedia.org/wiki/Japanese_holdout for interesting reading.
Answer: Exhaust fumes or lack of ventilation are unhealthy, but more unhealthy, to the point of lethal, is a bullet in the head/body. I think you are not interpreting the circumstances in the right way.
First of all, soldiers fighting to get control of an area bring with them weapons and rations, not cement. Then, preparing cement requires time for the dry powder to be mixed with water and then poured into the suspected hole. And while doing so, what do you expect, that nobody will shot at the cement mixing guys, just because they are indulging in masonry, not war?
Then, even if they somehow managed to clog the one pipe they found, the baddies behind it would still be alive, armed and hidden, ready to shot at whoever has had fun tampering with their lungs. And maybe they placed the holes in sight of their bunker, just to be sure to get a good sight on the pranksters.
Top this with the obvious countermeasure of creating a lot of dummy ventilation holes, and draw your conclusions: do you better go hunting for the bunker, or do you prefer jamming grenades into holes scattered around a place stuffed with armed soldiers?
Comment: @RonJohn I think he meant that the attackers wont be carrying cement during an attack in order to fill an exhaust like the OP suggested.
Comment: Why does this question presume that bunkers are built **during** the attack, instead of **well before** (which is when bunkers are actually built)?
Comment: @Demigan if I've scouted the territory, and thus know about the exhaust pipes, then I might very well bring some cement (but probably some *expanding foam epoxy*!
Comment: @RonJohn I'd bring some combat engineers with stuff instead, they can plug holes much faster and might not need cement to do it (some oiled up wads maybe enough?). That said, smart building would likely put the exhaust either in the firing line or behind the bunker. Bunkers are usually directional (as far as I know), if you can get to the rear of a bunker where an exhaust is then you are better off clearing the bunker than waiting for them to suffocate (assuming the shooting slits and doorways dont offer enough fresh air).
Comment: @Demigan "I'd bring some combat engineers".  Sure, because they're *combat* engineers.
Answer: Even sparsely populated areas have some population, which will typically live on roads, which are the logical paths of advance for an enemy force. So you can camouflage small bunkers as farm buildings and similar in the small towns along these roads.
Case in point: Constance is a German town that straddles the river Rhine, which along most of its course forms the border to Switzerland. Thus, it forms a natural bridgehead. And during the years before and during World War II, the Swiss were somewhat apprehensive about the Germans invading from this bridgehead. So they encircled it with a ring of infantry bunkers to at least slow the potential German advance. Most of these bunkers are still standing (because they are very well built - the Swiss are good at building for eternity - and correspondingly hard to dismantle). The Verein Festungsgürtel (site only in German) shows these bunkers on a map, and has hiking suggestions.
And there are indeed a number of bunkers that were indeed camouflaged as farm buildings, like this one in picturesque Triboltingen, right on the main street. The description says (my translation):

The infantry bunker, camouflaged as a stone building, is integrated into the town center of Triboltingen. The polygonal "fighting room" was prepared for an infantry gun, a machine gun on a fixed carriage and one observer. The entryway is angled, and the top floor can be reached through an exterior stairway. In the basement, there is a living/sleeping area without an emergency exit.

Edit- here is a nice short YouTube video on the analogue WW2 period bunkers guarding the road from France into Switzerland near Geneva: The Lovely Swiss Villas That Could Destroy An Army.

How can a WW-II style bunker be hidden?


Unit converter application

Question: I am working on an Android unit converter application, but I came to the point where I have to assign the formulas to the calculation method. At the moment I am using a switch-case statement, as it is more neat than an if-else, but still this proves to be very, very lengthy.
The way the application works is the user selects type of unit to convert, e.g. length. Then 2 spinners show up, one for the "From" unit and one for the "To" unit. On calculation the code picks up what is chosen in the spinners and determines the right formula to use.
Here is a code snippet for only one unit conversion:
switch (unitFrom) {
    case "Kilometers": switch (unitTo){
        case "Miles": initialValue = (initialValue / 1.6);
            break;
        case "Metres": initialValue *= 1000;
            break;
        case "Centimetres": initialValue *= 100000;
            break;
        case "Millimetres": initialValue *= 1000000;
            break;
        case "Feet": initialValue *= 3280.8399;
            break;
        case "Yards": initialValue *= 1093.6133;
            break;
        case "Inches": initialValue *= 39370.0787;
            break;
        case "Nautical Miles": initialValue *= 0.539956803;
            break;
        case "Fathoms": initialValue *= 546.806649;
            break;
        case "Light Years": initialValue *= (1.05702341*(10^-13));
            break;
    }
}

This will become so, so long after just few units being written down, so I was wondering if there's a better way of doing things. I am open to all sort of changes.
Answer: The problem with code like this is that it grows very quickly.

switch (unitFrom) {
    case "Kilometers": switch (unitTo){

Adding one unit means that you have to provide conversions to every other unit. But there's a pattern in your code:

    case "Metres": initialValue *= 1000;
        break;
    case "Centimetres": initialValue *= 100000;
        break;
    case "Millimetres": initialValue *= 1000000;
        break;
    case "Feet": initialValue *= 3280.8399;
        break;
    case "Yards": initialValue *= 1093.6133;
        break;
    case "Inches": initialValue *= 39370.0787;

Each unit is essentially just a factor. And the conversion is just the multiplication of the length value with that factor.
Take a look at the SI unit system, where such factors are actually part of the unit:
1 mm = =1 millimeter = 1 * milli * meter = 1 * 10^(-3) * meter

"milli" which would generally be considered part of the unit is actually just a number with a name: 10^(-3)
Notice that the opposite conversion means to divide by that factor.

To simplify the conversion, you can choose a common base unit.
Now you don't have to convert every unit to every other unit but only have to specify one conversion: to/from the base unit.
Here's an example class doing this:
import java.util.HashMap;
import java.util.Set;

public class Converter
{
    public static void main (String[] args)
    {
        Converter converter = new Converter();

        Set<String> units = converter.availableUnits();

        double value = 5.4;

        for (String unitFrom : units)
        {
            System.out.println(value + " " + unitFrom + " are:");

            for (String unitTo : units)
            {
                System.out.println("\t" + converter.convert(unitFrom, unitTo, value) + " " + unitTo);
            }

            System.out.println();
        }
    }

    private HashMap<String, Double> _units;

    public Converter()
    {
        _units = new HashMap<String, Double>();

        _units.put("Millimetres", 1.0);
        _units.put("Metres", 1000.0);
        _units.put("Inches", 25.4);
        _units.put("Feet", 304.8);
        _units.put("Yards", 914.4);
    }

    public double convert(String from, String to, double value)
    {
        return value * _units.get(from) / _units.get(to);
    }

    private Set<String> availableUnits()
    {
        return _units.keySet();
    }
}

The program does every conversion possible.
I kept the conversion from one unit to itself in as a quick test. If you don't want that, opt-out when unitFrom == unitTo.
5.4 Millimetres are:
    5.4 Millimetres
    0.017716535433070866 Feet
    0.21259842519685043 Inches
    0.0054 Metres
    0.005905511811023623 Yards

5.4 Feet are:
    1645.92 Millimetres
    5.4 Feet
    64.80000000000001 Inches
    1.64592 Metres
    1.8 Yards

5.4 Inches are:
    137.16 Millimetres
    0.44999999999999996 Feet
    5.4 Inches
    0.13716 Metres
    0.15 Yards

5.4 Metres are:
    5400.0 Millimetres
    17.716535433070867 Feet
    212.5984251968504 Inches
    5.4 Metres
    5.905511811023622 Yards

5.4 Yards are:
    4937.76 Millimetres
    16.2 Feet
    194.4 Inches
    4.93776 Metres
    5.4 Yards

Additional thoughts:
The name of each unit is only specified once. Retyping string literals is prone to error "Millimetres" != "Millimeters", which the compiler cannot catch.
You could go further and define a class Unit, which besides the name and factor can contain, an abbreviation, plural and singular forms, etc.
Answer: In order to optimize your distance converter, you should consider using a "common denominator". Since I am from Europe (not UK), I am biased towards International System of Units, so I would choose 1 meter (1m), although the presence of light years may lead to at least 1km.
Personally, I like to store data in database, since they can be easily read and changed even by back-end developers, so the structure could be like this (I use MSSQL style, but it should be almost identical to any other SQL flavor).
Unit
----
UnitId INT
UnitName VARCHAR(100)
RelativeValue FLOAT

It should contain the following values (skip the IDs, they are not relevant)
'Meter', 1.0
'Mile', 1609.344
'Millimeter', 0.001
'Kilometer', 1000.0

and so on
E.g. When you want to express x kilometers in miles, you should do like this:
nb_miles = x * {RelativeValue for kilometer} / {RelativeValue for mile}

that is
nb_miles = x * 1000.0 / 1609.344

This approach should greatly simplify the code:
double unitConvert(double value, string unitFrom, string unitTo) {
    // this should fetch value from DB or your proffered storage for the units
    // also, some error handling should be done here
    double fromRelativeValue = getRelativeValue(unitFrom);
    double toRelativeValue = getRelativeValue(unitTo);

    // some overflow check should be done here
    return value * fromRelativeValue / toRelativeValue;
}

It is also recommended to use enums for your units, so that unitConvert caller cannot provide an invalid unit:
public enum MeasurementUnit {
    Meter,
    Mile,
    Millimeter,
    Kilometer,
    // --
}

Unit converter application


Electrical wiring, meaning of the term "hots"

Question: On this site I have often seen the term "hots" used. With regards to electrical wiring, what does this term refer to? I am aware there is usually a positive, negative, and perhaps (not always) ground wire in home electrical cabling. Not sure what "hots" refers to.
Answer: While it's not a perfect analogy, think of this in terms of a kitchen sink (yes, I am throwing a kitchen sink at the question).

The faucet - It's hooked to a pipe that brings water in so you can use it
The drain - A pipe hooked to something that takes water away.

You then interface with the water within the sink.
In your circuit (because electricity requires one to work), you have the same basic thing.

Hot wire - Typically black, this carries current in from your power company. This is your "faucet"
Neutral wire - Carries electricity away to some sort of electrical sink (in most cases, the ground on the main service box). This is your "drain"
Ground - Think of this as a wet/dry vacuum for when your kids play in the kitchen sink and spill water everywhere. Ground soaks up everything that should have gone down the drain but didn't. Since you dump your wet/dry vac down the drain when you're done, it all goes to the same place eventually.

Why do we call it "hot"? Because it burns (sometimes literally) if you touch it while it's energized. It also might lead to dancing, colorful metaphors and other bad things
Answer: AC isn't so polar
DC has a clearly defined polarity to it -- one end of a battery is positive and the other is negative.  However, an AC source goes from being all the way positive to all the way negative and back again.  This means that we don't have "positive" or "negative" in AC circuits.  In an isolated circuit, in fact, the two supply leads are equivalent and interchangeable.
However, in order to make an isolated circuit safe, you need a reliable way to detect that electricity is flowing where it shouldn't be, and we didn't get that until the introduction of reliable, miniaturized ground-fault protection devices in the 1960s.  Another means of detecting "hard" ground faults was needed, and way back when, it was decided to do this by connecting one point on the AC supply to ground -- this becomes the neutral, or grounded conductor if you're reading the NEC.  As a result, a fault from the grounded conductor to the grounding system flows back through the grounding system to the neutral/ground bond in the main panel, and from there back to the source, so the resulting fault current blows the fuse/trips the breaker, or at least that's how the theory goes.  (Grounding the system also keeps it from floating off to a high voltage relative to earth due to induced charges, but that's mainly a problem from a dielectric breakdown standpoint.)
Neutral is not Ground
Neutral is the normal (designated) return path for current heading back to the power source from the load.  Ground is a "safety shield" or "drain" for wayward current.  These are kept separate as ground is intended to be touchable and often is (at boxes or in metal conduits, for instance), so it can't have significant voltage on it or current flowing through it normally.
Comment: By *isolated circuit* do you mean isolated AC circuit?
Comment: What about the difference between ground and neutral? Could you please include a diagram of your explanation?
Comment: For example: https://en.wikipedia.org/wiki/Ground_and_neutral


Turn off workspace switch-over display

Question: Using LightDM and wmctrl to set up workspaces and switch between them. How can I deactivate the screen which is very briefly shown when switching between workspaces?
Answer: When I use wmctrl -s <workspace#>, my screen switches workspaces and shows this: openbox workspace swithcing notification (image)
If this is the thing you want to deactivate, open Openbox Configuration Manager from Menu > Preferences > Openbox Configuration Manager or by running obconf, go to the Desktops tab, and deselect Show a notification when switching desktops.

Turn off workspace switch-over display


Red eyes darkness metal dragon ruling

Question: If I use red eyes dmd effect to bring a dragon from the graveyard then send red eyes dmd to the graveyard and then bring it back in the same turn, is it treated as a new monster resetting it so I can re-use its effect to special summon another monster?
Answer: Yes, you can do that.
This comes down to the same rulings involving this question:
Tri-Gate effect
Basically, the rule with once per turn effects is as follows:
If the cards simply says, "once per turn you can..." or any variation on this. It basically means once per turn, per card. If the monster is removed from the field and summoned again, this state resets because it no longer counts as the same card.
On the other hand if the cards states something along the lines of "you can only use this effect of "Monster Name" once per turn", then the effect can only be used once per turn for any card with that name. That includes any other physical copies of that monster you would summon.
Comment: +1 Correct. A friend of mine played Chaos Dragons and his main combo revolved around this ruling allowing him to use Darkness's effect twice by bringing him back from the GY (with [Lightpulsar Dragon](https://yugioh.fandom.com/wiki/Lightpulsar_Dragon)). I *think* this also applies if Red-eyes Darkness was flipped down (by, say book of moon), as it "resets" it's effect by "forgetting" which card it was, and also, as you say, by leaving the field
Comment: @DarkCygnus Correct. A more complete way if stating it would be: Once while the card remains face up and on the field.

Red eyes darkness metal dragon ruling


How are cases in the Federal District Courts treated/ handled when in opposition to precedent by the Court of Appeals/ SCOTUS?

Question: Essentially, I understand that lower courts are bound by decisions of "superior" courts/ Courts of Appeals (DC by the CoA and SCOTUS, and CoA by SCOTUS) and stare decisis. Even considering the binding authority of appellate courts. However, I was curious if it a) is even at all possible for a District Court (or CoA) to set aside binding precedent and rule in opposition to said precedent or out of line with said precedent and b) what the treatment of that decision is on appeal, would the appeals court merely do something along the lines of a GVR or would they hear the case? In general, I suppose I'm also curious regarding the actual logistics of stare decisis and precedent. Thank you.
Answer:
a) is even at all possible for a District Court (or CoA) to set aside binding precedent and rule in opposition to said precedent or out of line with said precedent

No.

A lower court may not rule against a binding precedent, even if it feels that it is unjust; it may only express the hope that a higher court or the legislature will reform the rule in question. If the court believes that developments or trends in legal reasoning render the precedent unhelpful, and wishes to evade it and help the law evolve, it may either hold that the precedent is inconsistent with subsequent authority, or that it should be distinguished by some material difference between the facts of the cases; some jurisdictions allow for a judge to recommend that an appeal be carried out. If that judgment goes to appeal, the appellate court will have the opportunity to review both the precedent and the case under appeal, perhaps overruling the previous case law by setting a new precedent of higher authority.

b) what the treatment of that decision is on appeal, would the appeals court merely do something along the lines of a GVR or would they hear the case?

A court that has the discretion on whether to hear appeals may exercise that discretion and let the wrong decision stand. They might do this if the error is not material, or the issue is not legally significantly, or the injustice is slight.
A court that has no discretion or one that does and accepts the case will either overturn the lower court decision or, if they are high enough in the chain, uphold the decision and overturn the precedent.
Comment: First of all, the key point in those cases where decisions are rendered contrary to the controlling law is that 90%+ of cases are not appealed even if there is a very clear basis for doing so, for all manner of reasons from the amount at stake and the cost of doing so, to the impact of delay and uncertainty, to the likely remedy of remand to the same judge if you win. Intermediate appellate courts handle all cases the same procedurally regardless of the basis for the appeal subject to exceptions much more dire than ignoring controlling precedents, e.g. in election law where timing is critical.
Comment: Not wrong. But trial courts first of all, do sometimes decide cases contrary to controlling law, secondly, almost any case can be factually distinguished (sometimes more and sometimes less convincingly) based upon factual differences, third, not of COA rulings are binding on a particular U.S. District Court, and fourth, sometimes the continued validity of old precedents is in doubt because despite no court expressly saying it is overruled, developments of principles in other controlling cases call its continuing validity into question. So, in real life it isn't as mechanical as it seems.
Comment: @ohwilleke So in those cases where decisions are rendered contrary to the controlling law by a lower court is there any favored approach of the appeals court? If the appeals court stands by the controlling law and the case is appealed will they normally do something like a GVR or moreso actually hear the case? (even with no intention of changing the controlling law) Thanks!


Magento 2.4.3 + Redis(7?)

Question: In my test environment (Ubuntu 20.04, PHP7.4, Percona 8.0, Varnish 6.5) I've just installed redis (backend, page cache and sessions) without thinking much about its version. And of course it's of version 7.02. I know Magento 2.4.3 requires Redis 6.0 but I haven't noted any problems with version 7.02. Does anybody has any experience running Magento 2.4.3 with Redis 7.0 in live environment under heavier load?
Answer: Redis 7 is so fresh for the real experience of using in production. But based on change log i don't see any reason to don't try it on production as well. I don't see any incompatible changes that might affect to compatibility.
I have 2.4.3 and 2.4.4 with Redis 7 on staging environment and didn't find any issues.
P.S. I suggest to try MariaDB instead of Percona. FYI: Magento Cloud uses MariaDB.
Comment: Thanks. Are there any clear advantages for using MariaDB over Percona? I had chosen Percona mainly because of XtraBackup and ease of doing proper backups of db...

Magento 2.4.3 + Redis(7?)


Riemann surfaces

Question: It is known that $\mathbb{H}$ (upper hyperplane), $\mathbb{C}$, $\mathbb{C} \cup \infty$ (riemann sphere) are riemann surfaces. $\mathbb{H} \cup i\infty$ is not, but what is the principal difference between this case and $\mathbb{C} \cup \infty$?
Comment: Boundary of $\mathbb H$ is homeomorphic with $S^1$, but in this case you are only adding a single point in the boundary.
Comment: The issue is the same with adding $0$ to the open upper half-plane (no neighborhood of $0$ in $\mathbf{H} \cup \{0\}$ is biholomorphic to an open disk) versus adding $0$ to the punctured plane.
Comment: $\mathbb{H}$ is homeomorphic with disk. anyway, thanks
Comment: so what?? I didn't get the meanng of your comment? Do you know the boundary of of upper half plane?
Comment: @Anubhav, i've missed the word "boundary " in your previous comment, sorry. i agree with you, that the problem is with neighbourhood of that point.
Answer: To answer this, one must understand that there is no isomorphism between an annulus $A_a=\{a<\vert z\vert <1\}$ and the punctured disk $\{0<\vert z\vert <1\}$.
Let us think about $\bf H$ as a disk ${\bf D}=\{ \vert z\vert <1\}$, and consider the annulus $A= A_{1/2}$ ; assume that there exists a complex structure on ${\bf D}\cup \infty$ which restricts to the given structure on $A$. Then $A\cup \infty$ would be a simply connected Riemann surface, hence either $\bf C$ of $\bf D$.
It cannot be $\bf C$ as $\bf C\setminus \{1pt\}$ is not isomorphic to a punctured disk (the universal cover of $\bf C\setminus \{1pt\}$ is $\bf C$). So it must be $\bf D$, and (as $:bf D$ is homogeneous) removing a point  would provide an isomorphism between the punctered disk and $A_{1/2}$.
This proof is perhaps to complicated (it uses Poincaré Koebe uniformisation) hopefully there is a simpler one using just the Riemann mapping theorem?

Riemann surfaces


18.04 Turned off display in Settings-Devices-Screen Display ON/OFF, how to turn on again?

Question: On a fresh install of 18.04, with laptop and two external monitors, I turned off the laptop display in Settings->Devices->Screen Display using the ON/OFF slider. How do I turn it back on again? Once turned off, it is taken out of the display arrangement. If I remove the laptop from the dock and power-on, it's display works. If I hot plug into the dock again, the two external monitors switch on, but the laptop screen switches off.
Answer: You can turn it back on by clicking on your monitor number in the Display menu and selecting the monitor that is turned back off. Screengrab below:
display monitor selection
Each monitor has a number. If you go to Settings > Devices > Screen Display and find the monitor number that is your primary monitor. Click on the number and it will show you a dropdown menu of all available monitors. Select the one you turned off and turn it back on.
Answer:
Go to Settings
Click on Devices
Now you  should have a window like the one displayed Displays
Then click on the display button (below the Display Arrangement section -- in my case it is 'Dell 22"')
You will get a menu listing of all your displays. You can then select the display you want to enable and turn on the display.


Copy database to local from server

Question:
As I show , I have server database version-10.50.1600 and local database version-10.0.1600 .
How can I copy database (with all tables and data(s)) from server to local which has different version ? I use MS sql server 2008 R2 .
Comment: I presume there's also the option of upgrading local to the same version as server, then doing backup/restore or the other usual suspects.
Answer: As I show , I have server database version-10.50.1600 and local database version-10.0.1600 .
How can I copy database (with all tables and data(s)) from server to local which has different version ?
Since you are trying to load data from higher version to lower version, this is not supported.
As others have pointed out to script out database objects + data, depending on the database data size, I would take a decision.
If the database size is few MB then, that is a good approach.
If the database size is huge or in GB, then the generated script wont be either handled by SSMS nor SQLCMD.
Below is my suggestion :

Script out the database SCHEMA_ONLY and recreate an empty database on the destination server.
Use BCP OUT and BULK INSERT to insert data.

Below is the script that will help you with Part 2.
<code>/************************************************************************************************************************************************
Author      :   KIN SHAH    *********************************************************************************************************************
Purpose     :   Move data from one server to another*********************************************************************************************
DATE        :   05-28-2013  *********************************************************************************************************************
Version     :   1.0.0   *************************************************************************************************************************
RDBMS       :   MS SQL Server 2008R2 and 2012   *************************************************************************************************
*************************************************************************************************************************************************/

-- save below output in a bat file by executing below in SSMS in TEXT mode
-- clean up: create a bat file with this command --> del D:\BCP_OUT\*.dat

select '"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\bcp.exe" '-- path to BCP.exe
        +  QUOTENAME(DB_NAME())+ '.'                                    -- Current Database
        +  QUOTENAME(SCHEMA_NAME(SCHEMA_ID))+'.'
        +  QUOTENAME(name)
        +  ' out D:\BCP_OUT\'                                           -- Path where BCP out files will be stored
        +  REPLACE(SCHEMA_NAME(schema_id),' ','') + '_'
        +  REPLACE(name,' ','')
        + '.dat -T -E -SSERVERNAME\INSTANCE -n'                         -- ServerName, -E will take care of Identity, -n is for Native Format
from sys.tables
where is_ms_shipped = 0 and name <> 'sysdiagrams'                       -- sysdiagrams is classified my MS as UserTable and we dont want it
and schema_name(schema_id) <> 'some_schema_exclude'                     -- Optional to exclude any schema
order by schema_name(schema_id)

--- Execute this on the destination server.database from SSMS.
--- Make sure the change the @Destdbname and the bcp out path as per your environment.

declare @Destdbname sysname
set @Destdbname = 'destination_database_Name'               -- Destination Database Name where you want to Bulk Insert in
select 'BULK INSERT '                                       -- Remember Tables **must** be present on destination Database
        +  QUOTENAME(@Destdbname)+ '.'
        +  QUOTENAME(SCHEMA_NAME(SCHEMA_ID))+'.'
        +  QUOTENAME(name)
        + ' from ''D:\BCP_OUT\'                             -- Change here for bcp out path
        +  REPLACE(SCHEMA_NAME(schema_id),' ','') + '_'
        +  REPLACE(name,' ','')
        +'.dat''
        with (
        KEEPIDENTITY,
        DATAFILETYPE = ''native'',
        TABLOCK
        )'  + char(10)
        + 'print ''Bulk insert for '+REPLACE(SCHEMA_NAME(schema_id),' ','') + '_'+  REPLACE(name,' ','')+' is done... '''+ char(10)+'go'
from sys.tables
where is_ms_shipped = 0 and name <> 'sysdiagrams'           -- sysdiagrams is classified my MS as UserTable and we dont want it
and schema_name(schema_id) <> 'some_schema_exclude'         -- Optional to exclude any schema
order by schema_name(schema_id)
</code>
Answer: Honestly, the easiest way to do this will be to upgrade your local instance to 2008 R2, or install a second local instance of 2008 R2. Then it's just a matter of making a database backup from the server, copying it to your local machine, and restoring it on a local instance.
If you really need to transfer the database to 2008, for development or troubleshooting on that version, you'll have to do all sorts of unpleasant things like scripting out all database objects (including indexes, security, etc), transferring the data (bcp or SSIS), and hoping that your database isn't using any features that are new to 2008 R2.
It's much less hassle to just upgrade.
Answer: Your best bet here would be to script out the database (schema and data) and run that script on the lower version server (provided that the database is of and acceptable size to script out).  The reason you can't just do a traditional backup and restore is because you're taking a database from SQL Server 2008 R2 to SQL Server 2008 (higher version to lower version).  You can't restore a database to a lower instance version.
To script out the database, right click on it in Object Explorer, mouse over Tasks and select Generate Scripts....  There will be a handful of configuration options, and you'll have to select to generate the script for schema and data.

Copy database to local from server


Using Django templates in an iframe, 404 error

Question: I have a Django site set up with the home page being home.html. Within home.html is a modal that is set to open automatically a few seconds after the home page loads. Within the modal is an iframe that should display template1.html. However when the modal comes up I have a 404 and I'm told the page didn't match the url patterns I defined. I'm not entirely sure where or how I go about getting template1.html to display in the iframe. The user isn't clicking on the main page to bring up a new template, which is how I'm familiar with using Django. Do I need to create another url pattern or view to achieve this or am I way off? Here are my files:
urls.py:
from django.conf.urls.defaults import patterns, url
from disease import views

    urlpatterns = patterns('',
    url(r'^$', views.home, name='disease_home'),
    url(r'^disease/(?P<pk>\d+)/$', 'disease.views.disease', name='disease_disease'),
    url(r'^treatment/(?P<pk>\d+)$', views.treatment, name='disease_treatment'),

home.html modal:

views.py:
 def home(request):
    return render(request, "disease/home.html")`

Other views return the second template, template2.html, based on actions in template1.html
Thanks!
Answer: The short answer is Yes, you'll need both another url pattern AND a view for your iframe.  An iframe is pretty much treated like an embedded browser window, it will make its own request to the server.
Answer: iframe src is just a url to a resource.
For example you could load your treatment page into it using

You will need to create a view to serve your challenge1.html template and an url to route to that view


Is there any specific scripture that tells us how to live and what to do in Hinduism?

Question: In other religions there are the books which tell you how to live your life, what is allowed what is not allowed etc. Is there such book in Hinduism as well, I've only read the summarised editions of the epics like Mahabharata, Ramayana etc.
Comment: Yes, these are the Dharmashastras.
Answer: Yes. The scriptures which discuss duty of daily life are the Dharmasutras and Dharmashastras.

athātas-sāmayācārikān dharmān vyākhyāsyāmaḥ || 1 ||
1. Now, therefore, we will teach the Dharmas which form part of the duty
of daily life, as they have been decided by the agreement [of those who
know the law].
dharmajña samayaḥ pramāṇam || 2 ||
2. The authority [for Dharma] is the agreement of those who know the law.
Apastamba Sutra 1.1.1

2.12. The Veda, the sacred tradition, the customs of virtuous men, and one's own pleasure, they declare to be visibly the fourfold means of defining the sacred law.
Manu Smriti

7. The Sruti, the Smriti, the conduct of good men, what appears pleasant to one's own self, and the desire which springs from a good resolution, are said to be the roots of Dharma.
Yajnavalkya Smriti

1.1. The Veda is the source of the sacred law,
1.2. And the tradition and practice of those who know the (Veda).
1.4. If (authorities) of equal force are conflicting, (either may be followed at) pleasure.
Gautama Sutra

These verses are from the beginning of the respective scriptures. They each mention the sacred law and what composes sacred law. The entire texts are devoted to discussing dharma and way of life according to scriptural law. The rules and restrictions are mentioned as well.
As explicitly mentioned in Gautama, remember that only in conflicts, either scriptural rule may be followed. Scriptural law cannot be rejected at one's own pleasure.
Comment: Just want to know if these scriptures are meant to be words from scholars or word from god himself. Who wrote these scriptures.
Comment: @VivekKumar Many of the Rishis who wrote these scriptures were the Rishis to whom the Vedas were revealed. These texts may have been composed by humans, but they are based on the Vedas. The Dharmasutras (like Apastamba and Gautama) are part of the [Kalpa Vedangas](https://en.wikipedia.org/wiki/Kalpa_(Vedanga)), which are part of the [Vedanga](https://en.wikipedia.org/wiki/Vedanga), which is based on study of the Vedas. The Dharmashastras (like Manu and Yajnavalkya) are based on these Dharmasutras. Just because they were written by humans does not mean that they are not divinely inspired.
Comment: Got it. So, it's not directly the word of god like some other religions.
Comment: @VivekKumar Yes, you're right. What I quoted isn't directly the word of God.
Answer: You need to differentiate between Hinduism and Abharamic faiths, because they have a definition of Sin, Halal, Haram, etc. but you won't find such things in Hinduism because the scenarios have contexts to it and you should act upon Dharma, For example, if Ravan would have waged a war to avenge his sister's (surpankha) honor that would have been Dharma but he abducted the wife of another man and inturn committed Adharma, Now both are acts of vengeance but one is driven by lust and other by brotherly love. So if we make a rule that "a brother has to always protect the honor of his sisters" that would leave the means of following the rule up to the individual hence terrorism, khalifates and crucades. I hope I am able to deliver my point clearly.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask).
Comment: For that, you need to first read Vedas then Vedang then Upanishads then Darshans.
Comment: Sure thing. Thanks.
Comment: Welcome to Hinduism StackExchange! Please visit [Guidelines for new users answering questions](https://hinduism.meta.stackexchange.com/q/125/647] to learn more.


Sardinia COVID-19 registration for tourists

Question: I've been noticed by a friend that Sardinia currently requires advanced registration before travelling due COVID-19. The registration page is in Italy, no English, so I'll ask the embassy. But maybe somebody here knows more.
https://sus.regione.sardegna.it/sus
Answer: OK, according to Czech embassy in Italy [in Czech], it's needed either to be registered on http://www.regione.sardegna.it/ or since 12th June it's possible to fill this form on the airplane and hand it in to the officers in Sardinia.
The online registration form appears to be: https://sus.regione.sardegna.it/sus/covid19/regimbarco/init
(found on http://www.regione.sardegna.it/j/v/2834?s=1&v=9&c=94253&na=1&n=8&c1=289&nodesc=1&ph=1&c1=3).
It also requires to add at least 1 location (address) where traveller is planning to stay (ID appointed there is required).
After registration, the autority will send you an email with a confirmation ID and an additional link to another form (health check and possible covid-19 infections) that is mandatory to file-in 48h before the departure date.
http://www.regione.sardegna.it/xml/getpage.php?cat=65 states that
for more information about this process, it's best to send an email at:
email@example.com
UPDATE: after filling a form I got confirmation with assigned ID and GUID and link to my form where I'm required to fill my health status declaration 48 hours before the boarding date.


AC mains LED flicker

Question: I have a number of simple LED strip lights, purchased to replace fluorescent tubes in a kitchen. Having installed the first ones, they have a noticeable flicker (to me, but not my wife!) on moving objects. I was wondering if it were possible to solder a smoothing capacitor across the dc drive to the LEDs.
The 1500mm strip is divided into 2 separate circuits each fed from 240v ac.
Each circuit consists of 5 blocks of 12 white LEDs (12 in parallel, then the 5 blocks in series). They are fed from 3 triac looking device circuits, with an output of 178v (on a cheap digital multimeter) so presumably 36v on each LED?
What uF of capacitor would I need? And will I need an extra leakage resistor too?
Comment: Shopping questions are off topic here but being very sensitive to flicker and autisticly interested in LEDs, I've bought several different vendors version of what on paper appears to be the same fluorescent tube replacement and you'll be amazed how much difference there is and the logic fallacy more expensive = less flicker isn't true. Second cheapest version had the minimum amount of flicker.
Comment: If you can trace a simple circuit diagram of the secondary side of the LED driver, with the actual LEDs and capacitors and the values of them, we can help you.
Answer: well aquainted with electronics. I'm not!
each fed from 240v ac
 smoothing capacitor across the dc drive
No, not at the level of detail appropriate to this question.
These LED light strips run from 240 V AC line power.  That's not something you should be messing with.  Getting this wrong can cause electrocution to you or anyone else that might touch these lights, burn down your house, possibly violate your electrical code, and almost certainly invalidate your insurance if these modified devices are found to have caused a problem.
We can't tell exactly how the conversion from AC to the DC the LEDs run on is accomplished.  Deep inside there may be a point where hanging a capacitor on would smooth out ripple.  Without a schematic, that's hard to tell.
Basically, you bought the wrong lights.
Comment: Thank you for such amazingly prompt answers! Those lights were remarkably cheap! It is impossible to read any data from any of the components, nor indeed to trace the circuitry. They have gone into a rented property, so I'll have to check with the new tenants as to whether they are problematic for them. Then bite the bullet and replace them.
Answer: A really big choke and then a really big cap may cost more than the LED strip.is worth.  Poor design but cheap.
Unfortunately this method of power regulation with phase modulated line frequency cannot be smoothed by simply a cap which would fry the Triac from switched cap surge current and squared Triac conductor losses.  As a cheap alternative to high rate PWM with slight more expensive magnetics and MOSFETs.
Yes it is well known that eyes are acutely more sensitive to flicker with peripheral motion .
Although possible, with more details... In theory a large tuned LC filter is needed to allow high switch impedance and low pass high frequency ripple rejection but not in practice , since this is line rate and not 1k times line rate used in SMPS LED drivers so both L and C parts need to be that much bigger to minimize ripple current that reduces e-cap life.
Stripleds are so cheap now that the power supply costs as much. ($0.2/W retail, <0.1$/W in volume) . I would measure the Vdc and look for an economical LED driver with suitable output current or simply use 12 , 24V , 36V, and now 48V 50m StripLEDs in warm white.

AC mains LED flicker


Plug-in class 2 transformer

Question: I had a bad plug-in transformer with a 3 wire output AC GRD  AC, with following specifications PRI 120V 60HZ 0.24A , SEC 12VAC 20VA, I could not find a 3 pin transformer with same specifications instead find one on Ebay with little different specifications of PRI 120V 60HZ 0.31A, SEC 12VAC 25VA, My question is can I use this one instead of original specifications of the damaged transformer ?
I would like to tell that the 3 wires goes to a Digital TIME TRACKER by FAST COMPANY. The timer gives a beeping sound at the end of the time set cycle
Comment: If it suits the PCB then go ahead.
Answer: <code>Original:    PRI 120V 60HZ 0.24A, SEC 12VAC 20VA - 3 wire output AC GRD AC.
Replacement: PRI 120V 60HZ 0.31A, SEC 12VAC 25VA.
</code>

simulate this circuit – Schematic created using CircuitLab
Figure 1 (a) 12 V AC transformer. (b) Center-tapped, 12-0-12 V AC transformer. (c) Centre-tapped 6-0-6 V AC transformer.
You state that the original is three wire and that it is 12 V. What isn't clear is whether that's a 12-0-12 (Fig. 1b) or 6-0-6 (Fig. 1c). You need to double-check.
You don't state that the replacement is centre-tapped. Again, you need to double check.
Power rating is fine. You may find that the output voltage is slightly higher as the 25 VA transformer will be running at a lower percentage of its rated output.
Comment: I think a photo of the PSU would have been more useful than a picture of the load.
Comment: While I don't doubt it as being something worth investigating, I don't recall ever seeing a plugpack with a centre tap, typically most are 2 wire Class II or 3 wire with an earth. OP does also mention ground connection so I would imagine that this is the case.
Comment: Without a doubt. Think you've wasted some time with a good answer that doesn't apply.
Answer: The voltage is the same, which is what you want and the VA is slightly higher so if anything it has a little overhead. Will work fine.
Edit: Sorry misread the original question.  You should try and source one with an earth as without knowing the purpose it would be difficult to make the call, may be performance related such as shielding, could be for circuit protection such as surge devices or may be for safety.
This can vary though. In Australia for example alarm panels have a provision for earth via the AC plugpack however direct bonding to communications earth (which is bonded to electrical earth also) is preferred.
So you may be able to also earth it seperately if you cannot source the exact plugpack.

Plug-in class 2 transformer


Youtube on Raspbian OS

Question: I am trying to install Youtube on a Rpi 3b+ but I get the fake apps (like Youtubuddy).Can I install Youtube on a Raspberry pi without running youtube in a browser ?
Comment: Android emulation?
Answer: I don't know the reason why you want an app, but I will assume that you want to separate YouTube from your main web browser. In that case I think a site specific browser is a good solution. It will work (almost) like a dedicated app.
Below I have listed a few options that are available on Linux. I have not tried them on Linux myself, but I have tried them all on macOS. Most of them exist for Windows also.
WebCatalog
https://webcatalog.io/webcatalog/
Chromeless
https://webcatalog.io/chromeless/
Ferdi (FOSS)
https://getferdi.com
Epichrome (End of support)
https://github.com/dmarmor/epichrome

Youtube on Raspbian OS


Is "our and other" correct?

Question: I am helping to edit a scientific manuscript.  The author in one sentence wants to talk about what his study and other studies have found.  Here is part of his sentence: "Although our and other studies have previously reported a link between [...]."  Is it grammatically correct to use "our and other?"  It doesn't sound right to my ears, but I'm not sure how else to word it.  Thanks!
Comment: If the author is talking only about the one study under discussion, why not *this and other studies*?
Comment: @bib: at least in my field, referring directly "this paper", "this study", etc. is Not Done in academic writing, rather like referring to oneself directly as "I".  And again like that, there are some very awkward conventional circumlocutions — "the present paper", for instance, is a standard alternative.  No idea why, but it's one of those well-entrenched quirks of academic style that it takes a brave author to break from.
Comment: The main problem with "our and other studies" is its ambiguity.  Are the authors discussing the present study and other studies, or are they discussing an entire body of work and other studies (that is, "our studies and other studies").
Comment: Hi everyone, thank you for your help!  I didn't add the rest of the sentence because it got quite technical, but if people would like more clarification, the author is saying that our group's study as well as other groups' studies have previously been able to find the same results (and then goes into other things).  Anyway, I changed it to "our study and others."  This is my first time using this site (I stumbled upon it when I Googled my question), and I'm surprised at how swift the response was!  I will probably use it again in the future. Thanks again! :)
Answer: Your wording is adequate, but it would be more elegant to say "Although our study and others have previously reported a link between [...]."
Comment: +1 Indeed, it would be less ambiguous to say that.  The phrase "our and other studies" could be read as "our studies and other studies" or "our study and other studies."
Answer: There's no obvious logical/grammatical principle involved here, but a couple of minutes on Google Books and NGrams confirms that most people think much the same as me...

we don't like [possessive pronoun] and other (things, or people's things) 1
we like it even less if other isn't followed by another "possessive" form (then a "shared" noun)
We really don't like it with first person possessives (my, our)

I find these Google Books results telling...

"his and other villages" (655 hits)
"my and other villages" (1 hit)

As indicated, I don't think there's a grammatical "rule" there. But clearly there's a strong idiomatic preference that goes far beyond the stylistic constraints of formal academic texts.

In OP's specific case an easy way to avoid the "awkward, non-idiomatic" version is...

Although our study and others have previously...

1 By which I mean Does the word other attach to the noun itself (studies, in OP's case), or to other "possessors", such as people's (which is often just implicit).

Is "our and other" correct?


What is the difference between quantum gates and quantum channels?

Question: I'm not sure if this is a dumb question, since they seem to be very basic building blocks of quantum information theory; however, I can't seem to wrap my head around the difference between the two. As I understand it, both quantum gates and quantum channels are operations that you can pass a quantum state into. Additionally, a quantum gate is represented by a unitary operator, whereas quantum channels are sums of probabilistic distributions of unitary operators and their inverses... Could anyone help me understand the intuitive distinction between the two, and their relation, if any?
Comment: Note that sometimes papers designing quantum circuits will use "gate" to refer to any basic quantum operation, *including* measurements, even though measurement is not a unitary operator. This is sloppy notation and Condo's answer is the technically correct difference.
Answer: A quantum gate is a unitary operator on a Hilbert space, where typically this Hilbert space is associated with a system of qubits. In the case of a single qubit a quantum gate is a $2\times 2$ unitary matrix, where $|0\rangle$ and $|1\rangle$ are the computational basis states. For example, the quantum NOT gate is the unitary matrix $X$ that maps $|0\rangle\mapsto|1\rangle$ and $|1\rangle \to |0\rangle$. Of course, unitary operators can act on superpositions (i.e. linear combinations) $\alpha|0\rangle+\beta|1\rangle$ of these basis states, which is required to perform quantum computation. For systems of $n$ qubits, quantum gates are unitary matrices that act on the Hilbert space $\mathbb{C}^{2^n}$.
Quantum channels are a little bit more complicated mathematically. A density matrix is a positive semi-definite matrix $\rho$ with $Tr(\rho)=1$. Density matrices represent the information about a quantum state, i.e. the probabilities and outcomes of the state that can arise upon measurement. A quantum channel is a linear map that maps density matrices to density matrices by preserving the fundamental properties, such as the positivity and trace condition of the density matrix. However, any quantum channel must also have an additional property known as complete positivity to ensure that it is compatible with the other axioms of quantum mechanics. A quantum channel is a completely positive trace-preserving (CPTP) map.
Distinctions aside, in the context of physics, quantum gates and quantum channels arise from the unitary evolution of a quantum system according to the Schrodinger equation. The  Hamiltonian (a mathematical object governing these dynamics via encoding the interactions of the quantum system) evolves in time, and the result is a unitary transformation of the quantum state of the system. Thus to enact a gate on a quantum computer, we find a Hamiltonian that we can evolve to produce the desired effect of the quantum gate. Although a quantum system evolves unitarily, perhaps we only have access to part of the whole system; in this case, the effect is not unitary on this portion of the system but is described by a quantum channel (i.e. a CPTP map). If the whole system is accessible, then the quantum channel is described by unitary conjugation (also called a unitary channel).
Comment: "quantum NOT gate is the invertible matrix" for this to be unique, it has to be the invertible unitary matrix, otherwise it is under specified.  I know you just said they have to be unitary, but I think being redundant in the first paragraph is worth it.
Comment: @Yakk thanks for the improvement!
Comment: @Yakk-AdamNevraumont, now that I think of it, if you want to be precise about the uniqueness of the matrices, then you need to define a quantum gate to be an element of the projective unitary group.
Answer: When you model your quantum system as closed and look at transformations the whole system can go through, those are described by unitary evolutions.
But, what if you want to describe local transformations? That's where the notion of channels are introduced; They describe local transformations (There's a dilation theorem stating that given any channel you can always find extended systems and unitary evolutions of those systems such that the channel you have in your hand describes the local evolution). As such, channels describe the most general transformations where states are preserved.
Unitary evolutions are then dubbed unitary channels. To wind up, quantum channels are the most general evolutions, unitary channels being a special case. And, you just call unitary channels as gates when you see them in circuits. From an information-theoretic point of view, you can see unitary channels as describing noiseless evolutions where (non-unitary) channels as describing noisy ones (the loss happening due to the appended system).


Cyanobacteria as Life Support?

Question: I'm aware that cyanobacteria are responsible for the Great Oxidation Event and are very effective at turning CO2 into oxygen so it stands to reason that with the proper nutrients for the bacteria, you could make a more effective life support system. Are there any reasons why this would/wouldn't work and why it hasn't been implemented?
Comment: Please define "more effective". Current life support systems keep the crew alive, that seems effective enough.
Comment: Having visited a mineral processing plant that used bacteria to treat ground up minerals from a mine, two things struck me about plants that rely on bacteria to do useful work. The first is the bacteria usually need a narrow temperature range to optimally do what is required of them. The second, is sometimes bacteria can produce very unpleasant odors in the natural course of what they do. Any such odors that may be produced by cyanobacteria would need to be dealt with so the crew were unaffected.
Comment: Another reason to be careful about using cyanobacteria, from [Doctors investigate mystery brain disease in Canada](https://www.bbc.com/news/world-us-canada-56910393). " ... beta-methylamino-L-alanine (BMAA) - which has been implicated as an environmental risk in the development of diseases like Alzheimer's and Parkinson's.

BMAA is produced by cyanobacteria, commonly known as blue-green algae.
Comment: Bacigalupi,  "Wind-up Girl"
Answer: Why this wouldn't work? It works for the Earth; the reason why it is not implemented in space is purely in the engineering limitations.

Cyanobacteria live in water, humans live in air.

Gravity is good at separating water from air, leaving a surface for the gas exchange. Microgravity is very good at mixing everything, so we should think about another approach for obtaining waterless air for humans and (mostly) airless water for cyanobacteria.

Light. Cyanobacteria are moderately efficient at producing oxygen. One will need few sq. meters per astronaut of transparent (but otherwise gastight) windows in order to allow enough light in. Not a trivial task in space. You will have to orient the windows in a favorable direction or make an extra amount of them. Also, good luck cooling the whole thing against these 1.5kW per square meter of heat input.

Closed carbon/nitrogen/phosphorus/etc cycle. Cyanobacteria don't only produce oxygen. They also reproduce at a rather high rate. One will want to recycle some of this biomass (it is barely edible and you have to extract it from the water in the first place).

In short, possible, but the transport to/from the Earth is WAY cheaper (for now).
Comment: Minor quibble, but the main thing that separates water from air is not gravity, but surface tension.  The dipole moment of water molecules causes them to stick together quite well, which is why water is relatively nonvolatile compared to most non-polar solvents, despite them having higher molar masses.  In microgravity, water forms closed surface volumes that cling and, if not stuck to anything, equilibrate into spheres.  They will lose some mass as vapor over time (just like water would under gravity), but the water globules won't just immediately mix with the air.
Comment: Even worse - a spacecraft significantly more than 1 or 2 AU from the sun will receive rather less solar input per sq. m
Comment: @uhoh yes, I know that the surface tension rules in low gravity environment - and wet fabric can be a thing even in normal gravity. Still not the simple "water at the bottom, air above it" we have on Earth. Just imagine pumping the water in question !
Comment: I don't think running the cyanobacteria "oxygen cells" on sunlight is going to be viable in any case. I'd much rather imagine LED lighting (a'la computer screen backlight) and  liquid cooling applied to tanks within pressurized volume of the ship.
Comment: @DanBryant small scale, yes, it is a surface tension. But big shaking droplets are of no use in a space station either.
Comment: @fraxinus in micrgravity surface tension rules! Water will stick to anything not sufficiently hydrophobic https://youtu.be/lMtXfwk7PXg?t=152 Former ISS Commander Christ Hadfield: "The water squeezes out of the cloth, and because of the surface tension of the water, it runs along the surface of the cloth and up onto my hand. It's almost like you had jello on your hand; gel on your hand, and it will just stay there."
Comment: @DanBryant I agree (see video linked in previous comment).
Comment: "One will need few sq. meters per astronaut of transparent (but otherwise gastight) windows in order to allow enough light in." Or you could just run some LEDs through the water tank...
Comment: I think it could be a better idea to have the cyanobacteriated water in tanks, and giving them light by LEDs. Then used air can be inserted into the tanks, and the bacteria would refresh it. Optional extension of the system could be to somehow re-process the bacteria to food.
Comment: In the deep space, beyond Jupiter - probably LEDs - as long as you don't have sunlight available. But still horribly inefficient.
Answer: Another engineering aspect is controllability. Most electrical/mechanical/chemical life support systems can be throttled to anywhere between 0% and 100% of production capacity within minutes, if not seconds. In particular you can shut the system down for repairs and also carry a fully inert system as a cold spare. And since the atmosphere inside a spacecraft is far from a natural equilibrium, it is really important to keep it at a stable survivable level all the time. You definitely do not want a "Great Oxidation Event" to occur aboard and oxygen levels dropping to low are of equal danger.
With biological systems, the same level of control is much harder. Changing oxygen production is much more indirect, via nutrients and light influx and even though bacteria reproduce fast, significant changes to the population will take hours or even days. And if by some accident you manage kill your bacteria by contaminating the system, getting it back to running will take a long time.
I am not saying, that it is not possible to build such a system, but it is a challenge and probably too dangerous without having a conventional system as a backup along with a few weeks supply. So for all the missions that are done currently, using the conventional system directly might be the wiser choice.
Answer: Environmental Control, and Life Support Systems need to be tailored to their application. There are many tradeoffs such as how much they weigh, how complex they are, how reliable they are and how efficient they are.
As a general rule the longer the duration of the mission, the greater the gains from life support closure. So missions of a few days can get by with little recycling whereas missions of many years need very high degrees of closure.
Any cyanobacteria oxygen recycling system would be too heavy for the short duration missions. But although it might be considered for long duration missions like a Mars base there are probably better materials to use. For example edible crops which can help further close the recycling loop. What happens to the dead/excess cyanobacteria?
Answer: In light of a very recent news item I thought I'd turn my comments into answer so the information isn't lost should comments be deleted.
Having visited a mineral processing plant that used bacteria to treat ground up minerals from a mine, two things struck me about plants that rely on bacteria to do useful work. The first is the bacteria usually need a narrow temperature range to optimally do what is required of them. The second, is sometimes bacteria can produce very unpleasant odors in the natural course of what they do. Any such odors that may be produced by cyanobacteria would need to be dealt with so the crew were unaffected.
Another reason to be careful about using cyanobacteria, from Doctors investigate mystery brain disease in Canada.

... beta-methylamino-L-alanine (BMAA) - which has been implicated as an environmental risk in the development of diseases like Alzheimer's and Parkinson's.
BMAA is produced by cyanobacteria, commonly known as blue-green algae.

Not exposing a crew to BMAA and its possible neuro-degenerative effects is another reason not to have life support system based on cyanobacteria.
Answer: Answer: O2 generation by algae has been implemented. It does work, but it is very challenging to scale the process. And it has a significant mass and power consumption penalty over stored oxygen.
I was recently involved in a feasibility study for using Chlorella vulgaris  (green microalgae) for generating medical oxygen using solar energy in off-grid medical facilities. This is the same species of algae used by NASA in the photobioreactor aboard the ISS:

https://www.dlr.de/en/latest/news/2019/02/20190503_photobioreactor-ready-for-launch-to-the-international-space-station
Light is toxic to the photosynthetic enzymes in algae. Sunlight needs to either be attenuated or intermittent. Light intensity decreases as it passes through the medium. If you are attempting to minimize the mass of the medium, you will need to use LED light source (and the attendant solar panels) rather than direct sunlight.
The algae themselves attenuate light so either algae density needs to be low (lots of medium) or LEDs must be close together (lots of LEDs).
Algae are not very efficient at converting light to O2. That's not what evolution selected them for since O2 is their waste product. Overall, algae are 12% energy efficient at separating CO2 into O2 and carbohydrates. The bioreactor process is power intensive, so it becomes a major power load (and therefor a big cooling load as well) on a spacecraft.
The bioreactor needs to be mixed, but very gently since the algae are fragile. On Earth this is usually done with bubbles rising through the medium, but the bubble size needs to be controlled to prevent shear forces on the algae. In microgravity, bubble mixing is not available. Mixing the cubic meter of medium in small passages is a non-trivial problem.
Separating O2 bubbles from the medium is easy if gravity is present. Not so in microgravity.
High O2 productivity is dependent on keeping the algae on a particular point of their growth curve by regulating density, light intensity and nutrient levels. The bioreactor will need attention, maintenance and problem solving. The astronaut becomes a farmer.
The bioreactor produces a large amount of green goo and consumes significant amounts of electrolyte nutrients. In theory a closed loop could be engineered where astronauts could poop in the bioreactor and eat the goo. You might want to run that past them first.
The mass of nutrient is one metric ton per person. If the system is run off solar panels, the total mass is several tons per person. A space voyage would need to be several years long for the system to have a mass advantage over liquid oxygen.

Cyanobacteria as Life Support?


Upgrade from Selenium 2.53 to 3.0.0

Question: Is there an accepted upgrade path from Selenium WebDriver 2.53 to 3.0.0? I'm using the Ruby gem if curious.
Comment: Just download the new Selenium Standalone JAR from seleniumhq.org and replace it with the JAR file you already have in your project.
Comment: There is many other dependency like Java 8 and Firefox latest. Please search more on Official blog of Selenium.
Comment: Nice to see information about the Upgrade from Selenium 2.53 to 3.0.0. Removing older files and installing it will be easier way to perform. I have also started creating the articles related to qa that i have focused to creating test data.
http://softwaretestingterminologies.blogspot.in/2017/03/tips-to-design-your-test-data.html
Answer: Selenium 3.0 is a drop-in replacement, so it's as simple as updating your Gemfile to use the latest version of Selenium-WebDriver (and any other libraries you want). Then run your package manager to update / install those libraries. For example, when I did this two weeks ago I ran bundle update (I use bundler). I deleted the Gemfile.lock prior to updating, just in case.
The only thing consider is that in Selenium 3.0 you'll need to start using GeckoDriver / MarionetteDriver instead of Firefox. That is also a drop-in replacement. If you use MacOS I wrote a post on how to install it.
Answer: It's simple, Just update you Jar files from 2.53 to 3.0.0
There are few other dependencies you need to add/update due to the changes in the way selenium was execution before. for example to execute firefox, you need to upgrade to latest version of GeckoDriver and firefox.
You need Java 8.
They have removed APIs related to selenium RC as well, if you are using any of that, you might need to change them accordingly.

Upgrade from Selenium 2.53 to 3.0.0


Best way to send users password?

Question: I used a plugin called WP Import to import a mass amount of users to my website. I now want to be able for them to log in using those accounts. How am I able to send them their passwords or get them to login to their account that we created for them?
Answer: You shouldn't have to send them passwords. That's a bad idea.
Instead, make sure your web server has email setup properly and your user accounts have the correct email addresses. Then all you'll have to do is send them the link to the Forgot Password link provided by WordPress by default. It looks like this: http://example.com/wp-login.php?action=lostpassword.
Then from that page they'll be able to reset their passwords using their own email address.
Alternatively, you may use a plugin like Bulk Password Reset or Emergency Password Reset to reset the passwords and send the password reset link to your users.
Whichever method you follow, you must make sure your web server can send email to your users properly.
Read more about WordPress password reset options.
Answer: You should give them a one-use limited-life access key via email this key is embedded in a URL (and it can only be used once, so if they try using it again, it is disabled, and if it not used within a short period of time, say an hour, it is disabled and a new key must be sent). Then, when the user clicks on that URL, he/she is redirected to the reset password page, where they enter a new password for their account.
Comment: How would you do that in Wordpress limitation?
Comment: You have to create a plugin for that purpose only. It does require some planning and code writing, but eventually will work.

Best way to send users password?


Help with Ethernet circuit

Question: To reduce EMI the datasheet recommends using a LP filter as shown in:
http://ww1.microchip.com/downloads/en/DeviceDoc/39762f.pdf page 219, Figure 19-2.
The filter is made of 56pF capacitor and 120ohm ferrit.
Why is the 56pF capacitor placed directly in parallel with the TPOUT+/- pins?
I would have placed the ferrit bead in series with the TPOUT+ pin and the capacitor after the ferrit bead (and likewise with the TPOUT- pin).
Answer: I finally figured it out.
The TPOUT pins can only sunk current, which is why the transformer center-tap is connected to VCC.
This is why the LP filter seems in inverse order, current is only flowing into the TPOUT pins, never out of the pins.  And therefore the LP filter will limit the high-frequency current flowing into the TPOUT pins.
Comment: I'm dubious about that. TPOUT may only sink DC but it generates outgoing AC by modulating the magnetic field in the transformer.It's a genuine AC source (else the ethernet implemented would be non functional.)
Comment: But the flow of current would still only be INTO the TPOUT pins, or am I misunderstanding something?
Answer: It does not seem to make sense by "normal" standards. 'Deep magic' may apply.
Their section 19.1.5 explains the filter considerations.
The ferrite cored inductor location is correct.
 But, a classic low pass filter would have the capacitor at the inductor + 49.9 ohm, resistor junction.
Either

It's a mistake, or
The loading effect on the slew rate of the IC is effectively what is being utilised. Unlikey. or
Other ?

None of the following useful refs use that type of filter:
Stunning & useful related discussion here - head spins - but not directly relevant to this question.
Relevant and usefl but doesn't answer this question. Common Mode Choke Filtering Improves CMRR in Ethernet Transformer Applications
More SimpliPHY'd TM 10/100/1000BASE-T Magnetics and EMI Control
And more
Comment: Hehe, yeah I got me thinking too. But "Deep magic" may apply.  ;-)
Comment: Thank you, the "SimpliPHY'd TM 10/100/1000BASE-T Magnetics and EMI Control" made me realize why the filter has been designed as it is.
Comment: @JakobJ You are more than welcome to submit an answer to your own question.

Help with Ethernet circuit


What is $\lim\limits_{n\to\infty} \frac{n^d}{ {n+d \choose d} }$?

Question: What is $\lim\limits_{n\to\infty} \frac{n^d}{ {n+d \choose d} }$ in terms of $d$? Does the limit exist? Is there a simple upper bound interms of $d$?
Comment: I think the limit sould exist and is a function of $d$. Because the denominator is $\sim n^d$ when $n\rightarrow \infty$
Answer: Write $$\frac{n^d}{(n+d)!}d!n!=d!\prod_{j=1}^d\frac{n}{n+j}$$
to see that the expected limit is $d!$.
Comment: You mean "... is $d!$" instead of $n!$.
Comment: I think there is a little mistake here.
Comment: The denominator in the product should be $n+j$.
Comment: Thanks guys, I've corrected.
Answer: $$n^d\frac{n!\,d\,!}{(n+d)!}=d\,!\,(\frac{n}{n+1})(\frac{n}{n+2})\ldots(\frac{n}{n+d})$$
Note that the R.H.S. contains a finite number of terms ($=d$) each tending to 1.
Hence the limit is $d\,!$
To find an upper bound you can simply do this
$d\,!\,(\frac{n}{n+1})(\frac{n}{n+2})\ldots(\frac{n}{n+d})<d\,!\,(\frac{n}{n})(\frac{n}{n})\ldots(\frac{n}{n})$
$d\,!\,(\frac{n}{n+1})(\frac{n}{n+2})\ldots(\frac{n}{n+d})<d\,!$
So your upper bound is $d\,!$
Another Method (Just to show that it the sequence is convergent)
Let us treat the given term $n^d\frac{n!\,d\,!}{(n+d)!}$ as term of sequces $\{x_n\}$.
Since we have shown that the sequence is bounded, it will suffice to show that the sequence is monotonically increasing.
We will now show that it is monotonically increasing.
$$\frac{n}{n+r}-\frac{m}{m+r}=\frac{r(n-m)}{(n+r)(m+r)}>0 \quad\forall\; n>m>0\quad \& \quad\forall r>0$$
Let $n>m$
Then $n!>m!$ and each term $\frac{n}{n+r}>\frac{m}{m+r} \quad \forall r \in \{1, 2, \ldots ,d\}$, we have proved this above.
Hecne $x_n \gt m_m$ (as $a>a' \quad \& \quad  b\gt b'\implies a.b>a'.b' \quad \forall a,a',b,b'>0$ )
If you want to see how a monotonically increasing sequence which is upper bounded is convergent go to this link.
Answer: You can use the Stirling approximation
$$ n! \sim \sqrt{2 \pi n} \left(\frac{n}{e}\right)^n\,, $$
after writing your expression in the form
$$ d!\frac{n^d n!}{(n+d)!} $$
$$  d!\frac{n^d n!}{(n+d)!} \sim d! \frac{n^d \sqrt{2 \pi n} \left(\frac{n}{e}\right)^n }{\sqrt{2 \pi (n+d)} \left(\frac{n+d}{e}\right)^{n+d}}= d!\, {\rm e}^d \left(\frac{n}{n+d}\right)^{n} \left(\frac{n}{n+d}\right)^{d} \left(\frac{n}{n+d}\right)^{\frac{1}{2}}$$
$$ \rightarrow d! \,{\rm e}^d \, \,{\rm e}^{-d}\, 1.1 = d!\,, \quad n \rightarrow \infty  $$


telephone sockets connecting them to an ATA

Question: We have many extension sockets in the house therefore be fairly expensive to buy an ata for each phone. Since extension sockets are daisy chained together, could I just plug it into the FXS socket instead of the BT master socket? Or is the FXS port strictly for one phone  only?
Answer: Most ATA FXS port can support multiple phones... they're typically spec for 3 to 5 REN.  So should be ok.


Select the objects for publishing and set article properties using RMO in C# .NET

Question: I am using transaction replication with push subscription. I am developing a UI for replication using RMO in C#.NET between different instances of the same database within same machine holding similar schema and structure. I am using Single subscriber and multiple publisher topology. During creation of publication i want to set a few article properties such as Keep the existing object unchanged ,allow schema changes at subscriber to false a,copy foriegn key constarint and copy check constraints to true. How do i set the article properties using RMO in C# .NET. I am using Visual Studio 2008 SP1.I also want to know as how we can select all the objects including Tables,Views,Stored Procedures for publishing at one stretch. I could do it for one table but i want to select all the tables at one stretch. This is the code snippet i used for selecting single table for publishing.
<code>TransArticle ta = new TransArticle();
ta.Name = "Article_1";

ta.PublicationName = "TransReplication_DB2";
ta.DatabaseName = "DB2";

ta.SourceObjectName = "person";
ta.SourceObjectOwner = "dbo";

ta.ConnectionContext = conn;
ta.Create();
</code>
Answer: Use the TransArticle.PreCreationOption property to specify what action should be taken. Set this property to None if you dont want to recreate the schema when article is created for the second publication.


How to convert higher order Bézier curves to piecewise cubic Bézier curves

Question: Is it possible to convert higher order Bézier curves to piecewise cubic Bézier curves in Inkscape?
Comment: As far as I know and according to a brief search, neither Inkscape nor any other graphics program does supports Bézier curves of orders higher than three (cubic) at all. What makes you think that Inkscape could be able to do this? And why are you interested in this feature?
Comment: jThis question could be better suited to [computer graphics.SE](http://computergraphics.stackexchange.com/questions/1443/what-are-the-graphics-libraries-available-for-use-in-the-python-ubuntu-ecosystem). @Wrzlprmft This kond of thing happens in data fitting and engineering applications.
Answer: You should look over this question on StackOverflow.com: https://stackoverflow.com/questions/30419726/simplify-high-order-bezier-curve
Now... as far as supporting higher-order curves in inkscape, Wrzlprmft is right. SVG path data only has commands for orders of the 2nd and 3rd order.
You could, in theory, build a path effect with python that pretends that a set of points are all control points of a single curve, then go through the trouble of sub-dividing that curve into cubic and quadratic curves.
http://wiki.inkscape.org/wiki/index.php/Script_extensions
I would encourage you to crack open Inkscape to view the path effect python files that already exist to use as guidance. And be prepared to be frustrated. It's a long road.


Opportunity product and Quoteline item have the same behaviour

Question: Can any one let me know .Opportunity has relatinship to opportunity product and quote object .Do opportunity product and quoteline item are related or do their have same behaviour or if different what is the difference.Please clarify.
Comment: Can you please clarify, what do you mean by behavior? Opportunity product and quote line item are not related to each other.....
Answer: I don't quite now if I follow exactly what you are asking but here goes.
There is no true relationship between Opportunity product and the quote line items.  I don't know what quoting solution you are using, but in many of them the 'syncing' of a quote pushes the quote line items to opportunity line items on the opportunity.  These Opportunity line items contain products and the amount of the opportunity is updated.  This is how the quote line items are 'related' to opportunity products.


Dr. X's assistant or Dr. X assistant?

Question: I don't know how to introduce myself in e-mails, am I Dr X's assistant or Dr. X assistant?
Answer: Use the possessive form: Dr. X's assistant.
You could also turn it around and say it without the possessive: an assistant to Dr. X.
Answer: You are Dr Smith's assistant in almost all cases. If his name ends in s, you may be Dr Jones' assistant or Dr Jones's assistant depending on the style you and Dr Jones prefer.
Answer: Doctor X possesses an assistant (well, he doesn't own you, but he owns your services as his assistant, so the possession stands). As such, you use the 's to denote said possession:

I am Dr. X assistant.

The meaning conveyed is I am the/an assistant working with Dr. X.  You might say that as well.

Dr. X's assistant or Dr. X assistant?


adding content from search result with jquery

Question: I am using this cool script http://qpoit.com/marcofolio_demo/apple_search/ however when I click on a search result, I want it to be added as html content to an id which I will use like . I know this is done with $("#displayContent").html(data); however I need the content of search result that I clicked on to be and not all the results found. Please help
Answer: The rpc.php-file of the search, contains the function, which generates the output of the search.
In line 29, change the content to a JavaScript-function, which does this work for you.
// Used in line 29 in rpc.php
echo 'url.'">';

// Change it to something like
echo 'url.')">'

After that, head back to the index.html (or the file in which you are using the apple-search), make sure jQuery is loaded and add something like this:

Once you click on a search-result, it should make it the content of #finalResult, or whatever element you choose.
Comment: great! however I don't want the content of the file I've found, I just want the html  data that rpc.php retuns to be added to #finaleResult. How do I do that? I know the script does that but it fades away and I want the clicked result to be appended in #finalResult
Comment: oh wait, i got it. I want the exact same thing that stackoverflow is using for the keyword adding when you ask a new question.