stdafx.h: When do I need it?

Question: I see so much code including stdafx.h. Say, I do not want pre-compiled headers. And I will include all the required system headers myself manually. In that case is there any other good reason I should be aware of where I require stdafx.h?
Comment: (for anyone who uses this as a referrence)
If you are already using precompiled headers, go to your project's properties, C/C++, and precompiled headers, and choose the option not to use them.
Comment: StdAfx.h for Novices: http://www.cplusplus.com/articles/2z86b7Xj/
Answer: If you don't want to use precompiled headers, then there is no point to using a standard include file - this will slow down the build for every file that includes it and cause them to include extra stuff that they do not need. Get rid of it and just include the headers they need.
Answer: stdafx.h is just another header file. If you feel that you don't need it then feel free to not include it and remove it from the project.
However it's quite typical to have a file like stdafx.h exactly for precompiled headers to work and to not include all the stuff manually in each source file.
Answer: You can use pre-compiled headers (which are  a good thing) without using stdafx.h (I abominate it too). I've only got access to VC++ 6.0 but in that go to Project Settings|C/C++|Precompiled Headers and select "automatic use of precompiled header" but leave the "compiled through" box empty.
Answer: Even without pre-compiled headers stdafx.h could be handy as it groups header includes and definitions common for all files.
You can of course choose to repeat all these definitions in every file. stdafx.h is not strictly necessary.
Comment: A common stdfax.h will include #pragma once directive, windows OS version definition and includes like windows.h or stdio.h. Why is it bad to group all these?. Also if you have a header of your own, that IS actually required by all files, why not put it there? Bad practice is to do otherwise.
Comment: Bad practice - you ought to always explicitly list the headers you need so you can check module dependencies.
Comment: stdafx usually includes platform specific definitions common for all files.  It is a "dependency" of every file. You use it in order not to repeat the definitions in every file. This is a good practice, because you only do that in one place.
Comment: It is not a dependency of every file unless every file actually requires every header in stdafx. In practise this is rarely the case (IME). Using it in this way is lazy at best, bad practise at worst
Comment: #pragma once doesn't help you across module boundaries without enabling pch support (try inserting a #pragma message in windows.h). Not all files in a decent project will need windows.h/stdio.h/etc. For more reasons, check my answer...
Comment: Then not include stdfax.h in the files that don't need all of its definitions. Do include though for the files that they actually need them; and in a decent project there are actually a few.
Answer: As others have mentioned: if you don't need precompiled headers, you don't really need stdafx.h . And using it just to group common includes is pretty bad practice, actually.
In fact, even when using precompiled headers, it's good practice to include the headers your process actually needs after stdafx.h (or precompiled.h or whatever you want to call it) - along with #ifdef magic in your precompiled header to turn off the usage of PCH.
Why? In order to check your module dependencies. Being able to disable your PCH lets you catch whether you're including necessary modules or not, and you can then write a tool to check your module interdependencies by parsing your .cpp and .h files (excluding the PCH header, of course).
Answer: I know this is an old thread, but I thought I'd pass my opinion to readers. I found this in 2017, so I'm sure I'm not the only one that will be here.
There is an advantage to using pre-compiled headers, that may be overlooked by others because they have been using their practice for many years. The C++ standard has evolved greatly. Instead of including vector in 20 files that you might need  and  and  or whatever, you use a PCH file and the compiler has to do less work, and that makes happy faces for everyone. Also you can put your common macros in there, such as VERIFY, and ASSERT and smart class objects. Don't put your class headers in there, it wouldn't make sense for that, rather the standard library or something you will need to use globally in a lot of places such as the macros I mentioned.
basically realize this, by including the headers you need in every file you need, such as iostream, string, and vector,  you are effectively compiling that every single time as an inline to the file. Include a "Pre Compiled" header, well just the name should ring a bell there.

stdafx.h: When do I need it?


What files can be deleted to decrease local profile size

Question: I am deploying windows 7 through altiris and I am noticing that the profile sizes under C:\users\username are about 200MB.  Is there any way to trim the fat? I already deleted the temp files out of the appdata folder but I am sure more can go.
Anyone got any thoughts on what can go? I am now at 117MB
Comment: What, supposedly, is taking up the space?
Comment: The microsoft folder under app data is 90 meg on its own.
Comment: yes, could you provide a dump of directory sizes? If you're pre-provisioning things like firefox profiles, photoshop, gimp, or msoffice, that's probably not out of the ordinary
Comment: Yeah thats what I had on there office cs3 and a few other apps.
I am trying to eliminate installing apps with wise setup capture through altiris but I wanted keep common apps on the image.
Thanks for you comments.
Comment: Try running ByteCount to see what the folder sizes are...think it's at http://www.xs4all.nl/~hneel/software.htm
Comment: I used tree size pro (old school) to see which folders they were it was the App data folder and the microsoft folder within that.
Answer: If your users are running Outlook in cached mode, the OST file (offline storage) is placed in the profile, that could take up some space and is easy to get rid of (it will just regenerate, if I remember correctly).
However, for Win7 deployments I would really urge you to have a look at USMT4.0, the newest version of the user state migration tool. It lets you maintain the user profiles on local disk while doing a new installation of windows (through some dark magic I think), which eliminates the whole user profile problem altogether.
Comment: But USMT is if you want to migrate your data from say an XP machine.
How would you use this to manage the default user profile on a new machine? Thanks
Comment: You can also use it to keep the User Profile while reinstalling Windows on the same machine, to eliminate the need to copy it out somewhere while doing the install. I might have misinterpreted your question. If you want to shed a bit more light on how your Win7 rollout is done, there might be someone here able to help you better.


Can the Higgs particle escape a black hole?

Question: The higgs particle or field is what gives mass to everything. It's said that nothing can escape a black hole. If that is true how can the black hole "tell" its mass as even the higgs would not be able to escape? If higgs particles are able to escape, will eventually all matter be converted to higgs particles -- it's the only way out of the black hole?
Comment: Does this answer your question? [What gives mass to black hole?](https://physics.stackexchange.com/q/453497/)
Comment: *Every* kind of particle gets emitted from a black hole as Hawking radiation to some degree. Higgs particles would be negligible until the very end when the hole is extremely hot.
Comment: I think youv'e misunderstood the Higgs mechanism
Comment: @bemjanim: Could you help out and provide a reference. It would probably help user3800527.
Comment: The introduction section of the wikipedia page for the Higgs boson provides a good overview of the basics.
Answer: "The Higgs particle or field is what gives mass to everything." No: not so. Most of the rest mass of any composite system is owing to the energy of its internal interactions.
But I wonder whether your question is really coming from some vague intuition that some sort of particle or influence has to travel from inside the black hole to outside, in order that the gravitational interaction can take place. This intuition is more wrong than right. It can be invoked if one understands quantum field theory well enough, and the distinction between particles and virtual particles or "off-shell" processes. But I would not recommend you do that until you have learned that area of maths. Better to stick to classical physics for your main intuitions about all gravitational phenomena.
The following might help.
The spacetime outside a spherically symmetric mass is the same, for a given mass, no matter what form the mass takes. At locations outside the object there will be no difference for a spherical star or rock or a spherical black hole. If the star were to collapse in a spherically symmetric way, then there would be no change at all outside the region initially occupied by the star, either during the collapse or after it. This helps one to see that the gravitational phenomena at any given place are caused by the shape of spacetime right at that place, not what is going on somewhere else. Meanwhile the shape of spacetime at one place is related to its shape at nearby places, and so on. The shape (i.e. curvature) is set up at any given place through the history of whatever happened at that place. It is not set up by influences propagating from inside a black hole or anything like that.
Comment: I was more thinking the way Erick van der linden describes space and  gravity as an emerging force was thinking maybe higgs is a carrier for this all mass time gravity  and space are emerging oh well it's above my knowledge there's no m theory yet.
Answer: The basic answer to your question is no, a Higgs particle cannot escape from the event horizon of a black hole, just like everything else. Although the underlying Higgs field is a (small, but important) source of mass for leptons, quarks, and the weak bosons ($W^{\pm},Z^0$), this essentially does not affect the discussion of how an actual Higgs boson particle will behave inside a black hole. Putting aside the fact that a Higgs particle will decay rather quickly (even in the black hole background), it will just fall to the center of the black hole, like anything else would.
I suspect a full quantum-gravity calculation will give this same basic answer, since at the heart of this is the fact that the event horizon distinguishes causally separated regions of spacetime, so by Lorentz invariance the particle can't escape.


How the StringBuilder class is implemented? Does it internally create new string objects each time we append?

Question: How the StringBuilder class is implemented?  Does it internally create new string objects each time we append?
Comment: +1 I learned something new from this question as well :)
Comment: @Brian Rasmussen wait for Jon Skeet's answer. I bet it will be huge and full of new stuff to learn ;)
Comment: Just a guess. It is chunked to avoid the LOH for large string.
Answer: In .NET 2.0 it uses the String class internally. String is only immutable outside of the System namespace, so StringBuilder can do that.
In .NET 4.0 String was changed to use char[].
In 2.0 StringBuilder looked like this
public sealed class StringBuilder : ISerializable
{
    // Fields
    private const string CapacityField = "Capacity";
    internal const int DefaultCapacity = 0x10;
    internal IntPtr m_currentThread;
    internal int m_MaxCapacity;
    internal volatile string m_StringValue; // HERE ----------------------
    private const string MaxCapacityField = "m_MaxCapacity";
    private const string StringValueField = "m_StringValue";
    private const string ThreadIDField = "m_currentThread";

But in 4.0 it looks like this:
public sealed class StringBuilder : ISerializable
{
    // Fields
    private const string CapacityField = "Capacity";
    internal const int DefaultCapacity = 0x10;
    internal char[] m_ChunkChars; // HERE --------------------------------
    internal int m_ChunkLength;
    internal int m_ChunkOffset;
    internal StringBuilder m_ChunkPrevious;
    internal int m_MaxCapacity;
    private const string MaxCapacityField = "m_MaxCapacity";
    internal const int MaxChunkSize = 0x1f40;
    private const string StringValueField = "m_StringValue";
    private const string ThreadIDField = "m_currentThread";

So evidently it was changed from using a string to using a char[].
EDIT: Updated answer to reflect changes in .NET 4 (that I only just discovered).
Comment: @Marc: this got me curious so I checked with Reflector; looks like this has changed. It was a `string` before, now it seems to be a `char` array being manipulated instead.
Comment: http://www.nesterovsky-bros.com/weblog/2010/08/25/StringAndStringBuilderInNET4.aspx
Comment: Had no idea.. Think Im gonna do some reflector magic to satisfy my curiosity :)
Comment: @Brian: as far as I know it holds a `Char` array internally, not a `String` (at least in .NET 4, perhaps this has changed?)
Comment: @Fredrik - in the MS implementation, it really is a `string` that gets mutated
Comment: @Fredrik - then I take it back!
Comment: @Fredrik: I was just going through the code in Reflector while you commented. I have updated the answer.
Comment: @Brian: NP. It was posted today so they could have easily copied your answer :)
Answer: The accepted answer misses the mark by a mile.  The significant change to StringBuilder in 4.0 is not the change from an unsafe string to char[] - it's the fact that StringBuilder is now actually a linked-list of StringBuilder instances.

The reason for this change should be obvious:  now there is never a need to reallocate the buffer (an expensive operation, since, along with allocating more memory, you also have to copy all the contents from the old buffer to the new one).
This means calling ToString() is now slightly slower, since the final string needs to be computed, but doing a large number of Append() operations is now significantly faster.  This fits in with the typical use-case for StringBuilder:  a lot of calls to Append(), followed by a single call to ToString().

You can find benchmarks here.  The conclusion?  The new linked-list StringBuilder uses marginally more memory, but is significantly faster for the typical use-case.
Answer: Not really - it uses internal character buffer. Only when buffer capacity gets exhausted, it will allocate new buffer. Append operation will simply add to this buffer, string object will be created when ToString() method is called on it - henceforth, its advisable for many string concatenations as each traditional string concat op would create new string. You can also specify initial capacity to string builder if you have rough idea about it to avoid multiple allocations.
Edit: People are pointing out that my understanding is wrong. Please ignore the answer (I rather not delete it - it will stand as a proof of my ignorance :-)
Comment: It acts *as though* it were a character buffer, but it really is a mutated `string` instance. Honest.
Comment: apols, it looks like (previous comments on this page) this has changed in .NET 4.
Comment: Anyway, let's make it clear, this answer is the only correct answer for .NET 4.0 here for the time being, and it should not downplay itself as "incorrect".  Some other answers have discovered the `char[]`, but that's a useless fact without noticing the ropes structure (`m_ChunkPrevious`) which is the real new thing here.
Comment: Thanks Marc - I was under impression that it uses character buffer. It means that it would have some native implementation to mutate string object.
Comment: sure, but it is a core framework class. It has access to the native implementation.
Comment: Never mind - I was under the same impression for even previous versions - so sure that I didn't even bother to check it via reflector.
Answer: I have made a small sample to demonstrate how StringBuilder works in .NET 4. The contract is
public interface ISimpleStringBuilder
{
    ISimpleStringBuilder Append(string value);
    ISimpleStringBuilder Clear();
    int Lenght { get; }
    int Capacity { get; }
}

And  this is a very basic implementation
public class SimpleStringBuilder : ISimpleStringBuilder
{
    public const int DefaultCapacity = 32;

    private char[] _internalBuffer;

    public int Lenght { get; private set; }
    public int Capacity { get; private set; }

    public SimpleStringBuilder(int capacity)
    {
        Capacity = capacity;
        _internalBuffer = new char[capacity];
        Lenght = 0;
    }

    public SimpleStringBuilder() : this(DefaultCapacity) { }

    public ISimpleStringBuilder Append(string value)
    {
        char[] data = value.ToCharArray();

        //check if space is available for additional data
        InternalEnsureCapacity(data.Length);

        foreach (char t in data)
        {
            _internalBuffer[Lenght] = t;
            Lenght++;
        }

        return this;
    }

    public ISimpleStringBuilder Clear()
    {
        _internalBuffer = new char[Capacity];
        Lenght = 0;
        return this;
    }

    public override string ToString()
    {
        //use only non-null ('\0') characters
        var tmp = new char[Lenght];
        for (int i = 0; i < Lenght; i++)
        {
            tmp[i] = _internalBuffer[i];
        }
        return new string(tmp);
    }

    private void InternalExpandBuffer()
    {
        //double capacity by default
        Capacity *= 2;

        //copy to new array
        var tmpBuffer = new char[Capacity];
        for (int i = 0; i < _internalBuffer.Length; i++)
        {
            char c = _internalBuffer[i];
            tmpBuffer[i] = c;
        }
        _internalBuffer = tmpBuffer;
    }

    private void InternalEnsureCapacity(int additionalLenghtRequired)
    {
        while (Lenght + additionalLenghtRequired > Capacity)
        {
            //not enough space in the current buffer
            //double capacity
            InternalExpandBuffer();
        }
    }
}

This code is not thread-safe, doesn't make any input validation and is not using the internal (unsafe) magic of System.String. It does however demonstrates the idea behind StringBuilder class.
Some unit-tests and full sample code can be found at github.
Answer: If I look at .NET Reflector at .NET 2 then I will find this:
public StringBuilder Append(string value)
{
    if (value != null)
    {
        string stringValue = this.m_StringValue;
        IntPtr currentThread = Thread.InternalGetCurrentThread();
        if (this.m_currentThread != currentThread)
        {
            stringValue = string.GetStringForStringBuilder(stringValue, stringValue.Capacity);
        }
        int length = stringValue.Length;
        int requiredLength = length + value.Length;
        if (this.NeedsAllocation(stringValue, requiredLength))
        {
            string newString = this.GetNewString(stringValue, requiredLength);
            newString.AppendInPlace(value, length);
            this.ReplaceString(currentThread, newString);
        }
        else
        {
            stringValue.AppendInPlace(value, length);
            this.ReplaceString(currentThread, stringValue);
        }
    }
    return this;
}

So it is a mutated string instance...
EDIT Except in .NET 4 it is a char[]
Answer: If you want to see one of the possible implementations (That is similar to the one shipped wit the microsoft implementation up to v3.5) you could see the source of the Mono one on github.


How to import many files into SharePoint Online document library

Question: I have a lot of PDF files in my local storage that should be submitted to the SharePoint Online document library.
Is there only a way to drag and drop it into the destination document library?
Is there a more efficient and safer way?
Answer: For uploading files to SharePoint library, you can use the upload button, it can directly upload a folder to library.
And for more information about uploading, you can check this:https://support.microsoft.com/en-us/office/upload-files-and-folders-to-a-library-da549fb1-1fcb-4167-87d0-4693e93cb7a0
Answer: Jerry's suggestion is the simplest solution. Be aware that the uploaded PDF files all get a fresh creation and modification date. There is also no extraction of PDF metadata (e.g. keywords). The pdf files also get assigned the default content type (probably document).
There is no support for adding custom metadata.
If you want these advanced features then look into other options:

PowerShell scripts
SPMT (free)
3rd party migration tools (not free)

Paul | SLIM Applications
Comment: Thank you very much. Could you tell me if you have any links related to those 3 your suggestions?
Comment: PowerShell
e.g.
https://www.enjoysharepoint.com/upload-document-using-powershell-https://sharepoint.stackexchange.com/questions/115834/uploading-files-to-sharepoint-document-library-and-updateing-column-fields-using/277555#277555

SPMT
https://docs.microsoft.com/en-us/sharepointmigration/introducing-the-sharepoint-migration-tool

3rd party tools
https://directory.collab365.community/office365-sharepoint/best-sharepoint-migration-tools/
Most tools are client/server based but there are also browser-based tools.
Comment: Thank you very much. It helps me.


Science of my creature super power

Question: Geo-Ionikinesis: my creature  is capable of generating plasmoid flames from thin air, not requiring the consumption of oxygen or combustible objects to maintain the flames. He has been seen being able to increase the temperature within his proximity which allows him to engulf his entire body into a flaming/molten rock form, fire concentrated plasma blasts from his hands and endure extreme heat and flame without being harmed.how would this work? what materials is my creature made of that make possible and what compounds allows these effects?
Comment: Do you have any constraints or targets for **how far from reality** this systems can be. It already seems to be pushing the limit.
Comment: The answer you're seeking is "magic". Also, I'm suspicious of the etymology of "geo-lonikinesis", but I'm not a linguist ;-)
Comment: This is just magic. The more scientifically detailed you try to explain this, the less believable it is going to seem because it's so far past the bounds of known biology AND technology.
Answer: He's some sort of silicon lifeform.
Carbon biology doesn't work well with extreme heat. As such, this being is some sort of rock monster made of complex silicon chains.
They produce lots of methane and oxidizing agents.
They can squirt out from compressed internal stores burning gases which sometimes get hot enough to do plasma. Flamethrowers can burn for about 10 seconds, so assume they have about ten seconds of full massive flames that go 40 meters, and maybe a few minutes of just being burny without refueling.
Comment: The melting point of silicon is about 1700K. Typical plasmas easily reach 10000K. You'll notice as well that you will never reach the required temperatures with a measly flame temperature of around 2000K at best for methane (tho you can still melt yourself at that temp). Also, OP mentioned O2 should not be required (or any matter actually, but that just goes against the definition of plasma so we can disregard it), so that methane is gonna feel lonely without a playmate. Not even close to allowing what OP wants, but you can't be blamed, nothing short of magic will achieve the effect he's after
Comment: You get some ionization even at a low temperature. It's pretty easy to run a current across a methane flame.
Comment: Yes, if you apply enough of a voltage. But methane is not needed for that. Many hand-powered diy generators can build enough voltage to run an arc through ambient air. Having a narrow channel of plasma for the few ms it takes for discharge is not what OP is after. If you go this way, you can also have cold plasma at no more than 40 degrees (tho doing that biologically would be as unrealistic as it gets). But I think it is clear that this is not the spirit of the question. OP expects a flaming ball of plasma engulfing his character. I dare you to get that with methane alone :p
Answer: Best I can figure, your creature has to:

Have some way to spawn new matter into existence, or:

To teleport matter from somewhere else, or:

You could say that there is a form of either matter or energy, like aether, that is quite abundant, but that does not register as one of the 118 atoms on the periodic table, and that your creature can simply transmute the aether into the substances required for the plasmoid flames your creature makes.

That being said, the latter two of these methods would have it so that your creature is technically not making these plasmoid flames out of thin air, although it could still appear as though it was.
So... it must be made of whichever types of materials would allow it to do one of these types of options.
Comment: Well getting the matter is one part of the problem (usually the trivial part, but with the restriction in OP's question, it is indeed made harder). But usually, the parts you'd be concerned about are: 1) where do I get enough energy to transform that matter into plasma 2) how do I survive bathing in something hotter than the melting point of any known material?

Science of my creature super power


openvpn, option tls-cipher not working, no shared cipher

Question: while experimenting with setting up openvpn, i stumbled upon this tip on a website. it says that you can limit the list of ciphers, to prevent downgrade attacks.
i testet it in a lan with 2 computers, both running a kubuntu 14.04 with OpenVPN 2.3.2.
in the server.conf on the openvpn server, i inserted this line
tls-cipher TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256:TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256:TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256
by executing openvpn --show-tls and comparing the output, i made shure that each of the ciphers in line above is known by my version of openvpn(on both server and client).
but when i start the openvpnserver and the client afterwards, the server is giving me following output
Fri Sep 25 12:31:59 2015 "THECLIENTSIP":38749 TLS: Initial packet from [AF_INET]"THECLIENTSIP":38749, sid=d9c33d37 653b2f0e
Fri Sep 25 12:32:00 2015 "THECLIENTSIP":38749 TLS_ERROR: BIO read tls_read_plaintext error: error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher
Fri Sep 25 12:32:00 2015 "THECLIENTSIP":38749 TLS Error: TLS object -> incoming plaintext read error
Fri Sep 25 12:32:00 2015 "THECLIENTSIP":38749 TLS Error: TLS handshake failed
Fri Sep 25 12:32:00 2015 "THECLIENTSIP":38749 SIGUSR1[soft,tls-error] received, client-instance restarting

without that tls-cipher option it works fine.
i dont understand why it says "no shared cipher".
is that way wrong to list the ciphers seperated with colons? or what is the problem here?
thank you for reading. i hope anyone can help me.
edit
i replaced the line in the server.conf with
tls-cipher TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256
to see what happens.
and the output of the openvpn server is the same.
edit 2
i was searching further and found this site https://community.openvpn.net/openvpn/wiki/Hardening
and now understood that OpenVpn 2.3.2 only has support for SSLv3/TLSv1.0 ciphersuites.
but openvpn --show-tls also shows TLSv1.2 ciphersuites

Limiting to TLSv1.0 DHE + RSA choices yields the following list,
  suitable for <=2.3.2 peers. DES choices are best avoided, especially
  single-DES (known very weak.)
TLS-DHE-RSA-WITH-AES-256-CBC-SHA
TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA
TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA
TLS-DHE-RSA-WITH-AES-128-CBC-SHA
TLS-DHE-RSA-WITH-SEED-CBC-SHA
TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA
TLS-DHE-RSA-WITH-DES-CBC-SHA
Avoid all DES cipher suites: DES is known to be very weak (3DES-EDE is still fine)
  Avoid all RC4 ciphersuites: RC4 is known to be weak
  Avoid all EXPORT cipher suites:
  EXPORT is specified to be weak many years ago

and it works when i use one of these ciphers in the server.conf, e.g.
tls-cipher TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA
sadly on that page is not written how exactly i can yield that myself... does anyone know?
since TLSv1.0 is SSLv3 and openvpn says it uses OpenSSL
i tried to get that information via OpenSSL, filtering with grep
openssl ciphers -v | grep SSLv3 | grep Kx=DH
but the output is different (for example the word WITH does not show up in that list)
assuming that there is maybe only a difference in the notation i tried to replaced some text with sed
openssl ciphers -v | grep SSLv3 | grep Kx=DH | grep DHE-RSA | sed 's/DHE-RSA/TLS-DHE-RSA-WITH/g' | awk '{print $1}'
prints:
TLS-DHE-RSA-WITH-AES256-SHA
TLS-DHE-RSA-WITH-CAMELLIA256-SHA
TLS-DHE-RSA-WITH-AES128-SHA
TLS-DHE-RSA-WITH-SEED-SHA
TLS-DHE-RSA-WITH-CAMELLIA128-SHA
but this is still not the same as the list on the "Hardening openvpn article" and i am not shure, if that is the right way anyways...
on this site using DHE-RSA-AES256-SHA is encouraged.
so, i assume, the safest tls-cipher i can use with openvpn 2.3.2
is TLS-DHE-RSA-WITH-AES-256-CBC-SHA.
but that answer is from november 2013. is that still the best choice?
somehow this is a different question now. but this is all about finding the safest tls-cipher option.
edit 3
ok, i could exted that openssl-grep-sed command
openssl ciphers -v | grep SSLv3 | grep Kx=DH | grep DHE-RSA | sed 's/DHE-RSA/TLS-DHE-RSA-WITH/g' | sed 's/SHA/CBC-SHA/g'| awk '{print $1}'
prints:
TLS-DHE-RSA-WITH-AES256-CBC-SHA
TLS-DHE-RSA-WITH-CAMELLIA256-CBC-SHA
TLS-DHE-RSA-WITH-AES128-CBC-SHA
TLS-DHE-RSA-WITH-SEED-CBC-SHA
TLS-DHE-RSA-WITH-CAMELLIA128-CBC-SHA
now its the same list as in that article without that DES and 3DES entry.
so is this now the right result? becouse this solution is only based on the assumption that there is only a difference in notation between the output of openssl -v command and the openvpn --show-tls command.
edit 4
no sorry, it wasn't the same list as in that article without that DES and 3DES entry.. now it is:
openssl ciphers -v | grep SSLv3 | grep Kx=DH | grep DHE-RSA | sed 's/DHE-RSA/TLS-DHE-RSA-WITH/g' | sed 's/SHA/CBC-SHA/g'| sed 's/AES/AES-/g' | sed 's/CAMELLIA/CAMELLIA-/g' | awk '{print $1}'
prints:
TLS-DHE-RSA-WITH-AES-256-CBC-SHA
TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA
TLS-DHE-RSA-WITH-AES-128-CBC-SHA
TLS-DHE-RSA-WITH-SEED-CBC-SHA
TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA
but this is a messup up way, isnt it? and it only works this way, if the list of names of the ciphers dont grow.
sorry, if the "question" might be confusing...
please comment, thanks a lot if you at least took the time to read this!
Answer: I don't think OpenVPN supports ECDHE yet - I have tried OpenVPN 2.3.4 on Debian 8.3 (stable) and 2.3.10 on Debian testing as server, and neither works when tls-cipher is specified with a ECDHE ciphersuite, connecting from a Windows client running 2.3.10. So far only DHE ones work.


Availability Group Listener - Dedicated Server?

Question: Should an AG Listener be set up on it's own server? If so, does it require it's own SQL Server license?
Answer: The listener is part of the Availability Group and will reside in the resource group of the Availability Group in the Windows Server Failover Cluster. Thus it is not possible to have a specific listener server as the listener will move with the owner of the resources in WSFC.
Answer: A listener is composed of hostname and IP address cluster resources that are created in the cluster role that is created for the availability group.  So asking if it should be set up "on it's own server" is an invalid question as it is set up as a cluster resource, which could be owned by any node of the cluster that is a replica in the availability group.
The listener itself does not require a SQL Server license, but the instance of SQL Server that is running as the primary of the availability group will require a license.  In general, questions about licensing here are not good questions because A) Many licensing scenarios are complex and require research, and B) licensing often changes from one version to the next.  So please check with your reseller regarding your license requirements.


Strategy for dealing with large db tables

Question: I'm looking at building a Rails application which will have some pretty
large tables with upwards of 500 million rows.  To keep things snappy
I'm currently looking into how a large table can be split to more
manageable chunks.   I see that as of MySQL 5.1 there is a partitioning
option and that's a possible option but I don't like the way the column
that determines the partitioning has to be part of the primary key on
the table.
What I'd really like to do is split the table that a AR model writes to
based upon the values written but as far as I am aware there is no way
to do this - does anyone have any suggestions as to how I might
implement this or any alternative strategies?
Thanks
Arfon
Answer: Partition columns in MySQL are not limited to primary keys. In fact, a partition column does not have to be a key at all (though one will be created for it transparently). You can partition by RANGE, HASH, KEY and LIST (which is similar to RANGE only that it is a set of discrete values). Read the MySQL manual for an overview of partioning types.
There are alternative solutions such as HScale - a middleware plug-in that transparently partitions tables based on certain criteria. HiveDB is an open-source framework for horizontal partioning for MySQL.
In addition to sharding and partioning you should employ some sort of clustering. The simplest setup is a replication based setup that helps you spread the load over several physical servers. You should also consider more advanced clustering solutions such as MySQL cluster (probably not an option due to the size of your database) and clustering middleware such as Sequioa.
I actually asked a relevant question regarding scaling with MySQL here on stack-overflow some time ago, which I ended up answering myself several days later after collecting a lot of information on the subject. Might be relevant for you as well.
Answer: If you want to split your datas by time, the following solution may fit to your need. You can probably use MERGE tables;
Let's assume your table is called MyTable and that you need one table per week

Your app always logs in the same table
A weekly job atomically renames your table and recreates an empty one: MyTable is renamed to MyTable-Year-WeekNumber, and a fresh empty MyTable is created
Merge tables are dropped and recreated.

If you want to get all the datas of the past three months, you create a merge table which will include only the tables from the last 3 months. Create as many merge tables as you need different periods. If you can not include the table in which datas are currently inserted (MyTable in our example), you'll be even more happy, as you won't have any read / write concurrency
Answer: You can handle this entirely in Active Record using DataFabric.
It's not that complicated to implement similar behavior yourself if that's not suitable. Google sharding for a lot of discussion on the architectural pattern of handling table partitioning within the app tier. It has the advantages of avoiding middleware or depending on db vender specific features. On the other hand it is more code in your app that you're responsible for.


"it rains something" - is it an idiom and when is it used?

Question: I think I heard somewhere expressions like "it rains apples" or "it rains ideas" which could possibly mean there is a lot of apples and ideas, but I am not sure. Is there anything like that in English?
Comment: It's an idiom and a metaphor.  Stuff is coming at you faster than you can deal with it.
Answer: Have a look at this.
It is used to convey that something is falling or happening in large or overwhelming quantities.
Examples - The gunship rained bullets on to the terrorists.
Bombs rained down.


Turn on camera light but not camera

Question: Is it possible to turn on the light that indicates that the camera (on a MacBook) is on without turning on the camera? (Then it could be used as an indicator for something else.)
Answer: A couple years ago there was rumours about malware being able to run the camera without having the light on.  Both LED and Camera are driven by the Apple SMC (System Management Controller) and are linked together far below OSX user level.
Since then Apple most probably have put extra efforts to avoid usage of one without the other.
Comment: Upvoted because the answer is _not_ irrelevant. I gather that you're suggesting that separating the two may be a security issue, and that the short answer to the original question is probably not.
Comment: The OP isn't asking how to use the camera on the MacBook without triggering the LED beside it, but how to trigger the LED without using the camera.
Comment: I tried to prove that the camera and LED are linked together on a hardware level.   If you don't see how that's related, just downvote.

Turn on camera light but not camera


Is there a similar expression to "level the score" in American English?

Question: I'm non-native English speaker and I found the expression "level the score" in dictionary was denoted as "British English". So I want to know if there is a counterpart in the US English.
Comment: [Handicapping](https://en.wikipedia.org/wiki/Handicapping).
Comment: Wouldn't handicapping be more like levelling the playing field? Or is this a regional thing? In Australian English to level the score is normally taken pretty literally, ie. one player or team has scored and the scores are now level.
Comment: In Britain it can vary according to sport. In football, for example, whilst *level the score* is perfectly understood and sometimes used, the far more common expression is that *United equalised against Arsenal in the 54th minute*. An *equaliser* is a goal which *levels the score*. However *equalise* is less appropriate in sports like rugby and cricket. In either *levelled the score* would seem appropriate in unusual situations where the scores are exactly equal.
Answer: In American English we use the term "even the score."  There are many many examples of this revealed with a quick google search.
At no point in watching sports in the US would announcers or fans use the term level for two teams with the same score. More commonly, the teams are tied at 30, even at 30, or the score is 30 all.
Answer: "get even" is one phrase that comes to my mind.
However, this phrase has a negative feel about it since Cambridge Dictionary gives the meaning of this as "to punish someone who has done something bad to you by doing something equally bad to that person"
However, having said that, in a sport, if an opponent scores against you, it is "bad" against you in the context of sport. Right ?


How to convert quantum anomalous Hall conductivity values from (Ohm.cm)-1 to e2/hc?

Question: I am currently working on anomalous Hall conductivity calculations using both Wanniertools and wannier90. The output values from these calculations are provided in units of (Ohm$\cdot$cm)-1. I am interested in converting these output values into the more familiar unit of e2/hc. Could you kindly provide guidance on the most straightforward and simple method for performing this conversion? Your expertise in this matter would be greatly appreciated and would help me immensely in my research. Thank you in advance for your assistance, and I look forward to your response.
Comment: +1 but e2 or $e^2$?
Comment: Are you sure there is a $c$ in there? Hall conductance is typically expressed in units of $e^2/h$.
Answer: The unit conversions
The SI base units for Ohms are:
$$
\Omega = \frac{\textrm{kg}\cdot \textrm{m}^2}{\textrm{s}^3\cdot \textrm{A}^2}\tag{1}
$$
Since 1 Joule is:
$$
\tag{2}
\textrm{J} = \frac{\textrm{kg}\cdot \textrm{m}^2}{\textrm{s}^2},
$$
and 1 Coulomb is:
$$
\tag{3}
\textrm{C} = \textrm{A}\cdot \textrm{s},
$$
we have:
$$
\tag{4}
\Omega = \frac{\textrm{J}\cdot \textrm{s}}{\textrm{C}^2}.
$$
The final units of the output from your software, are as follows:
$$\tag{5}
\frac{1}{\Omega \cdot \textrm{cm}} = \frac{\textrm{C}^2}{\textrm{J}\cdot \textrm{s}\cdot \textrm{cm}}.
$$
You then said:

"I am interested in converting these output values into the more familiar unit of e2/hc."

So let's first see what the units are for that quantity:
$$\tag{6}
\left[ \frac{e^2}{hc}\right] = \frac{\textrm{C}^2}{\textrm{J}\cdot  \textrm{m}}.
$$
Even if we convert cm to m in Eq. (5):
$$
\tag{7}
\frac{1}{\Omega \cdot \textrm{cm}} = \frac{\textrm{C}^2}{\textrm{J}\cdot \textrm{s}\cdot \textrm{cm}}\times \frac{100~\textrm{cm}}{\textrm{m}} = \frac{100 ~ \textrm{C}^2}{\textrm{J}\cdot \textrm{s}\cdot \textrm{m}},
$$
we still have incompatible units because what the software is giving you has "seconds" in the denominator and what you want does not.
Perhaps what you want is not $e^2/hc$ but $e^2/(\epsilon_0hc)$, but even then, and even if you were to convert cm$^{-1}$ to Joules, you would not get compatible units.
The final recommendation
I recommend to stick with the units that the software is using when printing the output, until you know better what unit system you would like your publication to use. Almost always, the authors of the software know very much what they're doing, and they will print the output in a unit that is acceptable for their own publications.


SafeERC20 wrapper library triggers foundry errors. How do i get around this?

Question: I wanted to test what the SafeERC20 wrapper contract did, whenever it interacts with a banlisted usdst transfer attempt. But i keep getting weird errors. Is this an inheritance issue? What am i doing wrong?
contract StableCoinBans is Test {

    using SafeERC20 for IERC20;

    IERC20 iusdt;

    function setUp() public {
        iusdt = IERC20(usdt);
    }

    function testSendUsdtSafe() public {
        vm.startPrank(usdtWhale);
        iusdt.safeTransfer(address(123), one);
    }

Compilation fails with this message:
Error (9582): Member "safeTransfer" not found or not visible after argument-dependent lookup in contract IERC20.
Ive also tried other ways of writing the same function call:
SafeERC20.safeTransfer(IERC20(usdt), address(123), one);
SafeERC20.safeTransfer(iusdt, address(123), one);

Both of these throw this error, saying that the passed parameter is of the wrong type!
That type IERC20 cant become type IERC20???
Error (9553): Invalid type for argument in function call. Invalid implicit conversion from contract IERC20 to contract IERC20 requested.
Answer: Whenever you get Invalid implicit conversion from "X" to "X" error means that you are importing "X" type from two different .sol files. In this specific case you'll need to make sure that the IERC20 is imported from a single source file. When you are importing it from two different source files the compiler tries to resolve the type from two different memory regions and you get this error. Refer this post.


Ubuntu 17.04 & natural scrolling

Question: In Ubuntu 16.10 and earlier natural scroll settings for touchpad were separatefor mouse and touchpad. Since 17.04 there is only one settings so I can't set it differently for diffrent input devices.
Comment: You can set it separately in `libinput` that is default in 17.04.
Answer: using the gsettings command line api, you should be able to access both
i.e. these command line commands will get the current values
$ gsettings get org.gnome.desktop.peripherals.mouse natural-scroll

This returns false for me.
for touchpad
$ gsettings get org.gnome.desktop.peripherals.touchpad natural-scroll

Then to change, change the get argument to set and pass a value on the end, e.g.
$ gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll true
            ^^^                                                       ^^^^

and obviously repeat the process for the mouse if you want to change that as well.
Comment: The user asked about natural scroll settings, not speed. Do you have an answer for that?
Comment: Doesn't work. They are set diffrent for both devices, but none of them has natural-scroll: `kamil@galactica:~$ gsettings get org.gnome.desktop.peripherals.touchpad natural-scroll` gets
true
`kamil@galactica:~$ gsettings get org.gnome.desktop.peripherals.mouse natural-scroll`
gets false
Comment: @Kamil do you want natural scroll on or off? you will have to use the second command and **set** the value you want
Comment: I wan't it on for touchpad and off for mouse. It is set like this, but it doesn't work.

Ubuntu 17.04 & natural scrolling


Why are parameters to Bash's builtin optional?

Question: Running simply builtin prints nothing and returns exit code 0. This is in accordance with help builtin, which shows all parameters as optional. But why isn't this no-op an error? Is there a use case for this? A more useful result would be an error code or, even better, listing the currently available builtins.
Answer: Bash built-ins are inconsistent and poorly documented.
Here's an example:
$ help command
command: command [-pVv] command [arg ...]
    Runs COMMAND with ARGS ignoring shell functions.  If you have a shell
    function called 'ls', and you wish to call the command `ls', you can
    say "command ls".  If the -p option is given, a default value is used
    for PATH that is guaranteed to find all of the standard utilities.  If
    the -V or -v option is given, a string is printed describing COMMAND.
    The -V option produces a more verbose description.
$ command; echo $?
0

Even without command the return code $? -eq 0 and there is no error on std err.
Another one:
$ help disown
disown: disown [-h] [-ar] [jobspec ...]
    By default, removes each JOBSPEC argument from the table of active jobs.
    If the -h option is given, the job is not removed from the table, but is
    marked so that SIGHUP is not sent to the job if the shell receives a
    SIGHUP.  The -a option, when JOBSPEC is not supplied, means to remove all
    jobs from the job table; the -r option means to remove only running jobs.
$ disown; echo $?
-bash: disown: current: no such job
1

All the arguments are optional but it returns $? -eq 1 when there are none.
I've even compiled the newest Bash 4.2 and here are my results:
$ help command
command: command [-pVv] command [arg ...]
    Execute a simple command or display information about commands.

    Runs COMMAND with ARGS suppressing  shell function lookup, or display
    information about the specified COMMANDs.  Can be used to invoke commands
    on disk when a function with the same name exists.

    Options:
      -p    use a default value for PATH that is guaranteed to find all of
        the standard utilities
      -v    print a description of COMMAND similar to the `type' builtin
      -V    print a more verbose description of each COMMAND

    Exit Status:
    Returns exit status of COMMAND, or failure if COMMAND is not found.
$ command; echo $?
0

There's a new section "Exit Status" and command is still an optional argument. Even worse than 3.x. The same for other built-ins.
So, you're right. Bash built-ins are a mess and should be fixed.
Comment: Minor explanation for the `disown` case: no `jobspec` means: `"Without any JOBSPECs, the shell uses its notion of the current job."`, and in your example, there is no current job.  Try `sleep 60 & disown`.


Arduino yun as ssh client

Question: Is it possible to set the Arduino Yun up as an ssh client? If so, how?
Comment: The Atheros chip should have enough muscle for an SSH client. The ATmega has not enough resources for that: too little RAM and too slow for reasonable use. But what do you mean by 'SSH client'? An SSH client is a program that can connect to an SSH daemon (or server). So an SSH client can initiate a connection to your PC which runs an SSH daemon. The client can send commands to the PC, the PC executes them. Is that what you mean?
Comment: Yes that is what I mean. I need the arduino yun to act as an ssh client to start an ssh session with another box and then execute some basic commands.
Comment: What do you mean that the ATmega doesn't have enough resources for an ssh client. Is this dependent on the work being done by the client or just in the setting up of the client / server
Comment: You need memory for at least the IP packets and session information as well as for the SSH keys. It would be useful if there was some memory left for regular tasks too. If you manage to squeeze that into maximum of 4kB RAM in the ATmega, then the key exchange would take ages because asymmetric key exchange is very CPU intensive.
Answer: You need to install package openssh-client: it's available in the package list. See this tutorial about how to install optional packages.
You can call ssh on the Linux side using Process from the Bridge Arduino library.
Best is when you execute single or grouped commands using a syntax as:
ssh user@your_other_host 'echo 1; echo 2'

Managing an open ssh session is possible but I think may be troublesome, so avoid it if you can.
Comment: Hi. Thanks for that answer. Im still struggling to get a fully operational ssh client. I can connect to the ssh server from the client but how do I receive data back from the server?
Comment: You can grab the output produced by the commands run on the server

Arduino yun as ssh client


What are the uses of Euler's number $e$?

Question: People make such a big deal of the number $e$. I do not get why it is so important, other than the fact that $\ln(x)=\log_e(x)$. People say it is used all over mathematics and such, but they never give me examples. Where is the number $e$ used? Also, how did Euler come up with the concept of some number $e$ that has the following property:
$$e=\sum\limits_{n=0}^\infty \dfrac{1}{n!}=\dfrac{1}{0!}+\dfrac{1}{1!}+\dfrac{1}{2!}+\cdots$$
I am just curious why people make such a big deal out of $e$.
Comment: If you don't want to use it we won't force you.
Comment: Functions of the form $c e^x$ with $c$ constant are the unique functions whose derivative (slope at a given point) is equal to the original function. This is why exponential growth is so useful in many areas.
Comment: All the comments above are basically saying "It's amazing, trust us" without actually answering the question and showing some applications.
Comment: Electric field of a hydrogen atom is also calculated with euler's number!
Comment: The fact that the points on the unit circle are precisely the complex numbers of the form $e^{i\theta}$ for real $\theta$ should be enough to convince anyone that $e$ has very special properties.
Comment: Without it, trigonometry and engineering, to name just two, would become unbearably harder to either apply or understand. It simplifies things tremendously, especially when coupled with complex or imaginary numbers.
Answer: $e$ is just as important as $\pi$ in mathematics having uses in pretty much every field.
For example,
$$e=\lim\limits_{x\to \infty}\left(1+\dfrac{1}{x}\right)^x$$
One of the most beautiful examples of its importance would be relating trigonometric functions to hyperbolic functions using the identity:
$$e^{ix} = \cos(x)+i\sin(x)$$
For example:
$$\sin(x)=\dfrac{e^{ix}-e^{-ix}}{2i}$$
Using these identities can greatly simplify the computation of antiderivatives of rational functions involving trigonometric functions.
One also must note the beauty of:
$$e^{i\pi}+1=0$$
$e$ is used to compute the compound interest of a bank account which is compounded continuously.
Many integral transformations such as the Fourier Transform and Laplace Transform make use of e to map a function into different domains in order to make its computation more simple.
$e$ can be used to parameterize the unit hyperbola.
$e$ also defines the factorial function or more generally the gamma function which has uses all throughout mathematics.
The uses of $e$ are seemingly endless as the number keeps popping everywhere in mathematics in all types of problems.
Comment: Can you link the text "parameterize the unit hyperbola" to a source describing what you mean?
Comment: http://en.wikipedia.org/wiki/Hyperbolic_function
Answer: $e$ is fundamental in mathematics. Aside from the awesome properties of $e$, such as $e^{i \pi}+1=0$ and the fact that $$\frac{d}{dx} e^x=e^x,$$ it is also found in equations that directly relate to everyday phenomena. For instance, the normal  distribution is represented by the probability density function $$f(x)=\frac{1}{\sqrt{2 \pi}}e^{-\frac{1}{2}x^2}. $$ It also appears in Newton's law of cooling/heating, in the  solution to the differential equation $$\frac{dT}{dt}=-k(T-T_0).$$
Alongside these, $e$ appears in the solutions of many differential equation that model anything from electric circuits to spring-mass systems. As for how Euler showed that $$e=\sum_{n=0}^{\infty}\frac{1}{n!}$$ I am not sure.
Comment: While I never looked up Euler's proof of the last identity, I'd like to remark that it is an easy exercise about Taylor expansions.
Answer: Eular's identity pops up everywhere, in calculus, differential equations and even probabilities. For example in elementary probability theory, it shows up in the Poisson distribution general formula which is used to calculate the probability of an event occurring given that we know the rate at which it happens     $$P(X=k)=\frac{\lambda^k}{k!} e^{-\lambda}$$
Furthermore, the hyperbolic identities are defined in terms of e.
There are so many applications to e, that I can pretty much write an entire book on it (and someone probably has). It is very important to get comfortable with it as if you're doing math, it will show up everywhere.
Answer: Eular's constant also describes the decay seen in blood concentration after a bolus of intravenous drug is administered:
$$C_p=X_0\sum_{i=1}^nA_ie^{-\lambda_i t} $$
Where:$$$$
$C_p$ is drug blood concentration, $X_0$ is dose given, $A_i$ and $\lambda_i$ are hybrid rate constants and $t$ is time. $i$ increases by one for every additional compartment to transform the equation from mono-exponential to poly-exponential.
(Ref: Shafer SL, Gregg KM: Algorithms to rapidly achieve and maintain stable drug concentrations at the site of drug effect with a computer-controlled infusion pump. J. Pharmacokinet. Biopharm. 20:147–69, 1992)
Answer: There are a lot of reasons that $e$ is important, but I think that there are an equal number that show that the exponential function $\exp(t)$ is important. Here is one that I did not see mentioned:
$t \mapsto e^{ta}$ is for every fixed $a \in \mathbb R$ a homomorphism from the additive group on the real numbers onto the multiplicative group, $\phi: (\mathbb R,+) \to (\mathbb R,\cdot)$. In particular, if we require this function to be differentiable, we see that
$\phi(x+y)=\phi(x)\phi(y)$ implies by differentiating both sides, $\phi^{\prime}(t+0)=\phi(t)\cdot \phi^{\prime}(0)$. But since it is a homomorphism, $f(0)=1$, so we see that the only solution is $\phi(t)=e^{ta}$. So, every differentiable group homomorphism of this type is the exponential function.
One can generalize this function to see that for a matrix $A \in L_n(\mathbb R)$, we have a function $$e^{tA}=\sum_{k=0}^{\infty}\frac{t^kA^k}{k!}.$$ Then this is a homomorphism from $\mathbb R \to GL_n(\mathbb R)$, a generalization, since $(\mathbb R, \cdot)=GL_1(\mathbb R)$.
This tells us for example that if we associate real numbers to rotations:
$$x \mapsto \begin{bmatrix}\cos(x)& \sin(x)\\ -\sin(x) & \cos(x)\end{bmatrix}$$
then since this is a group homomorphism $\mathbb R  \to GL_2(\mathbb R)$, it is of the form $e^{tA}$.
This can all be found in Vinberg's book Linear Representations of Groups.


Build 32bit on 64 bit Linux using a configure script for FFMPEG

Question: This question was asked in 2010 without specifying the application. Neither of the answers work for the current version of FFMPEG on a 64 bit Fedora 16 system. They both cause the configure script to generate an error. I would appreciate knowing if and how a 32 bit executable can be generated for FFMPEG on a 64 bit Linux system with configure options.
Answer: I'm not sure about FFMPEG, but gcc supports the "-m32" option to force it to build 32-bit code.  It might be worth a try to modify your configure script to add this gcc option.


How to make classic search the default search experience with modern sites?

Question: I am setting up a new on-prem SharePoint 2019 farm. The goal is to use the modern experience for site collections since it is responsive and that is where Microsoft is putting future development into. However, with initial user testing, the modern search experience is abysmal and lacks several key features like: refiners, number or results found, custom display templates, etc.
I would like to continue to use modern sites, but have it default to use the classic search experience instead of the modern one. I have searched to see if there is a way to accomplish this but haven't come across anything. I was wondering if it is possible to do this? And if so, how do you do it?
I know that there is a more link at the bottom of the modern search results but to having to tell users to constantly click that link after doing your initial search is a horrible user experience - not to mention a waste of time.
Thanks.
Answer: After filing a ticket with Microsoft regarding this question, the response was that (currently) this is not possible to accomplish.


Iconographic attributes of Devi Durga?

Question: I use a translator, I speak Spanish.
Could someone please describe the attributes of the image you sent? Arms, Head, lion horse, the headdress on his head? Who are the ones that show up there? And if there is a specific name for this representation of Mother Durga? And a text that describes it, with the attributes that are in the image?
Thank you so much.
Vanessa
Answer: It's most likely not any specific Devi murti.I think the Above is just an artist's Attempt at a Portraying the Vishvarupa (Cosmic Form) of the Mother Goddess. They probably just took some artistic liberty to draw the extra details such as  head on the top of her head.
We find similar descriptions of Devi's Cosmic form in multiple scriptures  bearing innumerable heads and arms.

Kurma Purana I.12.51-59

Skanda PurAna, Prabhāsa Khaṇḍa, Vastrāpatha-kṣetra-māhātmya, Chater 9,
Verse 49-62

Himavān said:
O you goddess of broad eyes, who are you? Tell me. I have a strong doubt. The goddess said:
Know me to be the greatest power resorting to Maheśvara, whom those desirous of liberation look upon as unique, immutable and one
(only).
I shall give you divine sight. See my divine form. Speaking this much the Goddess herself gave special power to Himavat.
(Himavat) saw the Highest Lord, resembling crores of suns, an
orb of light, clear, encompassed with the row of thousand flames,
resembling hundreds of destructive fires at the end of the world,
fearful due to the fangs, exciting, adorned with a mass of matted
hair, very calm, of a mild face, full of endless wonders, having signs
like the lunar digits, having lustre like that of crores of moons,
having a crown, with a mace in his hand, adorned with anklets, having
put on a divine chaplet and garments, having smeared the body with
divine fragrant substances, holding a conch and a disc, desirable,
having three eyes, clad in hide, residing in the Egg (of the universe)
and out of it, being external, internal and the highest, full of all
power, bright, (and adorned) with all ornaments, whose lotus-like feet
were saluted by Brahmā, Indra, Upendra and best yogins, who reached
everything with His hands and feet, and eyes, head and face, and who
remained after having occupied everything.
Seeing the Lord of Nandī, the highest one, i.e. Maheśvara,
along with the Goddess, the king, Himālaya Mountain, full of fear and
(at the same time) delighted in mind, concentrating himself,
remembering Oṃkāra, praising Him with eight thousand epithets, again
saluted him, and spoke with folded hands: "O highest goddess, I am now
afraid of your divine form that has come up. So (please) show another
(form)."

It's Notable that although the form described above seems that of Shiva, Devi refers to it as her form only(owing to non-duality b/w both).
Devi Bhagavata, Book 7, Chapter 33

21-41. Vyāsa said :-- "O King! Hearing the words of Girirāja, Viṣṇu
and all the other Devas gladly seconded him. Then the Devī, the
Goddess of the Universe, knowing the desires of the Devas, showed Her
Own Form that fulfils the desires of the Bhaktas, that is auspicious
and that is like the Kalpa Vrikṣa towards the Bhaktas. They saw Her
Highest Virāṭ Form. The Satyaloka is situated on the topmost part and
is Her head; the Sun and Moon are Her eyes; the quarters, Her ears;
the Vedas are Her words; the Universe is Her heart; the earth is Her
loins; the Bhuvarloka is Her navel; the asterisms are Her Thighs; the
Maharloka is Her neck; the Janarloka is Her Face; the Taparloka is Her
head, situated below the Śatyaloka; Indra and the Devas and the
Svarloka is Her arms; the sound is the organ of Her ears; the Aśvin
twins, Her nose; the smell is the organ of smell; the fire is within
Her face; day and night are like Her two wings. The four-faced Brahmā
is Her eyebrows; water is Her palate; the juice thereof is Her organ
of taste; Yama, the God of Death, is Her large teeth; the affection is
Her small teeth; Māyā is Her smile; the creation of Universe is Her
sidelooks; modesty is Her upper lip; covetousness is Her lower lip;
unrighteousness is Her back. The Prajāpati is Her organ of generation;
the oceans are Her bowels; the mountains are Her bones; the rivers are
Her veins; and the trees are the hairs of Her body. O King! Youth,
virginity, and old age are Her best gaits, positions or ways (courses)
paths, the clouds are Her handsome hairs; the two twilights are Her
clothings; the Moon is the mind of the Mother of the Universe; Hari is
Her Vijñāna Śākti (the knowledge power); and Rudra is Her
all-destroying power. The horses and other animals are Her loins; the
lower regions Atala, etc., are Her lower regions from Her hip to Her
feet. The Devas began to behold Her this Cosmic (Virāṭa) appearance
with eyes, wide awake, with wonder. Thousands of fiery rays emitted
from Her form; She began to lick the whole universe with Her lips; the
two rows of teeth began to make horrible sounds; fires came out from
Her eyes; various weapons were seen in Her hands; and the Brāhmaṇas
and Kṣattriyas are become the food of that Awful Deity. Thousands of
heads, eyes and feet were seen in that form. Crores of Suns, crores of
lightnings flashes, mingled there. Horrible, Awful, That appearance
looked terrific to the eyes, heart and mind. The Devas thus beheld and
began to utter cries of horror and consternation; their hearts
trembled and they were caught with immoveable senselessness. "Here is
the Devī, our Mother and Preserver." This idea vanished away at once
from their minds.
Comment: @user30068     Thank you very much for the answer and the references to the texts but I need the name of the attributes in Sanskrit or Hindi that are in your hands, the weapons and things, for example, conch, lasso, sword, mace and others, as well as the name of the nine beings on the side right and left that come out of his head example, ganesaha, vishnu shiva and others the details of his headdress above the head the snakes their names and those of those goddesses that are there. Thank you for your understanding, I hope you help me.

Iconographic attributes of Devi Durga?


How does clearing house deal with such cases?

Question: Imagine that I entered short into futures contract for asset "A" at the price 100 USD. Lets say that on the other side John went long. Contract expires in one year. I don't use leverage and I put as collateral 100 USD. In one month price goes to 200 USD, my position is liquidated. What happens at this moment? Does clearing house go long into futures contract at price 200 USD to provide the payments for John? Then the other question arises, if there are many people like me whose position got liquidated and there is not enough futures contracts for clearing house to go long will it go bankrupt?
Answer:
Lets say that on the other side John went long.

This is not what happened. The "other side" is ALWAYS the exchange. The exchange has a contract vs. John "on the other side", but YOUR contract is with the exchange. Thus it does not matter who you buy a contract from to offset your position.

What happens at this moment?

The FCM will issue a market order to buy an offsetting position. This is not "against John" - the offsetting position will go to the exchange as counterpart. it also will happen BEFORE - if you issue 1000 USD collateral, the liquidation will happen so soon that you are MOST likely to be left with a profit. Legally depending on jurisdiction you may have an underwater account AND BE LIABLE FOR THE DIFFERENCE, or your broker may be. But John is NOT IN THE EQUATION AT THIS POINT.

If there are many people like me whose position got liquidated and there is not enough
futures contracts for clearing house to go long will it go bankrupt?

There is a reserve fund for that case, and ultimately - yes, if that case would ever come up, a lot of funny things would happen, but ultimately, if the size is bad enough, the system would break. THAT SAID: remember that you have market makers in the game. Just because futures go bonkers price wise does not mean the real market goes. Prise goes up like crazy - market makers have an incentive to buy spot, keep till delivery, deliver. This DOES Happen - it is called arbitrage. So, in order for this to be a real problem, you would have to have a VERY one sided market. WHich happened i.e. in Silver or Lumber at some point. People seriously underwater (100k+ USD on a margin less than 1000) because (Lumber) Canada changed some environmental laws limiting the supplies, market went limit up without trade for a week and some, IIRC. 30 years ago or so. Yes, people will have to pay, and a lot, and ultimately the system will break.
But again, your contract in that example is not with John. It is with the exchange and your offset may be with anyone else. If you get liquidated, the market order to offset your position can come from ANY market participant.
Answer: With futures contracts, the exchange clearing house acts as the counterparty to both parties.
To open a position, you must provide sufficient margin.  To reduce credit risk, all positions are marked-to-market daily and maintenance margin must be met daily.  If you don't, you'll receive a margin call and you'll have to provide additional margin, reduce, or close your position otherwise your broker will do for you.
If your broker liquidates your position to meet your margin call, they are not replacing you as the holder of the short position.  They will buy to close  your position at market price, most likely at an unfavorable price, and you will bear any slippage from the liquidation of the trade.
In the initial position, you are short and John is long.  If you are liquidated, no one goes "long into futures contract at price 200 USD to provide the payments for John".  You buy to close  a contract to close your position while  a third party goes short (say Tom) and the end result is that you are out, Tom is now short and John remains long.


How to remove GMail contacts from Messaging app on Samsung Galaxy S Advance?

Question: I have a Samsung Galaxy S Advance and when I try sending an SMS message to someone, I have to search through all my GMail contacts that for some reasons appear on the app along with my phone contacts.
I don't send mails through the message app and most of my GMail contacts are people who I sent just one e-mail in my entire life.
The Sync and Account settings don't let me turn off Contact sync, just remove the GMail account entirely, and there is no menu in the messaging app that lets me hide the GMail contacts.
Is there any way to make the messaging app only show the contacts I have on my phone?
Answer: In Android 4.1 Jelly bean follow the following steps:

Open the Contacts app
Tap the Setting touch button
Select Contacts to display
Select Phone

A similar procedure should work also for the earlier Android 2.3 Gingerbread.
Answer: I have note II. Here's my solution: in SMS, when you click create messaging icon, then click on phone book icon, you will see CONTACT tab listing everyone you have emailed and those in your phone book. Ignore that list. Scroll to the left to GROUP tab. Scroll down to MY CONTACT. It'll then show a list with the contacts on your phone (that is, you have already set your phone to display people with numbers only).
You have to manually do this every time but it beats seeing random people you have emailed. And you don't have to group or clean Gmail database.
Visual tutorial on how to do it: https://www.youtube.com/watch?v=vRvuSfTZ-1c
Answer: after following the steps above and still nothing happens. Go to phone settings>accounts>(click on your email)>left bottom>remove account> check your sms app contacts. Then if you want to add your email again, make sure when you add the account to sync off all.
Comment: I wanted to point out that EVEN AFTER following anne's steps above, the email contacts get re-added in the sms. This is because when adding an email account, it is synced EVEN WHEN sync has been turned OFF. So, AFTER the account has been added, sync stays off (if we have disabled sync before adding the account), but because the system REGARDLESS executes one round of sync WHEN ADDING the acco
Answer: open up the default text messaging app, click the three dots in a row and tap settings. Click general and uncheck "Show email address. That will stop your email contacts from showing up when you start a new chat.
Answer: Here's what worked for me. Contact- settings- accounts- delete WhatsApp. My phone was completely free. (This was after I unsync Gmail and deleted the old Gmail account)


How to automatically get a Add-on folder's path regardless of OS?

Question: In Blender, is there a command to query what's the current path to the Add-on folder - regardless of what system I'm using?
Answer: Ah, got it.
Paste this to the Python Console to get your add-ons path:
bpy.utils.user_resource('SCRIPTS', "addons")

Also see the wiki.
Comment: Note, there can be multiple addon's directories (3 infact) UsersHome/UserPrefs/BlenderDefault. The example you give will only give the user's home directory addon path, which might not even exist.
Comment: Oh, good to know.
I guess they're listed here: https://www.blender.org/manual/installing_blender/directorylayout.html
Answer: If you want to know the directory of the currently-executing addon, try this:
import os

script_file = os.path.realpath(__file__)
directory = os.path.dirname(script_file)

This is especially useful if your addon is a Python package, because it tells you which is the relevant subdirectory.
Answer: Blender addon utils module can fetch the path of any given addon name if installed.
#iterate through all the addon name installed
#if The Addon Name exists then:
#.__file__ will give away the file path where it is installed
#We are printing the file path in console
#If the given name does not exist it will pass

import bpy
import addon_utils

for mod in addon_utils.modules():
    if mod.bl_info['name'] == "The Addon Name":
        filepath = mod.__file__
        print (filepath)
    else:
        pass


Why don't we put subject pronouns "you", "I" in questions? e.g."¿cómo tú estás?"

Question: Is this the inherent feature of Spanish? In English we always say who is doing the action:

How are you?

Why don't you say:

¿Cómo tú estás?
Answer: In Spanish you can omit the subject in sentences when it is known or it can be inferred from context or the verb. In the case you show, the subject is inferred from the verb.
This is the present indicative of verb estar:
yo       estoy
tú       estás
él       está
nosotros estamos
vosotros estáis
ellos    están

Note that every verb form is different, so knowing the verb form you can infer the subject, so the estás form can only correspond to the pronoun tú, and thus it is redundant to use it in the sentence.
You can also omit the subject when everyone in the conversation knows it, not only in questions but in every kind of sentences:

—¿Dónde está Juan?
  —[Juan] Está en su casa.

Nonetheless, there are cases in which you can put in the subject if it needs to be emphasised:

—¿Cómo está tu mujer?
  —Regular, aún no se ha repuesto del susto.
  —¿Y cómo estás tú?

Here you say tú to emphasise that the subject has changed from the previous sentence, even though it can be inferred from the verb.
Answer: This is not restricted to questions, you would say soy Erjan not yo soy Erjan. Since the verb tells us the person it is not necessary to use the pronoun unless either it is ambiguous or you wish to emphasise.
Ambiguous
Está en otra planta could mean he/she/you polite is/are on another floor so you might add the pronoun
Emphasis
Como quieres = as you wish, como quieres tü = no, as YOU want, not me.
Answer: As noted, you can include the subject as a means of emphasis, although I would phrase it "¿Cómo estás tú?"  Another example that comes to mind is the classic Spartacus scene.  It might be translated:
"Soy Espartaco"
"No, soy yo Espartaco"
"No, soy yo..."

and so on.


How to create shortcut of a file in Windows 8 Tiles?

Question: In Windows 8, is it possible to create shortcut of a file on the new Start screen with Live Tiles? If so, how is it done?
Answer: To create a shortcut to a file in Windows 8's new Tiles, simply go to Windows Explorer, right-click your file, and click Pin to Start.
Comment: This works for folders, but not files.  The "Pin to Start" option is not available.
Answer:
Right click on the Desktop, and select New->Shortcut.

In the Create Shortcut Window that pops up, Browse and select the file whose shortcut you want to create.

Finally right click on the created shortcut and select Pin to Start.
Comment: This works for shortcuts to applications, but not for shortcuts to files.  The "Pin to Start" option is not available on shortcuts to files.  Your example is for eclipse.exe, an application.
Answer: I have found a great article on the same. I don't think I need to explain anything else.
http://www.howtogeek.com/74331/how-to-create-your-own-windows-8-shortcuts-for-shutdown-perhaps/
Just consider creating your own shortcut instead on shutdown mentioned here.
Comment: Please include the most relevant parts of the link here, on-site.
Comment: This is the only correct answer so far (aside from the Pin to 8 app - I haven't tried that).  None of the other answers work for files, but this one does!  I was able to pin an *.xlsx speadsheet to Start using this method.
Comment: To summarize, you use the "Search Apps" feature from the main (tiled) screen itself, then right-click to pin the search result. You may need to create a shortcut first, and search for that.
Answer: You can use this tool to pin ANY type of data:
http://winaero.com/comment.php?comment.news.140

With our Pin to 8 you will able:

to pin ANY file regardless of its type;
to pin ANY folder;
to pin drive;
to pin Control Panel items, all them including some hidden like God Mode/All Tasks, Network Connections;
to pin Libraries;
to pin Shell Objects like Run command, "Show Desktop", Window Switcher;
to pin any folders or files with drag and drop. Drop them on application window
Answer: Easier, less expensive:  use the desktop to create your short cut.  Drage it (copy) it to where you want it to work.  You may have to 'allow' it as administrator if you are not in the admin account.


How to upgrade the solana version?

Question: I checked the solana project for a while and found that the repository is being upgraded continuously all the time. As blockchain is a state replicator machine, the validator project is already distributed across validators and might be impossible to upgrade at once. An other problem might be the existing states. In case solana project is upgraded, how is that reflected across the overall chain? For example, testnet should run with the upgraded version while preserving the previous states and transaction history generated by older version. Can anybody help me with this question?
Answer: for for the Solana Labs client, there is new versions released constantly.
You can see the current cluster versions like this:
for mainnet
solana cluster version -um

and
solana cluster version -ud

for devnet. Currently both at 1.14.19.
If now the chain wants to update to lets say 1.16.1 all the validators need to come together and start upgrading. The progress of the upgrade can be seen in all the validators staked sol that are running the new version. If it reaches 80% for the new version the upgrade reaches super majority and was successful.
Usually new features and state changes are not directly tied to the version upgrades but work like feature flags, which are called feature gates in Solana. These are first activated on test net, then devnet and then mainnet.
Here you can see the schedule of the next feature gates:
https://github.com/solana-labs/solana/wiki/Feature-Gate-Activation-Schedule
Comment: Thank you for letting me know. In this case, what does validators need to do? Just get the upgraded version and restart the validator?
Comment: I think thats how it works yet. Have not run my own validator yet though.
Answer: To upgrade solana version, you need to follow the failover method.
https://docs.solana.com/running-validator/validator-failover
If you just stop the running validator and start with new solana version, that can be really dangerous. If the validator was a leader, there can be penalty for this. If all validators just stop and start with the new version, the network might result in chaos because of unexpected penalty and sync problem.
Thus to upgrade the validator, need to wait until another validator(which can be thought of temp validator) use current validator's identity to take part in consensus(this is done via manual failover trigger). Once secondary validator use current identity, current validator can safely exit and restart with the upgraded version. Once the current validator start with new version, the secondary validator stops working.

How to upgrade the solana version?


Multiple databases in production

Question: We have 3 level hierarchy in our business model. Entities at level 3 contains huge data (like dailyfacts tables).
In our current DB architecture, we have one single database & all level 1 entities separated by db schemas. All level 2 entities are being used only for logical grouping & don't contain any data as such. Then comes all level 3 entities. All daily level data is stored with respect to these entities. There is a dailyfacts table in each schema which stores data for all level 3 entities under that level 1 entity. Plus there are some other additional table are being used to store data for level 3 entities.
Currently our business is growing very rapidly & with this DB architecture we are not able to handle data properly. SQL timeouts & deadlocks have became daily headaches. Also if load on one entity increases then it starts affecting other entities as well. It very hard to scale horizontally with current DB architecture.
So after long discussion with team, we came to conclusion that we should create separate databases for each level 3 entity & one master database which will maintain all business model hierarchy. But the problem with this approach is that we will end up creating almost 100 databases(as per current number of entities & it will keep on increasing as & when new customer comes). & maintaining these many databases will become pain in the a** after sometime.
I am not an expert on DB architecture. So I want to know,

Is it OK to have these many databases in production environment? Are we moving in right direction?
If it is OK then what all things we should look at before/after migration? (all are newbies here)
Is there any other alternative to solve above problem?

We are using,

DBMS : SQL Server 2014
OS : Windows Server 2012 R2
Processor : Intel Xenon CPU E5-2630 v3 @2.40GHz, 16 Cores
RAM : 128 GB

Thanks in advance.
Answer: No, creating several databases will not help you if the underlying tables and their dependencies stay unchanged. Think of it this way: why would it?
You should get your database setup checked out by an expert and hire a database consultant. Your problems can probably be solved with changes to your indexes, partitioning or tuning DBMS parameters.

Multiple databases in production


When will the success probability of a spaceship be something other than 0% or 100%?

Question: The image below shows a spaceship that has not been launched. Its success probability is 100%. Before completion, the success probability was 0%. These are the only two values I have ever observed. Under what circumstances will the success probability be something other than 0% or 100%?
Comment: Assuming that the game is performing actual calculations then it takes just mere microseconds to know whether or not it will fail. The animation which presumably occurs after launch is nothing more than entertainment. Simply put, the game knows what's gonna happen, why wouldn't it? Sounds like the devs did not want to build in superficial speculation with stuff like 83% success probability if there is no way to alter your course after launch.
Answer: The success probability is determined by the ratio of Life Support modules to Habitation modules, counting only the modules connected by Structure, and assuming there are enough Solar panels to power all modules.
A spaceship with two connected Habitation modules, two connected Life Support modules and two Solar panels has a success probability of 100%. If one of the Life Support modules is not connected by Structure, the success probability would drop to 50% (one Life Support module to two Habitation modules).
The current version of freeciv (2.6.0) selects the type and placement of all spaceship parts automatically. Since it is quite sensible about the selection and placement, it is uncommon (but not impossible) to see a spaceship with a success probability other than 0% and 100%.
Comment: Which module is the Habitation Module? Is it the one that has 4 round circles? Or is it the greenish one?
Comment: Follow-up question: [Identification of spaceship's Habitation Modules and Life Support Modules](https://gaming.stackexchange.com/q/369544)


Prove that $S_4 \cong V_4 \rtimes_\phi S_3$ for any isomorphism $\phi: S_3 \to \text{Aut}(V_4)$

Question: Note that $\text{Aut}(V_4) \cong S_3$.
I know how to prove that $S_4$ isomorphic to some semidirect product of $V_4$ and $S_3$.
I know if it works for an isomphorism it works for any isomorphism.
However, I'm having trouble seeing that the $\phi$ must be an isomorphism of $\phi: S_3 \to \text{Aut}(V_4)$ (i.e. the kernel is trivial).
Is there a better way to check this without doing each case (kernel cannot be 3-cycles, or all of $S_3$)?
Comment: Ah, I see what @Raekye wanted to ask: Why should every $\phi\colon S_3\xrightarrow{\cong}\operatorname{Aut}(V_4)$ gives $V_4\rtimes_\phi S_3\to S_4$ an isomorphism, without having to do some explicit calculation with elements?  For that, [answer to this question](https://math.stackexchange.com/questions/38093/g-rtimes-phi-h-cong-g-rtimes-psi-h-when-certain-automorphisms-exist) would be very helpful.
Comment: Can you elaborate what you want to ask better?  I have trouble understanding this part of the question: "However, I'm having trouble seeing that the $\phi$ must be an isomorphism of $\phi: S_3 \to \text{Aut}(V_4)$ (i.e. the kernel is trivial)."  Are you asking us how to find a good $\phi$?
Comment: If some element of $S_3$ were in the kernel of $\phi$, then that element would commute with all of $V_4$. As $V_4$ is itself abelian you would get an abelian subgroup of  order 8 or 12. $S_4$ has no such subgroups.
Comment: There is of course the direct product $V_4\times S_3$ when $\ker\phi=S_3$ but that isn't isomorphic to $S_4$.
Comment: @Zvi In general for a semidirect product we just need a homomorphism from $S_3$ to $\text{Aut}(V_4)$. As others have pointed out, the trivial homomorphism gives a direct product of $V_4$ and $S_3$, which is not isomorphic to $S_4$. However, there could be other candidates for homomorphisms that give the semidirect product $V_4 \rtimes S_3 \cong S_4$. The best way I could think of to classify them is by kernels (which have to be normal subgroups). If we show that the kernel of $\phi$ must be trivial, then we know the semidirect product comes from an isomorphism of $S_3 \to \text{Aut}(V_4)$
Answer: To show that $S_4 \cong V_4 \rtimes S_3$, first note that $V_4$ is isomorphic to the double transpositions in $S_4$, and this $V_4$ is normal in $S_4$.
Consider an isomorphic copy of $S_3$ in $S_4$ in the usual way.
Note that their intersections are trivial.
Denote the two subgroups as $H$ and $K$, then $HK$ is a subgroup of $S_4$ of size $\frac{|H||K|}{|H \cap K|} = 4 \cdot 6 = |S_4|$, so $HK$ is equal to $S_4$, meaning $S_4$ is a semidirect product of $V_4$ and $S_3$.
To show that $S_4 \cong V_4 \rtimes_\phi S_3$ for some isomorphism of $S_3 \to \text{Aut}(V_4)$ (rather than, more generally, some homomorphism), note that the kernel of $\phi$ must be a normal subgroup of $S_3$.
We make use of Jyrki's comment.
The only nontrivial normal subgroups of $S_3$ are $C_3$ and all of $S_3$, which includes $C_3$.
Note that $V_4$ is abelian.
If $C_3$ is in the kernel of $\phi$, then
$$\{ (h, k) \in V_4 \rtimes_\phi S_3 | h \in V_4, k \in C_3 \}$$
is an abelian subgroup of order 12.
However, $V_4$ has no abelian subgroup of order 12.
Therefore the kernel of $\phi$ must be trivial, i.e. it is an isomorphism of $S_3 \to \text{Aut}(V_4)$.
To show that $S_4$ is a semidirect product of $V_4$ and $S_3$ for any isomorphism of $S_3 \to \text{Aut}(V_4)$, see the answer to this question.


Using MAC Filtering in addition to WPA2 Encryption

Question: I've been trying to find some answers regarding using MAC filtering on my router in addition to having WPA2 encryption but I couldn't find any clear ones. I understand that using MAC filtering solely is bad security practice since anyone can spoof any MAC address by using certain tools and use that MAC to connect to the network.
If I have WPA2 enabled and someone uses one of my whitelisted MAC addresses, will they be able to connect to my network without providing the password?
Answer: If your network uses WPA2, then clients must connect using WPA2 and the appropriate authentication method (e.g. PSK). MAC filtering doesn't really have to do anything with WPA2, it just adds another layer of access control that determines which devices are allowed to connect.
Comment: That is what I wanted to confirm. I guess I didn't word it right, I didn't mean WPA2 has anything to do with MAC filtering but has extra layer of access control a you said. Thank you very much!


How do I markup a word document with template directives?

Question: I have the unenviable task of writing a template system that sits on top of word 2007/10/13 which allows people to inject simple logic into the document from a back end data store (TBD but this is likely an exported XML document of some form) in the following forms:

Direct binding to a data element (for example a paragraph/heading/section title)
Repeating a data element a number of times (for example a table body or list)
Providing in-line logic (for example an if-block which checks a business rule result value).

Rather than providing a program to do this on a case by case basis, we want to put this in the hands of the client which means they need to use the authoring tools provided by word. They can use an add-in that we're writing to markup a document, then upload this document as a template to our solution with the above directives in and execute them from there.
I've looked at the following ideas all of which have big holes in them unfortunately.

XML schema. This is gone in Word 2007+ unfortunately though.
Adding an XML namespace to the content.xml file and writing the directives in using attributes in that namespace (easy to post-process then!). Can't work out how to edit these or display them on the document via VSTO unfortunately.
Adding content inline which contains template instructions (don't like this as it breaks the semantic separation between template and document content).
Using content controls (which is fine but only 2013+ have repeat capability without ugly hacks)
Others?

Does anyone have any ideas on the best approach to resolve this problem or workaround for the above issues?
I'm using VSTO + VS2012 as the toolchain and need to target 2007, 2010 and 2013 versions of Word.
Answer: yOu can make a share folder on the client side machine\server to store the Templates.
client can upload new template by doing a copy it on the share folder and then from the Addsin they can link the template back to any option (Depends on the requirements).


Time complexity of solving a set of 2-sat instances?

Question: Suppose I have a set of 2-SAT instances, the set is of size $2^{3C}$ for some constant $C$. What is the time complexity of solving all instances using the fastest known 2-SAT solver?
Comment: [2-SAT (wiki)](https://en.wikipedia.org/wiki/2-satisfiability#Strongly_connected_components) can be solved in polynomial time.
Comment: By the SCC algorithm, the 2-SAT instance is modeled by a directed graph, in which there is one vertex per variable or negated variable, and an edge connecting one vertex to another whenever the corresponding variables are related by an implication in the implicative normal form of the instance. The SCC algorithm itself can be solved by two DFS procedures, in $O(|V|+|E|)$ time.
Comment: So if n is the number of variables and m is the number of clauses, what is the complexity in big O? I also read the same article but could not find a complexity.
Comment: @hengxin Make an answer?
Comment: @YuvalFilmus I am not sure whether it is the answer the OP is asking for because the question mentions the `fastest known 2SAT solver`. Anyway, I have converted my comment into an answer.
Comment: Is there some relationship between your 2-SAT instances?  Are they're related somehow?  If not (if they are arbitrary), the running time is obviously going to be just the number of instances multiplied by the time to solve a single instance.  So what precisely are you asking?
Answer: Although 3SAT problem is NP-complete, there is a polynomial algorithm making use of the beautiful SCC (Strongly Connected Component) directed graph algorithm.
Suppose there are $n$ variables and $m$ clauses in the 2SAT instance $\mathcal{I}$. The parameters $n$ and $m$ represent the size of $\mathcal{I}$
The 2-SAT instance is modeled by a directed graph $\mathcal{G_I}$, with

$2n$ vertices: for each variable $x$ in $\mathcal{I}$, there are two vertices $v_x$ and $v_{\bar{x}}$ (i.e., variable and its negation).
$2m$ edges: for each clause $x \lor y$, there are two directed edges $\bar{x} \to y$ and $\bar{y} \to x$. Note that the latter two implicative forms are equivalent to $x \lor y$.

The polynomial algorithm (it is actually a linear algorithm) proceeds as follows:

Obtain the SCCs of $\mathcal{G_{I}}$ in linear time $O(n + m)$;
Assign True to each literal (Notice: not the variable) in the destination SCC (denoted $SCC_d$);
Delete $SCC_d$ and its corresponding source SCC ($SCC_s$). (Note the symmetry in the graph $\mathcal{G_{I}}$);
Repeat (2) and (3) until $\mathcal{G_{I}}$ is empty.

For example:
$\mathcal{I} = (x_1 \lor x_2) \land (\bar{x_2} \lor x_3) \land (\bar{x_1} \lor
  \bar{x_2}) \land (x_3 \lor x_4) \land (\bar{x_3} \lor x_5) \land (\bar{x_4} \lor
  \bar{x_5}) \land (\bar{x_3} \lor x_4)$
The graph $\mathcal{G_{I}}$ is:


Mysqldump treats some table as View

Question: When doing a mysqldump, some tables are being skipped because mysqldump treats them as View rather than Table although they're 100% tables.
So for some tables it looks like
-- Retrieving table structure for table services...
-- Sending SELECT query...
-- Retrieving rows...

and for some ones:
-- Retrieving view structure for table users...
-- It's base table, skipped

I saw this issue was already mentioned a few times however there's no solution.

SHOW CREATE TABLE users;

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(50) NOT NULL,
  `password` varchar(50) NOT NULL,
...
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8915 DEFAULT CHARSET=utf8

SHOW TABLE STATUS LIKE 'users' \G;

*************************** 1. row ***************************
           Name: users
         Engine: InnoDB
        Version: 10
     Row_format: Compact
           Rows: 6638
 Avg_row_length: 713
    Data_length: 4734976
Max_data_length: 0
   Index_length: 2899968
      Data_free: 469762048
 Auto_increment: 8923
    Create_time: 2015-09-04 10:00:26
    Update_time: NULL
     Check_time: NULL
      Collation: utf8_general_ci
       Checksum: NULL
 Create_options:
        Comment:
1 row in set (0.00 sec)

MySQL 5.5.41-0ubuntu0.14.04.1
Answer:
So for some tables it looks like

Well, it should be that way for all the tables.
That message is generated by the --verbose option, and you should see it on all the tables, when mysqldump makes its second pass through the database.
Because views can't reference nonexistent objects, mysqldump iterates through all of the tables in each database, twice, if views are encountered.  On the first pass, it creates a dummy table for views so that, if it turns out a view references another view, the dummy table stands in place of the target view so that the referencing view can be valid while the restoration of the backup takes place.  If views were encountered, it makes a second pass, dropping each dummy table and replacing it with the actual view.
It does this by calling mysql_list_tables() in the c-client API, which sends "show tables" to the server (after switching the current database).  Since this contains a list of base tables and views, mysqldump has to iterate through each one and decide what the current identifier represents -- a table, in which case, it does nothing because the table was already dumped -- or a view, in which case it drops the dummy table and creates a proper view.  (Why it doesn't discover this information more intelligently is probably related to backwards compatibility with ancient versions of MySQL Server).
In short, this is normal.  The --verbose messages are just telling you something you already knew.  When you see these, mysqldump is iterating through the list of all tables in the database, checking whether they are views or not (for the second time).
The base tables are dumped and dummy view "placeholder" tables are created during the first pass; the base tables are skipped, placeholder tables dropped, and view definitions are dumped during the second pass.
The message -- Retrieving view structure for table users... is poorly worded, since in fact mysqldump is, at that point, checking whether the table is a view, by requesting its CREATE statement from the server, and the message appears to have given the impression in the original question that the table was first mischaracterized as a view, then omitted from the dump because it was not a view. This was an inaccurate perception, as the table had already been dumped during the first pass.
Comment: In original question by @Alexey Kosov , "When doing a mysqldump, some tables are being skipped because mysqldump treats them as View rather than Table although they're 100% tables" ; If I am parsing this answer correctly , that question was wrong : **no real tables were skipped**. It is only mysqldump resolving the tables&views in the second pass. **Working as Designed**
Comment: @Prem yes, that's correct.  Updated to clarify.
Answer: Hm, I just checked and it seems MySQL dumps all the tables properly despite the weird output. So I can just close eyes on that. But if anybody knows what that means, it'd be much appreciated.
Comment: I added an answer as to why
Answer: The reason a view is considered a table has to do with how INFORMATION_SCHEMA represents its existence in the database. (I mentioned this 3.5 years ago in my answer to How is it possible for mysql storage engine to be NULL?)
If you run this query
SELECT IFNULL(table_schema,'Total') db,COUNT(1) ViewCount
FROM information_schema.tables
WHERE engine IS NULL
GROUP BY table_schema
WITH ROLLUP;

you will get how many views appear in each database along with the total views.

Mysqldump treats some table as View


Showing a set $V$ is a vector space over the real numbers

Question: Let $V=\{f : S \to \mathbb{R} \}$ be the set of all the functions $f : S \to \mathbb{R}$. Show that $V$ is a vector space over $\mathbb{R}$ with addition and scalar multiplication defined by:
$(f_1 + f_2)(x) = f_1(x) + f_2(x)$ and $(cf)(x) = cf(x)$ for all $f_1,f_2 \in S$ and $c \in \mathbb{R}$.
I am not to sure what he wants me to show exactly, could it be to show all the other axioms (commutative, distributive, etc.) follow true if addition and scalar multiplication are defined as above?
Comment: you have a set of axioms that define a vector space.  i.e. closure under addition, zero vector, additive inverse, distributive property of scalar multiplication over vector addition.  Show that all hold.
Comment: LaTeX formatting would make your question much more readable...
Answer: Here's an example of something you should write:

We need to show that there's a "zero vector", i.e., a vector $z$ with
  the property that for all $v \in V$, we have $z + v = v + z = v$.
In our case, such a vector must be a function from $S$ to $\Bbb R$. We
  define  $$ z(s) = 0 $$ for every $s \in S$.
Now suppose that $f \in V$. Then for any $s \in S$, we have $$
 (z+f)(s) = z(s) + f(s) = 0 + f(s) = f(s) $$ and similarly,  $$
 (f+z)(s) = f(s) $$ Since functions are equal when their values are
  equal for every element of the domain, we see that $f+z$ and $z + f$
  and $f$ are all equal, as required.
Thus the purported vector space $V$ has an identity for addition,
  namely, $z$.

Now: Why don't you edit your original question to include a proof of one of the other axioms, like $1\cdot f = f$ for any $f \in V$?
Comment: I ended up showing all the axioms, like additive identity, additive inverse and other axioms like f+(-1)f = 0, etc. Thanks!