What is the correct way to make web form input safe for a variety of contexts?

Question: What do you all think is the correct (read: most flexible, loosely coupled, most robust, etc.) way to make user input from the web safe for use in various parts of a web application?  Obviously we can just use the respective sanitization functions for each context (database, display on screen, save on disk, etc.), but is there some general "pattern" for handling unsafe data and making it safe?  Is there an established way to enforce treating it as unsafe unless it is properly made safe?
Comment: I'm specifically interested in making data safe for use within the application after it has already passed through a simple validation layer that checks the general format of the response but doesn't look for say, SQL injection or other threats.  Basically ways to handle the data that will not result in significantly destructive behavior by the program.
Comment: I had in mind something along the lines of:  User input might get wrapped in a sort of wrapper that prevents code from using it in unsafe ways.  That input might then need to be unwrapped in a particular way that makes it difficult for someone to UNKNOWINGLY do something unsafe with it.  The code using it would need to ensure it was made safe for use in the context of that code before using it.  Is there something like this that has been established?
Comment: You mention at one point that you want something broad and flexible and at another point that you were imagining a framework of sorts. So you don't want a simple solution in the sense of "doing this one thing will scrub the input" so much as "doing this one thing will trigger 10 other things automatically that will scrub input", is that right? I'm not trying to be cheeky, I'm just unsure if you are looking for a method or a tool. More to come...
Comment: The other thing confusing me is what you have in mind by secure. All lectures aside, your comment above is a bit fuzzy. You want something to wrap the input (which makes sense and is a good way of putting it) but who are you ultimately trying to protect by wrapping and unwrapping the data? Are you wanting to avoid SQL injection? Unintended queries? XSS? or malicious browser-side output?
Comment: Anthony yes, you are correct that I'm not wanting "one thing to scrub the input" but rather "doing one thing will trigger 10 other things to automatically scrub the input".  Which would depend on how the information is being used and so on.  As far as what I'm trying to keep secure from, *all the above and anything else*.  I was thinking there might be some established way for preventing data from being used improperly but providing facilities to let it be used properly.  If not, then that's an answer to my question.
Answer: Like it's already been said, there are several things to take into account when you are concerned about web security.  Here are some basic principals to take into account:

Avoid direct input from users being integrated into queries and variables.

So this means don't have something like $variable = $_POST['user_input']. For any situation like this, you are handing over too much control to the user.  If the input affects some database query, always have whitelists to validate user input against. If the query is for a user name, validate against a list of good user names. Do NOT simply make a query with the user input dropped right in.
One (possible) exception is for a search string. In this case, you need to sanitize, simple as that.

Avoid storing user input without sanitation.

If the user is creating a profile or uploading info for other users, you have to either have a white-list of what kind of data is acceptable, or strip out anything that could be malicious. This not only for your system's security, but for your other users (See next point.)

NEVER output anything from a user to the browser without stripping it.

This is probably the most important thing that security consultants have emphasized to me. You can not simply rely on sanitizing input when it is received by the user. If you did not write the output yourself, always ensure that the output is innocuous by encoding any HTML characters or wrapping it in a <plaintext> tag. It is simple negligence on the part of the developer if user A uploads a bit of javascript that harms any other users that view that page. You will sleep better at night knowing that any and all user output can do nothing but appear as text on all browsers.

Never allow anyone but the user control the form.

XSS is easier than it should be and a real pain to cover in one paragraph. Simply put, whenever you create a form, you are giving users access to a script that will handle form data. If I steal someone's session or someone's cookie, I can now talk to the script as though I was on the form page. I know the type of data it expects and the variables names it will look for. I can simply pass it those variables as though I were the user and the script can't tell the difference.
The above is not a matter of sanitation but of user validation. My last point is directly related to this idea.

Avoid using cookies for user validation or role validation.

If I can steal a user's cookie, I may be able to do more than make that one user have a bad day. If I notice the cookie has a value called "member", I can very easily change that value to "admin". Maybe it won't work, but for many scripts, I would have instant access to any admin-level info.
Simply put, there is not one easy way to secure a web form, but there are basic principals that simplify what you should be doing, and thus eases the stress of securing your scripts.
Once more for good measure:

Sanitize all input
Encode all output
Validate any input used for execution against a strict whitelist
Make sure the input is coming from the actual user
Never make any user or role-based validation browser-side/user-modifiable

And never assume that any one person's list is exhaustive or perfect.
Answer: I'm more than a little sceptical that such a general purpose framework could both exist and be less complex than a programming language.
The definition of "safe" is so different between different layers

Input field validation, numbers, dates, lists, postcodes, vehicle registrations
Cross field validation
Domain validation - is that a valid meter reading? Miss Jones used £300,000,000 electricty this month?
Inter-request validation - are you really booking two transatlantic flights for yourself on the same day?
Database consistency, foreign key validation
SQL injection

Also consider the actions when violations are discovered.

At the UI layer we almost certainly do not just quietly strip out non-digit chras from numberic fields, we raise UI error
In the UI we probably want to validate all fields and flag each individual error
in other layers we might throw an exception or intiate a business process

Perhaps I'm missing your vision? Have you seen anything that gets close to what you have in mind?
Answer: You cannot use a single method to sanitize data for all uses, but a good start is:

Use Filter_Var to Validate/Sanitize

Filter Var takes a number of different types of data and strips out bad characters (like non-digits for things you expect to be numbers), and makes sure it is of valid format (IP Addresses).
Note: Email Addresses are far more complicated than the Filter_Var's implementation, so Google around for the proper function.

Use mysql_real_escape_string before inputting anything into a Mysql Database

I wouldn't suggest using this until you are about to input stuff into a database, and it is probably better to just use prepared mysqli statements anyway.
Comment: I know there isn't a single function to sanitize for all contexts.  As I was saying, "Obviously we can just use the respective sanitization functions for each context...".  Filter_var does seem potentially useful.  I guess I'm looking for a broader solution.  Something very flexible.  Maybe a sort of data handling framework.
Comment: Maybe you should look into an ORM like Doctrine? http://www.doctrine-project.org/


Should I use a Firefox master password or NTFS encrypt my profile?

Question: As a follow-up to another question, is the encryption via Firefox' master password more secure than simply NTFS encrypting the profile folder? I.e. is there a convincing reason to add the inconvenience of another password whereas NTFS encryption is coupled to my Windows login?
Comment: Related: [How secure is NTFS encryption?](http://security.stackexchange.com/q/8307/3272)
Comment: Related: [How secure are my passwords in the hands of Firefox using a Master Password?](http://security.stackexchange.com/q/408/3272)
Answer: You're protecting two different things. NTFS only provides storage protection. The Firefox master password provides protection in terms of storage, and up to the point of use.
Once in use, your filesystem will be decrypted for any application you're running. In contrast, the FF-based encryption will give access to your private key only to FF when it's running. Provided that the memory used by distinct applications is properly isolated by the OS, other applications won't have access to it.
If your machine is compromised with a keylogger or something similar, neither approaches help much, but the FF master password should at least protect your from "semi-trustable" applications: those that don't take control of your system, but can at least read what they like on your filesystem, while you're logged on. Of course, this depends on which applications your run.
In addition, assuming that you leave your seat without locking your machine, while another user could make use of that certificate and private key here and there if you've also left FF running, they wouldn't be able to export a copy of it without having to enter your master password when exporting (even if you've already typed in your master password for FF to use, it's a different thing), whereas they could easily copy/export these files when there's no master password.
Comment: That's a good point, I didn't think about having to trust all other applications... So I really should cope with the additional password :-/
Comment: Most likely what I would have answered: Use both, a master password to protect the file being decoded easily, and filesystem encryption to prevent stealing the file when someone powers up the machine. Of course you need strong passwords for a realistic protection for both. In addition you could use KeePass to protect "more valuable" accounts (while using "everyday accounts" with the password manager of FIrefox).
Answer: I'd say it's equally secure. If you forget to lock your computer when you go away someone could access that folder because it will not be encrypted anymore. However if you forget to lock your computer you might leave your browser opened as well after you introduced the master password.
If your system gets compromized (for instance remote access by exploitation) then neither will save you as an attacker could install a keylogger and get it that way.
Answer: I recommend you to use a Password manager like Keepass : http://keepass.info/

KeePass is a free open source password manager, which helps you to manage your passwords in a secure way. You can put all your passwords in one database, which is locked with one master key or a key file. So you only have to remember one single master password or select the key file to unlock the whole database. The databases are encrypted using the best and most secure encryption algorithms currently known (AES and Twofish).
Comment: That's how I actually secure my passwords, but Firefox/Thunderbird also store SSL certificates, which Keepass can't take care of.
Comment: Since I dropped using that SSL certificate, I'm purely using Keepass + [Keefox](http://keefox.org/), so you get the checkmark now


use of "be -ed verb" structure

Question: Could someone explain the grammar to me - use of "be changed" in The report recommends that radar screens be changed. Why it is used like this? What does this usage should express? Where (under what name)I could study it in detail? Thank you in advance. Edi
Answer: This is an example of writing in the 'third person' - i.e. the subject is always 'he', 'she' or 'it'. It is commonly used in formal or technical reports that will be read more widely than a specific person. In the UK, we use the style to avoid confronting others - in this example we would never say 'you should change the radar screens' since it might confer an element of blame that they hadn't already done so.
Comment: Welcome to English Language & Usage. Your answer cites no sources, which is about the equivalent of it being just an opinion. You would do well to research this and rewrite your answer, citing sources. Thanks.
Comment: Ironically, the only answer that I have seen that has cited any sources is the one below mine!
Comment: I think you need to read some more questions and answers, noting how they were received., We have good questions and answers, and, some , at times, not as good. I think you will want to write good questions and answers to make your experience here the best possible.
Answer: This is the subjunctive. According to Wikipedia:

The subjunctive in English is used to form sentences that do not describe known objective facts. These include statements about one's state of mind, such as opinion, belief, purpose, intention, or desire.

While it's sometimes hard to know the subjunctive is being used, this isn't the case with be:

Present subjunctive
(that) I be, (that) you be, (that) he be, (that) we be, (that) they be
Comment: It is also called the *jussive* or *mandative* subjunctive.  Note that *present/past* subjunctive refers only to the verb form used ('be' vs 'were') -- it has nothing to do with *when* the hypothetical action would occur.
Comment: The subjunctive (which term some reject totally and others accept to label the clause construction headed by a plain form verb (infinitival) but not a 'mood form')  has been covered far too often on ELU.

use of "be -ed verb" structure


Characters not applying avatars correctly

Question:
I am trying to get different models to go through animation cycles in Unity. The first four models are from Mixamo. Does anyone know why my characters end up like this (lodged into the ground) when I press play? Each model is set as humanoid animation. I set the avatar definition for each to be created from their own model, and they have their own avatars and animator controllers. When I play, the model in the middle animates fine (idle animation) but the other two do not go into the idle state I am trying to send them into.
Answer: This may be due to a misconfiguration on the animations.
Honestly, you should check out this post made on Unity Forums:
How To: Getting Mixamo and Unity to work, it's one of the most complete guides I've seen.
You've said that the models are set to Humanoid, but what about the animations?
In the post that I just mentioned, the following is said:

...Okay, so click on the animation that you just imported into your project folder. In the inspector window, click on Rig, now change that from Generic to Humanoid and click apply. If you followed the steps correctly, no red or yellow errors here.

Oh, and another thing, you didn't mention if you're using the same Idle animation for each character, so I'm assuming you're not. Still, even if it's not the case, there may be a misconfiguration somewhere else.
I doubt that the problem is something else, since it's usually not the case, so try the above first.


How to edit writable locations in a document in Pages '09?

Question: The following image shows a region of the sheet it is not possible to write or select. There the cursor is, if i write another letter it will show up on the next page.

How do i enable the document to let me write on that field? I have tried dragging the side markers, but they only control how far down the reference text is.
Answer: You can change the page borders in the property sheet:
Answer: Go to Inspector (⌘ cmd + ⌥ alt/option + I) → Text inspector → More and uncheck the Keep lines together box. The info on the following page will jump up into place.


Iterate an value in the object and Filter them if is not null

Question: So I want to iterate some users, and each of those users has an object name vehicles and I want to iterate the users, and also then iterate the vehicles value within the object, but the problem is that the second iteration that iterates the vehicles sometimes gives an error because a user might have null users, and it doesn't iterate them and stops the loop by giving an error, what I want to do is, skip the iteration on that value if it is null.
Here is my code:
const c = clients.clients.filter((c) =>
  c.vehicles.map((v) => console.log(v._id))
);

Error message:
Uncaught TypeError: Cannot read properties of null (reading 'map')
Answer: Take a look at the optional chaining operator ?.
In your case, the loop would become
const c = clients.clients.filter(c =>
  c.vehicles?.map(v => console.log(v._id));
);

To give a brief explanation of the operator, when used on a property that might not be present (I'm assuming vehicles in your case), instead of raising an error it short-circuits the evaluation to undefined, which is a falsy value, and it is therefore filtered out by .filter.
Answer: try this :
const c = clients.clients.filter((c) => {
  if(!c) return false;
  if(!c.vehicles) return false;
  return c.vehicles.map((v) => console.log(v._id))
  }
);


How do you remove an InfoPath Form or Restore a Default?

Question: How do you remove an InfoPath Form or Restore a Default Form?
Answer: If this is normal list or library You need to go to the library settings form settings from here you can switch from IP form to the default form. If this is form library the only option is IP form.


Where does the blue wire in my fan go to?

Question: I took my fan down because it was not working..... I cleaned it thoroughly, and recut all the wires.  I checked everything and it worked fine.  Next, I went to fully assemble it, (knowing that the motor was working now) and a blue wire fell out of the fan motor itself.  I know where to connect it to the ceiling, However I do not know where this blue wire goes to the fan box itself....
Answer: It connects the house wiring to the light kit if the fan has one, if the fan does not have a light, it does not need it, it is just a spare wire.
Answer: As Jack said - usually for a light - if you have a light, I'd try to trace the light wiring inside the fixture and find where it broke off of.


What is the frisch elasticity and its meaning?

Question: I understand that Frisch elasticity is the "elasticity of hours worked to the wage rate".
I wonder why then we use this specific naming only for this?
Is this to make it clear what this means?
or is there any other special meaning or characteristics on "Frisch elasticity"?
Comment: Does the [Wikipedia article on the subject](https://en.wikipedia.org/wiki/Frisch_elasticity_of_labor_supply) answer your question? If not, could you elaborate on what it does not answer?
Answer: I'm not sure this answers your question, but if I understand your question correctly, you are just asking what Frischian demand functions are. Very short: Frischian demands are the demands expressed as a function of prices and marginal utility of income.
For a thorough intro to Frischian demand functions, see the great paper of Browning, Deaton and Irish (1985) or the nice working paper of Browning (1993)
In demand theory, one usually expresses demand as a function of prices $p$ and total income $m$. This gives the Marshallian demand functions $q_i(p,m)$. It is the solution to the following utility maximization problem:
$$
v(p,m) = \max_{q} u(q) \text{ s.t. } pq \le m.
$$
The function $v(p,m)$ is the indirect utility function.
There are alternatives, however. For example, one could express everything in terms of prices and utility. This corresponds to the problem of minimizing expenditures given some threshold utility level $u$:
$$
e(p,u) = \min_{q} pq \text{ s.t. } u(q) \ge u.
$$
The function $e(p,u)$ is the expenditure function and the solution to the expenditure minimization problem gives the Hicksian demand functions $h_i(p,u)$, which, using the envelope theorem, can be obtained by taking the partial derivatives of $e(p,u)$ with respect to the prices.
$$
\frac{\partial e(p,u)}{\partial p_i} = h_i(p,u).
$$
There are some well known dualities between the Marshallian and Hicksian framework. For example, for all $(p,u)$:
$$
v(p,e(p,u)) = u
$$
and for all $(p,m)$
$$
e(p,v(p,m)) = m.
$$
There is a third (somewhat less known) alternative framework that expresses demand as a function of prices and the marginal utility of income. Actually, it is more convenient to use the reciprocal of the marginal utility of income, which I will denote by $r$. The underlying optimization problem is the so called "profit" maximization problem:
$$
\pi(p,r) = \max_{u,q} r u - p q \text{ s.t. } u(q) = u.
$$
Intuitively, the consumer purchases a bundle $q$ and sells the resulting utility at a price $r$.
Notice the similarity with producer theory. The utility maximization problem corresponds to the output maximization problem (given a certain expenditure level for the inputs). The expenditure minimization problem corresponds to the cost minimization problem where we minimize costs given some desired level of output. The profit maximization problem corresponds to, well, the profit maximization problem of producer theory.
The first order conditions of this problem gives:
$$
r \frac{\partial u(q)}{\partial q_i} = p_i.
$$
Note the similarity between these and the first order conditions for the utility maximisation problem, when substituting $r$ with the reciprocal of the Lagrange multiplier (which indeed give the marginal utility of income).
The resulting demand functions, say $f_i(p,r)$ are called the Frischian demand functions. By the envelope theorem, we have:
$$
\frac{\partial \pi(p,r)}{\partial p_i} = -f_i(p,r).
$$
As demands are the negatives of the derivatives of the profit function, we also obtain (by Young's theorem) that the cross price effects are symmetric:
$$
\frac{\partial f_i(p,r)}{\partial p_j} = \frac{\partial f_j(p,r)}{\partial p_i}.
$$
This is similar to Hicksian symmetry.
The function $\pi(p,r)$ can be shown to be convex (if utility is concave), so the Hessian (which is the matrix of the negatives of the cross partial derivatives) is positive semi-definite. This means that Frischian demands are downward sloping: $\frac{\partial f_i(p,r)}{\partial p_i} < 0$. Also note that $f_i(p,r)$ is homogeneous of degree zero in $p$ and $r$.
Note that also:
$$
\begin{align*}
\pi(p,r) &= \max_{u,q} ru - pq \text{ s.t. } u(q) = u,\\
&= \max_u \left\{ru - \min_{q} \left\{pq | u(q) = u\right\}\right\},\\
&= \max_u ru - c(p,u).
\end{align*}
$$
This gives the relationship between the profit function and the cost function (the profit function is the concave conjugate of the cost function). By conjugacy:
$$
c(p,u) = \max_{r} ru - \pi(p,r).
$$
Next,
$$
\begin{align*}
\pi(p,r) &= \max_{q} r u(q) - pq,\\
&= \max_{m}\left\{-m + r \max_{q} \{u(q)| pq = m\}\right\},\\
&= \max_m rv(p,m) - m
\end{align*}
$$
This gives the relationship between the profit and indirect utility function.
Frischian demands are quite convenient to work with if utility functions are additively separable.
Consider the case where $u(q) = \sum_t v^t(q^t)$ where $t$ denotes the subgroups. Then:
$$
\begin{align*}
\pi(p,r) &= \max_{u, q_t} r u - \sum_t p^t q^t \text{ s.t. } \sum_t v^t(q^t) = u,\\
&= \sum_t \max_{v^t, q^t} \left\{r v^t(q^t) - p^t q^t\right\},\\
&= \sum_t \pi(p^t, r).
\end{align*}
$$
So the profit function is also additively decomposable. The Frischian demand of good $i$ in subgroup $t$, will only be a function of prices $p^t$ in group $t$ and $r$,  $f^t_i(p^tt, r)$.
If we take, for example $t$ to denote time (so utility is additively separable over time), then we know that, if there is no uncertainty, the marginal utility of income ($1/r$) remains constant. As such, the Frischian demands show that demand at period $t$, will only depend on the prices in this period $p^t$ once controlling for the value of $r$. So all intertemporal effects (from outside period $t$) are captured by the single sufficient (but unobservable) statistic $r$.


Need Help with Flow for a sharepoint list

Question: I have created a flow with a conditon
CONDITION if Company Name = CACI, Inc., send email with attachment.  It only is successful for the "yes" side.  I have read online for hours and not sure what I am doing wrong.  I know how to use SP Designer with previous wf conditions, etc. but this is not apparent to me.
Comment: I may be mistaken, but it looks like you are not actually checking if Comapny Name = "CACI, Inc.", it looks like you are comparing if the value of the Company Name field equals the value of the Company Name field, which will always eveluate to true.
Comment: How would i update that?  thankyou in advance!
Answer: It looks like you are comparing the Company Name field value to itself, which will always evaluate to true.
You need to type in the specific value you want to check for.  In this case, you are saying that you want to check if the Company Name value is specifically

CACI, Inc.

To do that, just type that value in on the right side of the comparison:
Comment: Firstly, I really appreciate your help - I did exactly that initially but i still couldn't get the action under "no" to work...so I tried this way based on videos, either way I can only get the actions under "Yes" to work
Comment: No sure what to tell you there... I don't know what kind of field your "Company Name" field is or if you have to do some other kind of comparison. For my example here I set it up as just a plain text field, and I did test my Flow and was able to get it to take both the "Yes" and "No" branches.  My guess is that if it is a Text field or a Choice field it should work with just the straight comparison, but if it is a Lookup field you may need to do some additional stuff to get the comparisoon to work.
Comment: Yes it is a choice field....but thank you again!


What does this diode symbol mean?

Question: I found this diagram in the TI TLV431 datasheet. The diode symbol looks like a zener, but has an addition input on the side. What is this supposed to represent?
Comment: I believe it's meant to indicate a TLVH431 Low-Voltage Adjustable Precision Shunt Regulator.
Comment: Its a band gap precision reference mulitplier with R Ratios using an internal Op Amp so it is low current like a Reference Zener but more precise.
Comment: @TonyStewart.EEsince'75 So they probably just selected the zener symbol to indicate that the functionality is similar?
Comment: yes even an LED can used like  a zener
Answer: The title of the datasheet you linked is, "TLVH431, TLVH432 Low-Voltage Adjustable Precision Shunt Regulators". It's a kind of programmable Zener diode.
The description tells us

The TLVH431 and TLVH432 devices are low-voltage
  3-terminal adjustable voltage references, with
  specified thermal stability over applicable industrial
  and commercial temperature ranges. Output voltage
  can be set to any value between VREF (1.24 V) and
  18 V with two external resistors (see Figure 19).
  These devices operate from a lower voltage (1.24 V)
  than the widely used TL431 and TL1431 shuntregulator
  references.
When used with an optocoupler, the TLVH431 and
  TLVH432 devices are ideal voltage references in
  isolated feedback circuits for 3-V to 3.3-V switching-mode
  power supplies. They have a typical output
  impedance of 0.25 Ω. Active output circuitry provides
  a very sharp turn-on characteristic, making the
  TLVH431 and TLVH432 devices excellent
  replacements for low-voltage Zener diodes in many
  applications, including on-board regulation and
  adjustable power supplies. [Emphasis mine.]

From the datasheet.
The flyback power-supply is one application where it is useful. We need to signal from the secondary side back to the swithing controller on the primary side when the output voltage reaches the required voltage. Opto isolation is good and the TLVH makes it easy. The control pin is referenced from a voltage divider on the output and the resistor values are calculated to give 1.24 V on the control pin when the output voltage is correct. The device then turns on allowing current to flow through the opto-LED.
Comment: How did you copy the schematic from a pdf?
Comment: http://greenshot.org (for Windows) or Snag-It are both pretty good and allow annotation, numbered circles (1), (2), (3), etc., drop-shadows, torn edges and a bunch of other stuff.
Comment: @user105652 Also, on Windows, there is always the built-in snipping tool.
Answer: This symbol could represent any number of precision adjustable shunt regulators. Combined with a precision op-amp they are often a voltage reference for other circuits.
Typical internal reference is 1.24 volts, so by connecting Vref between 2 resistors, one to cathode and one to anode, it behaves like an op-amp feedback to multiple the Vref times the resistor ratio.
Connecting Vref to the cathode as the drawing shows gives it no gain, so its clamp (shunt) voltage would be 1.24 volts.
These type of adjustable zener diodes are often used with the opto-couplers LED input to set the output voltage of SMPS type power supplies, as part of a feedback loop. This allows for galvanic isolation between the high-voltage primary and a low voltage output(s).
See following image:
Answer: The TLV431 is a versatile reference device, which can be regarded as a programmable zener diode.
If you are happy with the very over-simplified description of what silicon junction transistors do, that is for Vbe < 0.7v they are off, and for Vbe > 0.7v they turn on, then a TLV431 is very much like that.
For Vra (voltage from reference to anode) < 1.24v they are off, and for Vra > 1.24v they are on. In contrast to a transistor, where on and off are not well defined, and the 0.7v is strongly temperature sensitive, in a TLV431, the 1.24v is very stable with temperature, and the current gain is very high.
With a resistive divider between anode and cathode to the reference, the overall effect is to give a very well defined (low impedance) voltage drop, when shunting a current.
As it happens, you can use a voltage divider with a junction transistor in exactly the same way. However the resulting shunt regulator is neither as low impedance or as temperature stable as a 431. This sort of shunt regulator is often found in class B audio amplifiers precisely to make the bias to the output devices track their temperature.
Answer: The zener symbol actually represents an integrated circuit which behaves like a very accurate and stable zener diode because it contains all the elements (transistors, resistors, diodes, capacitors) necessary to keep the voltage drop across it constant over a wide range of temperature and currents through it.
The third pin, usually called "Reference" or "Program" pin, can be tied to the cathode pin and the IC can then be placed into a circuit like a standard zener diode od 1.24V, 2.5V or whatever the minimum voltage is for the particular IC). Using a voltage divider with 2 resistors or a trimmer/potentiometer, you can set any voltage across the "diode" part of the IC, from the minimum to the maximum supported by the IC.

There are integrated circuits which only have 2 electrodes - anode and cathode, just like a zener diode, but actually contain many components inside which make them much more stable and accurate than regular zener diodes. With those, you are limited to their voltage set during manufacturing, without later adjustments possible, and they can range from 1.24V to 33V.

What does this diode symbol mean?


How big is the difference between the sustained PhD thesis and a version publishable as a book?

Question: In other words, how much improvement of the submitted thesis (and presented in front of the evaluation board) is allowed, if you want to later publish the thesis at a normal publisher of dissertations (with ISBN and sell on Amazon)? Is there a conflict here? Should it be exactly the same thesis, or if mistakes are found, or recommendations given, they can be implemented, no matter how much different from the submitted and approved thesis? I'm interested in at least a general view on this, at european level. I imagine there are country differences...
Comment: Are you planning on submitting the thesis for publication *as your thesis*?  I've known lots of people who have published their theses in journals, with modifications based on new knowledge, other feedback from reviewers, etc.
Comment: Some European universities require PhD students to publish their thesis as a book, with an ISBN, *before the defense*.  For those students, the book _is_ the official version of the thesis.  So the short answer is **nothing**!
Comment: I guess the solution is to publish the book and say it is based on the dissertation, and that it has the improvements suggested by prof. X in the view of a publishing. Is this right? Or, what do you suggest?
Comment: Basically what I have now is an improved version, which my professor insisted on publishing, because he thinks is good. Due to some financial issues and the fact that several partners were involved, I had to sustain the thesis earlier than foreseen. At my university for the defense only a few copies are printed, without ISBN, and also an electronic version is handed over. The defended thesis was good enough, but the results were so nice, that they diserved to be put in the best light… so this is the conflict I have...
Answer: It depends mostly on whether publishing your thesis as a book is a requirement in the PhD process or not. As JeffE notes in his comments, publishing the thesis as a book may be a university requirement before you get your PhD. Though, in the cases that I know, publication is after the defense, and you are allowed to make smaller modifications to the originally defended version, as long as the thesis reviewers agree to these.
Things would be different if publication is not part of the PhD requirements (maybe you have your certificates already in your hands). It's your work, and unless there are specific regulations to the contrary, I'd assume you can do whatever you like with it. In particular also publish a derived work as a book. In this case, I'd still recommend to state that it is based on your thesis (not your thesis), and discuss it with your PhD advisor.
Comment: Thank you for your answer. Yes I have the certificate in my hands, and I did not find any regulations or requirements regarding publication at my home university. My supervisor gave me the same advice, to say it is based on the thesis.


Install OSX in VM in Bootcamp

Question: I was wondering if it is possible to install OS X on a Virtual Machine in a Windows (Bootcamp) on a Mac?
Comment: It's OSception.
Comment: Then install Parallels to go one level deeper.
Answer: It's not possible because of Terms Of Use. If you want a MacOSX virtual machine you need to run it from MacOSX. And I might be wrong, but I think it's only possible since OSX Lion.

Install OSX in VM in Bootcamp


What is Rabi nutation in NMR?

Question: What is the mathematical and physical significance of Rabi Nutation in terms of NMR?
Answer: Here's my understanding based on my QM class and a lab I did a while back. I've tried to set it up in an intuitive way. This is my first answer so I'm sure there will be room for improvement but hopefully it gives you a general idea how it works:
Say we apply a constant magnetic field to a sample of hydrogen nuclei along the z direction, the Hamiltonian is given by:
$
H=-m \cdot B
$.
 The quantized energy states of an individual proton nuleus would be $\pm \frac{g_n u_N B}{2} $.
For a sample of N of these nuclei, the populations of each energy state at a given temperature is found from the Boltzmann distribution and the density matrix . When one speaks of Rabi nutation, they are referring to the time evolution of these populations when a time dependent magnetic field is applied.
So let's say we also apply a time dependent magnetic field in the x direction (RF and about 15Mhz for this example):
$$
B=B_1cos(\omega t) \hat{i}
$$
Our Schrödinger equation is :
$$
i\frac{d}{dt}\left(\begin{array}{cc} a(t)e^{-iw_+t} \\ b(t)e^{-iw_-t} \end{array} \right) = \left( \begin{array}{cc}
 \omega_+ & \frac{\omega_R}{2}(e^{-i\omega t}+e^{i\omega t}  \\
\frac{\omega_R}{2}(e^{-i\omega t}+e^{i\omega t}) & \omega_-\\
 \end{array} \right) \left( \begin{array}{cc}
 a(t)e^{-iw_+t}  \\  b(t)e^{-iw_-t}
 \\
 \end{array} \right)
$$
Where $\omega_R$ is the Rabi frequency and $\omega_\pm$ are the original energy eigenvalues divided by $\hbar$.
Now the idea with NMR is to tune the magnetic field frequency to $\omega_+-\omega_-$ (the energy spacing$/\hbar$) of the original system. If you can set up your experiment to (roughly) do that, (and solve the DE's with a Rotating Wave approximation) you get these results for the time dependence of the samples' population:
$a(t)=cos(\frac{\omega_R t}{2}) $ and $b(t)=isin(\frac{\omega_R t}{2})$
So the population of the two states will oscillate at half the rabi frequency. Knowing this frequency we can control the bulk magnetization by applying timed pulses. For example, by applying a $\frac{\pi}{2}$ pulse followed by a $\pi$ pulse with the right timing, (see Spin Echo) you can get the characteristic relaxation time of the sample, which is the useful information used in MRI's.

What is Rabi nutation in NMR?


smartglass Nokia Lumia 520 install error

Question: I went to Windows Store in UC browser to download the smartglass app and clicked
the link to download and install manually. After the xap file downloaded i clicked
the file to open it but an error message came up saying that there is a problem with
this company app and requested me to contact the company for assistance. Is it
possible to download and install smartglass manually on a Noka Lumia 520 if it is
not in your Windows Store app?
Answer: After much searching I found the answer to this question and decided to post the answer here incase google search users should happen upon it and be relieved. The problem here is that your phone is set to an supported region. You can fix this simply by going to your home screen and tapping settings. Scroll down till you find Language+Region and open it. There  you will find a bar with the header Country/Region. Select it and change it to a supported region; in most cases being US or UK. This is the important step: after changing your region scroll down and tap restart phone. If you do not do this the changes will NOT take effect. After waiting a minute or so your phones region should be changed upon restart.  You can now go to your windows app store and find the app that has stressed you out so much and shout joyfully as you watch it download. Enjoy.


How to join MySQL database to QGIS polygons

Question: I Have an *.sql file that has no spatial information. For every record there is an id. I also have a Qgis project with polygons without any id.  How can i connect the polygons with the database? I know that i have to add the same id to the shapes to make the connection. I don't know how to make the connection. Is there any tutorial that can help me?
Comment: If you dont have ids , you cannot join them. You can open attribute table , add corresponding to polygon and use properties to map relations by hand and then using layer properties (Join) to map polygons to table (or just use create spatial table which has joined shape and attribute table)
Answer: Just,
1. add vector layer --> database--> Type-->MySQL --> connection-->New
2. complete the parameters
3. test the connection
4. import the layer(s) you want
5. add id(s) to shape's attribute tables--> join.
Answer: Just load your data into QGIS and use the tool called "Join attributes by location". According to the doc :

Join additional attributes to vector layer based on spatial
  relationship. Attributes from one vector layer are appended to the
  attribute table of another layer and exported as a shapefile.

You need to install the ftools extension.
I guess you already have MySQL server running and you already know how to import your MySQL data.
Comment: The problem is that the database has no spatial information.
Comment: In that case, you should probably change _"I Have an *.sql file that has information about polygon areas."_ by _"I Have an *.sql file that has **NO** information about polygon areas._ and I'm scared there is no automatic way to do it


Magento 2 upgrade from 2.3.5 to 2.4 not working via composer - php is already at version 7.4 before the upgrade!

Question: Situation: Magento 2 upgrade from 2.3.5 to 2.4 not working via composer - php is already at version 7.4 before the upgrade!
These commands executed fine
COMPOSER_MEMORY_LIMIT=8G composer remove magento/product-community-edition --no-update
COMPOSER_MEMORY_LIMIT=8G composer require magento/product-community-edition=2.4.0 --no-update
And we needed to remove 1 package that had php stability as ~7.3
COMPOSER_MEMORY_LIMIT=8G composer remove package/package --no-update
BUt now we see (shortened here, but repeated vesion numbers like
tig/postnl-magento2 126.96.36.199 requires magento/framework
magento/framework 102.0.5-p2 requires php ~7.1.3||~7.2.0||~7.3.0 -> your PHP version (7.4.10) does not satisfy that requirement.
So it would seem we cannot upgrade due to? magento/framework? in it's composer file I can see
    "require": {
        "php": "~7.1.3||~7.2.0||~7.3.0",

Also I can see tig/postnl-magento2 has in it's composer file I can see
        "php": "~7.0|~7.1|~7.2|~7.3",
        "ext-soap": "*",
        "magento/framework": ">=100.1.0,<=100.1.18|>=101.0.0,<=101.0.11|~102.0",

question: is there a way to work around these 2 limiting dependencies? And also: how come the magento/framework does not want to upgrade if M2.4 is based on php 4.0 ....
Help appreciated
Answer: Late answer, but you have to downgrade PHP to 7.3, do the Magento upgrade and then upgrade PHP back to 7.4.


Local homology of a product having $\mathbb{R}^n$ as one of the factors

Question: Let $X$ be a topological space and $x \in X$ be such that $\{x\}$ is closed in $X$. Let $y \in \mathbb{R}^n$. I've read that
$$
H_k(\mathbb{R}^n \times X, (\mathbb{R}^n \times X) - \{(y,x)\}) \cong H_{k - n}(X,X - \{x\}).
$$
for every $k$. I have no clue how to prove that. Can someone help?
Answer: First let me say that I'm really no expert on algebraic topology, only because there still wasn't an answer up to now I thought it might be helpful to give my suggestion for a proof anyways:
Let us first assume $X$ is a CW complex. Further I assume you are referring to real coefficients (though this doesn't matter too much for the following).

From e.g. Hatchers book "Algebraic Topology", section 3.B, we know that there is an exact sequence of relative homologies, where we set $A:=X\setminus\{x\}$ and $B:=\mathbb{R}^n\setminus \{y\}$: $$\tag{1}0\rightarrow\oplus_i(H_i(X,A)\otimes_{\mathbb{R}}H_{k-i}(\mathbb{R}^n,B))\overset{(*)}{\rightarrow }H_k(X\times\mathbb{R}^n,A\times \mathbb{R}^n\cup X\times B)\rightarrow\oplus_i\mathrm{Tor}_{\mathbb{R}}(H_i(X,A),H_{k-i-1}(\mathbb{R}^n,B))\rightarrow 0 $$
Now, we use the long exact homology sequence (cf. section 2.1 of Hatchers book)
$$\ldots\rightarrow H_i(B)\rightarrow H_i(\mathbb{R}^n)\rightarrow H_i(\mathbb{R}^n,B)\rightarrow H_{i-1}(B)\rightarrow\ldots$$
to prove that $H_i(\mathbb{R}^n,B)$ is $\mathbb{R}$ if $i=n$ and $0$ else (where we use the fact that the homology groups are invariant under homotopy and $\mathbb{R}^n$ is homotopic to a point, $B=\mathbb{R}^n\setminus\{y\}$ is homotopic to a sphere $S^{n-1}$). In particular, the Tor term in the exact sequence (1) vanisches, i.e. the morphism ($*$) is an isomorphism, and the direct sum of the first factor collapses to $H_{k-n}(X,A)\otimes_{\mathbb{R}}\mathbb{R}\simeq H_{k-n}(X,A)$.
Observing that $A\times\mathbb{R}^n\cup X\times B=X\times \mathbb{R}^n\setminus(\{x\}\times\{y\})$ finishes the prove.

To get rid of the assumption that $X$ is a CW complex you might want to read the paragraph in Hatchers book about CW approximation (in section 4.1), but I really don't know about this, I just have the vague idea it might help (sorry if it doesn't)...


Computer freezes when compiling substrate

Question: I am trying to run all of the tests in the substrate codebase. When the pc gets to the 1670th dependency it freezes. All of my RAM is being used and the pc won't respond. I have 16GB of RAM, Ryzen 5 2600x and I am running ubuntu 20.04.
Answer: You probably need more RAM, 32GB should be good.
Otherwise you can reduce the number of threads that it compiles on with:
cargo test -j 4.
It is also possible to only test one create:
cargo test -p sp-arithmetic.
Comment: Polytope labs has been working on the solution on compiling the substrate in the cloud. cargo-cloud and prolly soon it will be available for the community
Answer: An alternative to increasing your RAM is to increase your swap space using available hard disk space on Linux, although swap space is slower than using RAM.
I always do this when using a cloud provider, especially when in development environment since I find it cheaper to buy extra volumes of block storage for slower testing using swap space than to buy an instance with a faster CPU and RAM than I need.
Check your free hard disk space with:
df -H

Check your swap space with:
free -h

Show the swap file and amount of swap available and being used:
sudo swapon --show

An example of increasing swap space by 10Gb would involve removing an existing swapfile (if any), adding for example 10Gb (10240) swap space (assuming you have at least that amount of free hard disk space), then creating the swapfile, turning on swap space, and finally verifying that the swap space has increased:
sudo swapoff /swap_file
sudo rm /swap_file
sudo dd if=/dev/zero of=/swap_file bs=10240 count=1M
sudo chmod 600 /swap_file
sudo mkswap /swap_file
sudo swapon /swap_file
free -h

Lastly enable swap space usage at boot time by editing the /etc/fstab file (i.e. with Vim sudo vim /etc/fstab), then copy/paste the below (single line) to bottom of that file and save it
/swapfile       none            swap    defaults,discard                0 0

Answer: Also run the tests with --release mode on. That will run the tests more efficiently.


What fetishes work with natural weapons in Lupus or Hispo?

Question: I'm going to be playing a lupus with a focus on Bite attacks in an upcoming game.  I'm aware of a few totems and gifts that enhance natural attacks, but I'm looking for fetishes to help out.
Answer: I think you coming to this from wrong perspective: you are a wolf, you don't need artificial, "human" fight enhancing tools - Gaia gave you your jaws and thats enough. You have natural contact with spirits, but you treat them as mentors and guides rather than tools  - again, thats human thinking.
Lets look at Red Talons, the lupus only tribe:

Red Talon fetishes are often of simple make, perhaps a piece of antler or a rock that just "felt right." Rarely they use fragments of human fabrication, if only because it's more frightening that way. Because Red Talons feel that Gaia gave them all the weaponry they need, and often prefer the Hispo form for fighting, the use of fetish weapons is fairly uncommon, and many Red Talons deride the practice. (Needless to say, Red Talons do not have the requisite skills or technology to forge silver into klaives.) Predator spirits are so rare in these times that Red Talons prefer to bind prey spirits into talens and fetishes if at all possible. (source)

If you are coming from more human-oriented tribe then there could be some more possibilities - I wouldn't be surprised if Shadow Lord or Uktena had a Pain Spirit imbued somehow i.e. as a tattoo on their face to add extra point of damage, and there are of course infamous Cyber Wolves - but as a general rule I'd say you are fairly limited.
Comment: I'm aware of the RP issues.  And while I'm starting as a first change, I will most likely go Red Talon (depending on IC Den Parenting and Rite of Passage).  I am, however in a somewhat high combat, high powered game, and as a player I'd like to know the canonical options.
Comment: Even if you skip the "wolves don't like using tools" issue, there is another problem: there is not that much you can put in your mouth and use it in combat. IMO at best you could go with mentioned above Pain Spirit. There is a reason why bite difficulty is only 5.
Answer: Quite complicated, since most fetishes that help combat are weapons, shields and armour (things you use in humanesque form) not really helpful for lupusesque forms. But there are a few.
I think the best suited should be scar fetishes (a fetish you create on your scar).
For example, you have body of scars (I find it through the net, but it seems to be in the book 'hammer and klaive'):

Body of Scars
Background Points: 5
Gnosis Rating: 7
Spirit: A plant or rabbit spirit
Appearance: This fetish is bound into a Scar that the Garou has
received that reduced her below Incapacitation (thus resulting from a
Rage Heal).
Effect: When activated the scar begins to slowly grow, spreading out
over the user's body.  If a blow strikes the bearer, the scar will
immediately surface there.  The hard scar tissue protects the body,
granting +2 traits for the purposes of soaking.  In addition the
fetish provides 3 additional health level that may be healed.  This
fetish may not be stacked with gifts or fetishes that provide similar
effects (such as Troll Skin). Source

As always, fetishes are not set in stone and you could create your own (if Mages can do it, Werewolves should be way more able to do so). So you can talk to your storyteller and build something that both of you are happy with.
I am aware that it is not a very helpful answer, since this specific example doesn't help with bite maneuvers.
You can also check leaf armor or combat harness to see other fetishes that help combat that can be used in lupus form.
Actually, if you convince your storyteller that your combat harness is for hispo form (for some reason) I think it could easily be the best fetish to help you (since it could add dex/str).
Comment: It is quite good example of a fetish that can be used in lupus or hispo form, but OP asked specifically for a bite-attack enhancing fetish (which, as I already explained) would be rather game breaking.
Comment: Yeah, I actually said that myself :)
Although I think combat harness could possibly fit the requirements of the question. Since there is another harness fetish used in lupus/hispo (the one that gives you hands) and tghe combat one gives you dex/str which mechanically helps with any combat situation, including bites.
Comment: Body of Scars is in Hammer & Klaive, the last of the three scar fetishes.
Answer: Hammer & Klaive
Three types of Fetish come to mind for use with natural weapons

Claw Carvings. 1 They require Crinos form.
Scar Fetishes. 2
Warpaint. 3

Furthermore, the Fire Teeth are very close, and a Red Talon classic. A knocked-out tooth turned into a spiritual hand grenade.4

Hammer and Klaive, p.68 & 69.
Hammer and Klaive, p.72 & 73.
Hammer and Klaive, p.74 - 76.
Hammer and Klaive, p.90.


Backup data inside Classic on Palm Pre

Question: I use a PalmOS app inside Classic on the Palm Pre to store some data.  Is there any way to back up the data?
Answer: Use Red Feline Backup - VFS Backup for Palm OS

Red Feline Backup is a backup program for PalmOS. It does not require a host PC. Instead all databases on your PalmOS device will be copied onto a memory card inserted into the device. then you can copy from your memory card to host PC
Comment: What "memory card" do I use with a Palm Pre?  Do you mean the USB "drive"?  Can Red Feline "see" that from inside Classic?

Backup data inside Classic on Palm Pre


Really confused about x's on a note?

Question: So on the sheet music I was playing there were these notes with x's on top of them. Like on the stem. What am I supposed to do? Do I just not play them? This is for the piano by the way.
Comment: Please provide more information such as title/composer and edition of the piece, and/or a screenshot.
Comment: Nonstandard markings are usually explained in a pre/postface (or footnotes). If you don't have those you probably have a copy so go find the original! ;)
Answer: Were this for guitar to play, it would show muted notes - notes of a time value but no actual pitch - a 'click'. It's not possible to do this on a piano, so I'd say it's a combination piece of music.Had the x been in front of a note, like a # or b , then it WOULD be a double sharp, the note being played a tone above the basic note.These are quite rare, so you wouldn't find lots anyway, and generally found in 'sharp' keys. Don't think knowing what key the piece is in will help.      It looks like it changes through many keys, is it occurring in one particular part ?
Comment: "X's" for noteheads in piano notation may be used for striking the body of the instrument, clapping, foot-stamping, or other percussive indications.
Comment: @jjmusicnotes True, but this could also be a jazz transcription where the `x`'s are intended to be ghosted.
Comment: @NReilingh - also true - there are dozens of uses for "x" shaped noteheads depending on which instrument they are used for.  My comment was not to describe their use, but rather to refute the idea that "x" shaped noteheads are not used in piano notation.  As an aside to Tim - pianos actually can be muted in a couple of different ways, but the notation is different.
Comment: Well i dont think its a jazz piece, it's Honor to Us All from Mulan. And it's only piano. It came from this book of sheet music I bought. So does it mean I should just tap something to the notes with the x's rhythm?
Comment: Thanks, jjmusicnotes, I imagine muting a piano would be a permanent thing for the whole tune?                     Having listened to this and looked at various dots, I haven't found a version with anything different from normal piano.                                 Jinan, Could you post the version you ask about, please?
Answer: It could be a typesetting failure. You often get "x" instead of noteheads when the music type font is not working on the computer. Maybe the music is faulty!
Answer: On the piano this could be a fingering notation, where x is the thumb. So for the right hand you would have (x 1 2 3 4). A giveaway would be that no note has 5 over it.
Comment: Unimaginably unlikely. There was something called "English fingering", in which the five fingers were +1234, with + for the thumb, but never 'x' as far as I know. And this was just about totally replaced by about 1950 by something called "Continental fingering" (which is the universal system used now).

Really confused about x's on a note?


NTC Thermistor Identification

Question: I would like to replace original NTC sensor for: https://www.aliexpress.com/item/TGT70-EP-Thermoregulator-Touch-Screen-Heating-Thermostat-for-Warm-Floor-Water-Electric-Heating-System-Thermostat/32669215824.html?spm=2114.13010308.0.64.mHnkr7
with self-made NTC probe. The problem is that manufacturer doesn't want to share any information on it. All I got is the picture and short description of it (not type or chart/table). Can anybody help to identify it?
Thanks
Comment: Assuming the yellow text is correct, you have all you need. It is 10k at 25C, and the beta value is 3950. You can read about NTC beta on wikipedia or some other website. https://en.wikipedia.org/wiki/Thermistor
Comment: Do you have a close-up photo of the sensor with the cap removed?
Comment: You'll have to match the sensors Temperature-resistance curve, If I was the manufacturer I wouldn't let you do that either because if you don't do it correctly you might break their system.
Answer: It's possible the manufacturer has no idea. The beta, as mkeith comments, is given, however the two temperatures at which beta is specified is not. It should be something like 25/50, 25/85 or 25/100.
I suggest you take a good sample of the instrument and adjust the input resistance with a pot until it reads 25, 50, 75, and 100°C. Read the pot with a digital ohmmeter (the first number should be 10K). Then you will be able to match a proper thermistor datasheet.
Or you could just buy some other no-spec sheet piece of 'stuff' that has the string '3950' in the description and hope it works well enough for long enough.

A reasonable and moderately educated guess would be that it's \$\beta_{25/50} = 3950K\$ but definitely confirm it.
That would imply it would read exactly 50.0°C at 3.5882 K, ideally.
Comment: This is a good point. There is more than one temp pair for measuring beta.

NTC Thermistor Identification


Do I need ND filters for a time lapse sunrise?

Question: I need to shoot a time lapse sunrise for an internal promotion. This will consist of a one minute interval from 3:00 (black) to 8:30 (day) and I want the sun in the frame. Is this a situation where using an neutral density filter is a good idea? I've never used one before but there are coworkers who own them so I could borrow if need be...
Comment: If you decide to do this with the ND filter I would strongly advice to try it beforehand as it will almost certainly produce flare which may or may not be desirable. Whereas flare from lens alone adds an interesting effect, it is often not the case with a filter.  Also, do you want the sun to appear as a stat burst or just a bright disk?
Answer: I'd guess you'd need a GND or partial ND, else the sky would be seriously overexposed. Put the ND over the sky, expose to have the total of the exposures cause the ground to be correctly lit, should help keep the sky look reasonably normal. Or just compose the final image in Photoshop using the ground from one and adding sun positions from all the others.
One or the other is what I'd try (likely using several cameras to take both sequences together, and with different ND gradations, especially if I can't reliably come back to reshoot the sequence on other days).
Answer: If you are asking about using an ND filter to limit potentially damaging light from direct sunlight then you should be fine as long as you use a wide-angle lens, especially near sunrise where the sun is shining through a dense slice of atmosphere, scattering the light.
Shooting the sun with a telephoto lens is strongly discouraged, and would certainly require a strong ND filter to prevent damage to the camera, or your eyes (if using an optical viewfinder).
A graduated ND filter may help tame the dynamic range of the scene, which can still be very high around sunrise. If the foreground is unimportant to the look of the shot then expose for the sky and you should be fine without a filter.
Answer: ND filter makes the scene really dark and lets you use a longer shutter speed in bright light without blowing out the scene. Assuming that in your situation, you need the whole scene and not just the sun, you won't need an ND filter.
More info Here.


Is there a quicker way to create links to attachments?

Question: I often want to create a link to the attachment I've just added. Especially when the attachment is an image and I want to show the image inline.
What I usually do is I open the attachment folder in dired mode, copy the filename, then create a link manually by writing [[attachment:the-file-name]].
I was just wondering if there's a quicker way to do this?
Comment: Have you looked at [Attach from Dired](https://orgmode.org/manual/Attach-from-Dired.html#Attach-from-Dired) in the manual?
Comment: @NickD that's a different/quicker way to create an attachment. I'm interested in knowing if there's a quicker way to link to it afterwards.
Answer: The variable org-attach-store-link-p is specifically designed for this purpose.
Adding the following line to your init file would make org push a [[attachment:file-name.ext]] type link to org-stored-links every time you add an attachment.
So after adding an attachment you can just use C-c C-l to insert the link.
(setq org-attach-store-link-p 'attached)

Comment: I think you should unaccept my answer and accept yours. It is clearly the right answer.
Comment: I spent some time wondering about this variable because, for once, it's documentation is not complete. You have to look at the variable definition in the source code to get the accepted values which are: attached file or t
Answer: The function org-attach-dired-to-subtree creates attachments based on the marked files (or the file the cursor is on) in a dired buffer - see  Attach from Dired for details, including how to bind it to a key sequence (C-c C-x a which happens to be unused by default in dired-mode).
The function org-attach-dired-to-subtree-store-links below is almost exactly a copy of org-attach-dired-to-subtree, except that instead of making attachments, it  creates links that can be inserted into the Org mode buffer using org-insert-link (usually bound to C-C C-l if you follow the convention in the Org mode manual).
The description of the link is the filename of the attachment, but you can change that when you insert the link. The code also shows a binding for that function (C-c C-x l which also happens to be unused by default in dired-mode):
* foo                                                                                :ATTACH:
:PROPERTIES:
:ID:       7df0d4a8-1cd0-4f7b-84ec-e6b4dba6aa24
:END:

[[attachment:david-vogan-E8.pdf][E8]]
[[attachment:carrying.pdf][carrying]]
[[attachment:aurifeuillian.pdf][aurifeuillian]]

* Code

#+begin_src emacs-lisp
  (defun org-attach-dired-to-subtree-store-links (files)
    (interactive
     (list (dired-get-marked-files)))
    (unless (eq major-mode 'dired-mode)
      (user-error "This command must be triggered in a dired buffer"))
    (let ((start-win (selected-window))
          (other-win
           (get-window-with-predicate
            (lambda (window)
              (with-current-buffer (window-buffer window)
                (eq major-mode 'org-mode))))))
      (unless other-win
        (user-error
         "Can't attach to subtree.  No window displaying an Org buffer"))
      (select-window other-win)
      (dolist (file files)
        (let* ((fname (file-name-nondirectory file))
               (link (format "attachment:%s" fname))
               (desc fname))
          (push (list link desc) org-stored-links)))
      (select-window start-win)))
#+end_src

#+begin_src emacs-lisp
(add-hook
  'dired-mode-hook
  (lambda ()
    (define-key dired-mode-map (kbd "C-c C-x l") #'org-attach-dired-to-subtree-store-links))))
#+end_src

Assuming that you've done both keybindings as above, the workflow is:

An Org mode buffer in one window
A dired buffer in a second window
Mark all the files that you want to attach
C-c C-x a  - that attaches all the marked files
C-c C-x l  - that stores attachment links to all the marked files
Back in the Org mode buffer, do C-c C-l to insert each link.
Comment: It doesn't have to be this complicated. It can be done by simply setting the `org-attach-store-link-p` variable to 'attached
Comment: Probably overwriting org-attach-dired-to-subtree is better? Saves a step.


Blurry stripes on monitor

Question: I installed Windows 7 on my ideaPad G560 and there's a problem with the screen. There are vertical areas where the image is a little blurry that span across the screen's whole heigth. There are five or six such stripes. I'm using drivers from Windows Update. Other OSes installed on the coputer (Ubuntu, FreeBSD) don't have that problem. What do I do?
Answer: This is most likely because you are not running the OS in the native resolution of the display.  As a result the image is stretched slightly and not all pixels will coincide with the actual physical pixels of the display.
Make sure you are running at the native resolution of 1366×768
Comment: Check the Lenovo site to see if they have drivers specific to that model?
Comment: Huh, you're right. But the resolution tops out at 1360x768.

Blurry stripes on monitor


Aurora Serverless alter table Error 1114 table is full

Question: Using Aurora Serverless, when attempting to alter table mytable add column mynewcolumn decimal(10,3) after myoldcolumn I receive "ERROR 1114 (HY000): The Table 'mytable' is full". The table has hundreds of millions of rows. Normally this error results from a full partition, but since I'm using Aurora Serverless, I can't manually provision partition space. What should I do to avoid this error?
Answer: On the AWS Forums, LawrenceAtAWS said,

the amount of temporary storage space associated with Serverless increases linearly with the number of associated ACUs. If you're having issues running out of temporary storage space for large table mutations, you could temporarily scale the cluster up to a larger number of ACUs and then run the modify statement. This should increase the associated temporary storage an allow the statement to succeed.

The way to achieve this with the CLI is
  aws rds modify-current-db-cluster-capacity --db-cluster-identifier sample-cluster --capacity 64


Content-type problems with Django under Apache, with static HTML + CSS files?

Question: I am trying to serve static files (HTML + CSS) under Django. (Later on, I will password protect them). However, I am getting the wrong content-type. HTML files are downloaded, not displayed.
My webserver is Apache, and I'm running this under Webfaction. I'm looking at the site under Chromium 18.
I am trying both a naive FileWrapper (sending the file from Django) approach, where I use mimetype to determine the type, and x_modsendfile, where I let the webserver decide.
HTML files are downloaded, not displayed.
Here is what the content header should be, when I serve through my Apache webserver not Django:
HTTP/1.1 200 OK =>
Server => nginx
Date => Wed, 19 Sep 2012 21:51:35 GMT
Content-Type => text/html
Content-Length => 9362
Connection => close
Vary => Accept-Encoding
Last-Modified => Wed, 19 Sep 2012 05:53:00 GMT
ETag => "e3a0c43-2492-4ca079e8fea23"
Accept-Ranges => bytes

Observe that the server claims to be nginx. Webfaction says that for static services it sets up Apache, and indeed I have been configuring an Apache server for Django. But the response says Nginx (!)
Here is the response from the naive FileWrapper implementation, wherein I choose the Content-Type using mimetypes:
HTTP/1.1 200 OK =>
Server => nginx
Date => Wed, 19 Sep 2012 21:53:28 GMT
Content-Type => ('text/html', none)
Content-Length => 9362
Connection => close

The content-type is a TUPLE.
Here is the response from the mod_xsendfile implementation, wherein I don't choose the Content-Type:
HTTP/1.1 200 OK =>
Server => nginx
Date => Wed, 19 Sep 2012 21:52:40 GMT
Content-Type => text/plain
Content-Length => 9362
Connection => close
Vary => Accept-Encoding
Last-Modified => Wed, 19 Sep 2012 05:53:00 GMT
ETag => "e3a0c43-2492-4ca079e8fea23"

Here is my code:
def _serve_file_xsendfile(abs_filename):
    response = django.http.HttpResponse() # 200 OK
    del response['content-type'] # We'll let the web server guess this.
    response['X-Sendfile'] = abs_filename
    return response

def _serve_file_filewrapper(abs_filename):
    p_filename = abs_filename
    if not os.path.exists(p_filename):
        raise Exception('File %s does not exist!')

    try:
        _content_type = mimetypes.guess_type(p_filename)
    except:
        _content_type = 'application/octet-stream'

    print p_filename, _content_type

    wrapper = FileWrapper(file(p_filename))
    response = HttpResponse(wrapper, content_type=_content_type)
    response['Content-Length'] = os.path.getsize(p_filename)
    response['Content-Type'] = _content_type
    return response

def _serve_file(filename):
    abs_filename = _get_absolute_filename(filename)
    return _serve_file_filewrapper(abs_filename)

def public_files(request, filename):
    return _serve_file(filename)

How do I get the correct Content-Type to be served, either for the FileWrapper or mod_xsendfile approach?
Answer: _content_type = mimetypes.guess_type(p_filename)
should be
_content_type, encoding = mimetypes.guess_type(p_filename)
Comment: or this: _content_type = mimetypes.guess_type(p_filename)[0] considering you do not need the encoding...


Microsoft Team System value within only a Dev Team

Question: Microsoft Team System appears to be a great platform for process-oriented systems implementation, however if you strip out access for the BAs, PM and Business Users and just purely use it within a Dev team does it have any more value than just using Visual Studio Professional, SourceSafe, a Defect Tracking Tool and a continuous integration server like CruiseControl or TeamCity?
Comment: Whoah, I recommend you consider getting away from SourceSafe as soon as possible if you have a team environment....
Answer: Yes.  Every replacement technology you've mentioned is something that is supported by the Team System package (either in this release or the next).  All of these components are designed to integrate and work with each other in TFS.  This is a high priority of the TFS team for all components.  The result is a set of features which in most cases seamlessly integrate with each other.
I'm not familiar with several of the other projects you mentioned but it's unlikely that they integrate as well with each other as the corresponding TFS components.  This is not to say they have no integration or perform poorly as products.  Just that they are not designed ground up to work with each other.  Hence the interaction will not be as crisp as the TFS components.
Is this valuable enough to continue using TFS?  Don't know because it would be highly dependent on how much you value this integration.
Comment: Seconded. The main benefit of TFS is tight integration of components (and other MS products, such as AD/Outlook/Communicator).
Comment: And with integration comes deep reporting capability, if you / your bosses are into that sort of thing.
Answer: One of the big selling points for TFS for my team is the coherency it provides to our overall product life cycle. We do allow BAs, PMs and Business Users to have certain levels of access to TFS, but even if we did not, the product would still be of great value to use. The ability to manage our workflows within TFS and enforce consistency across the development team is great.
Some of the features that TFS provides that we use: security, reporting, work flow management, integrated builds, email alerts, branching / merging.
Could you pull it off with a hodge-podge of other tools? Probably, but it wouldn't be as easy to manage and maintain and you probably wouldn't be able to pull out the kind of data necessary for reporting and tracking the way you can with TFS.
On a sidenote, if your counting on Visual SourceSafe as your repository I would highly suggest looking elsewhere. From personal and business experience, I can attest that it cannot be counted on as a stable/robust repository.
My thoughts.
Answer: Sure it has value.  There are a ton of client features only in the Team SKUs (don't let the name fool you -- they are primarily just the new "super premium" kitchen-sink versions, that also have the nice bonus of including a server CAL for TFS.)  Exact specs available here: http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx
Looking specifically at the collaboration features, again there's clear value in a system whose components were design to "just work" with each other.  The setup is streamlined (though it has a ways to go); the UIs are consistent and accessible from each other; the backend feeds a unified reporting/analysis service.  If you have a large team, the overall perf/scalability also far exceeds what the typical OSS suite is capable of at the moment.
The question is whether it's worth the $$ to you.  Why use Visual Studio Professional instead of SharpDevelop?  Why SourceSafe instead of Git?  Why not Notepad and specially labeled folders?
All of the commercial products are commercial for a reason (ok, maybe not SourceSafe!).  If you want something with a broad feature set, tight integration, well-defined support & testing lifecycle, good fit & finish, etc then it's usually worthwhile to spend the $$ and let your development staff get on with their work.  If you don't mind doing setup & troubleshooting yourself, switching between several applications as part of the development workflow, losing the ability to query & report on team statistics as a whole, etc then by all means go open source -- many OSS dev tools are very solid nowadays.


What is the physical meaning of the voltage across an inductor in the Laplace domain?

Question: In my Electrical Engineering degree I recently learned how to analyse circuits using Laplace transforms and I know that the Laplace transform of the voltage across an inductor is \$V_L(s) =s*L*I(s) - L*i(0)\$, but I don't understand its physical meaning. I know that \$s*L\$ is the impedance so with Ohm's law we get \$V_L(s) =s*L*I(s)\$ but when it gets to subtracting \$L*i(0)\$ I don't understand where it comes from, I know it is supposed to represent the initial voltage but shouldn't it be also \$s*L*i(0)\$ ?
Comment: All terms having an *s* in the laplace domain are time-dependent in the time domain. So, no, initial values cannot have an *s*.
Answer: The Laplace transform of a derivative is
$$\mathcal{L}\left\{ \frac{dy}{dt} \right\} = s\mathcal{L}\left\{f\right\} - y(0^+)$$
Ie. \$y(0^+)\$ is the initial condition, for time approaching zero from the right side.
Since the "law" of inductors is
$$v_L = L\cdot \frac{di_L}{dt}$$
Its Laplace transform is given by
$$\begin{align}
V_L(s) &= L\left( sI_L(s) - i_L(0^+) \right) \\
&= Ls\cdot I_L(s) - L\cdot i_L(0^+)
&\Downarrow \\
I_L(s) &= \frac{V_L(s)}{Ls} + \frac{i_L(0^+)}{s}
\end{align}$$
So in this formula, \$i_L(0^+)\$ takes the meaning of the initial current through the inductor. From the last equation, you also can assign a physical meaning to it. This equation coincides to having a parallel constant current source with the inductor!
In other words, you can replace an inductor with

simulate this circuit – Schematic created using CircuitLab
For a capacitor, the same can be done. It will result in putting a constant voltage source in series with the capacitor.
Answer: No, you're in the Laplace domain now. You're dealing in terms of frequency. If you did take the Laplace transform of an initial condition, the constant divided by an 'integrator' or a delta function. This delta function is also placed at zero in the Laplace world (which is DC in terms of frequency)
$${\mathcal{L}(c) = \dfrac{c}{s}} = \delta $$
This makes total sense, if you have a constant value, it's pretty much a DC value, if you want to know which frequency its at zero frequency, there is no frequency because it's constant.

So across an inductor this would signify that there was already something there before the system started, but it wouldn't make a lot of sense until you transform it back into the time domain, you can also think of it as a placeholder.
Comment: Agreed on all but *frequency*. *s* doesn't represent a frequency because of the ability of the Laplace domain to image real exponents of e.
Comment: Technically no, but it's a close analog to the FFT
Comment: Yes, sure, I am nitpicking. But this is the case where it really matters! Because the OP wanted to know the difference between a static value and a one-time signal. The latter **has** an *s* in the laplace domain. The frequency analogy will simply say "it's **all** frequencies as it's a jump" but this is even more mysterious.
Comment: Actually they do call s the complex number frequency parameter.
Comment: Yes, but as my control theory teacher put it: "Gee, what's that supposed to mean?" It's obstructive, not helping at all.


Facial Animation for Fuse/Mixamo Character

Question: Thank you in advance for any help.  I have created a character with Fuse and I was successful in exporting to mixamo to apply movements.  I can even import my Mixamo fbx into blender no problem.  I would like to add some blinking and some random facial movements to make the character look more alive and less "creepy".  Does anyone have any suggestions on easiest way to do this?
Thank you!
Answer: When you export your character to mixamo a rig is created. When it is finished you can choose if you want your character with facial shapes.
In Blender choose the body of the imported character, in object data you will find a lot of shape-keys. click one  and change it's values. See what happens.
Guenther
Edit - Adobe has since removed the facial Blendshape option.
Comment: The facial shape keys option appears to be gone. Any idea why is was removed?


Why are "Wire Nuts" not used in the UK?

Question: I have never seen a wire nut used in the UK, but they seem to be very common in the USA, why?
Comment: Something that seems to be frequently missed is that the UK employs ring circuits in most situations when dealing with sockets and outlets rather than radials/spurs. This type of wiring essentially rids itself of wire splicing. Wire splicing is not such a common feature in UK wiring and i have seen cable splicing as a frowned upon as an installation method. If cables do need to be connected together they either use specific joint boxes or they use mostly Connector strips which are essentially blocks of joined screw terminals.
Comment: @Tester101: I'm in very Eastern Europe and I don't remember ever seeing wire nuts in action. The typical way to connect wires is to either twist them and wrap in insulation tape or use connectors with screws.
Comment: @sharptooth in the US if you saw wires twisted and wrapped in just tape, you'd say the last electrician didn't know what he was doing.  We twist wires and then twist on a wire nut, to insulate the connection and hold it from being pulled apart.
Comment: @Tester101, I have never seen aluminium wire used in UK house wiring.   However it is used for overhead cables etc as part of the grid.
Comment: Part of it may be that most sockets (and switches) in the UK have space for 3 wires to be fixed in each terminal.
Comment: @sharptooth Or, if you felt the tape and found it rock hard, you'd say the last electrician to work on this was from the 40s or earlier, and still doing twist + solder + rubber tape + friction tape splices. Those work great, but eat space in your box like none other.
Comment: Don't know much about UK wiring, but if I'm not mistaken you guys use aluminium wire more, right?  If that's the case, I don't think aluminium wire works well with wire nuts.  Or it could just be an artifact; since they didn't use wire nuts with old aluminium wire, they found a different way and continue to use it today.
Comment: Just out of curiosity, what do you use in the UK instead of wire-nuts?
Comment: @Tester101 The recent "how do I wire this" posts from the UK seem to show an array of setscrews, similar to the back of an alarm system transformer. No clue how they do splices in J-boxes.
Comment: @JeremyW.Sherman, what are "J-boxes"?
Comment: @Walker Junction boxes, used to contain wire splices.
Comment: @sharptooth : same in Brazil... and people tend to think that using "wire nuts" is the cheap + unsafe + lazy way of doing it.
Comment: It's less about the rings per-se and more about the fact it's considered normal/acceptable to put 3 wires in the terminal of a socket, so you can have the two wires from the main ring or radial circuit plus a spur without needing a splice.
Answer: In Brief

Twist-on connectors have a bad history in the UK.
The UK traditionally relies on screw-terminal connectors.
UK Electricians are conservative.
UK junction boxes, switches, ceiling-roses etc contain enough built-in connectors that additional loose connectors are not normally needed.
Newer types of lever-action, squeeze-to-open or stab connector blocks are possibly more popular alternatives.

Twist-on connectors
The Wikipedia article on twist-on connectors suggests they were outlawed in the UK 50 years ago. No references are given. It is suggested that 50 years ago the ("Scruit" brand) twist-on connectors were made of ceramic and were liable to crack and expose the wires.
UK Electricians are a conservative group. Vendors of novel products have to go to considerable length to persuade them that their products meet the relevant legislation.
An Ideal Industries Inc. catalogue says

Conforming to BS EN 60998 Twister® wire connectors fully
  comply with BS 7671:2008 (17th Edition Wiring Regulations).

However, it isn't uncommon to see strenuous efforts on the part of manufacturers to persuade UK electricians that novel products meet regulations. E.g. Wagobox and Ezybond earth fasteners Some of these novel products more or less disappear from the market within a few years, others succeed.

Screw-terminal-blocks
In the UK, electricians almost invariably use screw-terminals.

ruler is marked in cm with mm subdivisions
The white translucent screw-connector block in the foreground is a typical example. This one is rated for 5A. Other sizes are available for different current ratings.
An electrician left behind the other connectors in this picture. I suspect they were used for temporary connections during installation. I've not seen any in a completed installation (but I'm only a householder not an electrician, so have very limited experience)
The "Marr No.1" connectors at back right  look superficially similar to US wire-nuts but are very different. The metal insert is removed and a grub nut is used to clamp the wires, then the plastic insulator is screwed over the connection.
The "Legrand 10mm2" connectors at top left may be for higher current ratings. Note that the plate that presses on the wires is arranged so as not to exert any twisting force on the conductors. Perhaps this avoids damaging stranded conductors. It certainly prevents the conductors being pressed to one side of the screw and therefore not being securely clamped in place.
An obvious advantage of these connectors is that the wires can be removed intact and should usually not need trimming before reconnection. I have the impression that in the US, wire-nut connections are often removed by cutting the wires, which may leave progressively less and less wire available in the junction-box or back-box for remaking connections.
When more than two wires are to be joined, a slightly different type of screw-connector is used:

Switches, junction boxes and ceiling roses often contain sufficient bult in capacity that you don't need additional connectors:

Newer connectors
Easier-to-use connectors are becoming more common:

Some of these are "lighting connectors" used to join solid-core wires to stranded wires. They are all rated at 20A and at least 300V. They all incorporate a test-port and wire-trimming guide.
It may be that UK electricians looking for novel connectors prefer these to twist-on connectors.
Comment: "I've not seen any in a completed installation..." the type of connector at the front left of your picture is used for splicing onto a wire without needing to cut it (just remove the insulation, put it and the splice into the slot, then tighten a nut onto it).  If you've ever been past a hole in the road and seen the big plastic epoxy-filled connectors where a power line has been spliced, you may be interested to know that they contain this kind of connector inside.
Comment: The grub-nut Marrs were the original kind in North America (or at least Canada), predating the twist-on Marrette, and are still available. I personally have more confidence in them, but they do take more space in the box.
Answer: One possible reason provided by Ideal Industries in This article

Although very much the connector of choice in North America, the
  twist-on wire connector remains a largely untapped resource in the UK
  electrical market. Unfortunately many electricians still associate
  them with the poor-quality 'screw-it' wire nuts from the 1970s;
  manufactured from ceramic, these had a tendency to crack very easily
  and expose the wires, leading to safety hazards.

Though it looks like Ideal is still trying to tap UK twist-on wire connector market, with the new Twister® PRO (which to me looks just like a regular wire nut, aside from it being multicolored).
Comment: Those ceramic wire nuts were crap. You find them in older installations here in the US. Their modern equivalents are the plastic ones with plastic threads that come with cheap fixtures. Quality Wire Nuts have either a hard or soft shell with a conical spiral spring that threads itself on and binds the wires together tightly. They're color coded for size of conductor and number of conductors they can contain.
Comment: The ceramic nuts I came across must have been out of the 50's, I'd guess, post WWII and kind of rare actually. I lived in a house that had a guest-house outbuilding with the old tube'n insulator wiring with Western Union splices and the remains of Gutta Percha insulation where it had baked one too many summers and started to flake off. Easy to see why people were afraid of rural electrification in the early days.
Comment: @FiascoLabs What years were the ceramic ones in use? I've found modern plastic + spring ones from early/mid-80s work. The mid-40s work I've seen uses soldered and wrapped splices.
Answer: I am a British Electrician and I have lived in the USA.
when I first saw and used wire nuts in the USA, I was horrified.
Frankly, the wiring standards and codes in the USA are lax compared with those in the UK and the domestic wiring is pretty amateurish.
Examples.
In the USA, 110v power outlets are allowed in bathrooms. Pull cord light switches are not mandated.   In the UK, power outlets and wall mounted switches are not allowed.
In the USA, Existing 2 wire circuits that do not have earth are not required to be brought up to code even when the property is sold.
In the UK - you very very rarely encounter circuits with no earth.
In the USA, some older houses are wired with metal sheathed BX cable where the metal sheath is the earth. It has a very high earth resistance and crappy insulation.
In the USA, Wiring is radial spur and sharing of power and lighting on one circuit is allowed.   There is a ridiculous amount of circuits in an average home. My own home had perhaps 40 breakers.
Connections are often made with wire nuts. And they aren't so great. More often than not the wire is damaged by either the pretwist or the action of the wire nut itself.  The wires themselves are just jammed into a box in a tangle. It looks awful.
Some three wire circuits are wired with two phases sharing a common neutral. The theory is that the net current through the neutral is zero when both loads are the same.  However, the power factor of the load can affect that.  Also you get situations where some idiot has wired the different phases through different single breakers (rather than a dual breaker linked by a bar) and then only isolated one side. Person working on it gets a shock.
Romex cable in the USA has softer and is less rugged than the equivalent T&E cable in the UK.  It is not mechanically tough and can easily be damaged.
2 pin plugs with no earth are allowed in the USA.  In the UK all plugs are three pin.
three pin plugs in the USA do not contain a fuse of any sort.
Three pin sockets in the USA do not have shutters in them. Its possible for a child to stick a paperclip in a socket and get a shock. In the UK, sockets have shutters that are lifted by the long earth pin that makes contact first.
This is just a selection.
The main thing I liked about the USA electrical system was that the faceplates of sockets and lights could be swapped without the need to disconnect the wires.  The rest of it, feels 50 years behind the UK.
Comment: Some of the policies you list (eg bathroom wiring) aren't realistically better or worse, just different because historically people were excessively  worried about different things. For example, in my part of the country we used to go your pull-string switches one better by putting the light witch entirely outside the bathroom. Realistically that makes no difference unless you're throwing buckets of water around, but as with the ceiling switch snd pull string it made people feel better back when electrification was new, and the custom has persisted as a quirk of local conventions.
Comment: @Walker - RCDs are required on all new socket circuits, but not on lighting circuits. Retrofitting is not required, but *most* UK houses have their socket circuits on RCDs.
Comment: How common where RCDs?
Comment: I would say the wiring you worked on was over 50 years old 2 pin has not been code since prior to my apprenticeship in the 70's . also since that time ground fault protection has been required within 6' of water or if in a bathroom so there is no real difference there compared to an rcd as far as 2 legs sharing a neutral there are codes that really make them no different than any other circuit. With wiring on the other side of the pond it is higher voltage, lower current so the same wiring methods are not needed. Continued
Comment: As far as cable it is covered or protected not ment to be exposed to dammage a nail through any wiring will cause failure here or there. The one huge difference I see is the US requires more grounding than I saw at non us locations. Do I think some practices are sloppy yes I do, I think back stabs, the push in connection should be outlawed.
Answer: Not sure about "why not" in UK (although Tester101 seems to have a good explanation [as always]), but there is a trend in US, at least in the DIY community to use the new side-by-side connectors

The overall connection is wider, but I find it easier to flex the bundle toward the back of the box, especially when there are three or four wires. Also, there is tactile feedback that the connection of each wire is solid and less chance that one of the wires has a loose connection as it might in a twisted bundle.
Finally, it generally needs less of a stripped lead, which is helpful if you need to snip the end for a new connection. Sometimes cutting the twisted lead leaves a pretty short wire to work with.
Comment: Just ran into these (made by Wago) the other day provided with some recessed cans for splicing. I had to look close, check the model, and look up the instructions. They aren't well labeled on the connector, but they include a strip gauge and a hole at the end for testing liveness with a probe. Pretty nifty.
Comment: These are starting to be used in the UK as well
Answer: Tester101 addressed your "why not in the UK?" question. As to the "why in the USA?", I believe it's because wire nuts are easy to use, cheap, and occupy little space in the box.
Even an amateur can create a good splice with wire nuts. They don't need to learn to pretwist or anything: just line the wires up, jam 'em in, and twist like your life depends on it (hint: it might). Then hold the nut and give each wire a tug to make sure the nut grabbed it good. Got it wrong? Try again, no muss, no fuss. Really mangled things? Cut the ends off, strip a bit more, and try again. It's a lot more forgiving and reliable than any similarly cheap alternative.
Comment: @Tester101 The instructions supplied with the nuts do not specify pretwisting. And IIRC UL standards require the nuts to make a solid splice without pretwisting, as well.
Comment: @geerlingguy You actually need two pairs if you want to pretwist heavier wires, one to clamp them at the base of the splice and the other to spin the ends around. I've found when splicing 3 or 4 (or more) wires, it's easiest to pretwist or use push-in connectors, because getting the wire nut to actually grab and twist all the wires into a solid splice without pretwisting them is very frustrating.
Comment: I've gotten good solid splices out of "hold 'em parallel and twist it on" with 4 12 AWG conductors. All I can think is trying to pretwist those would be an exercise in frustration.
Comment: You're actually *supposed* to pretwist the wires, even when using wire nuts.
Comment: @JeremyW.Sherman - that's when a good pair of linesman's pliers come in handy!
Comment: Just to explain pretwisting the way I have seen it done - the wires are stripped leaving extra exposed length. Pliers are then used to grip all the wires in the bundle and they are twisted tight. Then the extra somewhat mangled end which was damaged by the pliers is cut off, and the wire nut added.
Comment: I know this is older but thought I should expand on the correct amount of twist. Both scotch and ideal do not require pre twisting but the wire at the base of the wire nut should have 2 twists when the wire nut is properly tightened per listing instructions
Answer: Building Regulations Part P in UK does not specifically ban or recommend using screw terminals in the UK. It goes to mention, that during joing wires they should be joined in the terminal of a switch/contact or to use appropriately certified equipment that is relevant to the job!
There is also an a section for old building compliance that may be encountered during renovations and they show some bad and good ways of doing certain things but do not mention anything about joining wires.

I have noticed that in every electrical installation i work with in the UK there are always block connectors used. I even took apart some old lighting made in Birmingham in 1990 that used ceramic block connectors for joining 220V to ballasts.
When I did some electrical certifications in South Africa, examples of connecting wires used plastic block connectors. But, allot of light fittings I installed; for example ceiling fans - were supplied with screw nut thingies and I just used those. But other halogen type lights had block connectors.
It is interesting though that during a short period in Poland - most of the wiring i worked with (in pre-WWII buildings) they used some sort of soviet ceramic screw caps and connectors were scarce. Today however.. You can only buy plastic block connectors and those screw things are frowned upon. You cant even buy them at the whole sellers, just eBay if you desperate.

I have never seen any regulation banning the use of those connectors- But in my own experience I ALWAYS questioned how long will that wire actually last screwed in freely like that? And i preffered to use block connectors for piece of mind!
If you interested in more building regulations please click here (UK)
Answer: They are also common in Belgium, if that adds anything. I found the old ceramic ones in my house and have used the modern quality ones for wiring lighting circuits very effectively. Simple to use and the house has not burnt down yet after 5 years so appear to be safe.
Answer: Wire nuts are not used in the UK because the old ceramic ones were banned many years ago for good reason; the same reason outlets are not allowed in bathrooms: 240 volts! In Florida at least, code requires an outlet within 3 ft of each wash basin so that the wife can hook up a hair dryer - separate bathroom circuit on a GFCI. It is nonsense to say US wiring and electrics generally are inferior to the UK - just different systems and different codes. I had 10 inspections by the city for a bathroom refurb recently, 3 of which concerned the electrical - all subs had to be licensed. A pity the UK is not so vigilant about work done on properties there.
Answer: The reason we don't use wire nuts is because they damage the cable when you undo them.
I lived & worked in the uk as an electrician for nearly 14 years.
Most electricians that are considered to be master electricians have at least 3-4 years of college education. On top of that, we do regular courses to upgrade our knowledge when the electrical regulations get revised. eg 16th edition, 17th edition etc.
On top of this, you need to do a testing & inspection course.
This is essential as anytime, a house, flat/apartment or dwelling of any kind is sold or rented/leased, the electrics have to be tested.
We do not use wire nuts as twisted copper wires weaken ever time you untwist & re twist back together again. A terminal block is considered safer & better as you loosen the screw, pull out the wires, test, reinsert & wire up again.
Rental properties which change tenants would have to be tested regularly. Wire nuts would become a hinderance. Secondly like many countries using 220-250 volts, only qualified electricians can test & certify the condition of the electrical systems.
Most electricians that I have meet in california have a very limited knowledge of testing & fault finding. They normally want to rewire the house or upgrade the fuseboard/panel rather than locate & rectify the fault.
You will not find the answer in the electrical regulation book as they are more of a guide to good electrical practice than a how to guide. The regs book gave you the european guidelines but does not tell you how to execute the work.
Comment: Do you have a source that wire nuts significantly weaken the wire? Also, are you saying that every time a new resident moves into a building that an electrician dismantles the outlets, individually tests all the wires, and rewires everything? You can't just use a receptacle tester?
Comment: I'm a landlord with 6 units and every time we've bought properties my inspectors have used outlet testers.  I have no idea why they'd want to open up the outlet and play around with bare wires...
Answer: 240 Volts everywhere has something to do with it - not a good idea to have wires twisted together. Can't have receptacles or wall switches in bathrooms either.
Comment: [Another answer](http://diy.stackexchange.com/a/18250/22) states that they're common in Belgium, which uses the same line voltage as the UK.
Comment: Rob, can you elaborate a little bit more? Not sure I follow.
Comment: A picture of a typical British residential electrical panel would be interesting...anyone?

Why are “Wire Nuts” not used in the UK?