prove that $2\sqrt5 +\sqrt{11}$ is irrational

Question: how would you prove that $2\sqrt5 +\sqrt{11}$ is irrational?
I started with a proof by contradiction that assumes that $2\sqrt5 +\sqrt{11}$ is rational and therefore there exist integers $a$ and $b$ such that $\frac{a}{b}=2\sqrt5 +\sqrt{11}$ and squaring both sides yields
$\frac{a^2}{b^2}=31 +4\sqrt5\sqrt{11}$ and from this point im stuck as i dont know how to continue to arrive at a contradiction.
Comment: $31 + 4\sqrt{5}\sqrt{11} = 31 + 4\sqrt{55}$.  If $\sqrt{55} $ is not rational, neither is $31 + 4\sqrt{55}$.  So do $\sqrt{55} =\frac { \frac {a^2}{b^2} - 31}4 = \frac cd$ leads to a contradiction.
Comment: That might be the best approach (with suitable technique) unless you know some higher algebra.  Can you add a few words about your math background?
Answer: Here's a more advanced approach, with some common details to the above.
A monic polynomial with integer coefficients:
$$ (x^2 - (2\sqrt 5 + \sqrt{11})^2)(x^2 - (2\sqrt 5 - \sqrt{11})^2) = x^4 - 62x^2 +81 $$
Now $x = 2\sqrt 5 + \sqrt{11}$ is a root of this polynomial, but by the Rational Roots Thm., any rational root would be an integer divisor of $81$.
Thus one only needs to verify that $2\sqrt 5 + \sqrt{11}$ is not an integer.  A simple hand computation (or calculator computation) shows this positive number lies strictly between $7$ and $8$.
Answer: You simply need to show that $\sqrt{55}$ is irrational since $a+bc$ is irrational whenever $a,b$ rational (and $b\ne 0)$ and $c$ irrational. This produces a contradiction. To show $\sqrt{55}$ is irrational, there is a famous proof based on the fundamental theorem of arithmetic that the square root of any non-perfect-square natural number is irrational (or you can do an ad-hoc proof, similar to the proof that $\sqrt{2}$ is irrational).
Answer: If $2\sqrt{5}+ \sqrt{11}=r$ is rational then  $4*5 + 4*\sqrt{55} + 11 = r^2$ is rational.  Then $\sqrt{55} = \frac {r^2 - 31}4$ is rational.
NOW do the proof by contradiction
Let $\sqrt{55} = \frac ab$ so $55b^2 = a^2$ so $5|a$ and so $25|a^2$ so $5|b^2$ so $5|b$ so $a$ and $b$ aren't in lowest terms.... yadda, yadda, yadda....


How to set file permissions (cross platform) in C++?

Question: I am using C++ ofstream to write out a file. I want to set the permissions to be only accessible by the user: 700. In unix; I suppose I can just issue a system("chmod 700 file.txt"); but I need this code to work on Windows as well. I can use some Windows api; but what is the best c++ cross platform way to do this?
Comment: Horrible! Insecure! Don't create the file then fix its permissions afterwards - let alone using a crazy hack like `system("chmod")`. Instead do it the right way, creating with restrictive permissions and use a race-free API. Use `umask` (not thread-safe) or `open+fchmod+fdopen+std::fstream`.
Comment: There's nothing wrong with using chmod,as long as chmod is used before writing the sensitive data to the file. You realize in your "answer" that fchmod() is very similar to chmod, right?
Answer: Ironically, I have just run into this very same need earlier today.
In my case, the answer came down to what level of permission granularity I need on Windows, versus Linux.  In my case, I only care about User, Group, and Other permission on Linux.  On Windows, the basic Read/Write All permission leftover from DOS is good enough for me, i.e. I don't need to deal with ACL on Windows.
Generally speaking, Windows has two privilege models: the basic DOS model and the newer access control model.  Under the DOS model there is one type of privilege: write privilege.  All files can be read, so there is no way to turn off read permission (because it doesn't exist).  There is also no concept of execute permission.  If a file can be read (answer is yes) and it is binary, then it can be executed; otherwise it can't.
The basic DOS model is sufficient for most Windows environments, i.e. environments where the system is used by a single user in a physical location that can be considered relatively secure.  The access control model is more complex by several orders of magnitude.
The access control model uses access control lists (ACL) to grant privileges.  Privileges can only be granted by a process with the necessary privileges.  This model not only allows the control of User, Group, and Other with Read, Write, and Execute permission, but it also allows control of files over the network and between Windows domains.  (You can also get this level of insanity on Unix systems with PAM.)
Note: The Access Control model is only available on NTFS partitions, if you are using FAT partitions you are SOL.
Using ACL is a big pain in the ass.  It is not a trivial undertaking and it will require you to learn not just ACL but also all about Security Descriptors, Access Tokens, and a whole lot of other advanced Windows security concepts.
Fortunately for me, for my current needs, I don't need the true security that the access control model provides.  I can get by with basically pretending to set permissions on Windows, as long as I really set permissions on Linux.
Windows supports what they call an "ISO C++ conformant" version of chmod(2).  This API is called _chmod, and it is similar to chmod(2), but more limited and not type or name compatible (of course).  Windows also has a deprecated chmod, so you can't simply add chmod to Windows and use the straight chmod(2) on Linux.
I wrote the following:
#include <sys/stat.h>
#include <sys/types.h>

#ifdef _WIN32
#   include <io.h>

typedef int mode_t;

/// @Note If STRICT_UGO_PERMISSIONS is not defined, then setting Read for any
///       of User, Group, or Other will set Read for User and setting Write
///       will set Write for User.  Otherwise, Read and Write for Group and
///       Other are ignored.
///
/// @Note For the POSIX modes that do not have a Windows equivalent, the modes
///       defined here use the POSIX values left shifted 16 bits.

static const mode_t S_ISUID      = 0x08000000;           ///< does nothing
static const mode_t S_ISGID      = 0x04000000;           ///< does nothing
static const mode_t S_ISVTX      = 0x02000000;           ///< does nothing
static const mode_t S_IRUSR      = mode_t(_S_IREAD);     ///< read by user
static const mode_t S_IWUSR      = mode_t(_S_IWRITE);    ///< write by user
static const mode_t S_IXUSR      = 0x00400000;           ///< does nothing
#   ifndef STRICT_UGO_PERMISSIONS
static const mode_t S_IRGRP      = mode_t(_S_IREAD);     ///< read by *USER*
static const mode_t S_IWGRP      = mode_t(_S_IWRITE);    ///< write by *USER*
static const mode_t S_IXGRP      = 0x00080000;           ///< does nothing
static const mode_t S_IROTH      = mode_t(_S_IREAD);     ///< read by *USER*
static const mode_t S_IWOTH      = mode_t(_S_IWRITE);    ///< write by *USER*
static const mode_t S_IXOTH      = 0x00010000;           ///< does nothing
#   else
static const mode_t S_IRGRP      = 0x00200000;           ///< does nothing
static const mode_t S_IWGRP      = 0x00100000;           ///< does nothing
static const mode_t S_IXGRP      = 0x00080000;           ///< does nothing
static const mode_t S_IROTH      = 0x00040000;           ///< does nothing
static const mode_t S_IWOTH      = 0x00020000;           ///< does nothing
static const mode_t S_IXOTH      = 0x00010000;           ///< does nothing
#   endif
static const mode_t MS_MODE_MASK = 0x0000ffff;           ///< low word

static inline int my_chmod(const char * path, mode_t mode)
{
    int result = _chmod(path, (mode & MS_MODE_MASK));

    if (result != 0)
    {
        result = errno;
    }

    return (result);
}
#else
static inline int my_chmod(const char * path, mode_t mode)
{
    int result = chmod(path, mode);

    if (result != 0)
    {
        result = errno;
    }

    return (result);
}
#endif

It's important to remember that my solution only provides DOS type security.  This is also known as no security, but it is the amount of security that most apps give you on Windows.
Also, under my solution, if you don't define STRICT_UGO_PERMISSIONS, when you give a permission to group or other (or remove it for that matter), you are really changing the owner.  If you didn't want to do that, but you still didn't need full Windows ACL permissions, just define STRICT_UGO_PERMISSIONS.
Answer: There is no cross-platform way to do this. Windows does not support Unix-style file permissions. In order to do what you want, you'll have to look into creating an access control list for that file, which will let you explicitly define access permissions for users and groups.
An alternative might be to create the file in a directory whose security settings have already been set to exclude everyone but the user.
Comment: That answer is something people should really think about: Is dealing with permissions in apps really necessary? In many, many cases it is not and even breaks things, because it takes admins and users the possibility to control permissions as they see fit. Especially e.g. on Windows, no other user is able to access user's home dirs by default anyway, so there's most likely no need to make files "private" manually. A lot of chmod+umask-handling in Linux apps is legacy because of a lack of ACLs, proper inheritance and such. Try to avoid that as much as possible.
Answer: Cross-platform example to set 0700 for a file with C++17 and its std::filesystem.
#include <exception>
//#include <filesystem>
#include <experimental/filesystem> // Use this for most compilers as of yet.

//namespace fs = std::filesystem;
namespace fs = std::experimental::filesystem; // Use this for most compilers as of yet.

int main()
{
    fs::path myFile = "path/to/file.ext";
    try {
        fs::permissions(myFile, fs::perms::owner_all); // Uses fs::perm_options::replace.
    }
    catch (std::exception& e) {
        // Handle exception or use another overload of fs::permissions()
        // with std::error_code.
    }
}

See std::filesystem::permissions, std::filesystem::perms and std::filesystem::perm_options.
Answer: The system() call is a strange beast. I have been bitten by a NOP system() implementation on a Mac many moons ago. It's implementation defined meaning the standard doesn't define what an implementation (platform/compiler) is supposed to do. Unfortunately, this is also about the only standard way of doing something outside the scope of your function (in your case -- changing the permissions).
Update: A proposed hack:

Create a non-empty file with appropriate permissions on your system.

Use Boost Filesystem's copy_file to copy this file out to your desired output.

void copy_file(const path& frompath, const path& topath): The contents and attributes of the file referred to by frompath is copied to the file referred to by topath. This routine expects a destination file to be absent; if the destination file is present, it throws an exception. This, therefore, is not equivalent to the system specified cp command in UNIX. It is also expected that the frompath variable would refer to a proper regular file. Consider this example: frompath refers to a symbolic link /tmp/file1, which in turn refers to a file /tmp/file2; topath  is, say, /tmp/file3. In this situation, copy_file  will fail. This is yet another difference that this API sports compared to the cp command.

Now, overwrite the output with actual contents.

But, this is only a hack I thought of long after midnight. Take it with a pinch of salt and try this out :)
Answer: No idea if it would work, but you could look into using the chmod.exe executable that comes with Cygwin.
Comment: +1 because it's an interesting idea.  I know that chmod under cygwin does The Right Thing every time I've ever tried it.
Answer: There's no standard way to do this in C++, but for this special requirement you should probably just write a custom wrapper, with #ifdef _WIN32. Qt has a permission wrapper in it's QFile class, but this would of course mean depending on Qt ...
Comment: The warning on the link you provided implies that this might not work as expected on Windows.
Answer: I just found a couple of ways to do chmod 700 easily from the Windows command line. I'm going to post another question asking for help coming up with an equivalent win32 security descriptor structure to use (if I can't figure it out in the next few hours).
Windows 2000 & XP (messy- it always seems to prompt):
echo Y|cacls *onlyme.txt* /g %username%:F

Windows 2003+:
icacls *onlyme.txt* /inheritance:r /grant %username%:r

EDIT:
If you had the ability to use the ATL, this article covers it (I don't have Visual Studio available):
http://www.codeproject.com/KB/winsdk/accessctrl2.aspx
Actually, it says the sample code includes non-ATL sample code as well- it should have something that works for you (and me!)
The important thing to remember is to get r/w/x for owner only on win32, you just have to wipe all of the security descriptors from the file and add one for yourself with full control.
Answer: You can't do it in a cross-platform manner.  In Linux, you should use the function chmod(2) instead of using system(2) to spawn a new shell.  On Windows, you'll have to use the various authorization functions to make an ACL (access-control list) with the proper permissions.


Custom button to copy field values from other object

Question: we have created an APEX class that creates a contract object from an opportunity object. We need to create a custom button on contract object to copy some field values from the related opportunity object to the new contract object and I do not really how to do it. This step is not mandatory (for this reason I have not include that in the apex class), it is just an option for the users and has to be done always once the contract object has been already created. I have in a custom contract field the associated opportunity id. Thanks in advance.
Answer: You should just start by looking at Ray Dehler's URL Hacking post . This was all I needed to read up on URL hacking and custom buttons.  If all you are doing is creating a contract from the opportunity and either copying values from it or hardcoding then this should be enough reading..
Comment: URL hacking is unsupported, won't work via Salesforce1, and is generally a bad idea, especially if you're already using apex in your org!
Comment: Yeah of course it's unsupported,but I've used pretty successfully over the years in a pretty large org and don't remember any huge problems regarding the use thereof.
Salesforce do provide Chatter Actions that are able to do mostly the same thing, otherwise it's just a matter of writing an apex class and having a button that uses OnClick Javascript and calling the class.
I use a mixture of both.  Whatever works.
Answer: Running apex from a custom button is a fairly common requirement. The trick is if you need it to be protected against CSRF or included as part of a managed package.
At the simplest level you can create a custom button link on Contract to custom Visualforce page that takes the Contract ID as a query string parameter. The custom Visualforce page will then use the action attribute of the apex:page to fire a method in the controller. The method returns a PageReference that redirects back to the Contract when complete. See an example at:
Custom Button or Link to a Visualforce page with a custom controller
Making it work in a CSRF safe way with managed packages is a bit more tricky. Last I checked you need an intermediate page or a custom Contract Detail page. See CSRF safe Custom button linked to Apex method
Alternatively, you could expose your apex method as a webservice method and then invoke it using sforce.apex.execute via a javascript button. This isn't ideal if you don't want others to be able to call the webservice.


Quantum algorithm for QR and SVD matrix decomposition?

Question: I would like to know if exist a quantum algorithm tailored to compute the QR decomposition and SVD of a matrix? Pointers to relevant papers will be very appreciated.
Comment: Does this help: [Quantum circuits synthesis using Householdertransformations](https://arxiv.org/pdf/2004.07710.pdf)...?
Comment: I don't think so, I am afraid because their algorithm uses classical QR as the first step, but they aren't proposing a quantum algorithm to perform QR decomposition.
Comment: Hmm, ok right. How do you think to store the input $A$ and output $Q$ and $R$?
BTW: Householder trafo is mentioned on the [Grover' search Wikipage](https://en.wikipedia.org/wiki/Grover%27s_algorithm#The_first_iteration)...
Answer: I could find a few research papers with the potential application of quantum algorithms for Singular Value Decomposition and QR decomposition.
Singular Value Decomposition:
Singular Value Decomposition (SVD) is one of the most useful techniques for analyzing data in linear algebra. SVD decomposes a rectangular real or complex matrix into two orthogonal matrices and one diagonal matrix. The following research paper proposes a Quantum-SVD algorithm that interpolates the non-uniform angles in the Fourier domain. This Quantum-SVD algorithm is a fundamentally novel approach for the computation of the Quantum Fourier Transformation (QFT) of non-uniform states.
We can also consider Schmidt decomposition approach for Singular Value Decomposition as per the researches in Quantum Information Theory. It is considered as a Schmidt decomposition has a lot of applications for bipartite state purification.
Quantum SVD based Approximation Algorithm
QR Factorisation
Following research paper proposes a rotation graph to devise elimination orderings in order to achieve QR factorisations. Properties of this graph characterise and identify sufficient sets of rotation planes. The unitary or real orthogonal matrix Q is usually computed in one of three ways: Givens rotations, Householder reflections, or Gram-Schmidt orthogonalization. A Givens-based decomposition is also an essential tool in quantum computing. It is important to determine whether a given set of rotation planes
can be used to reduce a matrix to upper triangular form using a minimal number of
rotations. One interesting rotation graph is the star graph. A second interesting rotation graph is the chain.
QR Factorisation using Rotation Graphs and Eliminated Orderings
Comment: The second paper is not a quantum algorithm.


Thevenin analysis

Question: I have a hard time understanding why Thevenin analysis works.
I can see the math, and I can find the equivalent resistor, but I am not sure why it is a valid analysis from a practical point of view.
We are computing the open-circuit voltage across the two points of interest, which basically we are calculating for the maximum voltage across the two points.
And, when we short those two points to find the short-circuit current, we are finding the current for the minimum voltage drop across the two points.
So, technically, we are finding a maximum/minimum voltage range between the two points of interest. But why can this range can be locked down to one voltage source in series with a resistor to replace that part of the circuit?
Answer: An important point you are missing is that the short-circuit current is not measured at a minimum voltage but at exactly zero volts. It is an ideal short circuit.
These two measurements give you two points on a plot of current versus voltage. One is the voltage with zero current and the other is the current with zero voltage. If the circuit is linear then these two points can be connected with a straignt line to give the complete current/voltage output graph of the circuit. Therefore, the circuit is equivalent to an ideal voltage source (of the open circuit voltage) in series with a resistor (determined by the slope of V/I).
You can actually use any two measurements of current and voltage to find the slope of the line, the open circuit voltage and short circuit current are usually the easiest to determine by circuit analysis. If making actual measurements you just need to keep the points far enough apart that measurement error doesn't swamp the slope calculation.
Comment: Thanks, now I can see why they picked the two points, so that they can ccalculate the slope. But now, by having the resistance, why the voltage source is the open circuit voltage? Why it can't be some random voltage on that straight line?
Comment: The open-circuit voltage is the highest voltage that the circuit can possibly provide. So, you need an ideal voltage source that provides that voltage and nothing less.
Comment: @Rudy01: The Thevenin voltage is the open-circuit (zero-current) voltage, because that's the only condition under which the voltage drop across the resistance is zero.
Comment: @JoeHass: It's misleading to call the Thevenin voltage the "highest" voltage. Thevenin analysis works even in circuits that contain other sources, which could potentially (pun intended) force current "backwards" through the Thevenin source.
Comment: @DaveTweed Thanks, I should have said the "largest voltage difference that can appear at the terminals of the Thevenin equivalent circuit". Internal voltages of the original, non-Thevenin equivalent, circuit can indeed be higher.
Comment: Sure, I understand it now. Thanks. But can Thevenin analysis be used in circuits with active components as well (e.g. capacitors,inductors, transistors,...)?
Comment: I'm not certain, but I suspect you could do an a.c. Thevenin analysis with capacitors and inductors. At d.c. capacitors and inductors become zero-ampere current sources and zero-volt voltage sources (opens and shorts). In general the circuit must be linear, and since transistors are highly non-linear then the same analysis can't be guaranteed to work.
Comment: @Rudy01: Sure it can. Thevenin analysis works just as well with complex impedances as it does with pure resistances.
Answer:
but I am not sure why it is a valid analysis from a practical point
  of view

When you consider the Thevenin representation of a circuit, note that the output voltage, as a function of the output current is, by inspection:
$$V_O = V_{TH} - I_O \cdot R_{TH}$$
Thus, when the output current is zero, i.e., the load is an open-circuit, the corresponding open-circuit output voltage is
$$V_{OC} = V_{TH} - 0\cdot R_{TH} = V_{TH}$$
This establishes that the open-circuit output voltage of an arbitrary linear DC circuit must be the Thevenin equivalent voltage.
When the output voltage is zero, i.e., the load is a short-circuit, the corresponding short-circuit output current is:
$$V_O = 0 = V_{TH} - I_{SC} \cdot R_{TH} \Rightarrow I_{SC} = \dfrac{V_{TH}}{R_{TH}}$$
This establishes that the short-circuit output current of an arbitrary linear DC circuit must be the Thevenin equivalent voltage divided by the Thevenin equivalent resistance.

But why can this range can be locked down to one voltage source in
  series with a resistor to replace that part of the circuit?

Because we are dealing with a linear DC circuit (Thevenin's theorem holds only for linear circuits) and thus \$\dfrac{\Delta V_O}{\Delta I_O} \$ must be constant, i.e., the slope of the output IV curve must be constant.
Finally, recall that there is the Norton representation too which is dual to the Thevenin representation and consists of a current source in parallel with a resistor such that the output current is given by the equation:
$$I_O = I_N - \dfrac{V_O}{R_{TH}} $$
Clearly, we have
$$I_N = I_{SC}$$
Answer: Given a linear circuit with two terminals, the equation relating the voltage and current at its terminals has the form
v=v_1+R·i  (1)
Clearly, there exists a circuit containing one voltage source v_1 and one resistance R in series that has the same i-v relationship. This is called the Thevenin equivalent. There is no simpler circuit with the same i-v characteristic (although there is another one, the Norton equivalent, which is as simple as this).
To find the Thevenin equivalent, you can match both i-v relations as you like. For the linear relationship in (1) you just need any two data points. For computational convenience, you can set i=0, because this often simplifies computing one pair of points: (i=0,v=v_oc). Setting v=0 also often simplifies the circuit because one node vanishes, easing the computation of the second point: (i=i_sc,v=0).
But you could also try to find points on the line making other experiments (for instance when the previous easy ones could destroy the circuit). In RF circuits you often put a 50 ohm resistance at the terminals of the circuit and try to match your circuit i-v line with that of the Thevenin equivalent. Or you try putting different resistance values at the circuit terminals and look when the voltage is v_oc/2: this is exactly the Thevenin resistance value...
So, we are not finding a maximum/minimum voltage range but matching two i-v curves or, better, straight lines.

Thevenin analysis


TreeLayer GeoExt2

Question: I have a map with several layers and I want to have each layer in separate folder below the root. Can anyone help me with js source code to do that? (geoext2 documentation only separate layers between base layers and overlay layers).
Answer: I think what you need is the general gx_layercontainer, this one does not distinguish between baselayers or overlays. You can see it in action in the official example http://geoext.github.io/geoext2/examples/tree/tree-legend.html

TreeLayer GeoExt2


What is the name of Jesus in the Peshitta text?

Question: In Matthew 1:21 what is the name of Jesus in the Peshitta text?
Is it the same as the name given  in Luke 3:29, Acts 7:45 and Hebrews 4:8 which is rendered as Joshua in English?
Answer: Dr. Sebastian P. Brock, who retired from teaching at Oxford University, has demonstrated that the Peshitta New Testament was translated from the Greek into Syriac. The name of Jesus in the Syriac Peshitta text is ܝܫܘܥ (Jesu). This is how it is rendered in Matthew 1:21. However, the name 'Joshua' is not consistently rendered in this way in Syriac, presumably because it was not consistently rendered in the Greek.
In Luke 3:29, Joshua is transliterated as ܝܘܣܐ (Jose). Yet in Acts 7:45, Joshua is rendered the exact same way as Jesus (ܝܫܘܥ). This is most likely because in Luke 3:29, the Majority/Byzantine Greek text uses Ἰωσῆ (Jose) while in Acts 7:45 the Greek text uses Ἰησοῦ (Jesus).
Hebrews 4:8 is a peculiar case because most Greek manuscripts render this as Ἰησοῦς (Jesus), and the Syriac Peshitta also does (ܝܫܘܥ). However, the Syriac also has ܒ݁ܰܪ ܢܽܘܢ (son of Nun, בַּר נוּן) (clearly referring to Joshua, not Jesus). It seems that this may be a scribal gloss added for clarification, although the reasoning behind this gloss would be better suited as its own question. Modern translations almost unanimously translate this passage as referring to Joshua, but the King James Version rendered it as 'Jesus.'
Comment: The only real difference between the eastern and western texts are what books were included. The western texts have five additional books that were added later (2 Peter, 2 John, 3 John, Jude, and Revelation).
Comment: Does he have another work with supporting evidence?  In this book he more operates from a premise that the Peshitta was a translation from the Greek. He explains that translations contain more varieties between them, and the original less variations.  Yet, he then notes how "remarkably uniform" the Syriac manuscripts are, "comparable to the Hebrew Biblical manuscripts and unlike the Greek ones" (p. 7bottom) how "remarkably little variations" they contain (p. 30, 43).  The variation he notes appears to be between east (Peshitta)and west (Peshitto) Syrian texts.  We could chat on it.


How to prevent Magento admin url being indexed from Google?

Question: Is there any safe way apart from the robots.txt to prevent the Magento admin url being indexed by Google.
Answer: There are three ways
The first way to use robots.txt in a safe way:
I didn't try it but it should work.
suppose you admin url is localhost.com/admin . Create a sub folder called secret, then a sub folder called admin.
the structure is /secret/admin. Put the robots.txt file inside secret and copy the index.php to admin folder.
Edit the path in index.php . Then change the admin url in magento to localhost.com/secret/admin . I prefer to change it from the local.xml not from the back-end.
The second way to use .htaccess file to stop bots. It will be something like that:
<code>RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|Baiduspider) [NC]
RewriteRule ^admin/.* - [R=403,L]
</code>
Third way: to protect it with a password ( I prefer this way ). Because it is simple and will block the bots and users who does not know the password.


Conditional Formatting using e.Row.RowType for a Gridview in ASP.Net 2010

Question: Afternoon All,
I have been searching the net for some help in reference to applying some conditional formatting based on a value in my grid view.  I am using Studio 2010 in the form of VB.
I essentially have a gridview and want to highlight a row of data green when the 'Status' for items in my gridview are'On-Line'.
I have been been reviewing a solution here.
I believe this solution may work but i still get an error (Blue line) under the e.Row when i apply this to my code.  This simply states that 'Row' is not a member of System.EventArgs.
I have already added Imports System.Web.UI.WebControls.GridViewRow to the top of my web page and i still have no joy.
Please find below my code.  If someone could review this and let me know what the issue is i would be most greatful.
Imports Microsoft.VisualBasic
Imports System.Configuration
Imports System.Web.UI.WebControls.GridViewRow

Partial Class _Default
    Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub grdCriticalSystems_DataBound(sender As Object, e As System.EventArgs) Handles grdCriticalSystems.DataBound
    If e.Row.RowType = DataControlRowType.DataRow Then

        If DataBinder.Eval(e.Row.DataItem, "Status").ToString() = "On-Line" Then
            e.Row.BackColour = System.Drawing.Color.Green
        End If
    End If

End Sub
End Class

Many thanks is advance for any help.
Regards
Betty
Answer: Afternoon All,
I have managed to complete the above by amndeding the code to the following...
Protected Sub grdCriticalSystems_DataBound(sender As Object, e As GridViewRowEventArgs) Handles grdCriticalSystems.DataBound

I needed to replace system.EventArgs with GridViewRowEventArgs.  this has now worked a treat.
Betty


"South up" coordinate reference system

Question: Are there any CRS that represents south up in a map?
Just like this:
Comment: There are plenty of printed maps that are south-up; see https://www.flourish.org/upsidedownmap/
Comment: There are obviously many coordinate systems where Y increases downwards on the page, but they aren't generally designed for representing maps. If you create an SVG representation of a map in which North is shown at the top, then Y values will increase as you go South.
Comment: It would be fun to use a "negative meter" as a unit. I don't know if it's possible, though.
Answer: South Africa and Namibia have south-up coordinate systems. If you display a WGS84 shape of Africa with EPSG:2050, it looks like this:

Since it is a transverse mercator projection, you can not display the whole world with it, but you can build a similar mercator projection:
<code>+proj=merc +lat_0=0 +lon_0=23 +k=1 +x_0=0 +y_0=0 +axis=wsu +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
</code>
which makes the blue marble looking upside down:

It even works for robinson:
<code>+proj=robin +axis=wsu
</code>
viewed with a project CRS of sphere Robinson EPSG:53030
Answer: I don't know of any south-up projection (but it should be possible to modify an existing one to flip it) anyway for display or print purpose rotating the data frame or the print layout 180° should do the trick, alternatively you could rotate all label and text 180° then rotate the exported map south-up....
Comment: The question makes no mention of a "data frame" or a "print layout" or even a particular mapping technology. What are you referring to, and how do you know the OP's technology supports whatever you're talking about?
Comment: I was thinking on CRSs in proj4
Answer: Using QGIS, you can rotate the map canvas and also the Print Composer by 180 degrees, which is a quick and easy way to achieve this affect, rather than having to alter the image after the fact or alter the labels - or alter the coordinate system for that matter:
Answer: No CRS does really define that north or south should be pointing up. You could have east pointing up with any CRS if You want to.

"South up" coordinate reference system


Facebook: How to get Object id from url

Question: I am trying to Implement Facebook comments api(See this question if you got time), I need to get an Object id, all what I have is Object URL. If I will use Facebook debug, they are giving me some thing like this:
Graph API:  http://graph.facebook.com/451006711598242
I believe that 451006711598242 is my id. I been trying to do the fallow calls:
https://graph.facebook.com/comments?id={myUrl} but it's not working. Any ideas what I need to do?
Answer: Try this to return the object_id:
$object_url = 'http://google.com';
$url = 'SELECT url, id, type, site FROM object_url WHERE url = "'.$object_url.'"';
$fql_query_url = 'https://graph.facebook.com/fql?q='.urlencode($url);
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);

$object_id = $fql_query_obj['data'][0]['id'];

Facebook: How to get Object id from url


How do you get your child to say I have to go potty?

Question: My boy is 3years and 3 months and have been doing all the things charts, stickers, rewards, singing, dancing, high fives and videos you name it I have tried it! He goes all the time when I bring him but just won't ask to go potty!!! I'm at a loss. He just won't ask...I know they say when he is ready he will just ask but is there anything else I'm missing? They are going to ask him to leave school and I'm trying to not pressure him
Comment: Are you sure this is a language issue?  Does he have the self-awareness to know he needs to go?
Comment: My son was 4 yrs, 8 mos. The school is an issue; you may have to change to one where he can just change clothes or have a friend he can go with. Montessori schools are a little more forgiving.
Comment: Does not seem like a language-development issue to me either. BTW are we talking about peepee, kaka, or both?
Answer: It's a complicated and difficult thing for kids to learn on their own.
If you think about it from a cognitive perspective, they need to go from:
Clueless that I'm peeing --> I am peeing --> I need to pee --> I should tell an adult that I need to pee  (adapted from Oh Crap Potty Training)
Where is he on this spectrum? If he goes when put on the potty, he is likely aware that he is peeing. So the question is, has he already reached the step of "I need to pee"? I'm assuming from the details you've given that he hasn't.
How to get a child to anticipate their need to pee:

Model it: Say throughout the day, hmm. I wonder if I need to pee. No, my bladder doesn't feel full. Or yes, I feel like I should try to pee.
Prompt less/not at all: Put a potty within easy access, or multiple potties throughout the house, have a naked (or pants-less) day or two and have some towels on hand. When he starts to pee, if it's somewhere other than the potty, physically move him to the potty and say "pee and poop go in the potty." This will slowly build the awareness of "I need to pee" and his body will give him more warning time.
Make the setup at home like the setup at school - if he needs to ask to use the potty at school (if the potty is inaccessible to him) then make sure you follow the same at home so he gets used to the idea of asking
Make sure he knows who to ask at school if he needs to go school can be a scary place, with a lot of people. Go with him and show him, naming names, who he can ask if he needs to use the potty.
Have confidence in him: let go of any worrying, sense of urgency, or even wishing about him going potty. Toddlers have the healthy (and developmentally appropriate) inclination to resist pressure and crave autonomy. So, when we truly back off and mean it, it usually frees them up to do all the things they are capable of doing. Say something like "I know when you are ready to go on the potty, you'll tell me you need to go, you'll sit and do it," and really believe that. Believe in him. It will pay off. Adapted from Janet Lansbury
Answer: If he's still in diapers/nappies, then you could try changing him to undies. Nappies are so absorbent that the child can wet himself and barely notice it. This is great for keeping the child dry and comfortable, but very counter productive for potty training. He needs to be able to feel it. The suggestion about some pants free days is also a good one.


What is this octotonic scale?

Question: Another post of scale idientification: What scale has these notes : C D Eb F Gb Ab A B? It is a octotonic 8-note ascending scale .
Comment: In addition to user45266's "diminished scale," this is also commonly just called the octatonic scale.
Answer: It's Mode 2 of Messiaen's Modes of Limited Transposition. It's composed of four segments, each comprising the intervals of a tone and a semitone (or the reverse). Like the diminished seventh chord it can be transposed three times.
Messiaen never claimed to have invented it, and acknowledges its earlier use by Rimsky-Korsakov, Scriabin, Stravinsky and Ravel. In Russia it's known as the Rimsky-Korsakoff scale, partly perhaps because he documented his use of it. It is likely that most composers, when they are young, think they have invented it. Willem Pijper certainly did, and in the Netherlands it is called the Willem Pijper scale.
Mozart, Beethoven and Schubert used it, but only 'by accident' in the context of a diminished seventh harmony and always resolving to a common chord, which is inconsistent with the mode. Liszt seems to have been one of the first to have exploited the mode's tonal ambivalence.
It is often called 'the octatonic scale', but

C C# D# E F# G A Bb

has an equal claim to that name.
As user45266 says, you could write a book on it.
Answer: You can refer to my answer to your other scale ID question (lycrimic) for more specifics, but via the same sources and process, I dug up the name "diminished scale".
Really, I should have recognised it myself, because this scale is way less obscure in western music. It sees plenty of use under that specific name, often as a dominant scale, and it has many interesting properties. Other names include "octatonic" (generally context-specific), "Whole-half Diminished" (there's another scale called the Half-Whole Diminished that is very similar, though), etc.
You can do your own research on this one, because honestly someone could write a book on this scale.

What is this octotonic scale?


Do steel inquisitors ever run out of metals?

Question: I don't think I've heard of a steel inquisitor who ran out of metals. Can they? Or is there something about their spikes that prevents that?
Answer: As I believe an Inquisitor's spikes aren't necessarily well explained up to the third book, I will put the following part in spoiler tags. Feel free to skip it if you want, as the rest of my answer can still make sense to you even so.

An Inquisitor's spikes are hemalurgic tools designed to steal an allomancer's power and grant them to someone else. The process is deadly for the giver and some power is lost overall, but it allows the transfer of powers to even non-allomancers. This also works for feruchemy, explaining the Inquisitor's incredible healing/regeneration abilities.

In essence, spikes are only used to augment Inquisitors, not to give them otherwise impossible powers like metalless allomancy. It simply isn't the way the spikes work (keep reading the books or refer to the spoilers, but I have warned you!). As such, they'll eventually run out of metals if they keep on burning them, just like normal allomancers.
However, you have to remember that the Steel Inquisitors work for the Lord Ruler, the single richest person in the whole of Scadrial due to his monopoly on atium. Also, most cities of the Central Dominance are built near mines and, as such, the Lord Ruler has access to near infinite stores of allomantic metals.
Although Steel Inquisitors might not have access to infinite powers, it is probably safe to assume they have access to near-infinite resources. When they start their "shift", they probably ingest amounts of metals that would otherwise seriously damage normal allomancers (remember that the Inquisitors have increased healing and regenerative powers), which could explain why they never seem to run out of allomantic metals.
Comment: I would also like to point out, in book 3 Vin steals a vial of metals from an Inquisitor. They need to replenish their metals just like anyone else.
Comment: You are totally right! Even if I could ingest ridiculous amounts of metal, I'd still bring a backup. After all, some metals do burn rather quickly!
Answer: Yes, they run out. This is based on how the spikes work, which is a plot point. Relevantly:

Hemalurgy is of Ruin, so it cannot be used to create more of something - that power is Preservation's domain.

It's very likely that they get increased utility out of their metals, as Kandra do from their "Blessings". However, Steel Inquisitors are known to sleep for long periods of time, so their powers seem disproportionally taxing - presumably in metal as well as personal energy. They do have access to a lot of metal, though, working for the Lord Ruler.
The only "infinite" anything is a Twinborn, an Allomancer and a Feruchemist such as the Gold/Gold enemy in Alloy of Law, who can burn metals to compound the effects of feruchemcially storing traits.
Comment: How much of this is from the third book, I should have mentioned, I'm, not there yet.
Comment: Besides the fact that Inquistors need lots of sleep, none of it is in the first two books.
Comment: Minor point, rsegal: >! Preservation cannot create, he can only Preserve. This is part of why him and Ruin worked together to (re)create humanity on Scadrial in the first place: so he'd have something to Preserve. To create requires both Preservation and Ruin working together, as Saze did at the end of Book 3. But yeah, with the Inquisitors I just always assumed they had an enormous amount of metal ingested at any given point, and *certainly* before they went into battle/went hunting (which is how you saw them 99% of the time).
Comment: @rsegal Twinborn don't have infinite anything.  They still have to burn their metals to achieve the effect.
Comment: Hence the quotes. It's technically finite, but _so_ multiplicative as to be indistinguishable from something infinite.
Answer: It's already well explained before, but I'd like to add something: if an Inquisitor were to run out of metals, he could probably try burning one of his spikes, since they're in connection to his blood stream. Or can you only burn metals that are in your stomach?
However, I am not sure this would work, but it's certainly interesting to consider, I think.
Answer: yes and no.
as the above answers explain they seemingly do need metals for allomancy, though i would like to add a stronger source from book 3 (HUGE spoiler)

 when spook gained the ability to burn pewter through Hemalurgy, he needed pewter to do so

and therefore they can run out of metal, however there are other powers granted by Hemalurgy (spikes)

 like the "blessings" of kandra or koloss

that arent allomantic or feruchemistic, and are permanent (as long as the spikes are still there).

 although it is unclear where the power was drained from


QPSK/QAM, digital quadrature modulation: square wave as local oscillator possible?

Question: Goal is to build a lab exercise for students to illustrate digital IQ-modulation (QPSK, M-QAM). The bit stream for I and Q are generated by e.g. an Arduino.
Is it possible to use a square wave as local oscillator (original and 90-phase shifted) or must it be a sine wave? Most books and datasheets assume a sine-shaped local oscillator.
How would you implement it (square wave, square wave filtered, sine wave?) for a lab exercise (I'm not asking for a electric schema, although welcome, but more in principle how would you do it)? Goal of the exercise is not to show the most efficient way to transmit data but to make the students see and feel the most important principles of digital IQ modulation.
Comment: From https://en.wikipedia.org/wiki/Frequency_mixer : Switching is the normal operating mode of a packaged double balanced mixer [e.g., in DB Gilbert cell topology], with the local oscillator drive considerably higher than the signal amplitude. Instead of the LO sine wave term, the signum function [square wave] is used. Switching mixer enables to achieve a lower noise figure and larger conversion gain.
Answer: Yes, you can use a square wave LO. It makes the multiplication by the data trivial.  With digital data, it can all be done with logic, and with analogue IQ data you can do it with 4053-type analogue muxes.
It sounds like you're not expecting the Arduino to produce the LO. Use a 4x LO digital clock, clocking a /4 Johnson counter. That's most easily made with a single dual flip flop HC74 package, Q to D for one, Qbar to D for the other. This will produce all four phases, 0, 90, 180, 270 of your quadrature LO.


Is it possible for a Virus to "leave" the Windows Sandbox (VM) and infect the host system?

Question: Im using Windows 11 Pro. It has a feature called "Windows Sandbox", which is basically a virtual machine.
If im getting a Virus inside of this sandbox, is it possible for that Virus to somehow "break free" from the virtual machine and also infect the host system? How safe is the Windows sandbox mode when it comes to dealing with viruses?
Comment: There have been breakouts of virtual machines in the past. Also for Hyper-V, on which WIndows Sandbox is based. Side channel attack, Rowhammer, CPU bugs could also apply depending on the setup. But a virus needs to specifically designed for that.
Comment: When you say "But a virus needs to specifically designed for that", is this usually not the norm? I would imagine that a Virus developer might implement every known security exploits/problems to their viruses by default to maximize the spreading of it.
Comment: It is not the norm. Why should someone add any kind of exploit and not just the ones required for the "job". Exploits cost money or effort to search them yourself. Depending on the virus some might also use VM detection specifically and stop running to avoid further analysis. Breaking out of a VM is a targeted attack unless VM usage becomes more common for the average user.
Comment: That makes a lot of sense, thank you :)
Answer: Possible? Yes, absolutely. Probable? No. Safe? Nearly 100% safe considering this feature is barely used or known by people. Most hackers are targeting actual VMs, e.g. VirtualBox/VMWare/Qemu, not something obscure such as a built-in Windows VM.
Side channel attacks are mostly a thing of the past unless you specifically disabled protections against them in your host OS. Besides they are not meant to escape your VM environment, but to gain knowledge of the host OS (e.g. secrets/passwords/etc).
For running unknown software I've been using SandBoxie+ which has almost a zero footprint but in theory it's a lot less secure than using a full fledged VM since it overrides system APIs.
Comment: Still, cases of escaping a VM are relatively rare, so I wouldn't bother too much if I were you. You must be *specifically* targeted by three letter agencies or hackers for someone to be able to hack you via browsing in a VM.  Chrome based browsers and Firefox all run in sand boxes nowadays by default, so even escaping them in your real OS is a very non-trivial task. Fire up a VM with any OS, create a non-administrator user in it and you're pretty much 100% safe. The hacker will have to hack four layers of protection: web browser, limited user account, virtual OS and lastly VM itself.
Comment: This sounds promising.
Im mainly concerned since im using important stuff like online banking on my computer. Would using the Microsoft Sandbox be a suffiecintly safe option to use when wanting to brwose untrustworthy websites/using untrustworthy programs? Or would you still recommend using an extra seperate computer for that?
Comment: If you want to be super safe, yeah, having a separate computer on a separate network (meaning it's not directly connected to your LAN) is even better. AFAIK there are companies which offer remote desktops for such purposes. This must be even safer and requires no installation or maintenance.
Comment: Ok, thank you for your help :)
Comment: So, your calling a feature in a major commercial OS barely used, and claim on that basis that it will therefor be secure? Color me skeptical. Do you have corroborating evidence for / against these claims?


Did the requirements for fulfilling beta commitments change?

Question: Today a user commented on an Area51 post of mine about the 10 posts (questions +  answers) required to fulfill a commitment.  He got the Beta badge on Poker and his Area 51 profile shows the commitment fulfilled, but he's only made 8 posts on that site.  Have the requirements changed?  If not, is it perhaps counting deleted posts or something?
Comment: There was a fellow who blasted the Biblical Hermeneutics site with 10 quick questions.  (Not complaining about that; most were good.)  When someone asked why he had done that, he said he wanted to fulfill his commitment so that he could commit somewhere else.  I checked back with his Area 51 profile once in a while for several months and the commitment stuck.  Now I see that it's cleared.   All of which to say, it seems, um, inconsistent.
Comment: I've posted six answers and a question on [Sports](http://sports.stackexchange.com/users/12) and that was enough. No deleted posts either.
Comment: @CopyrightX: I mean: the commitment was not cleared for a long time and then it was.  And I checked again and it still is cleared.  I can't tell if he was able to commit to anything else though...
Comment: @JonEricson what do you mean by "Now I see that it's cleared."? The software reversed his previously fulfilled commitment after having first indicated for several months that he *had* fulfilled his commitment?
Answer: Yeah, the requirements can be slightly lower if you're an active participant during the private beta. Asking and answering are still the quickest / easiest way to fulfill commitment though, regardless of when you do it.
Comment: Bottom line, if committing _actually_ means something _more_ than what one explicitly agrees to with, "I commit to participate actively in Community X for at least three months, especially during the private beta, and _to ask or answer at least ten questions_.", then for Pete's sake, that oughta be explicitly stated. Committing to something nebulous (while under the false impression that commitment requirements are explicitly stated in a written contract) is a near-guarantee of disappointment and disillusionment. I could just join the Scientologists if I wanted that.
Comment: It is if I'm just answering a support question. You can probably find something more useful to do with the meta rep.
Comment: Details? Maybe in a FAQ somewhere? Rather than scattered all over the place? Posting something _useful_ in a group of hundreds of professional L2/L3 Network Engineers is going to be essentially impossible for someone who is not a professional L2/L3 Network Engineer. SE created a closed-group site for this crowd without advance labeling as such. Community Proposal description reads, "Beta Q&A site for network engineers." I'm a network engineer. Just not a professional one. Better description would have been, "Beta Q&A site for L2/L3 professional Network Engineers." I'd never have committed.
Comment: @CopyrightX: there is a reputation requirement as well; you need to actually post stuff folks find *useful*.
Comment: @CopyrightX: I'm pretty sure the lack of clear and visible documentation on this is *by-design* - the intent isn't to give folks a bare minimum threshold to try and scrape by, it's to encourage them to participate on the new site they've committed to participating on. I'll note that in your specific case, most of what you've written hasn't received any votes - so as far as the system is concerned, it's not really doing much. As far as NE knowledge goes, if you're having trouble contributing by answering, why not post a few questions of your own?
Comment: So implement an "uncommit" option as so many others have asked for. This proposal was a poor fit for me from Day 1 because the description was fundamentally misleading. Making the requirements for fulfilling a commitment as vague as this only aggravates the problem. Unless you can see something that I cannot see, this experience exposes a fundamental flaw in the software design: how to deal with minorities who (through no fault of their own) are unable to commit in ways that are _useful_ to the majority.
Comment: Is cancelling Meta bounties a thing now? :P
Comment: So I participated in Network Engineering during its _private_ beta with two questions (one I deleted voluntarily as it was fast on its way to being closed by others) and two answers. Since it went public I posted several other answers so that my NE profile currently shows I've posted 1 question and 9 answers. That was >24 hours ago, and still my area51 profile shows zero fulfilled commitments. Do I need to contribute more to NE to fulfill my commitment there? Or do I need to wait awhile before my profile shows the fulfilled commitment? I don't understand how this commitment fulfillment works.
Comment: I read "Once you've fulfilled your commitment on a new site by asking and answering a few questions, you'll be able to commit to another site. If you are very active, you may be able to re-use your commitment as soon as the second day of public beta. If you aren't active on the site, you won't be able to re-use the commitment until the end of the public beta, or until six months after the beta began." at http://area51.stackexchange.com/faq#commitment and wonder if anyone can elaborate on when I'll "...be able to re-use the commitment" I foolishly invested in NE. Six months would be painful...
Comment: Did you check the two questions I did post? Closed or deleted on the way to closure because they were deemed off-topic. Seems that **Real Network Engineers** don't use Linksys gear. That stuff is _contemptible_! (Never mind that the name is owned by Cisco.) So the other requirement for contributing _useful_ stuff there is that I own or have access to Cisco routers. Again, woulda been nice to see that in the Community Proposal description before I committed.
Comment: From [the Area51 FAQ](http://area51.stackexchange.com/faq): *If you are very active, you may be able to re-use your commitment as soon as the second day of public beta. If you aren't active on the site, you won't be able to re-use the commitment until the end of the public beta, or until six months after the beta began.* **Nowhere** does it state that 10 posts will immediately satisfy a commitment. To be perfectly honest, if you're signing on to a site without any real interest in the topic beyond doing the bare minimum to get in and get out, we'd rather you didn't bother, @CopyrightX.
Comment: Do questions/answers on the meta site count towards commitment?
Answer: You should count all non-CW (non-community wiki) posts including questions and answers on both of the main and meta sites (including deleted once). However it's not always achieved by posting exact 10 posts as mentioned here, since the exact logic of achieving commitment fulfilment is publicly not shared not, however it's most likely between 8-10 posts.
In my case I had 7 answers & 1 question on the main site and 1 answer on meta site with rep of 300 (9 posts in total, not 10). This was enough of achieving fulfilled commitment for. So most likely participating during private beta could make the difference.
Here are some hints found in Area51 FAQ section in terms of fulfilling commitment:

Once you've fulfilled your commitment on a new site by asking and answering a few questions, you'll be able to commit to another site. If you are very active, you may be able to re-use your commitment as soon as the second day of public beta. If you aren't active on the site, you won't be able to re-use the commitment until the end of the public beta, or until six months after the beta began.


What exactly is the 'lift' of a sailboat as explained by Bernoulli principle

Question: I have heard that when a sailboat is sailing against the wind, it operates on the principle of 'lift'. I am unable to understand the explanation, based on Bernoulli principle, completely. My question is, when it says 'lift', it literally means that the boat is being 'lifted' out of the water? Like when we throw a stone across the lake and it skims and hops on the water?
Comment: The Bernoulli principle applies here as much as to airplane wings (that is to say, not at all). But this is orthogonal to the question of sailing against the wind, which has nothing to do with "lift" (which can be said to be there, though horizontally) and [everything to do with the keel](http://physics.stackexchange.com/questions/123672/problem-understanding-basic-sail-mechanics).
Answer: Bernoulli's Principle is one very small piece of a large mathematical theory that explains lift.  Unfortunately, most attempts to explain lift using Bernoulli's principle without the overall mathematical context (i.e. vector calculus, partial differential equations, boundary conditions, the Navier-Stokes equation, etc.) are either so confusing that few readers can follow them, or they are just out and out wrong.  Often both.
From a layman's perspective, Bernoulli's principle does more to obscure the issue than it does to enlighten.   US Sailing does not use Bernoulli's principle in their instruction materials to explain how sailboats move and we do not use it in our instruction program (I am the manager of a learn to sail program with ten US Sailing Certified Instructors).  It's a red herring that confuses students without giving them any insight into how to sail.
To answer your question, "lift" is a defined term in aerodynamics with a different meaning than usual usage.  When a solid object is immersed in a moving fluid, the fluid exerts a force on the object and the object exerts a force on the fluid that is  equal in magnitude but opposite in direction. "Lift" is the component of this force perpendicular to the fluid flow.  For a sailboat sail, the fluid is air and the "lift" is a horizontal force that propels the boat forward (and also makes it lean).  So "lift" doesn't push the boat up, it pushes it forwards and sideways.
As for Bernoulli, there's nothing wrong with Bernoulli's principle, it just doesn't do a very good job of explaining why sailboat sails and airplane wings develop lift.  Lift is the result of unequal air pressure on one side vs the other.  An airplane wing has lower pressure on the top side of the wing and higher pressure on the bottom.  A sail has lower air pressure on the front (leeward) side and more pressure on the rear (windward) side. If you look at the derivation of Bernoulli's equation, it concerns itself with pressure gradients parallel to the air flow, while lift is the result of air pressure gradients perpendicular to the air flow.  So Bernoulli's equation doesn't get at the reason for the lift - to understand lift you need to understand why there is a pressure difference perpendicular (not parallel) to the air flow.
Fortunately there is an equation that deals with pressure gradients perpendicular to the air flow. It doesn't have a name, but was derived at the same time as Bernoulli's equation so it's been around for centuries.  It is:
$$\frac{dp}{dz} = \frac{\rho v^2}{R}$$
where $p$ is the pressure, $dp/dz$ is the pressure gradient perpendicular to the air flow, $\rho$ is the density of the fluid, $v$ is the velocity and $R$ is the radius of curvature of the airflow. (BTW, the derivation of this formula is just a straightforward application of Newton's 2nd law to the kinematics of centripetal acceleration - Physics 101 stuff)
This equation shows that whenever air follows a path that is curved there are pressure gradients perpendicular to the airflow, the tighter the curvature the higher the pressure gradients, and for straight flow (R -> infinity) there is zero pressure gradients and therefore no lift.
Lift comes from curved air flow.  Sails are curved.  When air follows the curve of the  sail, you get pressure differences. That's what drives the boat. Bernoulli's principle tells you that the air speeds up as it flows through the region of reduced pressure, but it doesn't tell you why the low pressure is there, and while the air speeding up may be an interesting side effect of lift it's not very important to understanding how a sail works.
If you know a little bit of calculus,  Babinsky's paper "How Do Wings Work?' (http://iopscience.iop.org/0031-9120/38/6/001/pdf/pe3_6_001.pdf) is a good overview.  Or check out NASA's site:
http://www.grc.nasa.gov/WWW/K-12/airplane/wrong1.html
Answer: An important point that is often overlooked is that sails do not just generate 'lift', but generate lift in a direction. The pressure differential across the sail's surface is typically much larger near the leading edge, which results in more forward force than you might expect. The two sails (with a sloop) also interact in a way that generates more forward force.
You can see some simulations with different sail configurations, and comparison to the performance of a real sailboat at this site:
https://sites.google.com/site/sailcfd/
Comment: NB: the link is dead
Answer: Unfortunately the link is broke with no forward link. However the effect is the same as an airplane wing, where lift is generated on the upper or slightly rounded surface. This in effect "Pulls" the aircraft up at a constant rate of assent as long as the upper surface continues to receive the "flow" at a constant rate. Now imagine the airplane wing sitting im the vertical position. The air flow will do the very same thing to the wing as it does to the sail. Now to make matters more complicated, Airplane wings have "airflow disrupters called ailerons, which disrupt the air flow in a certain section of the wing. Now if the flow remains constant, then the disturbed air will cause an area of increased or decreased  pressure which causes certain areas of the wing to either slow down or speed up depending on the pressure flow.
The Wikipedia article on wingsails explains the use of a fixed wing/sail and the way airflow flowing around the wing creates the force needed to push the boat. These are essentially airplane wings that have been turned from a horizontal position to a vertical position. The effect is the same because the sailboat with a center keel assumes the characteristics of a plane. The lower centerboard or keel act as a wing in the same way as the fixed wing above decks.
This explains the relation between the Bernoulli principal and how a boats sail works. Aviators are trying to build a stunt plane with both horizontal as well as vertical wings for never before seen stunts. (See this gizmag article for more information)
Answer: Well, according to this  Bernoulli effect is NOT the cause of lift.

Basically planes fly because they push enough air downwards and receive an upwards lift thanks to Newton's third law.

It is clear that blowing over a piece of paper pulls it up (video).
Here: fast air => lower pressure => paper pulled up. Right.
But that IS NOT the case for sails and wings. Wind arriving to a sail/wing goes ALL of it at the SAME speed. The air above the wing / on leeward of a sail does not spontaneously accelerate up. It gets speeded up by a a lower pressure in that zone. Thus, the "fast air" is not the cause but THE CONSEQUENCE.
What does it cause the low pressure zone above a wing / on leeward of a wing?
What is for sure is that wings/sails deflect air. Then for wings and sails:
Main cause: air deflection => change of pressure => changes in air speed.
That's it.
Don't get confused by the fact that Bernoulli equation can be effectively used to measure lift. It's perfectly right to estimate the real cause (air deflected downwards) by a direct effect (change of pressure).
Comment: The argument from momentum has an element of truth, but it misses out the significant fact that a continuous entity such as air can transmit force just by pressure differences, similar to the way a solid rod can. The force exerted by a rod is not directly to do with the motion of the rod. The same goes for a fluid.
Comment: @AndrewSteane Totally true. But there are 2 cases. Fast air => lower pressure OR lower pressure => fast air. Unlike the case of lifting a paper (fast air => lower pressure); for sails and wings we have lower pressure => fast air; because unlike the lifting paper case, air arrive at same speed to the sail/wing.  Think of a wing flying through still air (i.e. air speed = 0), that is not the case of the lifted paper (there is a *`previous* airflow over the paper).
Comment: @AndrewSteane See this video https://www.youtube.com/watch?v=zp1KzGQdouI.


Adjective beginning with 'c' that describes an institution that sacrifices individuality for conformity

Question: I'm struggling to remember the word, going through a bout of lethologica I guess. If someone can help me that would me great. I believe I first heard the word being used by William F. Buckley, if that's to any help. Perhaps, the word begins with 'Ch'- although I can't suggest that with certitude, It might come in handy.
Thanks!
Answer: Perhaps "collectivist" is the adjective you are looking for. Buckley frequently decried what he referred to as "collectivism" on American campuses and elsewhere as the enemy of individualism.  (See, e.g. one of his best known works God and Man at Yale.)
When Buckley used the term (especially in the 1950s and 1960s) he implicitly or explicitly evoked the collectivist ideology of the soviet union.  That is still the first definition in the online Miriam Webster ("a political or economic theory advocating collective control especially over production and distribution
also: a system marked by such control").  The second definition is "emphasis on collective rather than individual action or identity." Definition here.


What happens to a familiar if the master dies and is brought back?

Question: If a character who has a familiar dies and is then raised via raise dead or even reincarnation, is the familiar still bound to that character or is that bond broken at character death?
Comment: [Same question for *Pathfinder*.](https://rpg.stackexchange.com/q/88984/8610)
Comment: I suspect that this question has no answer. What standard of evidence would you want from an answer that claims that there is no official answer to this?
Comment: Well I know what happens if the familiar would have died were it not a familiar, but that's just the obvious portion of the whole thing...
Answer:
Death of a Master

If a master dies and the familiar survives, part of the master lives on in the familiar. It loses any extra hit points and skills it gained from the master but retains most of its familiar abilities. It is treated as having a master two levels lower (but never below 1st level). If the master is later brought back from the dead, the bond is reestablished, and the familiar gains whatever abilities go along with the master's new level.

---Tome and Blood, page 12

Although published before the Dungeons and Dragons 3.5 Revision, anything not republished from Tome and Blood is still a source for Dungeons and Dragons 3.5 information according to Why a Revision? (DMG (2003), p. 4)
As long as that section of Tome and Blood is not reprinted or superseded by newer material, it still pertains to the rules at large.
Comment: +1 for relevance, but this answer would be improved by an explicitly mention of how Tome and Blood is a third edition sourcebook, rather than a 3.5rd edition one.
Answer: Nothing in 3.5rd edition's rules suggests that the bond between a familiar and its master is broken by the master's death.
In fact, there seem to be no rules at all for what happens to a familiar when the master dies. Granted, it's hard to prove a negative, but in this case it's easy to check the parts of the rulebooks where we might expect to find such rules:
The "Familiar" class feature description on page 54 of the Player's Handbook doesn't specify that anything in particular happens when the master dies. Given that this section does describe in detail what happens when the familiar dies, this is where I'd expect to find any special rules for the master's death - and there aren't any.
The "FAMILIARS" sidebar (Bottombar?), on pages 52 and 53 of the Player's Handbook, also doesn't specify that anything in particular happens to a familiar when its master dies. This would be my second guess as to where to find information about what happens to a familiar when its master dies, as it's the single biggest section of the rules that deals with familiars. No such information is present.
3.5rd edition doesn't actually define the effects of death anywhere, presumably its authors assumed players would be able to guess. As such, there's nothing in the non-existent rules for death that describe what happens to bound familiars.
The rules for bringing back the dead on page 171 of the Player's Handbook contain no mention of familiars.
In the absence of a rule describing for what happens in a specific situation, it's generally safest to assume that real-world common sense applies; or if the situation is one with no real-world precedent, that the status quo is maintained. This is why we assume that spells don't end upon the caster's death, and that magic items don't cease to be magical when the spellcaster dies. Accordingly, we must conclude that, like Hachikō, a familiar remains bound to its master even after that master's soul departs for the outer planes through the nearest astral conduit.
Technically-unrelated bonus rule: The homunculous, listed on page 154 of the monster manual, isn't a familiar. However, it acts a lot like a familiar, and can fulfil most of the same roles. Its monster manual entry specifies that it dies and melts into a pool of ichor if its master is slain, which is disgusting, but thankfully not the norm for familiars.
Comment: Cf. The section Death of a Master from the Rules of the Game Web column ["All About Familiars (Part Four)"](http://archive.wizards.com/default.asp?x=dnd/rg/20050927a). Yeah, the columns are sketchy, but it may be better than nothing.


How do I know when to harvest my potatoes?

Question: I'm sure I've heard before that the time to harvest potatoes is when the flowers fall off. Is that right or is it more complicated than that? For example, does it differ based on climate or variety, etc.?
Comment: @Kevin, all green parts of the irish potato (*Solanum tuberosum*) are poisonous. Sweet potatoes are in a different genus (*Ipomoea batatas*).
Comment: @KevinKrumwiede, I don't think you can with all varieties though; some are poisonous apparently, which makes sense given that they're in the nightshade family of plants. Some more details here: http://en.wikipedia.org/wiki/List_of_poisonous_plants#Poisonous_food_plants When I googled it though, people seem to be specifically saying you can eat the leaves of sweet potatoes.
Comment: One thing the other answers left out: you can eat the greens, too.
Comment: You could be right.  I've only eaten sweet potato greens myself.
Answer: If you harvest when the flowers fall you will get a more tender potato, better for frying and boiling. If you wait until the tops are dried, you get the best storage potatoes, better for mashing and baking. Harvesting over time is easier on you and gives a steady supply.
Also, there is nothing wrong with frost on the vines at maturity, because the vines are useless to the plant at that time. The vines are going dormant like most other perennials do near the hardest time of year. Frost might make the vines dry out, but you don't need to worry unless you are going to get a hard freeze. You will want to harvest the rest of your potatoes before the hard freezes start.
Answer: Every time I've grown potatoes, there's been a day when the plants as a whole just all collapse. Distressed, I've dug up to see what's going on, and ended up with perfectly nice potatoes. If that doesn't happen to you, then do it before a frost, because potatoes aren't one of those vegetables that is nicer for frost exposure.
(Actually I grow them in a stack of tires, so "dug" isn't quite the right word, but "knocked over" doesn't make sense without the context.)
Given the size difference between "new potatoes" and "ordinary potatoes" in the store, and the historical role of potatoes as an everyday staple, I'm pretty sure there's a huge range of acceptable harvest times. The only downside of too early is that you might have got more by waiting. So don't do all the plants at once until you know you're done for the year - either because the plants have died or because there's a frost coming.
Comment: Also, you can steal a few potatoes by sticking your hand under the soil ("grabbling") so you can treat yourself to a dinner of small, tender new potatoes *(... mmm... with melted butter...)* before the proper harvest arrives. Just beware that if you succumb to the lure of the new potatoes too often you won't have any baking-size potatoes in the fall.
Comment: Funny story, I had a few pots from several months before where I forgot I had grown potatoes, I was clearing out the soil for a new plant and lo and behold a bunch of potatoes were in there waiting to come out, looking fresh too.  Lesson for me was that you don't have to worry too much about getting them out too late!
Answer: Depending on where you live you can harvest potatoes anytime.  When I lived in zone 5 for example, I'd leave the potatoes in their (raised) beds all winter.  I had silt-loam soil and lived near the ocean.  It was such a treat to go out and cram my hands into the beds to pull out potatoes in the middle of winter; large or small...by spring I'd pulled them all inside to keep cool in shredded newspaper.  Buried in the soil protects potatoes an awful lot.  In zone 4 or lower, I'd get them pulled up and nestled in shredded newspaper or sawdust.  They'll be fine in a dark garage or root cellar or cool basement stored in this manner for the entire winter.
Potatoes were one of the first things to 'die back' in the vegetable garden.  There were white flowers (white potatoes), pink flowers (reds) and blue flowers (blue potatoes). But they started dying back before anything else.
Once the plants start dying the potatoes won't be getting any larger.  I've always grabbed new potatoes whenever I wanted and there were always the huge ones.  Which I don't think are as good as the 'new' potatoes.  Potatoes are one of the easiest vegetables to grow and harvest!
Just one caveat...don't eat any 'green' potato.  They are the ones that are sort of exposed on the top of the soil and get sunlight.  When you see potatoes exposed grab a handful of soil and cover them.  They are starting to produce chlorophyll and as their genus proves, becoming toxic.
Potatoes are one of the best most forgiving vegetables to grow!


How can I move an email to my inbox?

Question: If I have moved a message out of my inbox, how can I move it back there? The Inbox label doesn't show up in neither tags nor folders and I don't have the Move to Inbox button.
Comment: If you didn't deleted it, it shows for sure in _All Mail_.
Comment: I mean that "inbox" shows in neither tags nor folders. I can find the message, no problem.
Comment: OK, got it. See my answer below.
Answer: Short answer:
In the URL, replace #inbox with #all and press Enter to refresh the view. Then you get the missing Move to Inbox button.
Long answer and explanation:
I just had the same problem, so I believe I understand your exact situation and the reason for your question. So let me rephrase the question to this: "How do I move an open email that is not in the Inbox to the Inbox if the Move to Inbox button is not present?"
Normally the button Move to Inbox is present above the open email if the email does not reside in the Inbox folder.
But this is not always the case. If you happen to use an old URL for showing the message, the Move to Inbox button can be missing, even though it should be there due to the fact that the email is no longer in the Inbox. This can happen:

if you used the browser's Back button or its history function
if you have a stale view on the browser due to archiving that email
separately (e.g. through another device or browser)
when archiving the email on the same browser tab by removing the Inbox label (or if you hit Archive then go back on the browser).

For instance, I have an email with ID 14197daa44aa8fc5 which is no longer in the Inbox. (To test what I write below, replace this ID with an actual ID from one of your own emails.)
If I use this URL to display it the email:
https://mail.google.com/mail/u/0/#inbox/14197daa44aa8fc5
then the Move to Inbox button will not be there. Adjust to one of your own IDs to test it.
But if I use this URL to display it:
https://mail.google.com/mail/u/0/#all/14197daa44aa8fc5
the Move to Inbox button will be there.
The only change is that #inbox was changed to #all in the URL.
Note that the email is exactly the same in both cases, and that, in both cases, the email is not in the Inbox.
So, Gmail seems to look at the URL to determine whether to display the Move to Inbox button. Whether the current email is actually in the Inbox or not does not matter.
So, make sure there is no #inbox in the URL – change that part to #all and press Enter. Then you get the button.
Comment: Good, detailed explanation. This should be the top answer.
Comment: this should be the correct answer
Answer: Without opening it, just drag it to the Inbox label from the list of emails.

Hover over the most left side of the message in the list and three vertical dots will appear besides the checkbox (see picture below).

Click and drag & drop it over the Inbox label.
Comment: Note: this works even if you have multiple messages selected.
Answer: If you can find your message by searching for it, a button will appear at the top of the message. It says "Move to inbox." Click that button and the message will reappear in your inbox.
Alternately, you can select some other label from the labels dropdown and move the message into that label category.
Added:
You can also find your missing message by clicking the "All Mail" folder and move it into the appropriate folder.
Comment: I can't find the "move to inbox" button. There is a "back to inbox" button, but that is just fo viewing the contents of the inbox.
Answer: Gmail doesn't have folders only labels. Every email, with only three exceptions, will always be found in "all mail". When an email enters gmail it has the inbox label. When you archive an email the inbox label is removed. If no other label was attached to the email it will still be in "all mail".
There three exceptions to the inbox label:

spam
emails altered by the filter system
emails that you actually delete. Though this is very rare.

It is very hard to completely lose en email. Just search for it, or look in "all Mail"
Answer: Very simple: right click the email and click on Move to tab. Select Primary and you're done.
Comment: This doesn't relate to the gmail web application, maybe it's your client.

How can I move an email to my inbox?


revert,assert,require,throw what is the difference?

Question: Who can tell me what is the difference between revert,assert,require,throw!
Comment: It's always better to mention your findings when you ask a question which might lead to get an answer on where you need the exact clarification. This question shows no effort at all.
Answer: Throw is the old mechanism for reverting the state of the current call (and all its sub-calls)

From version 0.4.13 the throw keyword is deprecated and will be phased out in the future.

Revert is the new, preferred mechanism for reverting a call

The revert function can be used to flag an error and revert the current call.

As for assert and require:

The convenience functions assert and require can be used to check for conditions

The difference between them being
Assert:

The assert function should only be used to test for internal errors and to check invariants

Require:

The require function should be used to ensure valid conditions, such as inputs, or contract state variables are met, or to validate return values from calls to external contracts

e.g.
<code>contract Sharer {
    function sendHalf(address addr) payable returns (uint balance) {
        require(msg.value % 2 == 0); // Only allow even numbers
        uint balanceBeforeTransfer = this.balance;
        addr.transfer(msg.value / 2);
        // Since transfer throws an exception on failure and
        // cannot call back here, there should be no way for us to
        // still have half of the money.
        assert(this.balance == balanceBeforeTransfer - msg.value / 2);
        return this.balance;
    }
}
</code>
Source: Solidity documentation

revert,assert,require,throw what is the difference？


Logging access tokens

Question: In our REST API we write a log entry for every call made, including things like the query string, response code, duration etc... along with a SHA256 hash of the access token used. The thought process behind this is that the hashed values still lets us correlate API calls (e.g. these 5 calls are all made with the same access token), however even if an attacker obtains the logs there is no way for them to reverse the hash and obtain a usable access token. Is this reasoning sound?
Comment: Do your tokens have an associated id that you could log instead?
Answer: SHA256 is still a secure hash.  As a result the main concern is someone trying to bruteforce your access token.  SHA256 isn't a slow hash so depending on how much entropy your access token has, this may be a valid concern.  You can calculate the cracking time from the amount of entropy versus the hashing rate the attacker can achieve.  As it turns out, SHA256 is what bitcoin uses so hashing rates for various setups are readily available.  For non-specialized GPU hardware you can roughly estimate a hash rate of 1GH/s (1,000,000,000 guesses per second).  Let's take that and run through two extreme examples of the entropy of your access token:
1. Access token is a simple permutation of creation time + user id.
Ever seen something like access_token = md5(time() + $user->id)?  Things like this are surprisingly common.  If an attacker knows the id of the user they are trying to attack (which is likely since it may also live in the logs) and know how your access tokens are created, then they just need to guess the account creation time.  Even if the creation time includes microseconds, this is still extremely easy to guess.  At a rate of 1GH/s and given a fixed user id, you could brute force all creation times over a decade in a second ((86,400,000 possible hashes/year) * (10 years) / (1,000,000,000 hashes/second) = ~1 second
This access token has no security from brute force at all.
2. Access token is a GUID
Alternatively, your access token may be a GUID.  These typically have 128 bits of entropy or roughly 3.4e38 possible combinations.  This means that bruteforcing one would take: 3.4e38/1e9 = 3.4e29 seconds, which is approximately 10,000,000 times the age of the universe.
This is absolutely safe from brute force.
Another option
Finally as a different suggestion (which may not be applicable) is to store the id of the access token, presuming that it is stored in the database and therefore has an associated id.  After all, the access token is the sensitive part, but the id of the access token is just as useful for tracking and (normally) not sensitive.  Of course if you aren't storing your access token in a database (for instance, if you are using a JWT) this isn't possible.
Answer: Have you considered using JSON web tokens instead? The advantage there is that you could encrypt them with the users ID, or some other unique signifiers and when you get a request decrypt them to retrieve that data.
The upsides would be that no sensitive data whatsoever would be stored in the logs and you could tie a request to a specific user, the down side is that you'd have to spend a bit more horse power on decryption
Answer: I see from your question that the only purpose of storing the hash of access is for correlation of the API requests. I would recommend you to use some other identifier (i.e. random GUID hash encoded with Base64) as correlation ID and NOT store access token in any form in your logs.
The main recommendation is not to store access tokens in the any storage in unencrypted form. The SHA256 hash, as for the first sight, is possibly secure, it is not encryption. It is still just hashing. What more, if you will not store access token in logs, you will avoid thinking of secure hashing mechanism which you would need to use (or maybe implement). You just remove the problem from the equation. :)
The general rule I try to follow (and would recommend), is to use proper things to proper purposes.
Answer: As long as your access tokens are opaque randomly generated strings, it seems to me there won't be any security issue proceeding like this.
Comment: What is an "opaque" string?
Comment: An opaque token is a token that has no inner meaning and is just composed of random bytes, as opposed to JWT access tokens (base64-JSON tokens) for example
Comment: Why does it matter if they are opaque or not?

Logging access tokens


Specifying Custom Network on Regional Managed Instance Groups on GCP

Question: I am exploring managed instance groups on GCP, and I am trying to create a multi-zone (regional) MIG. However, it always selects the default network, and I don't see any way to change it (I know it can change if the MIG is zonal). Is it possible to use a custom network with a regional MIG, or is that just a current limitation that it always needs to use the default?
Comment: There shouldn't be any difference between zonal and regional MIGs in this respect. Could you provide a recent screenshot/error message/etc?
Answer: First you will need to create the VPC Network and set its dynamic routing mode to Global.
Then simple while Creating an instance group, select Create New Instance Template under Instance Template  and while setting the instance template choose the created network under the Networking section .
Comment: Hi, that works for single-zone MIGs. My issue is with multi-zone MIGs. They are always grayed out.
Comment: You were right, I have updated my answer with the multiple zones setup in the configuration. And I have not found any issue. Could you share a screenshot and or the full configuration?


Is it legal for a US military servicemember to disobey a lawful order that they reasonably believed was unlawful?

Question: In the US military (and I would assume all militaries?) a servicemember must obey an order from a superior officer if the order is lawful; however, if complying would require the commission of a crime, the order is unlawful and must be disobeyed. Would a court-martial ever rule that it would have been legal to obey an order, but the servicemember reasonably believed it was unlawful and was therefore justified in refusing to comply? Has such a ruling ever actually happened?
Comment: Conceivably, isn't that what courts and trials are for though?  To make a determination whether or not there was a reasonable belief that an order was unlawful if charges were brought up?  What sort of answer are you looking for?
Comment: @MichaelHall There could be cases available where an orders legality was tricky to judge  and a servicemember made the wrong call. Were they punished or did the court martial decide something along the lines of 'you were wrong but you made a reasonable guess in your situation so it is not your fault'.
Comment: @quarague, I get that.  My point is that this would all come out at trial.  There's no broad category of gray area orders as Jen points out.
Comment: If the order is indeed unlawful, the service member gets off. The exact intent standard necessary to invoke this defense is the harder question.
Answer: united-kingdom1
They would commit a prima facie offence contrary to section 12 Armed Forces Act 2006:

12 Disobedience to lawful commands
(1) A person subject to service law commits an offence if—

(a) he disobeys a lawful command; and

(b) he intends to disobey, or is reckless as to whether he disobeys, the command.

(2) A person guilty of an offence under this section is liable to any punishment mentioned in the Table in section 164, but any sentence of imprisonment imposed in respect of the offence must not exceed ten years.

HOWEVER...
Section 325 allows for the defence to prove there was a "lawful or reasonable excuse" to disobeying a lawful order:

325 Evidential burden as respects excuses
(1) This section applies to an offence under any of sections 1 to 41, 93A, 93E, 93G, 107, 229, 232G and 266 which is such that a person who would otherwise commit the offence—

(a) does not do so if he has a lawful excuse; or

(b) does not do so if he has a reasonable excuse.

(2) In proceedings for an offence to which this section applies, the defendant is to be treated as not having had a lawful excuse or reasonable excuse (as the case may be) unless sufficient evidence is adduced to raise an issue as to whether he had such an excuse.

1Although tagged united-states, I have answered in line with: we expect and encourage answers dealing with other jurisdictions ... please tag your answer using the tag markdown: [tag: some-tag]" from the Help centre
Comment: I imagine that there will be similar provisions in the USA
Comment: There might be, but I wouldn't count on it. Historically, the U.K. has taken a harder line against extraordinary defenses to crimes like choice of evils and duress than the U.S. has, and also has a weaker tradition of individual rights (here the right to uphold the constitution and the law personally) as excuses to violate the law, so I wouldn't be surprised if the U.S. law were more lenient.
Answer: Let's look at the UCMJ text.
Art. 92. Failure to obey order or regulation
Any person subject to this chapter who—
(1)violates or fails to obey any lawful general order or regulation;
(2)having knowledge of any other lawful order issued by a member of the armed forces, which it is his duty to obey, fails to obey the order; or
(3)is derelict in the performance of his duties;
shall be punished as a court-martial may direct.
There is a tremendous amount of case law contained in "lawful order."  A key concept is that orders are presumed to be lawful, so the burden of proof for unlawfulness will be on the defendant.  I could find no case (not that I know how to actually search federal military cases) that applied the defendant's state of mind ("mens rea") as to lawfulness of the law as a defense here.  Basically the defendant will have to show that the order was unlawful; the member's belief in unlawfulness is not at issue.
Mens rea issues tend to be if the defendant understood the order, or what the defendant's state of mind was when they were performing the activity they are charged for (like did the member know they were giving alcohol to an underage person).  These are not choices to disobey an order due to perceived unlawfulness.
Certainly I would not say that no Court-Martial would ever rule differently - these courts and juries have wide latitude to choose outcomes.  I do however feel like this defense would be hard to pull off.


Which pins in ESP-12F are SDA SCL Pins

Question: I would like to use ESP-12F using I2C, however the official documentation is not clear about SCL / SDA pins on the chip. I would like to know which pins should be used for SDA / SCL on the chip. BTW the firmware is Tasmota.
Comment: By the way, I know I have already given an answer, but when you ask a question stating that documentation does not have the information, it is a good idea to include a link to said documentation
Answer: All I did was Google the ESP-12F and the first result was THIS. On page 14 it tells you the I2C pins needed.
Go up to page 8/9 for the pinout description.
Answer: The Tasmota firmware uses the esp8266 Arduino core. The Wire library in esp8266 Arduino uses software I2C. It can use any pair of suitable io pins. Default pins for most esp8266 variants are SDA 4 and SCL 5.

Which pins in ESP-12F are SDA SCL Pins


A question about 依り代

Question: I was reading a few articles about 依り代 and there's one thing I'm wondering about. Most of what I read say that 'yorishiro' are objects or sometimes people that attract kami. The following is just my assumption because I did not find something that would specify, but, I wondered if the objects or 'vessels' (this is how I would translate in a particular context) need to have certain qualities/certain aspects in order for the kami to posses it?
I'm asking this because it might help me with something I came across for which I have formed a theory.
Thank you!
Comment: It depends on the plot, I guess.
Comment: @broccoliforest
I don't want to make wrong assumptions, so I was hoping that if someone here has more knowledge upon the subject of 依り代 to enlighten me, it would be great. After reading on a few sites and fragments in books, I wonder if kami have preferences. I read that swords for example are among the usual yorishiro, so, are swords appealing to kami that are regarded as deities of war for example?
Answer: Today, 依り代 is broadly used in any context related to spirit possession, and it can be anything or anyone. It's also commonly used outside the contexts of Japanese shinto. It can be a piece of paper, a sword, a tree, a rock, a doll, an animal or a human being. I think it's perfectly fine to use 依り代 to describe some ritual item used by a Voodoo priestess, for example.
According to sources, the word 依り代 was invented in the early 20th century by an ethnologist Shinobu Orikuchi to explain a certain aspect of religious belief of Japanese people. It's not a traditional shinto term, and by its nature, the word will not determine what a concrete 依り代 must look like.
Comment: thank you! I needed more info in order to explain something from a story.

A question about 依り代


What are the appropriate first steps to writing a scientific paper concerning a physical constant?

Question: We are looking to write a scientific paper in the topic of measurement physics, that includes experimental data and dimensional analysis. How do we begin the process of writing a paper for a journal, maybe Physical Review Letters?
Comment: I don't understand this kind of question. If you have the knowledge to write a scientific paper, you must have studied physics. Every academic education includes instructions how to write a publication in that field. For example, students of physics have to hand in several papers each semester to get the necessary credits. There is no way they can not learn how to write papers. So how come you know enough physics to write a publication but have somehow managed to miss the accompanying instructions how to write it?
Comment: This question is awfully broad. What kind of paper do you need to write? What knowledge do you already have about writing? Your school may already have a writing lab, have you tried that resource?
Comment: Closing this until Bill returns to the site to edit the question.
Answer: In answer to the question you need to find books about academic publishing. also, many scholarly journals have their own guideline for publications. Best if you read all you can about the academic publishing process to improve your chances to be published. try also to look at answers in the Academia StackExchange.
If you are not speaking about research papers but textbooks you need to familiarize yourself with non-fiction publishing, there are many books on this subject too.
In answer to the comment many people who have done only a master, or even a bachelor can later, and often do, contribute to the body of scientific literature. Even in PhD programs, some get more advice than others and a PhD holder may not know how to publish. This is even more true for international degrees whose study-contents may not include papers or research publications at all.
Also, like it may be the case here, he is asking about writing a paper for his professor. many people involved in reseach may have to write the paper for their "elders", specialty lab or research assistants, even if they are just students. From the tone of the question, i would guess that the asker is starting his PhD program.