Efficiently duplicate some rows in PostgreSQL table

Question: I have PostgreSQL 9 database that uses auto-incrementing integers as primary keys. I want to duplicate some of the rows in a table (based on some filter criteria), while changing one or two values, i.e. copy all column values, except for the ID (which is auto-generated) and possibly another column.
However, I also want to get the mapping from old to new IDs. Is there a better way to do it then just querying for the rows to copy first and then inserting new rows one at a time?
Essentially I want to do something like this:
INSERT INTO my_table (col1, col2, col3)
SELECT col1, 'new col2 value', col3
FROM my_table old
WHERE old.some_criteria = 'something'
RETURNING old.id, id;

However, this fails with ERROR:  missing FROM-clause entry for table "old" and I can see why: Postgres must be doing the SELECT first and then inserting it and the RETURNING clauses only has access to the newly inserted row.
Comment: Do you happen to have idea how to do your query w/o naming all the attributes I want to copy? I have pretty large table (with a lot of attributes) and typing all of them and not to forget one is a pain...
Comment: why two questions about the same thing? http://stackoverflow.com/questions/29256888/insert-into-from-select-returning-id-mappings
Answer: RETURNING can only refer to the columns in the final, inserted row.  You cannot refer to the "OLD" id this way unless there is a column in the table to hold both it and the new id.
Try running this which should work and will show all the possible values that you can get via RETURNING:
INSERT INTO my_table (col1, col2, col3)
    SELECT col1, 'new col2 value', col3
    FROM my_table AS old
    WHERE old.some_criteria = 'something'
RETURNING *;

It won't get you the behavior you want, but should illustrate better how RETURNING is designed to work.
Comment: Thanks - but I believe I already understand how RETURNING works.
Answer: This can be done with the help of data-modifiying CTEs (Postgres 9.1+):
WITH sel AS (
   SELECT id, col1, col3
        , row_number() OVER (ORDER BY id) AS rn  -- order any way you like
   FROM   my_table
   WHERE  some_criteria = 'something'
   ORDER  BY id  -- match order or row_number()
   )
,    ins AS (
   INSERT INTO my_table (col1, col2, col3)
   SELECT col1, 'new col2 value', col3
   FROM   sel
   ORDER  BY id  -- redundant to be sure
   RETURNING id
 )
SELECT s.id AS old_id, i.id AS new_id
FROM  (SELECT id, row_number() OVER (ORDER BY id) AS rn FROM ins) i
JOIN   sel s USING (rn);

SQL Fiddle demonstration.
This relies on the undocumented implementation detail that rows from a SELECT are inserted in the order provided (and returned in the order provided). It works in all current versions of Postgres and is not going to break. Related:

Does Postgres preserve insertion order of records?

Window functions are not allowed in the RETURNING clause, so I apply row_number() in another subquery.
More explanation in this related later answer:

INSERT INTO ... FROM SELECT ... RETURNING id mappings
Answer: Good! I test this code, but I change
this (FROM my_table AS old) in (FROM my_table) and
this (WHERE old.some_criteria = 'something') in (WHERE some_criteria = 'something')
This is the final code that I use
INSERT INTO my_table (col1, col2, col3)
    SELECT col1, 'new col2 value', col3
    FROM my_table AS old
    WHERE some_criteria = 'something'
RETURNING *;

Thanks!
Answer: DROP TABLE IF EXISTS tmptable;
CREATE TEMPORARY TABLE tmptable as SELECT * FROM products WHERE id = 100;
UPDATE tmptable SET id = sbq.id from (select max(id)+1 as id from products) as sbq;
INSERT INTO products (SELECT * FROM tmptable);
DROP TABLE IF EXISTS tmptable;

add another update before the insert to modify another field
UPDATE tmptable SET another = 'data';

Comment: `UPDATE tmptable SET id =` only works if id is an integer, not if it's serial
Answer: 'old' is a reserved word, used by the rule rewrite system.
[ I presume this query fragment is not part of a rule; in that case you would have phrased the question differently ]
Comment: Yes, you're right - I made up the query for the post as the real one is more complex.


Maximum Ratio Combining vs. Selection Combining

Question: In literature, I am seeing that MRC almost always works better than SC. Also, in my simulations for Rayleigh and Rician fading channel, I am getting the same results. Could anyone please explain what are the reasons behind this? I tried to read some papers but did not get a clear idea.
Comment: removed the unrelated matlab tag. Just because you're using matlab doesn't mean a question is related to that. Try to keep your tags as precise and descriptive as possible.
Answer: Very quick explanation: SC just throws away $N-1$ of $N$ observations, whereas MRC combines all $N$.
MRC does to a signal in spatial domain what a matched filter does in frequency domain: it maximizes the inner product of signal vector and weights. The exact same derivation as for the matched filter's optimal performance under AWGN apply to the MRC under the same assumption.
You can also do the same consideration on a basic stochastic level.
Assume the combiner has correct knowledge of each observation's SNR.
Then, SC picks the best one. Derivation is simple: if channel realizations are Rayleigh distributed, then the best of these channels has $\sum_{n=1}^N \frac1N$ increased SNR in expectation, $N$ being the number of concurrent observations.
For MRC, you literally get the weighted average of the received signals, so your overall SNR literally is $\sum_{n=1}^N \frac {S_k}{N_k}$, which yields a diversity gain of $N$ (the maximum possible).
Regarding your "I've read papers": the 1959 Brennan paper is the only one you need to read for this :) But, honestly, this is knowledge that's 60 years old, so you don't have to read the original paper, and should probably rather read a good modern textbook or lecture slides explaining combining methods, as these tend to didactically process the paper's content to make it more accessible. A really quick google for "diversity gain MRC" instantly yielded a link to these lecture notes, and you could have found them, too! They're easy to read, I find after quickly scanning them.
Comment: well, it's certainly simpler to only have to deal with one signal. But no, as you effectively *always* increase the sum SNR in MRC, if you can do MRC, you'll always do MRC. Reality is that especially for bad SNRs, your CSI estimator might be off, so to make sure you're not mis-estimating a bad signal for a good one, you might be cutting of your MRC sum below some SNR threshold. But, really, the cases where you need to do that are relatively hard to construct – how many 16-antenna receivers do you have of which some are borderline noise, so you're not sure if your CSI estimate is good enough?
Comment: Is there a case that SC outperforms MRC? And is there a case that MRC is not available that one must use SC?
Comment: @AlexTP define "outperform"!  If you mean "SC being constantly better than MRC": yes, but only if your channel isn't Rayleigh, or your noise isn't uncorrelated. If both is given, then: see the formula, $\sum_{n=1}^N\frac 1n < \sum_{n=1}^N 1 = N \,\forall N > 1$, hence MRC better than SC for any number of antennas greater than one.
Comment: I do agree with your answer and yeah, the definition of "outperform" is exactly what I am asking. I mean I just wonder if there is any criteria that SC is "better" (in normal sense) than MRC. In other words, do people still use SC if two assumptions above are satisfied?
Comment: So, under perfect CSI, you'll never prefer SC, but in reality, CSI doesn't come for free, and so you might be willing to make a trade-off: being unable to estimate the CSI for worse channels without spending too much time on channel estimation, you might want to simply pick one (or a few) channel and roll with that – but that might indicated that you're actually working with a channel that's more Rician than Rayleigh!


How do I access the Ashes of Ariandel DLC?

Question: I'm starting a new file, because I'm assuming I need to in order to access the DLC, as is custom for Dark Souls. I realize the DLC has only been out for an hour at this point, but I'm curious as to at what point of the game I'll be able to access Ashes of Ariandel. If anyone finds out, please tell me, but use spoiler tags for specifics, as I'd like to find out where it is at least sort of on my own!
Answer: Seems to be accessed by a location at the Cathedral of the Deep zone.  You can read the article for more details.
Source
Based on the article's information, it seems like starting a new game was not the way to access this DLC, since this area is not available at the start.
Comment: Oops. Oh well, it's been months since I've played DS3, so it's "nice" to get back into things AKA get inexplicably rekt by Vordt like 10 times. (Probably shouldn't have chosen spear tbh)


The Man in the Ocean

Question: A man dressed in uniform is lying face down in the ocean with a backpack on. What happened to him?
Comment: idk if im qualified to say this, but is this question kinda broad?
Comment: These kind of questions do really extend our later-thinking abilities. Some of these are simple and require no tangent processes, while others really push the limit. I think this is  valid riddle.
Answer: He is

 Scuba diving (most likely surface scuba diving) with a backpack on.

 He's lying face down in order to see underwater, and the uniform in question is, in fact, the diving suit he's wearing.
Comment: me too, but then i realized they never specified the person's status :P
Comment: Oooo good one I never thought of it that...my first reaction was that he died :P
Comment: wait wat...OP just accepted? I'm so confused now...
Answer: I think

 he jumped out of a helicopter (or some other aircraft :P) and tried to open a parachute (which is supposed to be a backpack I guess...) and it uh...kinda failed to open? So he died...whoops.

But, I don't know

 how he was going to survive anyways because he jumped out in the middle of the ocean...like even if the parachute worked...
Answer: Or maybe (just to add some silliness to the otherwise grim-looking situation)

 a sailor on shore leave got blackout drunk and passed out in the McDonald's ball pit.
Comment: this solution is clearly the best one

The Man in the Ocean


Sound diffraction through a single slit

Question: When sound waves diffract through a single slit, do they produce an interference pattern which is mathematically identical to that of light waves in the corresponding experiment?
Comment: related: http://physics.stackexchange.com/questions/5886/what-is-the-effect-of-polarization-on-diffraction-by-a-narrow-slit http://physics.stackexchange.com/questions/141562/diffraction-by-small-holes
Answer: The answer is the two are very close, but there are theoretical differences. It is VERY hard to construct actual scenarios where linear acoustic diffraction differs substantially from the diffraction of light.
As noted already, linear acoustic waves are scalar pressure fields, whereas electromagnetism is a vector phenomenon, i.e. there is a polarisation state light that does not apply to acoustic waves.

(Likeness) The Cartesian components of the electromagnetic field vectors, as well as the Cartesian components of the potential four vector all fulfill the D'Alembert wave equation (Helmholtz equation in the time harmonic case). The propagation for linear acoustic waves is also the D'Alembert wave equation;
(Difference) In co-ordinate systems other than Cartesian, the components of the electromagnetic field do not in general fulfill the D'Alembert wave equation.
(Likeness) For many kinds of problem, 2. is not a big difference, either because light either has a predominant polarisation in a constant (non spatially varying) direction (so the only significant component is a Cartesian one), or because it is a classical probabalistic mixture of pure polarisation states with such predominant, non spatially varying direction polarisation. This idea can be generalised to any pure polarisation state: there are orthonormal (complex) transformations on the co-ordinate axes which keep the D'Alembert wave equation - see for example the Riemann-Silberstein vectors, whose Cartesian components fulfill the D'Alembert wave equation. Instead of x and y components, they have left and right circular components.
(Difference) The intensity of the sound field is the square of the scalar field, i.e. the square of a field fulfilling the D'Alembert wave equation. The intensity of an electromagnetic field is the inner product between the Poynting vector and the surface through which the energy flux is being defined. It can also be construed as the energy density $\frac{1}{2}\epsilon\,|\vec{E}^2| + \frac{1}{2}\mu\,|\vec{H}^2|$ times the speed of light in the medium in question. Thus it is a more general quadratic function of several different scalar fields, each fulfilling the D'Alembert wave equation.
(Likeness) Again in many situations, there is one predominant direction of the electromagnetic field, thus one Cartesian component seems to hold sway and so we again get a square of a single scalar field fulfilling the D'Alembert wave equation as the approximate intensity. Thus for both fields the square of a scalar is the intensity- this holds exactly for acoustics, but only approximately for electromagnetism;
(Difference) The main difference to my mind is the boundary conditions. For acoustics, the pressure and normal velocity component are continuous across interfaces. These are simple scalars. For the EM field, the polarisations bear critically on the behaviour at interfaces. The acoustic reflexion and transmission co-efficients bear strong likenesses to the Fresnel equations for light, but there is only one reflexion and one transmission co-efficient. For light, these two co-efficients vary widely, depending on the incident polarisation, as described by the Fresnel equations.
(Likeness) The Snell law, Eikonal equation and raytracing apply equally in both cases, being valid approximations under exactly analogous conditions.

Leaving the vector nature of light aside: a great deal of optical diffraction theory is scalar theory. Scalar optical diffraction theory is valid especially in the paraxial (fields comprising only a narrow spread of wavevector directions) case, and when one Cartesian component of a field vector is predominant.
There is no difference between scalar optical diffraction theory, and the theory of linear acoustic diffraction
Answer:
When sound waves diffract through a single slit, do they produce an interference pattern which is mathematically identical to that of light waves in the corresponding experiment?

I think the answer is almost, but not quite. It's a little complicated.

First off, there's the question of whether you're talking about the far field (Fraunhofer diffraction) or the near field (Fresnel diffraction). In the Fraunhofer approximation, we can take all the waves reaching a given point to be plane waves arriving from the same direction. But in the near field, the waves being superposed can arrive from different directions, so depending on the polarization, you can get nontrivial vector addition of the fields. This causes an actual change in the shape of the diffraction pattern, not just a renormalization.
Huygens' principle doesn't say anything about polarization, so if you believed in Huygens' principle, then you would think that all results in diffraction would be independent of polarization. But Huygens' principle is an approximation. One example where it fails is in the case where the slit is small compared to the wavelength: Diffraction by small holes From Huygens' principle, you'd expect that 100% of the power impinging on the slit would emerge as a diffracted wave. But in reality the transmission in this limit is proportional to $(a/\lambda)^n$, where $a$ is the width of the slit and the exponent $n$ depends on the multipolarity of the wave. As explained in an answer to the linked question, we have $n=4$ for light waves, but $n=2$ for sound. This causes a difference in normalization in the two cases.
Finally, a physically realistic diffracting object will interact with the polarization of the wave. For example, a conducting metal slit will interact differently with a wave depending on the direction of the wave's polarization. These are basically the same phenomena you get in a polarizing filter. If the slit has a finite thickness, it can act like a waveguide, and waveguides are sensitive to polarization.

These are three independent, well known, noncontroversial reasons why the diffraction can and will be different for light than for sound. Having said all that, I think that under most circumstances the two diffraction patterns would look almost the same. For $\lambda \ll a$, I think the normalization would even be the same, in the sense that the unitless transmission factors would both be approximately 1. It would be an interesting project to try to detect some of the differences in the lab. I don't think it would be easy at all.
Comment: If it is truly a "corresponding experiment" than you must look at the case where the edges of the slit are not conductive since there is no obvious equivalent mechanism for sound waves. But I suppose that depends on your interpretation of "equivalent experiment".
Comment: @Floris: You could also worry about the dielectric constant of the material, etc. You can't just assume a material with no electromagnetic properties -- such a material would be perfectly transparent.
Comment: I don't think that assuming a perfect slit (100% absorption outside the opening) requires either "no electromagnetic properties" or "conducting at the frequency of interest" (which would result in reflection not absorption). I think your answer is a possible explanation but not the only one - and specifically I think you are assigning properties to the slit that make the experiments _less_ "equivalent".
Answer:
When sound waves diffract through a single slit, do they produce an interference pattern which is mathematically identical to that of light waves ...?

The answer is no. The diffraction pattern of sound and of light behind a slit is not similar and so the mathematical description is not complete. This is because the real patterns on an observation screen (or an imaginery line for sound waves) are never the same for sound and light. The fringes from the light diffraction are not moving patterns. More, the reflection of these light (from the observation screen) does not interact with the incomming waves. The diffracted water (or sound) waves don't stand still (picture), they are moving to the left and to the right if one look on them at the position there is the screen for light fringes. If one put a screen in the reflected waves interact with the waves from the slit and produce more complicated patterns.
We have to state that the mathematical model describes for water waves a instantaneous situation. The position of the spherical water waves behind a slit depends from the postion of the wave in front of the slit at some time. Opposite situation for light, the fringes from light stand still.
As pointed out in the answer from Ben Crowell, the slit can work as a waveguide. As pointed out from Floris, the edges could "electrically conducting at the frequency of interest for the electromagnetic case". In both cases the light interacts with the slits material. This do the light with every edge too, fringes appear behind every edge.
As I pointed out here, "light is a lot of photons, and if you take monochromatic light, a lot of same energy photons and they interact with the electric field of the electrons of the edge. The last point one has to imagine is that the field they "built" together is quatitized. The fringes on the observers screen show how the field is quantized."
So a mathematical model for sound or water can predict instantaneous distances between maximum and minimum points of the sperical wave behind a slit. And a matematical model for light can predict the positions of maxima and minima for fringes on an observation screen. But physically that are total different phenomena.
Answer: If you can ignore the effects of sounds attenuation in air, I believe the answer is "yes". Note that when the slits are electrically conducting at the frequency of interest for the electromagnetic case, then certain effects relating to polarization come into play as explained in Ben Crowell's answer, and the sound and light cases become more and more different as the slit dimension decreases. I would argue that since there is no equivalent mechanism (conductivity along the edge of the slit) for sound, you cannot talk of an "equivalent experiment" I that case - and that the comparison must be made with a non-conductive slit.
Comment: I don't think this is right, for the reasons given in my answer. Note that I gave three separate mechanisms for the diffraction to behave differently.
Comment: I wasn't the person who flagged it as low quality, but the original answer was only one sentence.

Sound diffraction through a single slit


Hyperparameter tuning

Question: Jane trains three different classifiers: Logistic Regression, Decision Tree, and Support Vector Machines on the
training set. Each classifier has one hyper-parameter (regularisation parameter, depth-of-tree, etc) that needs
to set, so she chooses a set of 10 reasonable values for each and performs a sweep over those values (retraining
the classifier each time) and chooses the value that gives the best performance on the test set. She then reports
performance for the three classifiers with their best hyper-parameter settings on the test dataset. Is there a
problem with her approach? I think the answer regards some problems related to overfitting ,isn't it?
Answer: This is called data leakage.
She should choose hyper parameters based upon the training data. And then report performance when evaluated using the test data.
Being able to make good predictions on already seen data is uninteresting . Any relational database could accomplish that trick, it is trivial. What we care about is the ability of a model to generalize to unseen data, and to make good predictions on that.

Hyperparameter tuning


What is a latin stem for swap?

Question: I don't know if I asked this question correctly, but what is a latin stem for swap? I don't specifically need it to be just swap. You can answer my question by saying a latin stm for switch, or another adj. for swap. Please, any of you, please get back to me as soon as you can. Thanks!
Comment: Welcome to the site! Can you give an example sentence or otherwise describe the context? It can make a big difference.
Answer: The most obvious verb to use seems to me to be permutare, which can very literally mean to transform completely or to turn about, but also to exchange or swap. Its attendant noun is permutatio.
Depending on what you mean exactly I could envision constructions with transponere or some of the various verbs associated with commerce, like cambire (which is not Classical Latin but gave rise to English change).

What is a latin stem for swap?


Pressure cooking vacuum sealed meat

Question: Can a meat that is vacuum sealed for sousvide cooking be cooked instead in a pressure cooker and appropriate results be achieved?
Comment: What do you mean by "appropriate results" and what meat?
Comment: What kind of packaging?  Can it withstand the elevated temperature of the pressure cooker?
Comment: Bags will handle up to 250°F. appropr0aite results = tenderized without being overdone.
Answer: This probably isn't safe, and there's no reason to do it in the first place
The purpose of sous vide cooking is to get your food to a very specific and even temperature throughout, in order to guarantee a certain degree of doneness and minimise the possibility of overcooking. It achieves this by holding the food in a water bath at that appropriate temperature until the food has equalised with the water in temperature.
Pressure cookers, on the other hand, work by preventing steam from escaping from a boiling liquid, thereby raising the pressure in the vessel and hence raising the boiling temperature, which will allow certain reactions in the food to proceed more quickly than they would at a regular boil. This means that a pressure cooker is held at a much, much higher temperature than a sous vide water bath - indeed, if i wanted to overcook food without burning it, an extended stay in a pressure cooker is the most effective method I can think of.
If your sous vide bags can handle the elevated temperatures of a pressure cooker (and I don't think that's true for you; a quick Google suggests that pressure cookers are generally capable of hitting 250 degrees Fahrenheit, which is the number you provided for your specific bags) there may still be a danger in putting them in your pressure cooker; when you release the pressure, the liquid inside your pressure cooker boils rapidly to come back down to a temperature that makes sense at its new pressure; the liquid sealed inside your sous vide bags, however, can't vent to the atmosphere, meaning that your sous vide bags are suddenly themselves tiny pressure cookers, except they're not built to withstand internal pressure like that and will likely burst, spraying boiling liquid out of the pot.
In summary, cooking food sous vide inside a pressure cooker will generally drastically overcook it, and then, if you're not careful, spray boiling liquid around your kitchen. Personally, I wouldn't try it.
Comment: Thanks for your advice. I have a sous vide oven that I use frequently. I was just seeking a quick way to prepare a beef stew, so I simply put the beef out of the vacuum pack into a Bain Marie configuration in the instant pot and achieved the results that i wanted.
Answer: As long as your bag can handle the temperature you should be fine. The bag exploding is not an issue because there is no way for it to expand under the pressure. Once you release the pressure, the liquid starts to boil, reducing the temperature to a maximum of the boiling point of water (212˚). Since there is no air in the bag, only liquid, and because it's under vaccum, it will not over expand. Also do a natural release as to prevent a potential problem just to be sure. (important). I have found it to be completely safe. Simple thermodynamics.
For example, Sous Vide pork ribs @ 145˚ can take as much as 36 hours. On the other hand, pressure-cooked ribs take less than an hour but the seasonings and juices end up in the bottom of the pot due to the steam created from the water in the bottom which is needed to generate pressure. Would I pressure cook a filet? No. but there is an application for other meats.
Instead, by pressure cooking in a vaccum sealed bag you infuse the meat with seasoning and retain moisture while dramatically reducing cooking time. Finish in the oven or smoker/grill.
If you think it through, there is no fuss/muss, drastic reduction of time and the meat turns out brilliantly. A 2 day job is cut down to a few hours. It's a winner for me!
Sous Vide bags are NOT little pressure cookers. They are under internal vaccum and external pressure and liquids don't expand like air. To close the point, if you do a natural release, the pressure in the pressure cooker will prevent the liquid in the bag from expanding. A natural release reduces temperature and presure in a controlled manner at the same time. QED.

Pressure cooking vacuum sealed meat


Should answers based on Dobbs be posted on questions asked while Roe was in effect?

Question: If someone asked a question about abortion while Roe v. Wade was in effect, and then-accurate Roe-based answers were posted, should new Dobbs-based answers be posted?
Answer: If relevant, Yes. Any such answer should make clear that it is applying the new decision, and that it only applies to the law subsequent to that decision. In general, I think we should answer what the law is currently, and then optionally updating the set of answers provided when the law changes, if anyone thinks it worthwhile. Of course questions abut what the law was at a particular time in history need not be updated.
To be clear, I am thinking primarily about adding new answers to an existing question, rather than updating existing answers, particularly not updating answers initially given by others. Correcting typing, spelling and formatting errors is one thing, but we do not normally change the sense of answers given by others. Of course, if a user who previously gave an answer  wants to update it, that is fine, but no one should feel compelled to do so. I add this paragraph in response to comments by Iñaki Viggers
Comment: "*thus updating answers when the law changes.*" That is unrealistic and it places too much burden on contributors. Common sense is that case and/or statutory law might have changed since the posting of an answer, especially in regard to controversial issues of law that get extensive coverage in the media.
Comment: @Iñaki Viggers
 I don't say that there is any requirement on anyone to do such updates or improved answers, any more than there is a requirement to answer any particular question. I say only that it is appropriate for people to provide such updated answers if they so choose.
Comment: "*I don't say that there is any requirement*". You do portray it as corollary of something that contributors are expected to do: "*we should [...], **thus** updating answers when the law changes*". Even if the connotation of "requirement" is put aside, that wording amounts to inviting everyone to *modify* others' answers under the pretext that the law is different now. It also departs from the OP's idea/mention of *posting* (i.e., publishing a *new* answer).
Comment: @Iñaki Viggers Then it seems I wrote my answer poorly, and I shall edit it. Because that was not what I had in mind.
Answer: If you like
However, the OP presumably got their question answered (or not) which is the primary purpose of the site. Going back and changing them seems like unnecessary busy work.


How can I unlock and configure my Nexus One without a SIM card?

Question: I have a Nexus One which I want to send to my mother.  Where do I go to have it unlocked?
Does it run the latest version of Android and can I install apps without a SIM card?
Answer: If you mean unlocked so any SIM can be used, the device comes from Google SIM Unlocked.
From Wikipedia Article:

The device is sold SIM unlocked (not restricted to use on a single network provider). Google offered T-Mobile USA and AT&T versions of the phone online in the United States before closing the online store in July 2010.

The difference between the AT&T and T-Mobile version is the bands that the phone uses for its network. If you don't have the right bands, the network will fall back to the common network, which is EDGE. For example, if you have a T-Mobile version, and you mother has AT&T, then when she is browsing the internet she will only get EDGE(2G) speeds. Voice there really is not noticeable difference.
So to answer your question, you don't have to take it anywhere, and it costs nothing extra. You paid for it to be unlocked when you bought it.
You should be able to install applications without having a SIM card. At the very least, you will need to have wifi available so you can download the applications. I would suggest a factory reset, then start the device and configure it how you want for your mother, with apps, and email setup, etc.
Answer: To address your second question, you can pre-configure the phone to your liking before sending it to your mother.
You may wish to factory reset it first (or reinstall the custom ROM you're using, if you are), and then configure a 'clean' image, depending on what you had installed on the phone.


How does "only:" at "before_action" work in Rails?

Question: After scaffold generation we usually get a line like that:
before_action :set_newsletter_email, only: [:show, :edit, :update, :destroy]

Could someone explain to me how exactly this only: symbol works?
Answer: The only option of before_action defines one action OR a list of actions when the method/block will be executed first.
Ex:
# defined actions: [:show, :edit, :update, :destroy]
before_action :set_newsletter_email, only: [:show, :edit]

The set_newsletter_email method will be called just before the show and edit actions.

The opposite option except define when NOT to execute the method/block.
# defined actions: [:show, :edit, :update, :destroy]
before_action :set_newsletter_email, except: [:show, :edit]

The set_newsletter_email method will be called for all existing actions EXCEPT show and edit.

only / except is just a kind of whitelist/blacklist.
Comment: @KarolSelak yes, exactly
Comment: Thanks for your answer! Your example was firstly not fully clear for me because of list of available actions in comment - you meant that available actions are just all actions defined in the controller, didn't you?
Answer: Option :only runs a method, ':set_newsletter_email' in this example, when any of the action defined in the list in square brackets [:show, :edit, :update, :destroy] is called in the current controller and runs before the actions is run. Any other action defined in the controller will not execute :set_newsletter_email method.
You can also do the opposite with :except option to define method that will run on every actions defined in the controller except the one's that are listed.
You can also do after_action that will run after the action in the controller
You can read about the filters and all the options here:
http://guides.rubyonrails.org/action_controller_overview.html#filters
Answer: When a user navigates only to those routes, it will trigger the :set_newsletter_email function, usually at the end of that controller file.
So when the user navigates to the index method, it will not trigger it because :set_newsletter_email is only called for the methods on brackets.
In this case that callback is needed because it sets the resource in the single resource views before it is rendered.
For example:
/newsletter/2 route will trigger the :set_newsletter_email that will first get the id from the link params and then it will look for the resource and set an instance variable with it.
I don't know what is your concern about security in this case, but this callback only gets the id param to set the resource and because you're using scaffolds it also generates a params function (also at the end of the file) that whitelists the parameters you defined earlier while generating the scaffold.
You can find more info here: http://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html
If you want me to explain more or clarify something just ask


Inequality Filter in AppEngine Datastore

Question: I understand that Google AppEngine supports only one inequality filter per query. What are the workaround on this limitation? Are there any solution that will provide similar effect?
Answer: Actually GAE supports multiple inequality filters as long as they are on the same property.
The workarounds to this limitation are data-specific, e.g. it depends how your data is structured and how you want to query it. For example, for geo searching, as @Dan Holevoet mentioned, there are various geo-hashing algorithms.
Basically all such algorithms involve combining multiple properties into one and at the same time quantizing the property (creating discrete values). For example geo-hashing involves dividing up the world map into small fixed-size areas (= combining lat/lon and quantizing) in order to be able to search via equality operator.
Answer: Whether there is a workaround for having a single inequality filter per query depends on the type of dataset you are querying over.
For instance, if you wanted to query positional data using a latitude and longitude address, you'd typically need to query for a range of values on two properties (lat and long). However, with a geohash algorithm you can accomplish an equivalent query using only a single property.
Answer: When I meat this problem (example searching range from - to) I use query with single inequality filter. Depending on sorting order (asc or desc) I select upper or bottom limit. After that I filter result programatically with bottom or upper limit that was not in query filter.
Comment: was it necessary? as mentioned by Peter, multiple inequality filters is supported as long as they are on the same property.
Comment: I try to use one (range from - to) for same date field - it was not supported for me. I use it with JDO


Aggressive bearded dragon help?

Question: My bearded dragon is being aggressive, anything that comes in or near his tank he tries to attack. If I vacuum near his tank he tries to go after it, when I plug up anything in the socket, if I stick his food in there. For example I have a prepared his pellets and bugs with calcium. And I'll just pour that in his bowl and he tries to attack to container. I'm the only one that can handle him, but it takes a lot of trying. I'm also guessing it's a him I have another one who's a female and about 1 year old who displayed this behavior but not near as bad.
Comment: have you tried putting up some backgrounds and getting another hide? It sounds to me like he is stressed and feels exposed
Answer: Sometimes during breeding season they can become aggressive (indoor dragons cycles are off so it's possible to trigger breeding mode anytime during the year).

Aggressive bearded dragon help?


Question regarding assumptions in Morera's theorem and conditions for existence of antiderivative.

Question: Morera's Theorem as it is phrased in Wikipedia states that if $\Omega\subseteq\mathbb{C}$
  is a simply connected open set in the plain and $f:\Omega\to\mathbb{C}$
  is a continuous function such that for every closed piece-wise $C^{1}$
  curve in $\Omega$
  the following equality holds: $$\left(\star\right)\;\oint_{\gamma}f\left(z\right)dz=0$$
Then $f$ is holomorphic in $\Omega$. The proof in this case follows by constructing an anti-derivative of $f$ in $\Omega$ and deducing that $f$
  is holomorphic as the derivative of a holomorphic function. My question is this: Suppose we omit the assumption that $\Omega$
  is simply connected (but remains connected) and assume $f$
  is a function such that for every aforementioned $\gamma$
  the equality $\left(\star\right)$
  holds. Pick any $z_{0}\in\Omega$
  and define: $$F\left(z\right)=\int\limits _{z_{0}}^{z}f\left(\omega\right)d\omega$$
 Wouldn't it follow that $F$
  is an antiderivative of $f$
  in $\Omega$
 ? I believe the definition would be independent of the choice of path of integration from $z_{0}$
  to $z$  from the assumption $\left(\star\right)$
  holds.
Comment: You are correct. Wikipedia is deficient on this topic. http://mathworld.wolfram.com/MorerasTheorem.html
Comment: @AmritanshuPrasad I don't see why F would be not well-defined. An open connected set is also path connected, so there is no problem to define F.
Comment: @Serpahimz if I remember well my complex analysis: If $\Omega$ is an open connected set then "Every closed contour = 0" is equivalent to say that "Contours depens only on endpoints" thus proving that your right
Comment: Oh sorry, you are right. I was not reading this carefully. Of course, that $\Omega$ is simply connected is needed in the proof only to establish that the integral of $f$ does not depend on the path. If we already know that, we do not need this assumption. In fact, such an $f$ can be extended to a simply connected domain containing $\Omega$.
Answer: Being holomorphic is a local property. (A property is local if the following is true: a function has it iff each point of its domain has a neighborhood in which the property holds). Other examples of local properties: continuity, differentiability, measurability, harmonicity, being real-analytic... Non-examples: integrability, being Lipschitz continuous, being  bounded.
When you are to prove that a function has some local property, the global structure of its domain, and in particular its topology, is irrelevant. It suffices to establish the property on every open disk contained in the domain.


MacBook Pro Retina not charging

Question: So my MacBook was on 2% so I tried charging it but it worked at first ,but then a little later another message came up saying that the macbook was low battery and then I realized that the cord was not plugged in so I plugged it in to my MacBook but it won't charge this time. I figured since the computer was kinda overheated I decieded to shut it down and then charge it but now it won't charge, I even used a different charger (that works) but nothing and using a different outlet as well. When I try turning it on it just has simple of needing to be charge but when I plug in a charger it won't charge my MacBook at all. Can someone tell me what to do?????
Answer: It is possible your Power Management got messed up
Reset the SMC following this instructions:.
That should fix the problem, unless your battery is fried.

MacBook Pro Retina not charging


802.11n Wireless network link speed?

Question: I have a Linksys E4200 router and a laptop with an Intel Centrino Wireless-N 135 adapter. If I place my laptop right next to the router, the link speed is about 20 Mbps. Is that normal or is there any way I can increase it?
(P.S. Sorry if this question sounds stupid...)
Answer: No, it is not normal if the router is operating in 802.11n mode. It might be that the antenna in the router is disconnected, but first you should play around with settings of the router.
Make sure that the router is in only 802.11n mode. 802.11n/g is also good, but not 802.11b, which usually causes routers to lose performance for ALL devices. In the end, it would be smart to reset the router to see whether that helps.
Comment: I just did some research and it turns out that the wireless adapter I have (Intel Centrino Wireless-N 135) is really crappy. Even though it supports Wireless-N, it really only supports SISO (1x1) which limits it to near-Wireless-G speeds. So now my usual link speed is 72 Mbps with an actual throughput of almost 30 Mbps, which seems fine to me.
Comment: So, you meant an actual throughput? It then is definitely normal that you have 30 Mbps. When I had 802.11b/g/n mode enabled on my D-Link DIR-615C, I was not able to get more than 54 Mbps link speed (an actual throughput was 2 MB/s). Later I changed it to 802.11n and it now gives me 150 Mbps link speed and something like 9 MB/s actual speed. I suggest you try to eliminate as much as possible load from your router - that might help as well. As for the adapter - yes, you're right, it may be it's fault, but I'm just suggesting that you probably can get a bit more out of it.

802.11n Wireless network link speed?


Unable to read contents of Fedora file system!

Question: I have been running Fedora (32 bit) on a USB stick, plugged into my laptop, since version 25. This has been an attempted learning process. Currently at version 28 it now refuses to boot into the operating system (OS) any more. Whilst I could easily replace the system by burning a saved image back to the stick, I would appreciate some assistance in learning how to repair and recover the system.
My boot screen gives seven options for booting into various versions of the OS, ranging from Fedora 25 Rescue to Fedora 28 as shown under.

Regardless of which option is selected the boot progress appears to be random, ranging from
hanging after a single line :
"nouveau 0000:01:00.0: pci: failed to adjust lnkctl speed"
to  varying line reports ending in examples such as:
"Unable to fix SELinux security context of sys/fs/bpf: Permission denied"
"A start job is running for File System Check on dev/mapper/fedora-root (2min 48s / no limit)"
"Reached target Timers" etc.
I have also attempted to investigate this by booting into Fedora 29 on a separate USB stick and checking the failed USB stick / OS with GParted. This shows an exclamation warning against the Fedora partition (sdd3) stating that the contents of he file system are unable to be read, as shown below. However, both the check and repair options in GParted return that there are no errors on any of the USB stick partitions.
Answer: I would boot from a different drive unmount the usb you want to check, and run fsck -N -C -M /dev/sd* then if what it reports looks like it might fix the problem. run fsck -C /dev/sd*
Comment: Many thanks for your suggestion @Michael. I am having trouble understanding the output even after much googling:

[root@localhost Me]# fsck -N -C -M /dev/sdd; results in
fsck from util-linux 2.30.2
[/usr/sbin/fsck.ext2 (1) -- /dev/sdd] fsck.ext2 -C0 /dev/sdd

[root@localhost Me]# fsck -N -C -M /dev/sdd2; results in
fsck from util-linux 2.30.2
[/usr/sbin/fsck.ext4 (1) -- /boot] fsck.ext4 -C0 /dev

[root@localhost Me]# fsck -N -C -M /dev/sdd3; results in
fsck from util-linux 2.30.2

Reluctant to run auto repair without understanding the above.
Comment: Apologies for lack of formatting. Also trying to understand instruction on this


How to deploy a contract on your chain

Question: Hi i have cloned the node-template and also added the pallet-contract in it, now i want to know that how can i deploy a smart contract on my chain i have also deployed it on EC2 instance but i want to know how can i deploy and write smart contract on my chain network. Can someone guide me on this.
Comment: can you explain more related that issue.Do you want to add contract into your node template runtime or something else.
Comment: yes you got it right contract on node template
Answer: If you have your network with the pallet contracts in it running you can already deploy smart contracts.
You have two options to deploy the Smart Contract, see the ink! docs Deploy your Contract.

Using the tool cargo-contract, you can follow the Substrate Docs: Deploy and test the smart contract
Using the UI: https://contracts-ui.substrate.io/ you just need to change and use your local node.

How to deploy a contract on your chain


What is considered a business expense on a business trip?

Question: Scenario:  I own my own business (LLC).  There is a business-related conference that I wish to attend that requires travel.  I assume airfare, cabs, hotel and conference tickets are all obvious expenses that I can use my American Express Business card on.  But what about meals?  Can I expense meals?  What are other things can and cannot be expensed?
Comment: I think there are two issues. If you own 100% of the business (or get the agreement of all the other shareholders) you can charge what you like. But you may be obliged to consider some of the expenses as 'income' for tax purposes. That's what Chad's answer is about. If you have other shareholders that's a separate question.
Comment: @DJClayworth - As I stated in the answer the business can pay anything it wants but anything not reimbursable should be counted as income.  If you go beyond the allowable I would read up on Embezzlement statutes, and consult a professional to be certain you are not going to get in trouble.
Answer: The IRS Guidance pertaining to the subject.  In general the best I can say is your business expense may be deductible.  But it depends on the circumstances and what it is you want to deduct.
Travel

Taxpayers who travel away from home on business may deduct related
  expenses, including the cost of reaching their destination, the cost
  of lodging and meals and other ordinary and necessary expenses.
  Taxpayers are considered "traveling away from home" if their duties
  require them to be away from home substantially longer than an
  ordinary day's work and they need to sleep or rest to meet the demands
  of their work. The actual cost of meals and incidental expenses may be
  deducted or the taxpayer may use a standard meal allowance and reduced
  record keeping requirements. Regardless of the method used, meal
  deductions are generally limited to 50 percent as stated earlier.
  Only actual costs for lodging may be claimed as an expense and
  receipts must be kept for documentation. Expenses must be reasonable
  and appropriate; deductions for extravagant expenses are not
  allowable. More information is available in Publication 463, Travel,
  Entertainment, Gift, and Car Expenses.

Entertainment

Expenses for entertaining clients, customers or employees may be
  deducted if they are both ordinary and necessary and meet one of the
  following tests:
Directly-related test: The main purpose of the entertainment activity is the conduct of business, business was actually conducted
  during the activity and the taxpayer had more than a general
  expectation of getting income or some other specific business benefit
  at some future time.
  Associated test: The entertainment was associated with the active conduct of the taxpayer's trade or business and occurred directly
  before or after a substantial business discussion.
Publication 463 provides more extensive explanation of these tests as
  well as other limitations and requirements for deducting entertainment
  expenses.

Gifts

Taxpayers may deduct some or all of the cost of gifts given in the
  course of their trade or business. In general, the deduction is
  limited to $25 for gifts given directly or indirectly to any one
  person during the tax year. More discussion of the rules and
  limitations can be found in Publication 463.

If your LLC reimburses you for expenses outside of this guidance it should be treated as Income for tax purposes.
Edit for Meal Expenses:

Amount of standard meal allowance.   The standard meal allowance is
  the federal M&IE rate. For travel in 2010, the rate for most small
  localities in the United States is $46 a day.

Source IRS P463
Alternately you could reimburse at a per diem rate
Comment: The business can pay for it but if the amount is over the standard allowance the 50% should be treated as income for tax purposes.  You could also pay a Per Diem rate for all expenses.  You will want to talk with your accountant if your expenses are regularly outside of the IRS Acceptable rates.  They sometimes have other options but someone who knows more about your expenses would be in a better position to recommend where to look. If the IRS decides you applied a code improperly the penalties are to severe to take lightly over a few hundred dollars.
Comment: @BrianDavidBerman - Any payment expense that the business covers that does not fall into being covered by p463 should generally be reported as income... that is the 1040EZ type of answer.  I assume your name is on the card, and that you are ultimately responisble for the charges on the card.  If so then the business paying the card would PROBABLY be considered reimbursement by the IRS.  You may want consult a professional to verify that you are within the guidelines of the law.
Comment: You say meals are limited to 50% so what happens when you charge a meal to your Business Credit Card?  Do you then personally owe the business 50% of the charge?
Comment: Also, most of this documentation leans towards "reimbursement".  Since I will be using a Business Credit Card, there is no one to reimburse.  I am, more or less, trying to determine what is safe to charge on the Business Credit Card and what isn't.  If this is a different question, let me know.  Thanks for your answer.
Answer: The IRS clearly states that for businesses to claim deduction on trips, the travel's primary purpose should be for business. You can claim mileage, travel costs, per diems under tax deductions. The standard allowable rate of mileage and per diem also varies from state to state and the IRS updates the rate annually. To know exactly how much can you save on tax deductions, you can use a per diem calculator.
Answer: The general principle is that expenses that would have been incurred without the job are not deductible. If you wouldn't have otherwise gone to the city, then the plane tickets are deductible. For lodging, you do normally have housing expenses, but hotels tend to be more expensive, plus you probably still have to pay rent/mortgage at your residence, so the hotel is an additional expense rather than a replacement of a regular expense. Meals are where it gets complicated, as you would have had to eat anyway, but meals on the road tend to be more expensive, so while the entire cost isn't an additional expense, some of it is. The IRS has settled on letting you deduct some of the cost of meals, with the cap being 50%.
There's been some discussion on a further point in the comments, and I think it should be put in an answer: Technically, you can charge anything you want to the business card, you just have to consider anything you charge that isn't deductible to be income. However, it's still legitimate to ask what is deductible in deciding what to charge, in that it is a good idea to keep the accounts separate, as the accounting gets messy otherwise. And if you have a credit card that's labelled as being a business card that's being used for personal expenses, that can raise red flags.


Are Core Data fetches (NSFetchRequest) sorted in any specific fashion by default?

Question: I have a basic question. Say you have a NSFetchRequest which you want to perform on a NSManagedObjectContext. If the fetch request doesn't have any sort descriptors set to it explicitly, will the objects be random every time, or are they going to be spit out into an array in the order they were added to the Managed Object Context initially? I can't find this answer anywhere in the documentation.
Answer: No, they're not guaranteed to be ordered. You might happen to see consistent ordering depending on what type of data store you use (I've never tried), but it's not something you should depend on in any way.
It's easy to order by creation date though. Just add a date attribute to your entity, initialize it to the current date in awakeFromInsert, and specify that sort descriptor in your fetch.
Answer: The order may not be "random every time" but as far as I know you cannot/should not depend on it.  If you need a specific order, then use sort descriptors.
Answer: I see two questions here: will it come out in the same ordering every time?  And, is that ordering on insertion order?
It comes out in set order, which is in some ordering.  Note that NSSet is just an interface and there are private classes that implement NSSet.  That means that while some instances of NSSet you get back if you call allObjects against it might return them in some consistent ordering, it's almost assuredly in hash ordering as sets are almost universally implemented as hashed dictionaries.
Since the hashing algorithm is highly variable depending on what is stored and how it's hashed, you might "luck out" that it comes out in the same ordering every time, but then be caught off guard another time when something changes very slightly.
So, technically, it's not really random and it could be in some stable ordering.
To the second question, I would say it's almost assuredly NOT in insertion order.
Marc's suggestion for handling awakeFromInsert is a good one, and what you would want.
Answer: There is no guarantee on the ordering. For example, I could implement an NSAtomicStore or NSIncrementalStore that returns results in random order and it would be completely correct. I have seen the SQLite store return different ordering on different versions of the operating system as well.


Does touching the Live wire makes it neutral?

Question: If I have two 'hot' wires connected to a source and a load, and one of the wire is connected to the ground, this wire is called the 'Neutral'. But what happens if instead of using an additional wire to connect the 'live' wire to the ground, I use my body, I know that I would get an electric shock, but why, doesn't my body 'neutralize' the 'live' wire, just like a normal grounding wire that is connected to essentially make it 'neutral', causing no potential difference/voltage just like a regular 'neutral' wire?
Comment: Related: https://physics.stackexchange.com/q/434712/2451
Answer: I think grounding gets rid of the stray charge that builds up on something, making it neutral. But here, although the hot wire is neutral, it does have an alternating voltage coming from whatever generator it is connected to, which can certainly shock you.
This could be true in DC current as well, if the wire is connected e.g. to a battery. The battery generates a certain voltage, and the shock you get is not long enough to deplete the whole battery.
Answer: Let's say you have a transformer connected to an AC outlet. As long as neither of the terminals of the secondary is grounded, they, in theory, should have no voltage relative to ground. We can say that both terminals are hot in a sense they they have voltage relative to each other.
In practice, both terminals will have some voltage relative to ground due to a parasitic capacitance between the primary and the secondary, but, for the sake of discussion, we can ignore it.
Under such ideal conditions, either of the secondary terminals could be grounded with a wire and no current would flow through the grounding wire. You can "ground" it through your body and, under ideal conditions, no current would flow through your body either. When one of the terminals is grounded, the other, naturally, becomes hot relative to ground.
This, essentially, what is done at the secondary of distribution step-down transformers, bringing electricity to residential consumers. For instance, in North America, the secondary's center-tap conductor is grounded making it neutral. As a result, two other conductors (two phases) become hot relative to ground.
With that understood, it is extremely dangerous to touch any conductors associated with AC power, even if you believe that they are not hot. If you are curious about their voltage relative to ground, you can always measure it with a properly rated voltmeter.
Comment: But if no current flows how could we get 'electrocuted'? Doesn't touching the live wire makes it the same potential as the earth, thus no potential difference, and obviously no current, so how is 'shock' possible? (Or does the current only flow initially, then the voltage eventually becomes the same? )
Comment: @marshallbensin We get shocked when we touch live wire (and simultaneously touch ground), because the other wire, neutral, is grounded.
Comment: No, what I mean is when you bring a wire and connect it to a live wire to the ground, it technically becomes neutral right? So what happens if that 'grounding' wire is replaced by a person with his feet on the ground? Doesn't the person somehow neutralize the live wire?
Comment: @marshallbensin A person makes a poor grounding for the neutral. First to note is that, when such connection to ground of one of the wires is made, the only current flowing through the grounding person would be a leakage current due to parasitic capacitance I've mentioned, i.e., it would be pretty low current.
Comment: @marshallbensin Second, if, with that grounding in place, another person touches the other wire, while also touching ground, both people will be electrocuted. This would be similar to two people holding each other's hands, and using their free hands to touch two live wires. Third, if we measure the voltage on that "neutralized" wire, it will be smaller than before grounding, since the leakage current would divide the voltage, induced from the primary side, between the parasitic capacitance and your body. Let me know what other scenarios you would like to explore.
Comment: I'm still not getting it, please assume ideal circuits here. If a person touches a live wire, the live wire would be at the same potential at the ground right? Just like a grounding wire connected to another live wire to make it 'neutral'.
Comment: "If a person touches a live wire, the live wire would be at the same potential as the ground right?" If the transformer is ideal and the other wire is not connected to ground in any other way, that would be the case.
Answer: Yes, in a sense your body will neutralize the wire, but it does not mean that it will be safe for your body. Nor for any body else for that matter, as a human body is a poor conductor.
In an ungrounded installation you can say something  certain only about relative voltages and currents between various points of the same circuit. But you cannot be sure about absolute voltages measured to the ground, nor to any circuit with which its not galvanically connected. It may be zero, it may be a few volts, or it may be thousands volts - depending on where the extra charge comes from. And it may come from a faulty insulation,  circuitry,  components, static electricity,induced by electromagnetic fields, radioactivity. ... you name it.
When you touch such a wire with a non - zero potential,  and some part of your body is grounded then a current will flow through your body to neutralize the difference. If  the voltage is large enough, it will cause an electric shock. This is also true for low voltage circuits. If you have a 5 V ungrounded circuit and it accumulates enough charge, it may happen that it's 'mass' will be at 100v above the ground, and the 'hot' wire will be at 105V.   The circuit may work correctly, while it will still be dangerous. That's why proper grounding is so important: to protect users from electric shock, and possibly,  circuits from being damaged by large currents caused by uncontrolled grounding.
Human body is quite a poor grounding, btw - it's resistance is about 1000 ohms (depending on connection points), while the proper grounding should be a small fraction of it. Preferably, a fraction of an ohm.


Decompose a 4D rotation as a pair of quaternions

Question: I'm trying to rotate points in 4D. In fact I have been able to rotate using $6$ rotation matrices. I've managed to perform 3D rotations using rotation quaternions. I understand that I can use plane angle rotations using a pair of quaternions and the vector (used as a quaternion).
$$Z_lVZ_r$$
I understand that $Z_l$ and $Z_r$ represent the $6$ rotational planes but how do I construct $Z_l$ and $Z_r$? And can I simply add the rotations together like quaternion 3D rotations?
Comment: What do you mean by "the 6 rotational planes"? If you use $\{1,i,j,k\}$ as a basis for the quaternions (which is standard), then there are six "basis" plane rotations in the six planes spanned by $\{1,i\},$ $\{1,j\},$ $\{1,k\},$ $\{i,j\},$ $\{j,k\},$ and $\{k,i\}$. What is "ZlVZr" supposed to mean? What are "Zl" and "Zr"? Reading your question and figuring out what you're asking should be *easier* than answering the question itself, not harder
Comment: Zl is the left rotation, Zr is the right rotation and v is the 4 vector used as a quaternion so Zl * v * Zr rotates gives a quaternion representing the new vector. my question is how do i construct the i j k values for the left and right rotations.
example if i wanted to rotate 45 degrees around the xy plane and 20 degrees around the zw. what how would i construct the right and left rotation quaternions to give me that rotation.
Answer: Suppose $R$ is a rotation of $\mathbb{H}\cong\mathbb{R}^4$ in the oriented planes with orthonormal bases $\{a,b\}$ and $\{c,d\}$ by angles $\theta$ and $\phi$ respectively. (Assume the ordered basis $\{a,b,c,d\}$ induces the same orientation of space as does $\{1,\mathbf{i},\mathbf{j},\mathbf{k}\}$.) There exist unit quaternions $u,v\in S^3$ such that $R(x)=uxv$.
First, solve the system of congruences
$$ \begin{cases} \alpha+\beta\equiv \theta \\ \alpha-\beta\equiv\phi \end{cases} \pmod{2\pi}$$
Up to integer multiples of $2\pi$ in each coordinate, the solution is $(\frac{1}{2}(\theta+\phi),\frac{1}{2}(\theta-\phi))$.
Then $R=ST$ where $S$ is the left isoclinic rotation by $\theta$ and $T$ is the right isoclinic rotation by $\phi$ in the $\{a,b\}$- and $\{c,d\}$-planes. That is, they may be represented by matrices
$$ \begin{array}{l} S=\begin{bmatrix}\cos(\theta) & -\sin(\theta) & 0 & 0 \\ \sin(\theta) & \phantom{-}\cos(\theta) & 0 & 0 \\ 0 & 0 & \cos(\phi) & -\sin(\phi) \\ 0 & 0 & \sin(\phi) & \phantom{-}\cos(\phi) \end{bmatrix}, \\[7pt] T=\begin{bmatrix}\cos(\theta) & -\sin(\theta) & 0 & 0 \\ \sin(\theta) & \phantom{-}\cos(\theta) & 0 & 0 \\ 0 & 0 & \cos(-\phi) & -\sin(-\phi) \\ 0 & 0 & \sin(-\phi) & \phantom{-}\cos(-\phi) \end{bmatrix} \end{array}$$
with respect to the orthonormal basis $\{a,b,c,d\}$ (not with respect to the usual basis $\{1,\mathbf{i},\mathbf{j},\mathbf{k}\}$).
Note $ST=TS$. Define $u$ and $v$ such that $ua=b$ and $cv=d$ (these are easy to solve: $u=b\overline{a}$ and $v=\overline{c}d$). Then $S(x)=\exp(\alpha u)x$ and $T(x)=x\exp(\beta v)$ so we conclude that
$$ R(x)=\exp\left(\frac{\theta+\phi}{2}b\overline{a}\right)\,x\,\exp\left(\frac{\theta-\phi}{2}\overline{c}d\right). $$
Comment: This is what I've been looking for. The math hear is slightly above me (Which i don't mind because i will learn a great deal from it) but I'm positive i can. but that's the hole point. This is the clearest and most useful answer I've come across. Thank you very much.
Answer: This is the direct method for 4D rotation factorisation given in Perez-Gracia and Thomas's paper. Given the rotation matrix $R$ compute
$$S=\frac{R-A_1RA_1-A_2RA_2-A_3RA_3}4$$
where
$$A_1=\begin{bmatrix}0&0&0&-1\\0&0&-1&0\\0&1&0&0\\1&0&0&0\end{bmatrix}$$
$$A_2=\begin{bmatrix}0&0&1&0\\0&0&0&-1\\-1&0&0&0\\0&1&0&0\end{bmatrix}$$
$$A_3=\begin{bmatrix}0&-1&0&0\\1&0&0&0\\0&0&0&-1\\0&0&1&0\end{bmatrix}$$
Then the decomposition's right factor is
$Y=\frac S{(\det S)^{1/4}}$, while the left factor is $X=RY^T$. $X$ and $Y$ are left- and right-isoclinic rotations respectively, with corresponding quaternions $x$ and $y$ given by their left-most columns; $R$ may then be effected on a quaternion $q$ as $q'=xqy$.


Enable hardware encryption in Bacula with LTO-7

Question: Does Bacula support encryption by using the AES-chip which is integrated in LTO-7 Tapedrive?
Or is there a plugin like "stenc" that could be integrated in Bacula?
Comment: I really don't want to advertise here, but we've used Bareos (a fork of bacula) with LTO encryption successfully. Everything is built into the bareos-sd and bareos-dir without the need for any scripting.
Answer: I was able to get this to work with the use of a tape library, by modifying the autochanger script to set the encryption key after each tape had been loaded into the drive.
I did this by modifying /etc/bacula/scripts/mtx-changer and changing the load condition to enable encryption before returning:
load)
  ...
  stenc -f $device -e on -a 1 -k /path/to/my.key
  exit $rtn
;;

I am not sure exactly how you could do it if you don't have a tape library, as the drive can only have an encryption key set when there is a tape loaded.  Possibly you would have to manually run stenc after inserting each tape.


What is cold pressed method to extract Juice?

Question: Yesterday I came to know about the term when I was looking for some juice. They were stating that we will deliver cold pressed Juice. So that make me wonder about what is Cold Pressed method and how can we extract juice using that way.
Comment: Sounds ambiguous or gimmicky or both. Not pasterurised? Low temperatures? Pressed rather than pulped and centrifuged?
Answer: Cold pressing is as the name implies, to press(instead of blending) juice from a fruit while minimizing heat generation. You can buy these cold pressing juicers from the market as they're quite common nowadays.
Cold pressers from the market will likely have a rotating core (think drill bit) fixed in a tube structure. Drop your fruit from the top, and juice comes out after it gets pressed by the slowly rotating core.
The need for cold pressing juices likely came about when people thought that the traditional style of juice extraction via a blender/juicer subjects the mixture to high shearing/centrifugal forces which introduces heat and oxygen, which degrades the nutrients and vitamins in the juice. On the other hand, cold pressing purportedly negates these effects by "gently" treating the fruit. (think your cold pressed olive oil, coconut oil etc.).
Personal opinion: Since you essentially discard the fibrous parts of the fruit (that has a ton of benefits!) and consume the sugary mixture, your body will absorb a lot of sugar in a short time. Have a whole apple instead! :)
Slight addition:
For the heat generated by a blender, you may refer to this:
Experiment on waste heat in a blender. Over 3 minutes time, 9.4 degC rise was achieved in 200mL of water with a 350W blender. Of course, with fruits in the mixture the figure might vary slightly so take it with a grain of salt.
Sources:
(1) https://www.wired.com/2015/04/nobody-can-prove-cold-pressed-juice-better/
(2) http://www.ctvnews.ca/health/fact-check-are-cold-pressed-juices-worth-the-hype-1.2926121
(3) My mum bought a cold pressed juicer
Comment: hmm. I wonder how much of a temperature rise is achievable in a conventional high speed blender. I appreciate the problem with dissolved air and the unsightly browning. I wholeheartedly agree that the best juicing method is mastication in a small closed cavity called the mouth.
Comment: On a large, commercial scale, pressing is often done by heating the item being pressed external to the press to cause it to release more juice or liquid. Using olives as an example, high quality olive oil would be cold press with gently handled olives. As you go down in quality, the handling might also become rougher, more bruising, etc. By they time you get to low end utility oils the olives may get almost baked, may even be pressed, heated and pressed again to get more oil out even though much lower quality. Apples, heating may allow say 25% more juice, all of it many of us find low quality.
Comment: Is pectinase still used esp given the low yield in cold pressed juice?
Comment: @user110084 I think the answer would be no, since pectinase is an enzyme that is optimally active at around 50 degC. It would defeat the purpose of cold pressing.

Source: Wikipedia/Googling
Comment: I heard that normal juicer mixture and grinder are causing heat and that heat claims most of the nutritional items. Is that true?
Comment: @TheDictator Yes, heat can destroy certain nutritional compounds. Quite a few research has been done on this topic: eg. google on "Effects of temperature on Vitamin C in Orange Juice".

However, one of the studies do show that you'll need to achieve quite substantial temperature (>40 degC) to see a notable decrease in the vitamin C content.

Link: http://new.chemistry-teaching-resources.com/Resources/CfENewHigher/Researching2016/fin1877.pdf


Show all elements from 45 list live on one list

Question: How could show elements from 45 list in one list live, without any wait. How Could  I view this records from 45 lists in one screen ?
Comment: The list are situated in many sites.
Answer: My choice would be to create a result source in SharePoint search. See: https://technet.microsoft.com/en-us/library/jj683115.aspx. The small downside is that you need to wait for the search crawl to index the items.
Other options would be to call all the rest api's for all the lists. Performance wise this is probably not a good solution.


Unarmed Attacks, animal forms and Natural Weapons

Question: Is it possible for a creature like a bear to make an attack that counts as an unarmed attack, even though it has a claw attack as a Natural Weapon?
Answer: Yes. A non-monk bear without Improved Unarmed Attack could throw a punch, and that would be an unarmed attack that used the typical unarmed attack values for a creature of the bear's size, be nonlethal, and provoke attacks of opportunity. Because a punch "uses" the bear's paw, doing so prevents the bear from using his claw attack. He may still use his bite attack, but at a −5 penalty.
It can reasonably be assumed that a wild bear would never do so, but it could, and more relevantly someone shapeshifted into a bear could and might even want to do so, particularly if that person had Improved Unarmed Strike to eliminate the AoO provoking.
If a bear was also a monk (or, again, more realistically: a monk turned into a bear), the bear's unarmed strike damage would deal damage as appropriate for a creature of the bear's size with the given number of monk levels. Moreover, the unarmed strike would not need to be a punch (e.g. a kick), allowing the bear to also use his claws (again, at a −5 penalty).
Some relevant information about monks with natural attacks:

Multiple attacks with natural and manufactured weapons – note that unarmed strikes generally behave like manufactured weapons even though they aren't actually manufactured.
Beast Strike and Black Blood Cultist are potent
Beast Strike and monks is a little weird though
Flurry of Blows and natural attacks – note that I have linked my own answer here. It disagrees with the accepted answer; I have laid out my case for that disagreement in my answer. Do consider reading all of the answers there to have a more informed opinion.
Comment: Grappling creatures routinely and specifically inflict their unarmed strike damage (*not* natural weapon damage) when Starting a Grapple during Step 3: Hold ("If you succeed, you and your target are now grappling, and you deal damage to the target as if with an unarmed strike") (*PH* 156 and [here](http://www.d20srd.org/srd/combat/specialAttacks.htm#grapple)), so it's good to know a bear's unarmed strike damage even if a bear's never going to haul off and sock a dude.
Comment: Yay, the same monk bears idea! 8)
Comment: Might be easier to imagine with an elbow, a knee or a head butt :)
Comment: @Wyrmwood Elbow or headbutt could arguably eliminate claw or bite as options.
Comment: @thedarkwanderer That Skip Williams felt it was appropriate to stealth-errata the game while his editor wasn't looking if of no interest to me; the actual, official, published rules do not work that way. Unarmed strikes provoke unless you have Improved Unarmed Strike, period. It doesn't matter if you are otherwise armed; if you lack IUS, you cannot avoid an AoO by simply having a weapon in the other hand while you punch.
Answer: Basically, claw attacks are, well, attack with claws. Usually, the "unarmed combat" term refers to "punching stuff with your fists", and bear may as well do it, through, it surely does not posess an "Improved Unarmed Fighting", so if you want to optimize it a bit, you may give your bear a 1-level monk dip:

Monks are highly trained in fighting unarmed, giving them considerable advantages when doing so. At 1st level, a monk gains Improved Unarmed Strike as a bonus feat. A monk's attacks may be with either fist interchangeably or even from elbows, knees, and feet. This means that a monk may even make unarmed strikes with her hands full. There is no such thing as an off-hand attack for a monk striking unarmed. A monk may thus apply her full Strength bonus on damage rolls for all her unarmed strikes.

Basically, this text grants us two pieces of knowledge:

Usually, a character may not and can not attack while full-handed (and some may rule that ability to use Natural Attack negates the ability to use that, let's say, arm for unarmed combat)
A monk may do this, even if full-handed, so even if the DM rules that "the bear may not stop using claw attack to just punch stuff", a MONK BEAR can do exactly that. Like, jam some dude in the teeth with its bear elbow. Awesome AND practical.

okay, basically it's just a post about monk bears now XD
Comment: Or cast Awaken on FOUR bears and one chinchilla, then tell them that evil samurais are bad. Then that would be simply magnificent XD
Comment: Cast Awaken on a Bear, and get it Monk levels. Hilarity ensues.
Answer: While you already accepted an answer, I'd still give another.
It is true no rules as i know directly forbid unarmed strikes on a bear or the like. On the other hand, there is no direct statements to ensure one that animals can fight unarmed (even someone shifted or transmuted into an animal).
I'd personaly rule against unarmed strikes on a bear.
Animals newer use unarmed strike (even for grappling). So I assume they haven't it.
Brief clarifications on my point of view on animals and grapple:
There are two "types" of animals from the viewpoint of grappling: some hasn't Improved Grab and some has. First ones normally will not try to start a grapple and if they are grappled will try to byte or scratch you (i.e. attack with natural weapon with -4 penalty). Those who has Improved Grab use their natural weapon's (which the creature used to establish the hold) damage in place of unarmed strike damage. They also has previous option, of course, but will use it quite seldom, i think.
What about someone who "became" an animal by some means? Most common ways to do so are Alternate Form and Alter Self and their variants.
Alternate Form says:

The creature loses the natural weapons, natural armor, and movement modes of its original form, as well as any extraordinary special attacks of its original form not derived from class levels.
  The creature gains the natural weapons, natural armor, movement modes, and extraordinary special attacks of its new form.

Alter Self says:

You acquire the physical qualities of the new form while retaining your own mind. Physical qualities include natural size, mundane movement capabilities, natural armor bonus, natural weapons, racial skill bonuses, racial bonus feats, and any gross physical qualities.

Unarmed strike is a natural weapon (with some special rules, but still it is). So I think you lose it, when you polymorphed/wildshaped into something that hasn't it.
Comment: This: "there is no direct statements to ensure one that animals can fight unarmed," is irrelevant: the rules state that everyone has one, and nothing ever makes an exception for animals. "Animals newer use unarmed strike (even for grappling)." What? *No one* has unarmed strike damage listed as part of their grapple stats, yet *everyone* uses unarmed strike damage for it. That statement, in particular, seems inaccurate. Also, while various shape changing effects cause you to lose natural weapons, which unarmed strikes are sometimes treated as (but other times not), that doesn't cover *awaken*.
Comment: Ah, it is 3.5e. I misread the tag, probably still had the one in mind from the previous question i'd just been reading before coming to this one. Yea, 3.5e was somewhat more ambiguous in the actual natural weapon rules, and as you've pointed out, specifies unarmed as natural in a few tangential references. It's one of many ambiguities that PF fixed by providing explicit rules statements.
Comment: @Matthew The statement you linked is from pathfinder rules. It is slightly different system. Check this two links: http://www.d20srd.org/srd/spells/magicWeapon.htm and http://www.d20srd.org/srd/spells/magicFang.htm
Comment: @KRyan Could you point where rules state that averyone has unarmed strike? I don't say they aren't, just would like to have a link or page number or something like that.
Comment: @KRyan Since there is no answer for some time, I'll add counter arguments here. I doubt that "everyone has one". It is hard for me to tell what a dog or a snake should do to make an unarmed attack. And more of it there are such creatures as oozes and wisps. Do they have Unarmed Strike too? As for the Awaken, I can't see anything wrong with this spell. To receive it one should be an animal in the first place. And if animals doesn't have Unarmed Strike, the target of Awaken allready doesn't have it (and would not get it by means of this spell).


Is there USA trademark or copyright law regarding using word titles seen on youtube to create their own logo?

Question: Is there USA trademark or copyright law regarding using word titles seen on youtube to create their own logo?  For example, if the title of a YouTube Video was "Avocado Sunrise" could one use those words to create their own logo for their own video promotion to be "Avocado Sunrise" but look different? Would an additional word need to included to be more unique?
Comment: A mark protected in one country isn't necessarily protected right next door in a different country and may well be owned by a different organisation that has no affiliation or even by a competition, for example the mark "7up" in the US and UK are owned by direct competitioners!.
Answer: "Avocado Sunrise" is probably a distinctive mark, and could perhaps be used as a trademark. Short phrases such as "Avocado Sunrise" are not subject to copyright protection at all, and so we can ignore copyright here.
(It should be noted that an existing logo, unlike a short phrase such as a title or slogan, will often be protected by copyright, and that using  or imitating an existing logo will bring in copyright law. But the question does not suppose any such situation.)
Use of the mark as the title of a YouTube video might or might not interfere with someone else using the mark, depending on the content of the video. If it was advertising the same or a similar sort of product or service that might count as a prior use in commerce, and interfere in a new claim for the mark.
Please understand that trademarks normally are only protected relative to a type of product or service. Firm A could use "Avocado Sunrise" as a trademark for  a variety of orchids, say, and firm B use "Avocado Sunrise" for a fruit drink, and firm C for a hotel chain, and firm D for a cleaning service, all without infringing on each other.
Also trademarks are limited by market area. Firm E could use "Avocado Sunrise" for a fruit drink sold only in California, and firm F could use "Avocado Sunrise" for a similar drink sold only in Florida, with no infringement.
Also, trademarks are protected separately in different countries. A protected trademark in Canada, say, has no protection in the US unless it separately qualifies for US protection. As YouTube is international, one would need to determine what countries a video was affecting to see what trademark effect, if any it had.
Also, only use of a mark "in trade" or "in commerce" is relevant to trademark protection. Use of "Avocado Sunrise" as the title of a video showing images of the sun rising out of the ocean to music but not promoting or advertising any product or service, and not itself being sold or rented, would not be 'in trade' and would have no effect on any trademark.
A mark that is similar but not the same may or may not infringe. If firm H had registered "Avocado Sunrise", could firm J use "Avocado Tulip Sunrise"? The test is whether reasonable consumers might falsely think there was a connection, might believe that Firm J's product came from Firm H or was endorsed or approved by firm H. If confusion is probable, the new mark is an infringement on the old one, otherwise not. This is a somewhat subjective test, of course.
In the US, simple use of a mark in commerce can confer a degree of protection. In many countries there is no protection at all unless a mark is formally registered with the government of that country. Even in the US, registration gets significantly increased protection.
If firm G used "Avocado Sunrise" as the title of a video which it sold, and promoted that with a YouTube video, say an extract, that would be a use of the mark in commerce. In that case, another firm could not market a different video under the name "Avocado Sunrise" to the same market without permission or a legal proceeding to establish that Firm G's mark was invalid.
In short the issue is a complex one, and use in a YouTube video might or might not be significant. It is often wise to consult a lawyer with trademark expertise before trying to establish trademark protection or to use a mark which someone else has used in a way that might possibly infringe. The exact rules in a particular case are fact dependent.
Comment: @hszmv  While it is surely correct that a detailed logo such as you describe would be protected by copyright, that is not what the question asks about. The question refers to creating a **new** logo based on **words** previously used in the title of a YouTube video. This comment is not addressing anything in that question
Comment: Copyright could come into play if you were to mimic a firm's "Avacado Sunrise" logo.  So if you see the phrase in green lettering, curved around a rising orange sun, with the "o" in Avocado" replaced with an image of a circular avocado and copy the entire logo, that would constitute a copyright violation.   Note that this is different from using the phrase "Avocado Sunrise" in a document to discuss the concept.   I can name a character in my fiction book "Harry Potter" but I better make sure he's not a British wizard with dark hair and glasses and a scar on his forehead...
Comment: See my recent addition of a mention of this issue to the answer.


How to setup ROS and it's GUI tools in local server and connect to local macbook

Question: I recently started learning ROS and I am having Macbook (MacOS Catalina) which is not ideal for running ROS. So, I decided to install ROS in my local home ubuntu 20.04 desktop server and connect it to my local Macbook, but I was searching for the setup all over the internet but I didn't find any so please help me to set up it.
Answer: On a general level, if we're talking about ROS1, then you can use your Macbook to send/receive ROS topics/services/parameters etc. using SSH to/from your Ubuntu server, where ROS master runs. I've mostly used this without GUI, since in my use case I have RViz installed on my client machine that I can use to process/display ROS topics etc., but you can use VNC to gain GUI access to your Ubuntu server as well.
Non-exhaustive list of steps you may need to perform:

Getting both server and client machines on the same network.
Setting up an SSH server on your Ubuntu machine and an SSH client on your Macbook.
Follow the steps listed here to set up the connection between the machines: http://wiki.ros.org/ROS/NetworkSetup. After you're done here you should be able to run some nodes on the Ubuntu server and receive the topics on your Macbook.
Set up VNC if you want to export the entire Ubuntu server session to your Macbook, effectively giving you full GUI access. There should be plenty of VNC servers available that you can find online.

I haven't done too much ROS2 to tell you about that though.


How to use Stephanus numbers?

Question: A technical question here. I'm new to Plato and want to learn how to cite using Stephanus numbers. I'm a little confused because I'm not sure if the numbers are accurate to the line from translation to translation.
So for example, if I have something in between two pages like in the picture, do I cite it like this: "the expertise of the king with that of the interpreter" (Statesman, 260d-e)?
Or what if I just want to cite "that of the interpreter", is it still (Statesman, 260d-e) or can I just cite (Statesman 260e), or do both work?

Like this?
Answer: I would quote it as "Plt. 260d11-e1", but "Plt. 260d-e" is also OK.

How to use Stephanus numbers?


Blaschke Factor mapping holomorphic

Question: In Stein and Shakarchi's book, Chapter 1, Exercise 7 asks us to show that $$\left|\frac{w-z}{1-\overline{w}{z}}\right|<1$$ if $|z|<1$ and $|w|<1$, with equality if either $|z|=1$ or $|w|=1$. I was able to show this much, and for the second part of the question, most of it is immediate from the above, except showing that for a fixed $w\in\mathbb{D}=\{z\in\mathbb{C}:|z|<1\}$ $$F(z)=\frac{w-z}{1-\overline{w}{z}}$$ is holomorphic. I can do it if I completely expand everything and get it to the form $F(x,y)=u(x,y)+iv(x,y)$ (I haven't actually written everything out, only assured myself that I could actually get it to such a form). From here I should be able to check the Cauchy-Riemann equations and verify the partial derivatives are continuous, which is enough to show that $F$ is holomorphic, but I was wondering if there was a better/more elegant way of showing it? Thanks!
Comment: Quotients of holomorphic functions are holomorphic where they're defined.
Comment: What is the definition of holomorphic that you're using?
Comment: @JonasMeyer: The limit definition (mimics the definition of a derivative for real variables).
Comment: @anon271828: That isn't quite an answer to my question, but I take it you mean that a function is defined to be holomorphic if it is everywhere (complex) differentiable?  Sometimes continuity of the derivative is also assumed (although it is redundant).   In calculus, you know how to find the derivative of $f(x)=\dfrac{3-x}{1-3x}$?  I just want to point out that this is very similar.
Answer: Quotients of holomorphic functions are holomorphic where they're defined -- that is, wherever the denominator is nonzero.
In your case, the denominator is never zero because.... (details left to you)
Edit: Of course, you do have to mention (or prove) that both the numerator and denominator are, in fact, holomorphic!
And if this fact about quotients hasn't been proven... well, I guess you'll have to do that, too.  The proof is exactly the same as the real-variable case.
Comment: Excellent! Thank you. Sometimes I just overthink things... Yes, it was a previous theorem that quotients of holomorphic functions are holomorphic. I didn't stick around to think about it much more than to observe the proof for real variables should suffice. Again, thanks for clearing up the minor confusion I had!
Comment: You're very welcome

Blaschke Factor mapping holomorphic


Zero Voltage in a power semiconductor chip

Question: In an ON-mode silicon IGBT chip operating within a real power module, is the collector contact fixed at 0 V or emitter?
What about Power SiC MOSFET?
enter link description here
Comment: Huh??  You're going to have to be a lot more specific.  Give an example with a link to a datasheet and a schematic showing what you are asking about.  Power modules are general purpose and much depends on the application and specific implementation.
Comment: What is a "real power module"? Can you link to a datasheet? (Add the info into your question - not in the comments.)
Comment: @Transistor, the datasheet link has been added.
Answer: IGBTs are only available in NPN type, so to make something like a bridge you have to use two of them. Typically the lower one(s) will have the emitter common with the negative rail and the upper one(s) will have the collector common with the positive rail. From this Infineon web page:

The same is true of MOSFETs when only N-channel types are used. For practical reasons that's the case with almost all high voltage H-bridge, 3-phase bridges, and half-bridges. At lower voltages, such as 12VDC or 24VDC, it may become attractive to use P-channel MOSFETs for the upper switches, which allows the sources of those transistors to be tied to the positive rail, which in turn simplifies the gate drive circuitry.


Party is refusing to cooperate with the court. How do I proceed without a lawyer?

Question: A ruling (from a US court) was registered with a Canadian BC Provincial court that required them to remove CPLs (liens) from my property. This person (who lives in Canada) is refusing to cooperate. I understand they are in contempt of court. I'm told that only a lawyer can put things into motion to put this person in jail for their contempt. But they require $5000. Is there anything I can just do myself without having to pay this huge lawyer fee for something so simple?
Comment: The person filed a CPL lien against your property, you filed in a US court which found that the CPL should be removed but the US court can't do it directly so they ordered the other party to remove it. The BC court registered the judgment, but nothing else has happened. Is that the situation? You might check the references here about removing CPLs: http://disinherited.com/removing-certificates-of-pending-litigation-cpls/
Comment: Your actual goal is to get the liens removed, isn't it, rather than to get the person into jail?
Comment: Yes. I figured going to jail would encourage them to comply. Do you know of a better way?
Comment: No, I don't, but I suspect that a better way likely exists.
Comment: Thanks for your input phoog. I'm leaving my question as-is unless you can suggest something more constructive.
Comment: I'm afraid I can't.  There tends to be more activity on this site during the week; late on Friday isn't a great time to post a question.  You'll probably get an answer over the weekend or on Monday.  If you don't, you may want to edit it again on Monday to bump it to the top of the "active" list.
Comment: Yes that is correct. And thank you taking the initiative to read my previous posts for context. I read over that article you posted but I don't quite understand where this falls in my situation. My order to remove the CPL is registered, but not enforced. Is there anything I can personally do without hiring a lawyer?
Comment: "Is there anything I can just do myself without having to pay this huge lawyer fee for something so simple?" FWIW, this is not at all simple and $5,000 is a quite modest legal fee for this work.
Comment: Possible duplicate of [Can a lawyer file for a divorce 14 years after finalizing the divorce in an other country?](https://law.stackexchange.com/questions/24758/can-a-lawyer-file-for-a-divorce-14-years-after-finalizing-the-divorce-in-an-othe)
Comment: It appears that Raven and the poster of the duplicate question (who has posted multiple duplication questions about this issue) are the same person.
Comment: Where do you live, where is the property, and what is the ownership status of the property?
Answer:
I understand they are in contempt of court.

Yes. At least in U.S. courts, the situation described here constitutes civil contempt. The contemptuous party is at risk of being jailed for as long as he or she disobeys the court order despite his/her ability to comply therewith. That is why the lawyer floated the idea of putting that person in jail. One alternative sanction consists of ordering the contemptuous party to pay an amount for each day he continues to disobey the order.

Is there anything I can just do myself without having to pay this huge
  lawyer fee for something so simple?

I don't know how different are the procedural rules in BC with respect to U.S. jurisdictions, but I believe your litigation would need to take place in the Canadian court because it has to do with enforcement of a ruling rather than judgment on the merits. Somebody knowledgeable of treaties between the U.S. and Canada may be able to determine the feasibility of litigating in the U.S. and having the Canadian police incarcerate the party held in contempt. If that's not the case, you might want to check https://representingyourselfcanada.com/ and other resources mentioned here for people seeking to represent themselves in a Canadian court.
Although I generally encourage litigation in pro per, I don't want to understate the complexity of (laws and) judicial proceedings. The intent and substance of your court ruling might be very simple. However, under the pretext of due process, procedural rules are replete with intricacies which are abused by vexatious parties (especially when they are represented by counsel).
I agree that charging you $5,000 is excessive for essentially a motion and hearing to show cause. That type of work is routine among attorneys, but one main advantage is that they already went through a learning curve that a brand new pro se litigant hasn't.
Another disadvantage that even an experienced pro se litigant endures is the arrogance that pervades (at least) some courts. Many judges and attorneys dislike the expertise a non-attorney litigant can attain, because that self-sufficiency tends to erode the influence trafficking that runs amok in those courts. Even under the most innocent view, lawyers attempt to protect the legal profession, and to prevent its image from falling in pieces. This is palpable in the heckling (beyond mere correction of misconceptions) a non-attorney occasionally receives from attorneys in public platforms.
Comment: Thanks for the reply. Is there any guarantee that the court will make this person remove the CPL? It sounds like this court's decision to register this order is only 'recommended' and hardly even enforced. These CPLs are registered with another pending supreme court case, where this party tried to file for a divorce, 14 years after being divorced. It was really a sham to try and tie up these properties. The Provincial court registered the order to remove the CPLs anyways. The party believes they don't have to comply because of the pending supreme court case. How much truth is there to this?
Comment: It depends on (1) whether a US ruling truly is binding in the Canadian court, and (2) the integrity of Canadian judges. I state the latter because that's a big "if" among Michigan corrupt judges. The other case pending in supreme court (from where? state|US|BC) would matter only if (3) the contemptuous party timely appealed the ruling, and (4) a court entered an order to "stay" (that is: to pause, to hold in abeyance, or similar term) the liens ruling. Without (3) and (4), the decision in that unrelated case doesn't release the contemptuous party from his obligation to comply immediately.
Comment: I presume "a *pro se* litigant" is the US term for what in England is referred to as a "litigant in person" (often abbreviated to LIP).
Comment: @MartinBonner That's correct. The term "litigant *in pro per*" is likewise common (and perhaps a bit more correct than *pro se*) in the US.