Noise can be Differential or Common!

Question: I have a basic understanding on this topic but i still have some doubts, my text books says Differential means it will have impact on one of the 2 signal nodes. and Common will have a common impact on both nodes. There is no picture to show what nodes it is talking about! (If possible a description with some basic picture would be easy to understand).
Answer: Imagine a perfect noiseless signal transmitted down two wires and you looked at what was received at the other end. Along the way, noise impregnates the two wires. What you might see at the receiving end is a noise voltage that exists between the two wires (differential). You will likely also see a noise voltage that affects both wires exactly the same with respect to ground (common mode).
The differential noise is effectively added to your signal and unfortunately, cannot be got rid of without special techniques. The common mode noise (both wires affected the same) can be eradicated by a decent differential amplifier i.e. it only amplifies the differential signal and is unaffected by common mode signals or noises.
Here's an example of a sudden spike of common mode noise affecting a differentially transmitted signal: -

The same noise signal affects both wires but, because a differential amplifier is used to receive the signal, that noise is cancelled out in the receiver.
However, if that noise affected one wire more than the other it would produce a differential noise and adds to the signal and cannot be eradicated easily. There are things that can be done but, I feel, it's beyond the scope of the question to go into these.
To avoid common-mode noises (the main source in a lot of installations) becoming differential noise, the following safeguards are observed: -

Differential signals are transmitted
Driving impedances (sending end) are matched
Differential amplifiers are used at the receiver
Receiving impedances to ground are matched
Decent twisted pair is used preferably with a screen

In addition to this, the cable at the receiving end may have a terminator to match impedances and prevent relections.
Comment: Absolutely correct.
Comment: Always the best answers from you !! So, a differential noise occurs when the signals on the two wires are affected differently by the noise! and common noise is when they are affected in the same way.
Comment: Also, is it correct to say that common mode noise are high frequency always? i was reading CM CHOKE and somewhere it says that it blocks common mode noise and somewhere it stops high frequency and allows low frequency to pass!
Comment: NOise is generally not regarded as being high frequency or low frequency. Common mode chokes do deal better with high frequencies though.
Comment: ok!! so is it because the CM chokes are inductive and as a result it is less effective with low frequency noise but more effective with high frequency noise?
Comment: Yes I would think so but they won't necessarily do a great job at 100 MHz for example.
Comment: Ok! understood!

Noise can be Differential or Common!


Simple design for a list of two items with subcategories

Question: I am scientist and I want to create a graphic/chart to display a list of two different star types with some subcategories (some subcategories also have subcategories). Is there some sort of design principle I should follow when wanting to create something for this?
Comment: "Form follows function". What are you trying to communicate with your list? Just present the names? Is there any hierarchy or any other detail that would be relevant? Are the numbers important?
Comment: Hi. Welcome to GDSE. What's wrong with what you have already done?  I think it's reasonably effective and communicates what you want. I'm not sure how rearranging it in some way would improve it TBH.  Maybe [a simple table](https://imgur.com/MWoKBDD) would work, but is it an improvement?
Answer: Opinions:
Graphics do not lift the scientific value, but it can help reading.
Belonging to a category can be visualized by letting the item be inside the area of that category. Your indented list already uses that idea. Do not try any wonky structure tree which forces one to follow a string to see which belongs to which.
Colors can be useful to visualize the areas. But the data content of an area is text, so do not obscure the readability. Faint colors can have easy to read black texts on them, but you cannot have many colors because faint ones easily look the same.
The shortest way to go on is simply to colorize your list. It's also space-effective, all texts can be horizontal and it doesn't create anything which could be considered to be a false illusion of size or importance.
If the writing order presents something it should be mentioned clearly and exactly in the drawing and also in the text.
Coloring example with zero decorations:

The black (or colored) outlines of the areas are useful if there's needed grayscale copies or one wants to help those who cannot see colors. Do not try to use any flashy outline geometries, they cause distraction from the content. A slight rounding is acceptable.
Not asked: Check if the numbering of the categories and items could be removed or at least use something easier than romans like xvii. Of course changing it can be difficult if your text already uses them.


My sample of gallium does not melt

Question: I held gallium under a heat lamp. It didn't melt. I didn't even find a thin film of liquid gallium. Can anyone explain why? Does gallium rust?
Comment: Where did you get it? Are you sure it's gallium? Gallium does rust slowly in air I think, forming an oxide which doesn't melt nearly as easily, but I don't think that would be the case. Try dropping it in some almost boiling water to be sure it doesn't melt.
Comment: It takes quite some time to get gallium to melt. Even my small sample (in a plastic bottle) needs to be kept on a warm (>50 celcius) household radiator for 15-30mins to show much melting.
Answer: Having recently had an opportunity to play around with some gallium of my own, I have a few thoughts.
It's possible you have a different metal than what you thought you had, but frankly, I don't think that's very likely.
It takes a surprising amount of absorbed heat to melt gallium. Putting a sizable chunk of gallium in $35~^\circ\mathrm C$ water doesn't cause it to melt immediately. Even boiling water doesn't melt it instantly. Because gallium is a metal, it conducts heat fairly well, so when heated gently, it won't melt until the temperature of the whole piece gets close to the melting point.
As mentioned by user5134, a shiny metal like gallium isn't going to pick up heat very quickly from a radiative source like a heat lamp. If you wait long enough, it'll definitely melt. If you want to melt the gallium relatively quickly, then you'll want to put it into physical contact with something warm. The standard method for melting solid gallium in a container is to just immerse the closed container in hot water (not boiling water, especially if the container is glass).
Answer: Gallium metal may be obtained in the elemental form.  A classic demonstration is to hold gallium in your hand and watch it melt.
http://astounde.com/wp-content/uploads/2012/06/gallium.jpg
The energy from the heat lamp must be absorbed by the gallium, but if the IR light is reflected, then it may not be getting hot enough to melt.
It's also possible that you have an alloy of gallium and some other metal and that the melting point is higher than for pure gallium.
Answer: Maybe it is another metal.
If you are sure it is gallium try melting it with your hand, smaller pieces melt faster.
Gallium oxide layer is too small to make a difference, it takes hundreds of years for it to completely rust.
It is very important to note that storing it in a metal container will ruin your sample and that storing the gallium while it is a liquid in a glass container is dangerous because it expands when solidifying.
You can also measure gallium' density around 6 g/cm3 with a water cup placing the gallium and seeing how much volume it increased and weighting it (remember that gallium amalgamates metals so measure them with not metal tools.
Divide the weight in grams with the volume and you should get a number lower than 6 and higher than 5.7.
Answer: Elemental gallium does not occur in free form in nature, but as the gallium(III) compounds. So it mustn't be gallium but something else.
Comment: Likewise aluminum, iron, tin, zinc, sodium, magnesium, chromium, etc. Yet these metals can be obtained in pure form from their compounds.
Comment: The asker may have attempted to purchase metallic gallium online. Whether they received what was expected is another matter, though.

My sample of gallium does not melt


Auto-redirect to another HTML page

Question: What is the syntax for making a page auto-redirect to a different HTML file in a separate folder? All of my searching returns how to redirect from one website to another.
Comment: http://stackoverflow.com/questions/5411538/redirect-from-an-html-page check this. Your question seems to be a duplicate of this.
Comment: It depends on what server tech you're dealing with and what your access to them is.  Are you using Apache and can you create a `RewriteRule` in an `.htaccess` file?
Answer: One of these will work...

  <meta http-equiv='refresh' content='0; URL=http://example.com/'>

...or it can done with JavaScript:

window.location.href = 'https://example.com/';
Comment: Window.open is a popup. I think window.location would be better?
Comment: What about security? In isolation, is there any problem with this? If so, is there any addition that can help? Also, is one option better than another?
Answer: <meta http-equiv="refresh" content="5; url=http://example.com/">
Answer: If you're using Apache and can use a .htaccess file you should use the following type of redirect.  Add the following to an .htaccess file in the root of your website.
RewriteEngine On
RewriteRule ^/oldfile_path/file_name\.html$ /oldfile_path/file_name.html [R=301,L]

This has the advantage of being a very fast and immediate redirect.  It also depends on your reason for the redirect.  This is a more permanent method because it sends the HTTP 301 status code signifying that the file has moved permanently and causes many browsers to cache that request.  You can change the code to something else like a 302 for temporary redirects.
Otherwise you can do a simple redirect using an HTML <meta> tag as suggested by others:
<meta http-equiv="refresh" content="5; url=http://example.com/">

By default the content="5" makes that redirect after 5 seconds.  This will be slower and not all browsers support it.  A redirect can also be done in the server language of your choice PHP, Node.js, etc.
Answer: You can use <meta> tag refresh, and <meta> tag in  section
<META http-equiv="refresh" content="5;URL=your_url">

Answer: If you want to redirect your webpage to another HTML FILE, just use as followed:
<meta http-equiv="refresh" content"2;otherpage.html">

2 being the seconds you want the client to wait before redirecting. Use "url=" only when it's an URL, to redirect to an HTML file just write the name after the ';'
Answer: Its a late answer, but as I can see most of the people mentioned about "refresh" method to redirect a webpage. As per W3C, we should not use "refresh" to redirect. Because it could break the "back" button. Imagine that the user presses the "back" button, the refresh would work again, and the user would bounce forward. The user will most likely get very annoyed, and close the window, which is probably not what you, as the author of this page, want.
Use HTTP redirects instead. One can refer the complete documentation here: W3C document
Answer: I'm Maybe kind of late but here is a way to have a redirect for your website and another link if it does not do in auto redirect for them,
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="5; url=YOUR_URL_HERE" />

<title>Page Redirection</title>

If you are not redirected automatically, follow this Link

Auto-redirect to another HTML page


How to trigger onclick for Unity Selectable by script?

Question: As title, I know Button can be triggered onclick by button.onClick.Invoke();
But how to simulate onclick event of Selectable?
Thanks for the help.
Comment: A Selectable can be Selected on click. If it has another reaction to being clicked, that might be implemented by a more specific derived class. Can you tell us more about what this specific object is, and how you've set it up in the Unity Inspector?
Comment: Are you trying to select the object as with [EventSystem.SetSelectedGameObject](https://docs.unity3d.com/2018.2/Documentation/ScriptReference/EventSystems.EventSystem.SetSelectedGameObject.html)?
Comment: @DMGregory I am select the object, but cannot submit/click it.
Answer: As you know:
button.onClick.Invoke();

Acts like the user has clicked the button, invoking callbacks, but there's no visual effect on the button itself.
Do you also want the Selectable to be highlighted as if you'd moused-over it and clicked on it? I.e. a "simulated" click?
If so, the following code works for at least Buttons:
public static void SimulateClick(Button button)
{
    ExecuteEvents.Execute(button.gameObject, new BaseEventData(EventSystem.current), ExecuteEvents.submitHandler);
}

From my (limited) understanding, this uses the EventSystem to create a new "Submit" event on the Button object, as if the user had clicked on it.
I tried it for a Toggle too, and it seems to works fine (Unity 2019.4).
I'm not sure if this is the best way to do it, but it seems legitimate since it's making use of the EventSystem which is designed to manage this kind of interaction.
Answer: You can actually create your own click event by overriding the OnPointerDown(PointerEventData eventData) method. This works perfectly well for normal Mouse Input but sadly not directly for controller input. My code using this method is this:
public override void OnPointerDown(PointerEventData eventData)
{
    base.OnPointerDown(eventData);

    if(!IsActive() || !IsInteractable())
    {
        return;
    }

    //Do stuff here i.e. invoke event or method
}

You can even add the a on click event assignable in the inspector (Like the one on a button element). If you'd like to do that make sure to implement using static UnityEngine.UI.Button; and make a SerializeField private ButtonClickedEvent m_OnClick = new ButtonClickedEvent(); Then you can assign your method in the inspector and call m_OnClick.Invoke(); in the above Method.
This approach is actually pretty similar to the general "Button" UI element, so using this or simply a button will probably not make much of a difference. Nevertheless, this works for me!
I also found out how to add an onClick event that can also be triggered by a controller (by the whole event system):
If you click on the points of a component in the inspector, you can sometimes "edit" the script, even if it is a Unity pre-built component like "Button". This helped me to understand the structure of a Button and helped me to find the solution.
You can implement the interface ISubmitHandler (and others like ICancelHandler , ...) to implement an OnSubmit method which is called every time the submit action, referenced in the eventsystem, is triggered. You can use these to get this working with controller and keyboard!
Hope that helps, cheers! :)


Variation partitioning in vegan. Do variables need to be centered?

Question: I would like to carry out variation partitioning to see how landscape variables and local variables contribute to variation in species richness.  Do I need to centre my data prior to analysis?  Furthermore, my local variables are largely dummy coded factors (0|1) how do I approach this?
Answer: You don't need to centre the variables for varpart() (either the response or the predictors). If you have your variables coded as factors and not dummy variables, then vegan will create the correct contrasts for you.
So for a variable colour with three levels red, green, and blue, you'd have this as a single factor variable in R with those levels:
levs <- c("red", "green", "blue")
env <- data.frame(colour = factor(sample(levs, 100, replace = TRUE).
                                  levels = levs))

rather than three hand-coded dummy variables
env <- data.frame(colourRed = ...., colourGreen = ...., colourBlue =, ....)


How does centripetal force relate to angular momentum? AP Physics 1

Question: The answer to question below is B please tell me why? I thought the answer would be C because by Keplers law and conservation of energy. The total mechanical energy = gravitational potential energy + the kinetic energy, at every point in time energy would be the same because there's not external force. I understand that since there's no net external torque the angular momentum is conserved throughout the whole orbit. Angular momentum is also defined to be the linear momentum times the radius. By Kepler's Law the further away the planet is the slower it will move. Since they sweep out equal area from the planet to the moon in equal time periods. Therefore for angular momentum (Mass x Velocity x Radius) to be conserved if R increase/decrease V does the opposite by the same factor. Please correct me if I'm wrong and explain to me why the answer is B.
Answer: The force of gravitational attraction is an example of a central force because it always points towards a "fixed" point which in this case is the centre of mass of the planet.
This means the the force on the moon due to the planet exerts no torque about the centre of the planet.
If there is no torque exerted on the moon then its angular momentum would be conserved.
Any response in terms of energy, which is also conserved, would require both the kinetic energy and the gravitational potential energy to be known at positions $A$ and $B$.
You would not be able to find a solution "in terms of the given quantities", $(u_{\rm A}, u_{\rm B}$ and $r_{\rm A})$,  as demanded by the question.
Option (C) is incorrect because energy is always conserved irrespective of the direction of any forces.
Answer: In general, you can calculate the properties either by conservation of energy or by conservation of angular momentum. The question here is, do you have enough information to do it by energy. You only know the speeds at A and B and the Radius at A. Try to calculate it both ways and have a look if you have enough data to do it via energy.


Certificate mis-match issue installing Android Test App on AVD using Jenkins

Question: I am having an issue using Jenkins to build and install my Android test project (page down for the actual error).
I have created a simple Android project and corresponding test project, in Eclipse.  I have executed the following:
android update project -p App1
android update test-project -m ../App1 -p App1Test

I can run the test project in Eclipse, the projects build, install on the AVD (already running) and execute correctly.
Also, I can execute the following successfully from the command line:
D:\> adb uninstall com.ss

(remove App1 from AVD if it is already installed)
D:\workspace\App1> ant clean debug

then
D:\workspace\App1Test> ant all clean debug install test

Again, App1-test-debug.apk and App1-debug.apk are built and installed on the AVD, tests are executed.
The problem is when I am trying to do this using Jenkins.
I create 2 Jobs:

App1 - ant targets: clean debug
App1Test - ant targets: all clean debug install test

App1Test is configured to run after App1 is built successfully.
App1 job runs correctly, creating App1-debug.apk.
App1Test appears to run correctly up to the install task.
App1-debug.apk and App1Test-debug.apk are created, but there is an error in the INSTALL task:

install:
       [echo] Installing D:\Jenkins\workspace\App1Test\bin\App1Test-debug.apk onto default
  emulator or device...
       [exec]   pkg: /data/local/tmp/App1Test-debug.apk
       [exec] Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
       [exec] 40 KB/s (14127 bytes in 0.343s)
-set-mode-check:
-set-debug-files:
install:
       [echo] Installing D:\Jenkins\workspace\App1\bin\App1-debug.apk onto default emulator or device...
       [exec]   pkg: /data/local/tmp/App1-debug.apk
       [exec] Success
       [exec] 433 KB/s (13883 bytes in 0.031s)
installd:
-test-project-check:
test:
       [echo] Running tests ...
       [exec] INSTRUMENTATION_STATUS: id=ActivityManagerService
       [exec] INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation
  ComponentInfo{com.ss.test/android.test.InstrumentationTestRunner} from
  pid=2520, uid=2520 not allowed because package com.ss.test does not
  have a signature matching the target com.ss
       [exec] INSTRUMENTATION_STATUS_CODE: -1
       [exec] java.lang.SecurityException: Permission Denial: starting instrumentation
  ComponentInfo{com.ss.test/android.test.InstrumentationTestRunner} from
  pid=2520, uid=2520 not allowed because package com.ss.test does not
  have a signature matching the target com.ss

I understand that both App1 and App1Test need to be signed with the same certificate, which in this case should be the same debug cert.  Why would a different certificate be used for each project?
The full log shows that both apks are signed with the debug cert:
-package:
[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
[apkbuilder] Creating App1-debug-unaligned.apk and signing it with a debug key...

and:
-package:
[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
[apkbuilder] Creating App1Test-debug-unaligned.apk and signing it with a debug key...

I followed Jenkins:Building and testing an Android app, with one exception.  I could not get the test project to build if I used the
tested.project.dir=

property in the Advanced Ant section.  I simply set the correct value in the projects ant.properties file, and committed to SVN:
tested.project.dir=../App1

(sure this is not causing the issue, but though best to document it).
I am really tearing my hair out over this one, if some one can help me regain my sanity, there will be BIG LOVE coming your way.
Using:
android-sdk-16
SVN
ant 1.8
Eclipse Indigo
Answer: Solved....
A test apk must have been installed on the device using a different keystore (not sure how).
So by executing:
adb uninstall com.ss.test

The 'new' test apk installs fine.


How do I remove outlook cached mode and OST file for users with existing mail profiles?

Question: We're a citrix shop, and we've got hundreds of persistent Windows 7 VMs out there mostly running Office 2010 Pro, with disk sizes from 45GB to 100GB each. Ideally, we like Outlook to be set up to not use cached mode from the get-go, but often times its missed during user setup. Anybody know of a way to do this after-the-fact? That is, take outlook out of cached mode and remove the associated OST files and ensure they do not get re-created... given the number of machines it would be nice to be able to do this silently and remotely.
Comment: Are they all on the same domain and complies with group policy? Change the group policy. https://technet.microsoft.com/en-us/library/cc179175.aspx?f=255&MSPPError=-2147217396 - you can use psexec to kill the outlook.exe process, and OST file. Just thinking out loud.
Comment: The VMs are all on the same domain, the users are not.... yet. Thank you for that technet article link! However, it seems that the cached mode group policy is set for users and not machines. It'd be nice to set it for specific computer OUs, since we want to allow laptops to use cached mode, we don't care about physical desktops at the moment, and VMs are in their own OU.
Answer: Okay... here's the answer to my question:
The associated reg key for cached mode for Outlook 2010 & beyond is:
"HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" CachedModeValueName="00036601"
But that varies too much from user to user because there is a different key for each mail profile.
The best way to do it is in fact group policy, and although it is a user policy loopback user policy allows user policy to be applied to a computer OU which will apply to users on those computer resources and take precedence over inherited user policy. We can create a user policy within VDI OU with the "Do not allow an OST file to be created" enabled and "Use Cached Exchange Mode for new and existing Outlook profiles" disabled using ADM templates for Office 2010. This policy will apply to any users logged onto computers within that OU only.
Thanks for everyone's input!


How can this image be turned 'white'?

Question: How can this image be turned white - the figures, clock etc, so that it can be placed on a black background, while still retaining its quality?
Comment: What have you tried?
Comment: Please do not remove images from your questions after asking.
Comment: when you inverse a image you also inverse the gamma correction of the image.
Comment: Are the elements separate? I'm assuming yes since your other question had the human figures on a transparent background, but can you [edit] your question to add more details? Is the clock a vector element or is it all raster?
Answer: One thing to try is a fake metallization trick. It should be done differently to the clock and to the statue figures, but I made a compromise because your attached image has too low quality for easy separation. I guess you have them separately.
First I made (a complex) selection and deleted the white background with it. Layer mask doesn't work here, the BG must be fully transparent, but the white parts in the clock and statue shapes must stay intact. I desaturated and duplicated the remnants of the original and inserted a new black background:

The upper copy got a curves layer (next layer only switch=ON) which simulates solarization:

The result is a little greyish due the ridiculously uncontrollable curve tool of Photoshop. It's practically impossible to adjust it right. The greyness will be fixed later.
The curve doesn't affect to the clock in the right way because there's no right contrast in the right place. That's worked around by inserting layer style Bevel&Emboss > Outer bevel to the lower copy. It generates the wanted light edges. Unfortunately it adds an edge to the statue shapes, too. A good edge to the clock can be too much for the statue figures. That's why they should be separate. I tried to find a compromise.

The greyness can be fixed by inserting a curves layer above all. No layer grouping is needed, because the new curve doesn't lift black:

ADD: Just found your earlier question which had a little better quality statue figures altough still very noisy ones. The next zoomed view shows how bad the image is:

There's no hope of glossy result. There are noise reduction plugins for Photoshop which quite cleverly guess which details are noise and which should be saved. I used Redfield Perfectum for this:

I'm sure advanced Photoshop users get the same without plugins, but I used one to avoid experimenting.
The fake metallization result is clearly more polished now:

Your own attempt in your comment has very coarse clock image which isn't even unsaturated (it has colored noise) and the outer bevel is far too wide. It obscures the text. For perfect result I would redraw the clock and texts in Illustrator.
Comment: I followed your steps and managed to produce [this image](https://i.stack.imgur.com/kUB2R.jpg). But I think it looks quite tacky. Is there a way to make it look more 'polished'?
And I ccan't read the lettering around the inside - it is too thick?
Comment: Always my best compliments for your excellent works.
Comment: In this case, it is better to separate the clock from the humans.
Answer: From what I understand, you want to turn the image white and the background black. One method could be using a negative filter and manually refining the color values.
Answer:
Open the original image in Photoshop. Apply a layer of Gradient Map
(Image 1 and 2).
Duplicate the layer and mask the part you don't want to be white
again; to fix the things (Image 2).
Create an adjustment layer for Levels (Image 3).

Tweaking and playing with these layers might give you the result you want :)
Answer: I think that you need to redraw it completely. But if that is not possible maybe just increase the brightness or something in software like Photoshop or something familiar. When doing this, make sure it is a transparent PNG.

How can this image be turned 'white'?


Measuring Response Times In Combination With WatiN

Question: I'm looking for a tool that I could potentially use in combination with WatiN that would allow me to more or less measure both the response time of an interaction and also the filesize of the same interaction in combination with WatiN. Let's say, I make a google request. That's great, we've all seen that example, but what if I want to see how long that request took and also what was downloaded and how long it took. Does anyone know any tools that can be used programmatically to do this? Sure, there are many tools such as Charles, Fiddler 2 and Firebug that allow you to do this via an interface, but I'd like to be able to automatically generate reports and the like based on this tool.
Answer: Check out HttpWatch:
"HttpWatch is an HTTP viewer and debugger that integrates with IE and Firefox to provide seamless HTTP and HTTPS monitoring without leaving the browser window."
There is an article on the website called Using HttpWatch with WatiN with sample code for using it with WatiN.


How do I disable APC caching just changing any Drupal setting?

Question: Is it possible to disable APC caching completely in Drupal 8 without modifying the php.ini settings (i.e. only by modifying the Drupal settings)?
Answer: There are multiple settings necessary to do so:
in active settings.php:
<code>/**
 * Class Loader.
 *
 * If the APC extension is detected, the Symfony APC class loader is used for
 * performance reasons. Detection can be prevented by setting
 * class_loader_auto_detect to false, as in the example below.
 */
$settings['class_loader_auto_detect'] = FALSE;

// Default cache backend.
$settings['cache']['default'] = 'cache.backend.database'; // or any other alternative cache backend
</code>
After looking at Berdirs comment and diving further into code and looking at more usages of apcu within Drupal it appears to be pretty much impossible to catch every usage / and even if you manage to find all of them - disabling at some points is not possible (e.g. no configuration options present).
Comment: The default isn't going to help you, you need to specifically change each f the fast chained bin, which by default are discovery, config and bootstrap. The default worked by accident before Drupal 8.2, but that was considered a bug and changed. Plus, there are a few things more, for example there is file caching for some yaml files based on Apcu


what is the mass of chromium in this sample?

Question: If the total number of atoms in a sample of potassium dichromate is $2.13\cdot10^{24}$ , then the amount of chromium in this sample is?
the answer that I've come up with is $367.64\ \mathrm g$
but in fact the solution in my book is $33.4\ \mathrm g$.
Comment: Well how did you come up with your answer?
Comment: 2.13*10^24/6.022*10^23=3.54 mol *2=7.07 since the molecular form of the compound is K2Cr2O7 , then I"v calculated the mass by multiplying moles by 52
Answer: I like to solve such assignments using Python as a scientific calculator.
import scipy.constants

# number of atoms in sample
N_ATOMS_TOTAL = 2.13E+24

# atomic mass of chromium
M_CR = 51.9961 # g/mol

# ratio of chromium atoms to total atoms in K2Cr2O7
CR_RATIO = 2/11

# moles of Cr in sample
n_cr = N_ATOMS_TOTAL * CR_RATIO / scipy.constants.Avogadro

mass_cr = n_cr * M_CR # mass of chromium in g

mass_cr

Let me explain:

You have an unknown mass (in gramm) of potassium dichromate, $\ce{K2Cr2O7}$.

The total number of atoms in this sample is $2.13\cdot10^{24}$.

How can you calculate the number of chromium atoms in the sample?

You need to determine the ratio of $\ce{Cr}$ to all atoms in $\ce{K2Cr2O7}$, and that's $\frac{2}{11}$ atoms.

I know the number of $\ce{Cr}$ atoms now, but how many moles is that?

You know that 1 mol of an element has $6.02214129\cdot10^{23}$ atoms of that element (Avogadro's number).
Divide the number of $\ce{Cr}$ atoms determined before by Avogadro's number to determine the number of moles of $\ce{Cr}$.

I know the number of moles of $\ce{Cr}$ now, but what is the weight?

You know that the standard atomic weight of $\ce{Cr}$ is 51.9961.
Multiply  the standard atomic weight with the number of moles to get the weight.
Comment: @119j7fly $\ce{K2Cr2O7}$ has  2 $\ce{K}$ +  2 $\ce{Cr}$ + 7 $\ce{O}$ atoms, that's 11 atoms in total. Two of these are $\ce{Cr}$ atoms. This means that the number of $\ce{Cr}$ atoms in the sample is 2/11 * the total number of atoms :)
Comment: Im so confused :( , I know that when a substance like H20 has 2.5 mol it means H has number of moles=2*2.5 . but If I used the way u solved the question it will be 2 H atoms+1 O atom=3 atoms , to calculate H it will be (2/3)*2.5 and the result is different then :(
Comment: its very clear right now thanx a lot mr Klaus.


Tutorial recommendations for understanding GANs

Question: I understand that generative adversarial networks (GANs) can synthetically reconstruct the input using a generator and a discriminator in a zero-sum game. However, I feel that I do not fully understand the mathematics or usefulness of GANs. Are there any good tutorials or explanations on understanding GANs? I have found few videos to help.
Answer: Ian Goodfellow, the inventor of modern GANs, gave a tutorial at NeurIPS 2016. Video and slides are available, as well as a version written as a paper.
Comment: I was looking through that. I didn't see where the architecture was described between the generator and the discriminator. He had notes the DCGAN architecture, but I didn't find any specifics on the layers in the networks
Comment: That's going to vary depending on the application. You might be intersted in looking at an example model, e.g. https://github.com/osh/KerasGAN/blob/master/MNIST_CNN_GAN_v2.ipynb.
Answer:
However, I feel that I do not fully understand the mathematics or
usefulness of GANs.  Are there any good tutorials or explanations on understanding GANs?

I found these resources to be helpful:

https://stats.stackexchange.com/a/287249/103153
Agustinus Kristiadi. "Generative Adversarial Nets in TensorFlow."
Answer: Late answer, but people may find it useful. I have some recent results on this topic. Specifically, it turns out that the GAN theory presented in Proposition 1 (optimal discriminator) of the original 2014 paper by Goodfellow et al is missing a key condition. That condition is: ${\rm dim}(z)\geq{\rm dim}(x)$, that is, the dimension of the latent variable is at least equal to that of the data, which is the opposite of what usually applies in practice since GANs map a low-dimensional latent space to a high-dimensional generated data space. This is not to say that the GAN technique does not work, but the theory must be approached carefully. The result I am referring to is contained in the paper: Convergence & Optimality Analysis of low dimensional GANs, which was published in Dec 2021 in the IEEE Access online journal, a peer-reviewed source.
Now to the main part of your question that I can help with: "I feel that I do not fully understand the mathematics or usefulness of GANs"
The usefulness of GANs is in their practical applicability: synthetic image generation, where they are a powerful unsupervised learning technique, even if there are convergence problems.
To understand the maths, I recommend you read the second part of the paper referenced above. In particular, there is a simple ${\rm dim}(z)={\rm dim}(x)=1$ least squares GAN (LSGAN) example that has the nice property that the loss function is quasi-analytical - just needing a 1-D Monte Carlo integration to evaluate. Thus the parameter trajectories can be obtained for any starting point and step size in the gradient algorithm. No stochastic sampling is needed; the results are always the same to several significant figures. There is also a comparison with the usual stochastic gradient ascent-descent algorithm. This is the only work I am aware of where an analytical GAN has been compared with its sampled counterpart and the results shown to agree.
Note that the GAN loss function usually can't be obtained exactly since it needs the data PDF, which is unknown; but in the example it is explicit.
It turns out that the parameters of this very simple LSGAN converge to a plateau, not a saddle point. A good amount of insight into the functioning of GANs in higher dimensions can be obtained from this quite simple example, although it doesn't explain mode collapse. The paper also has some interesting visualisations, including a powerpoint presentation 1-D Analytical LS-GAN talk with more material available in the log at Low-dimensional GAN project.
I hope you find the material interesting and helpful.


How to connect to a peer in ethereum and then run contract on ethereum?

Question: I have developed a smart contract and run it with remix in cases of javascript vm and web3 provider.
Now, I want to run it such that my computer to be connected to real ethereum network.
I think in case of using web3 provider in remix, I am not connected really to ethereum and it's like a simulation, isn't it?
Answer: To run it on main network of Etherum You need to do it using MyEther Wallet or MetaMask.

First Download Myetherwallet (it will take time to sync to main Etherum network) . So be patient
If you want to just Test your Smart Contract then I would suggest you do it using "Ropsten Test Network" which can be switched to under Development Tab in MyEther wallet App.(Even this needs to be Synced)
For Deploying your Smart Contract you would be needing some Ether , so for that use Ropsten faucet .
Now that you have your Account set up and some Ethers in your account ,start Deploying your contract
Make Sure you are not on Main Etherum Network but on Ropsten Test Network which is similar to Main Etherum Network but for Testing smart Contract.
Hope it helps.


Precompiled headers: do's and don'ts?

Question: I know precompiled headers are used for speeding up compilations, but are there any do's and don'ts to what files I should include in them? For example, I have a project that uses a lot of boost libs so I just include the boost header files in stdafx.h (I'm using VS2008). Should I include every standard header file in them, too? Will this increase the size of my executeable even if I, for example, include <vector> but never use std::vector? Is it a bad idea to include my own project's header files in stdafx.h?
Answer: Generally speaking, every header file that you use across the application and that doesn't change often should go into the precompiled header file. This will speed up compilation because the precompiled header file gets compiled only once.
If you add a header file which changes often, you'll miss the point of the precompiled header file, because this often-changing header file will cause your whole project to recompile, possibly unnecessarily.
Specifically,  defines a template class, so if you won't use std::vector, the overhead will not be big. However, I would advise against adding header files - however standard and generic - if you don't really need them. There IS some overhead to the compilation time, the binary size, and it could cause conflicts later in the project, so why add something if you don't really need it?
Answer: Pre-compiled headers don't affect the size of your executable, only the compilation speed. Since they are pre-compiled, they don't have to be re-compiled all the time. Windows.h is the primary beneficiary of this feature.
Answer: It's a good idea to include the c++ standard header-files and the boost library headers and any other headers from third party libraries that you frequently use. This will not affect the size of your executable.
However, you should not include headers from your own project, since the whole project needs to be rebuild whenever you make changes in these headers.

Precompiled headers: do's and don'ts?


How long is the notice period by the landlord for a furnished room in an apartment in the same house as the landlord?

Question: Details:

The tenant is single.

The tenant cannot enter the landlord's apartment.

The landlord owns the entire house.

The agreement was verbal

The apartment has two rooms, but only one is rented out, the other is furnished but empty and locked.
Comment: Points 1 and 4 are AFAIK irrelevant in German law. What is relevant, though, is whether the landlord lives in that house (seems to be the case according to the question title), and whether the house has more than 2 flats (one where the landlord lives and the tenant's).
Answer: If the house has only two apartments, the one the landlord lives in and the one the tenant lives in, § 573a BGB is relevant as well:

Section 573a
Eased termination by the lessor
(1) The lessor may also terminate a lease of a dwelling in a building inhabited by the lessor themselves and having no more than two dwellings without this requiring a legitimate interest as defined in section 573. The notice period in this case is extended by three months.
(2) Subsection (1) applies accordingly to residential space inside the dwelling inhabited by the lessor themselves to the extent that the residential space is not exempt from lessee protection under section 549 (2) no. 2.
[...]

The usual procedure in §573c (as cited by K-HB) always requires a legitimate interest of the landlord to terminate the contract (§573). The exemption here does not require such an interest, and instead prolongs the notice period.
Answer: The relevant norm is § 573c BGB:

Periods of time to be observed in giving notice of termination in accordance with usual procedure
(1) Notice of termination is permissible at the latest on the third working day of a calendar month with effect for the end of the second month thereafter. The notice period for the lessor is extended, by three months in each case, five and eight years after the residential space has been made available to the lessee for the latter's use.
(2) For residential space that is leased only for temporary use, a shorter notice period may be agreed.
(3) For residential space under section 549 (2) no. 2, notice of termination is permissible at the latest on the fifteenth day of a month with effect for the end of that month.
(4) An agreement deviating from subsections (1) or (3) to the disadvantage of the lessee is ineffective.

In (3) it is referring to the case nvoigt cites in his answer: "residential space that is part of the dwelling inhabited by the lessor themselves and that largely is to be furnished with furniture and fixtures by the lessor, provided that the residential space has not been made available for permanent use to the lessee with their family or with persons with whom the lessee maintains a joint household set up on a long-term basis,".
I don't think the case you describe, is not meant hear: The landlord has an own flat and only lives in the same house. So § 573 (1) is the relevant norm: normally a bit less than 3 months, after some years longer.
A verbal renting contract is highly unusual in Germany, but perfectly legal. Most regulations in the standard contracts only repeat the law, so the difference is not big.

nvoigts answer is not correct. The law has a standard notice period for any case of rent. One has to read the law carefully to find it, but it is there.
Answer: There are a lot of laws handling rent in Germany. However, those do not apply to this case, since:
Bürgerliches Gesetzbuch (BGB) § 549 Auf Wohnraummietverhältnisse anwendbare Vorschriften says:

(2) The provisions [...] shall not apply to tenancies of

[...]
living space which is part of the dwelling occupied by the landlord himself and which the landlord has to furnish predominantly with fixtures and fittings, provided that the living space is not let to the tenant for permanent use with his family or with persons with whom he has a permanent joint household,

With a verbal contract, it is assumed that the default legal provisions apply. Any deviation from this would need to be proven by the party that claims the verbal contract differed.
But there are no legal defaults, since all the renter laws do not apply in this conditions.
So if you think you have any rights at all, the burden of proof is on you.
The only thing you have going for you is that they cannot kick you out for days you already paid for, without giving you that money back.

A personal note... not having a written contract is highly suspicious in Germany. I have written contracts for vacation homes, hotel stays, dorms... any kind of stay really. I mean they need my bank details, my identification and all those things. Having nothing but a verbal contract smells of planned abuse and possible tax evasion on the landlords part. Especially if you only paid in cash, I cannot think of a normal reason for that, other than tax fraud.
Comment: BGB §549(2)2 is for *subletting*, e.g. you rent a room in the flat/house of someone else that is not separated from the rest of the housing unit - commonly called in german "Untervermietung". OP might have only one room in a whole appartment that is not accessible by the landlord usually, very much akin to a "Monteurswohnung", which usually falls under BGB§549(2)1


Is there a way to disable custom webkit scrollbars?

Question: Is there an extension, custom user stylesheet, etc. that will disable or revert the customization of scrollbars in Webkit based browsers like Google Chrome?  I like the plain, native scrollbars but I cannot seem to find a combination of CSS to make them come back once they have been styled by CSS.
Comment: The webkit-scrollbar occurrences can be found in chrome_child.dll in later versions.
Comment: replicate the native scrollbar in css, then inject that stylesheet using a extension.
Answer: Unfortunately, the CSS cannot be "disabled" or reverted once activated:

::-webkit-scrollbar cannot be simply overridden to get the default style, the only way to do it is to remove all ::-webkit-scrollbar rules from the code. At that point, scrollable areas have to be forced to redraw the scrollbars. To do that you either quickly add and remove display:none; from  or do the same thing with overflow:hidden; on scrollable elements. The problem with the first one is that the page flashes white at every page load; the second one is resource-intensive as it would have to whether check any element on the page overflows—not ideal.

The link above is from a script that will remove the custom bars completely, leaving you with no scroll bar.
Comment: If they are still scrollable areas, wouldn't it render a regular scrollbar? Embedded iframes get scrollbars, so I figured the same would be true for other things that overflow. I mean, I'd expect something like http://backbonejs.org/ with its #sidebar div.
Answer: Open your web browser executable in a binary-clean text editor or hex editor, and replace all occurrences of "webkit-scrollbar" with some other junk like "webkit-scrollb4r". I just tried this with Chrome and it solves the problem.
Comment: Is modifying a compiled executable really safe? Wouldn't it be better to download Chromium source, modify it and compile it?
Comment: This would invalidate any digital signatures of the chrome.exe build, fwiw - so you may get scary warnings every time you try to open Chrome.
Answer: I took @bumfo's answer, and fixed this security issue on chrome: https://stackoverflow.com/questions/49161159/uncaught-domexception-failed-to-read-the-rules-property-from-cssstylesheet
If you paste this in your console, you'll get your scroll bars back:
for (var sheetI = 0; sheetI < document.styleSheets.length; ++sheetI) {
    var sheet = document.styleSheets[sheetI];
    try {
        var ruleSet = sheet.rules || sheet.cssRules;
        for (var i = 0; i < ruleSet.length; ++i) {
            var rule = ruleSet[i];
            if (/scrollbar/.test(rule.selectorText)) {
                sheet.deleteRule(i--);
            }
        }
    } catch (e) {
        console.warn("Can't read the css rules of: " + sheet.href, e);
    }
};

Here's a chrome extension with this: https://chrome.google.com/webstore/detail/default-scrollbar/nkjmoagfbmeafonfhbkeicjdhjlofplo
And its github repo: https://github.com/ubershmekel/default-scrollbar
Answer: As discussed here, it does not seem feasible to reset Chrome scrollbars with CSS, but you can always override them.
/* Adjust as desired */

*::-webkit-scrollbar {
    all: initial !important;
    width: 15px !important;
    background: #d8d8d8 !important;
}
*::-webkit-scrollbar-thumb {
    all: initial !important;
    background: #7c7c7c !important;
}

*::-webkit-scrollbar-button { all: initial !important; }
*::-webkit-scrollbar-track { all: initial !important; }
*::-webkit-scrollbar-track-piece { all: initial !important; }
*::-webkit-scrollbar-corner { all: initial !important; }
*::-webkit-resizer { all: initial !important; }

Comment: You can also use the following extension with `*` as the site selector to apply this to all websites, preventing them from messing around with the scroll: https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha/related?hl=en-GB
Answer: Note: this answer is last tested in 2015, may not work in newer environments.
The code below is a user script that removes every css rule matching ::-webkit-scrollbar.
// ==UserScript==
// @name         My Fancy Scrollbar Userscript
// @namespace    http://your.homepage/
// @version      0.1
// @description  enter something useful
// @author       You
// @match        http://*/*
// @grant        none
// ==/UserScript==

[].forEach.call(document.styleSheets, function(sheet) {
    for (var i = 0; i < sheet.rules.length; ++i) {
        var rule = sheet.rules[i];
        if (/::-webkit-scrollbar/.test(rule.selectorText)) {
            sheet.deleteRule(i--);
        }
    }
});

Comment: Please provide an explanation of what this is. What would you do with this code?


Facebook get data

Question: I am not familiar in drupal 8. How do I get facebook information like posts, events, album, video? and want to be displayed as a node. can anyone help me on this.?
Answer: You mean that you want people to register to you Drupal 8 site so they will be able to see their Facebook data?
With Simple FB Connect you can give users the ability to register to Drupal by accepting the condition of your Facebook App and you'll be able to save data from their profile as nodes and display them later.
You need to use hook_simple_fb_connect_registration (see the function inside the module in order to understand how it works)

Facebook get data


Unable to use mex on R2010a

Question: I'm using Matlab R2010a. I need to create a custom block embedded with my code for which i require mex. I have Visual Studio Express 2010 installed on my system. I followed the instructions and installed the mex patch for R2010a into the matlabroot folder using the unzip command. I also installed Windows SDK 7.1 64 bit as recommended. However when i type        mex -setup no compiler is shown. Any alternative solutions?
Comment: If you pay for your Matlab installation, make sure you ask their Tech Support this question.
Answer: Is your matlab 64Bits? I don't think it supports mex (or there is some problems. I don't remember). I had this problem and switched to a newer version.

Unable to use mex on R2010a


Can a prediction be better with insignificant variables than with only significant variables (or none at all)?

Question: I have two OLS models and want to do an out of sample prediction for wages on a test set. In the first model I excluded the insignificant variable. The second model has the insignificant variable. The second model yields a better prediction because it has a smaller mse then the first model.
How could that be? What's the explanation for this result? Have you maybe a reference where somebody had the same results for prediction with significant and insignificant coefficients?
Answer: If you are interested in prediction accuracy then in general I'd advise you to not be that concerned with the statistical significance of predictors.
There may be certain predictors that you think should definitely be significant (for example, if you were modeling ice cream sales and had a variable for time of year), and if they are not, that may indicate some kind of specification issue.
I also like to include rules if I expect certain variables to have a specific sign (eg, temperature should have a positive effect on ice cream sales)-- if the sign is wrong there is some kind of issue.
And finally I also like to use rules for the magnitude of certain coefficients. For example, if predicting the weekly sales of televisions, a variable representing thanksgiving/black friday week should not only be positive but it should be at least 2 because the sales will at least be doubled.
Concern over the significance of predictors is more appropriate when you are concerned with the effect of x on y, rather than the prediction of y. Some may disagree with me here-- I think there's some philosophical differences in the approach in an academic/theoretical setting and in industry where you simply must make a prediction and want to do whatever gives the best possible prediction against a holdout/validation set.
Comment: And how about a sample selection bias problem in a wage estimation. I mean if i do two ols regressions one with sample selection correction by using lambda from the heckit method (inverse Mills'Ratio) and one without the sample selection correction term. If lambda is not signifcant it means i have no sample selection bias. If  I do with both models an out of sample prediction and the model with the insignifcant lambda yield a better mse value how can explain the result?
Comment: I'm not familiar with that. You said insignificant lambda = no bias so wouldn't you expect better prediction? Nevertheless, to apply the same principles I mentioned above if something in the model results/output doesn't make sense then pay attention to it. If your sample is biased and prediction is better then perhaps your out of sample set is also biased. Or perhaps it was random chance, and you should not assume such "luck" in the future.
Comment: insignficant lambda means the regression coeffcients are not biased so no sample selection correction is needed https://en.wikipedia.org/wiki/Heckman_correction
Answer: We should note that p-values a measure of strength against the hypothesis that a given coefficient is zero. Note that this does not directly give us any statement about the predictive power of the given coefficient. For example, in truth it may be a very powerful predictor but we have not collected evidence in regard to this coefficient, so really there's no strong reason to think that a model with insignificant predictors should do worse than one with only significant predictors.
In general, p-values should not be seen as tool to improve predictive models. Building accurate predictive models leads to very different strategies, such as tuning complex penalized models with cross-validation.
Answer: The significance of a predictor corresponds to an "added last" test; given all the variables in the model, how much variability is explained in the outcome by adding the predictor in question? If the other predictors in the model are highly associated with the predictor in question, then there is little it will add to the prediction of the outcome, even if on its own it is a good predictor of the outcome.
For a set of highly correlated predictors, it may be that the added last tests for each of them are nonsignificant because each individually doesn't do more than the variables already in the model, even though together they explain the outcome well. So, it's possible for a set of predictors to jointly explained the outcome well even if none or few of the predictors are significant.
because of this phenomenon, you should not consider the significance of a variable in determining whether to include it in a predictive model. You might use other variable selection techniques that are separate from statistical significance if you want a parsimonious model. Otherwise, you might end up discarding a well-performing model just because many of its predictors are nonsignificant, which could be an artifact of the fact that significance depends not only on preditive ability but also on correlation with other predictors in the model.
Comment: The desire for a parsimonious model in this setting is misplaced.


How does an operator on the form $e^{\beta \hat{H}}$ act on a eigenstate?

Question: The notion of operators in exponentials is a bit confusing to me. I know that that in some cases one can use the Taylor series of $e^x$, but how do you work with them when that's not the case?
Comment: Generally if $A | v \rangle = \lambda | v \rangle$, then $f(A) | v \rangle = f(\lambda) |v \rangle$. (Also, I haven't run into a case where you're not allowed to use the Taylor series; that's how we define $e^{\beta H}$ in the first place.)
Comment: The exponential of a self-adjoint operator on an invariant domain from the maximal domain of the operator is defined by means of the so-called "functional calculus", i.e. the exponential is mapped to the von Neumann spectral decomposition of that self-adjoint operator. See also here: https://mathoverflow.net/questions/95334/the-exponent-of-self-adjoint-operator
Answer: $\newcommand{\ket}[1]{\left| #1 \right>}$Let's take a step back and look at an arbitrary linear operator $H$ (I don't like putting hats on operators). You probably know from your linear algebra classes how to act on a vector $\ket \psi$. Well it is just $H \ket \psi = \ket \varphi$, which is of course another vector in your vector space, which I have called $\ket \varphi$. Now you probably also know, how $H^2$ acts on a vector; namely you just act with the operator $H$ twice:
$$H^2 \ket \psi = H (H \ket \psi) = H \ket \varphi =  \ket \chi$$
where I defined the vector $\ket \chi := H \ket \varphi $
By induction, you also know how $H^n$ acts for $n \in \mathbb N$.
Remember also that you are in a vector space that is you can add two vectors, and in particular two linear operators. For example, let's look at the operator $H^2+H$:
$$ (H^2+H) \ket \psi = H^2 \ket \psi + H \ket \psi = \ket \chi + \ket \varphi   $$
Again by induction you know for a polynomial $p(x) = \sum_{k=1}^n a_k x^k$, where $a_k \in \mathbb C$ some constant coefficients, how the operator $p(H)$ acts on states:
$$ p(H) \ket \psi = \sum_{k=1}^n a_k (H^k \ket \psi) $$
Without worrying too much about convergence issues (we are physicists (!)), we can define the exponential map of an operator:
$$  \exp(H) = \sum_{n \in \mathbb N} \frac{1}{n!} \, H^n \implies \exp(H) \ket \psi = \sum_{n \in \mathbb N} \frac{1}{n!} \, (H^n  \ket \psi) $$
The upshot is that you have to define the exponential of an operator and there is no way around it. There is however a special case, when for example you have an eigenvector of the operator. Let's assume that the vector $\ket E$ is an eigenvector of $H$ with eigenvalue $E$ i.e. $H \ket E = E \ket E$, then we have:
$$ \exp(H) \ket E =  \sum_{n \in \mathbb N} \frac{1}{n!} \, (H^n  \ket E ) =  \sum_{n \in \mathbb N} \frac{E^n}{n!}\ket E  = \exp(E)\ket E$$
In analogy, you can convince yourself that if you can write a function $f$ in taylor series and if $\ket E$ is an eigenvector of $H$ as above then we have $f(H) \ket E = f(E) \ket E $.
I hope that this helps you understand the exponential of an operator. If you have question, don't hesitate to ask!
Answer: The exponential of an operator is defined by its series expansion:
\begin{align}
e^{\beta \hat H}&= \hat 1 +\beta \hat H+\frac{1}{2}\beta^2\hat H^2+\ldots  \, ,\\
&=\sum_{k=0}^\infty \frac{\beta^k \hat H^k}{k!}\, .\tag{1}
\end{align}
If $\vert\psi\rangle$ is an eigenstate of $\hat H$ so that
$$
\hat H\vert\psi\rangle=\lambda\vert\psi\rangle\, ,\quad
\hat H^2\vert\psi\rangle=\lambda^2\vert\psi\rangle\, ,\quad
\hat H^n\vert\psi\rangle=\lambda^n\vert\psi\rangle
$$
then
$$
e^{\beta \hat H}\vert\psi\rangle
=\sum_{k=0}^\infty \frac{\beta^k \hat H^k}{k!}\vert\psi\rangle
=\sum_{k=0}^\infty \frac{\beta^k \lambda^k}{k!}\vert\psi\rangle
=e^{\beta \lambda}\vert\psi\rangle\, .
$$
If $\vert\psi\rangle$ is not an eigenstate, there are fewer options.  First, work out in details
$$
e^{\beta \hat H}\vert\psi\rangle=\sum_{k=0}^\infty \frac{\beta^k \hat H^k}{k!}\vert\psi\rangle \tag{2}
$$
and hope that each $\hat H^k\vert\psi\rangle$ can be simplified.  This occurs, for instance, with Pauli matrices where - say - $\hat H=\sigma_j$ and $\sigma_j^2=\hat 1$ for any $j=x,y,z$.   It may then be possible to resum the series in  (2).
The second alternative is to expand $\vert\psi\rangle$ in terms of eigenstates of $\hat H$.  Thus, if $\vert\mu_\alpha\rangle$ is such that
\begin{align}
\hat H\vert\mu_\alpha\rangle&=\lambda_\alpha\vert\mu_\alpha\rangle\, ,\\
\vert\psi\rangle&=\sum_{\alpha}\vert\mu_\alpha\rangle\langle \mu_\alpha\vert\psi\rangle
\end{align}
then
$$
e^{\beta \hat H}\vert\psi\rangle=\sum_{\alpha}e^{\beta\hat H}\vert\mu_\alpha\rangle\langle \mu_\alpha\vert\psi\rangle
=\sum_{\alpha}e^{\beta\lambda_\alpha}\vert\mu_\alpha\rangle\langle \mu_\alpha\vert\psi\rangle
$$
which cannot be resummed further in general.
You can still calculate, for instance,
\begin{align}
\langle\psi\vert e^{\beta \hat H}\vert\psi\rangle &=
\sum_{\alpha\kappa}e^{\beta \lambda_\alpha} \langle\psi\vert\mu_\kappa\rangle
\langle \mu_\kappa\vert\mu _\alpha\rangle\langle \mu_\alpha\vert\psi\rangle\, ,\\
&=
\sum_{\alpha}e^{\beta \lambda_\alpha} \langle\psi\vert\mu_\alpha\rangle
\langle \mu_\alpha\vert\psi\rangle
\end{align}
where $\langle \mu_\kappa\vert\mu _\alpha\rangle=\delta_{\mu\alpha}$ has been used.
Answer: The definition of the matrix exponential comes straight from the Taylor expansion of $e^x$. Thus, you can always substitute the matrix exponential for its definition.
You can still use the Taylor expansion in the example you provided. You just take $x$ to be $\beta \hat{H}$ and apply the Taylor expansion as you would normally.


PGP Encryption before generating a csv file

Question: I 'm generating a csv file and uploading in Azure Blob Storage however I have a requirement where I also need to encrypt using PGP encryption, I followed this tutorial "https://www.codeproject.com/Articles/457453/PGP-Encryption-with-Csharp" it seems tedious and secondly it is encrypting after the file is generated, I need to encrypt before generating and uploading in Azure Blob, could you please help.
Answer: Get your csv data (string) to a memory stream / byte array and then use Bouncy Castle encryption utilities to encrypt that data. after encryption you can write the stream / byte array to a file and upload  to azure.
http://www.bouncycastle.org/csharp/ contains samples
Comment: thanks I did some changes however how to pass the public key in memory stream instead of FileStream?


How can I make my writing more interesting?

Question: For some reason my writing is really boring. I think its because I write in the character's point of view and I suck at that. How can I fix this?
Comment: Maybe you are a boring person? If you don't have a good imagination or interesting experiences to draw from, things you write about will be boring. Try having some interesting experiences. Knock over a liquor store or something, get the juices flowing.
Comment: Maybe a better title: How to write an interesting story without writing from a single point of view? (If you can't do it well, don't do it. Many other people can do it better in that case. Do what you can do well.)
Comment: Use more words like "yellow" and "caretaker." And make sure to utilize the letter q.
Answer: I assume you're writing in the first person. (Writing from a single character's point of view can be done in third person too.)
A trusted instructor told me that writing in first person should only be done when (a) the character has a unique voice or (b) the narrator is not the main character, but is telling someone else's story.
I haven't always followed his advice, but I present it to you as something to try. If you want to continue in first person, then either give your narrator a unique voice (Read "The Prophet from Jupiter," one of my fave stories) or make a secondary character your narrator (The Great Gatsby might be the most famous example).
Answer: First of all, you're actually making it difficult for yourself by writing from a single character's point of view. Presumably your perspective character is the same person as your hero. Don't do that I suggest.
Some authors do it successfully only if the plot really requires it and the plot has sufficient novelty in other ways.
Here is a structure that I like. I call it the Spear on Mount Fuji plot, and think it works and is fun to fill out into a story. It is is easy to use to get emotional impact. Focus on behavior. Results are more surprising when they are occur: the reader did not already know who was thinking what leading to action.
This structure also works if you get stuck in deciding where the story is to go at a point.
Introduce another character at whatever point in the story you are at. It doesn't really matter who they are. They can leave or disappear for any other reason. Have them now ask a question.
Here you have the perspective (main) character (not necessarily the hero) answer it.
Switch to the hero of the story and also have them answer the question casually in dialogue. In a different way. Let the difference work for you converging toward the end. The goal is to make a contrast in outcomes, not necessarily positive, but what is more probable for the story.
From here the narrative follows him for a bit. It introduces a secondary perspective character who goes along. His reports on behavior is what the reader knows. The hero merely talks or acts. You don't know what he or she is thinking.
Have the answer the hero goes anticipate the ending but this does not become clear until later. Let the ending be in significant contrast to most of the narrative, positive or negative.
Make sure incidental characters that appear early and disappear for most of the story play a large role in the end, and behave contrary to their earlier behavior. Make some up precisely for this to happen. This gives some organization to where your story can go at any place, and makes it easier to write well.
Return to the perspective character, making a third perspective character to switch between them and report on what's occurring. Proceed swiftly to the end.
Compress the action and description. This makes sure the action can be anticipated in retrospect but novel when it occurs, disorienting and fast paced. Actions happen quickly in real life, faster than described, while speech usually takes more time in real life.


What are the advantages of using the C++ Boost libraries?

Question: So, I've been reading through and it appears that the Boost libraries get used a lot in practice (not at my shop, though). Why is this? and what makes it so wonderful?
Comment: C++ is crap without Boost :)
Answer: Boost is used so extensively because:

It is open-source and peer-reviewed.
It provides a wide range of platform agnostic functionality that STL missed.
It is a complement to STL rather than a replacement.
Many of Boost developers are on the C++ standard committee. In fact, many parts of Boost is considered to be included in the next C++ standard library.
It is documented nicely.
Its license allows inclusion in open-source and closed-source projects.
Its features are not usually dependent on each other so you can link only the parts you require. [Luc Hermitte's comment]
Comment: In addition, we can also say that boost sub-libraries can be used independently of each other (except a few core libraries). It is not because we are using boost.shared_ptr that we have to use boost.ublas, for instance.
Comment: I love to see answers that look like encyclopedia entries.  It makes it so easy to get a large amount of material.  +1
Comment: Althrough it seems that every library is dependent on MPL...
Comment: Boost allows for write once, cross-platform development and usage correct?
Comment: Is it free for commercial use?
Answer: From the home page:

"...one of the most highly regarded and expertly designed C++ library projects in the world."
  — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards
"Item 55: Familiarize yourself with Boost."
  — Scott Meyers, Effective C++, 3rd Ed.
"The obvious solution for most programmers is to use a library that provides an elegant and efficient platform independent to needed services. Examples are BOOST..."
    — Bjarne Stroustrup, Abstraction, libraries, and efficiency in C++

So, it's a range of widely used and accepted libraries, but why would you need it?
If you need:

regex
function binding
lambda functions
unit tests
smart pointers
noncopyable, optional
serialization
generic dates
portable filesystem
circular buffers
config utils
generic image library
TR1
threads
uBLAS

and more when you code in C++, have a look at Boost.
Answer: Because they add many missing things to the standard library, so much so some of them are getting included in the standard.
Boost people are not lying:

Why should an organization use Boost?
In a word, Productivity. Use of
  high-quality libraries like Boost
  speeds initial development, results in
  fewer bugs, reduces
  reinvention-of-the-wheel, and cuts
  long-term maintenance costs. And since
  Boost libraries tend to become de
  facto or de jure standards, many
  programmers are already familiar with
  them.
Ten of the Boost libraries are
  included in the C++ Standard Library's
  TR1, and so are slated for later full
  standardization. More Boost libraries
  are in the pipeline for TR2. Using
  Boost libraries gives an organization
  a head-start in adopting new
  technologies.
Many organization already use programs
  implemented with Boost, like Adobe
  Acrobat Reader 7.0.
Answer: A few Boost classes are very useful (shared_ptr), but I think they went a bit nuts with traits and concepts in Boost. Compile times and huge binary sizes are completely insane with Boost, as is the case with any template-heavy code. There has to be a balance. I'm not sure if Boost has found it.
Comment: You forget that Boost is not one library but many. Additionally, you have to offset the large size and compile time against the functionality. Traits and concepts are a great help in development. Compile time is a small price indeed to pay for it.
Answer: It adds libraries that allow for a more modern approach to C++ programming.
In my experience many C++ programmers are really the early 1990s C++ programmers, pretty much writing C++ classes,  not a lot of use of generics.   The more modern approach uses generics to compose software together in manner thats more like dynamic languages, yet you  still get type checking / performance in the end.    It is a little bit ugly to look at. But once you get over the syntax issues it really is quite nice.   Boost gives you a lot of the tools you need to compose stuff easily.   smart pointers, functions, lambdas, bindings, etc.   Then there are boost libraries which exploit this newer way of writing C++ to provide things like networking, regex, etc etc...
if you are writing lots of for loops, or hand rolling function objects, or doing memory management, then you definitely should check boost out.
Answer: BOOST's a collection of libraries filling needs common to many C++ projects.  Generally, they do prioritise correctness, reusability, portability, run-time performance, and space-efficiency over readability of BOOST implementation code, or sometimes compile times.  They tend not to cover complete high-level functional requirements (e.g. application frameworks), and instead (thankfully) offer building blocks that can be more freely combined without dictating or dominating the application design.
The important reasons to consider using BOOST include:

most libraries are pretty well tested and designed: they generally get a reasonably sound review by some excellent programmers, compared to by people with home-brew solutions in the same problem space, and widely used enough to gather extensive real-world feedback
it's already written and your solution probably isn't
it's pretty portable (but that varies per library)
more people in the C++ community will have a head-start in helping you with your code
BOOST is often a proving ground for introduction to the C++ Standard, so you'll have less work to do in rewriting your code to be compatible with future Standards sans BOOST
due to the community demand, compiler vendors are more likely to test and react to issues of correctness with BOOST usage
familiarity with boost libraries will help you do similar work on other projects, possibly in other companies, where whatever code you might write now might not be available for reuse

The libraries are described in a line or two here: http://www.boost.org/doc/libs/.
Answer: Because the C++ standard library isn't all that complete.
Answer: Boost basically the synopsis of what the Standard will become, besides with all the peer review and usage that Boost gets you can be pretty sure your getting quite a good deal for your dependencies.
However most shops don't use Boost, because its an External Dependency. And in reality reducing External dependencies is very important as well.
Answer: Boost is to C++ sort of like .NET Framework is to C#, but maybe on a smaller scale.
Answer: Anything with Kevlin Henney's involvement should be taken note of.
Answer: I use the filesystem library quit a bit, and the boost::shared_ptr is pretty nifty.  I hear it does other things too.


Commutator of derivatives with torsion

Question: I am currently looking at "Physical aspect of space-time torsion" by IL Shapiro. There in eq. 2.10, it mentions that in space-time with torsion the commutator of covariant derivatives acting on the scalar $\phi$ gives $$[\nabla_\mu, \nabla_\nu]\phi = K^\lambda_{~~~\mu\nu}\partial_\lambda \phi$$
Where $K$ is the contorsion tensor. Clearly this is incorrect. Shouldnt we instead have
$$[\nabla_\mu, \nabla_\nu]\phi = T^\lambda_{~~~\mu\nu}\partial_\lambda \phi$$
Where $T$ is torsion? Or am I missing something?
Comment: You should specify the equation no. or page no. etc. while citing a specific equation from a reference.
Answer: Torsion is always defined by
$$
T(X,Y)= \nabla_X Y-\nabla_y X -[X,Y]
$$
and the curvature is defined by the commutator on a vector field as
$$
[\nabla_X,\nabla_Y] Z - \nabla_{[X,Y]}Z=R(X,Y)Z.
$$
This last equation holds both  with and without torsion in the connection.
On a scalar the commutator is given by
$$
[\nabla_X,\nabla_Y]\phi - \nabla_{[X,Y]}\phi= 0
$$
as  the scalar does not see curvature. So, using the coordinate basis vectors $X=\partial_\mu$, $Y=\partial_\nu$, we have
$$
[\nabla_{\partial_\mu},\nabla_{\partial_\nu}]\phi=0.
$$
It's not safe  to write $\nabla_{\partial_\mu}$ as $\nabla_\mu$ as this gives the impression that you need an extra connection term because of the $\nu$ index when $\nabla_\mu$ acts on $\nabla_\nu$ etc. If you make this interpretation then then the $\nabla_\mu$ changes the tensor character of the object it acts on, unlike the usual covariant derivative $\nabla_X$ which does not change the tensor character.  If you insist of changing the character then $\nabla_\mu$ and $\nabla_\nu$ are acting on different spaces depending on their order, and the "commutator" is not really a commutator and its properties are rather ill defined.  This is harmless in torsion-free GR but becomes a probelm when you have torsion as it leads to  notational ambguities that I suspect  you have in your paper.
The torsion definition applied to $X=\partial_\mu$, $Y=\partial_\nu$ gives
$$
\nabla_{\partial_\mu} \partial_\nu - \nabla_{\partial_\nu}\partial_\mu = T^{\lambda}(\partial_\mu,\partial_\nu)  \partial_\lambda.
$$
With
$$
T^\lambda(\partial_\mu,\partial_\nu)= {T^\lambda}_{\mu\nu}
$$
as the coordinate componets of the torsion tensor, and
applying the vector field ${T^\lambda}_{\mu\nu}\partial_\lambda$  to a scalar $\phi$ we get
$$
(\nabla_{\partial_\mu} \partial_\nu - \nabla_{\partial_\nu}\partial_\mu) \phi = {T^{\lambda}}_{\mu\nu}  \partial_\lambda \phi.
$$
which suggests that you opinion that  $K$ should be replaced by $T$  is correct.
Also, by the definition of the Christoffel symbols
$$
\nabla_{\partial_\mu} \partial_\nu= {\Gamma^\lambda}_{\nu\mu} \partial_\lambda
$$
we see that the above dequation  gives the usual
$$
{T^{\lambda}}_{\mu\nu}= {\Gamma^\lambda}_{\nu\mu}-{\Gamma^\lambda}_{\mu\nu}
$$ where I am using MTW's placement of the indices on the $\Gamma$'s, so the indices might seem to be backwards compared to  some other defs.
Comment: The formulae for the torsion and the curvature are the usual *definitions* in differential geometry, so there is no real "derivation." There is a good discussion in Misner, Thorn and Wheeler, although I suspect that they do not consider torsion. I  learnt them from books on differential geometry.  Lots of people use $\nabla_\mu$ and have extra torsion terms in their "commutators" and you *can* be consistent if you are careful.  It's just always safer to use $\nabla_X = X^\mu\nabla_\mu$ fo these things.
Comment: I've added some extra material to my answer.
Comment: it would be very helpful if you can put the entire derivation of the equation. I would be most grateful.
Comment: I am glad that somebody agrees with me. I thought I was going crazy or something.
Answer: You are right, this must be a typo, as the following shows:
$[\nabla_\mu, \nabla_\nu] \phi = \nabla_\mu \partial_\nu \phi - \nabla_\nu \partial_\mu \phi = (\partial_\mu \partial_\nu \phi - \Gamma^\alpha_{\mu\nu} \partial_\alpha \phi) - (\partial_\nu \partial_\mu \phi - \Gamma^\alpha_{\nu\mu} \partial_\alpha \phi) =
- (\Gamma^\alpha_{\mu\nu} - \Gamma^\alpha_{\nu\mu}) \partial_\alpha \phi =
- T^\alpha_{\mu\nu} \partial_\alpha \phi $
Comment: Yeah. But unfortunately, he is using this wrong equation in various parts of this paper and making some conclusions. It's really bizzare.
Comment: I guess, it is a typo, for in 2.11 he writes $T^\tau_{\cdot\alpha\beta}$ at the same place.

Commutator of derivatives with torsion


Shunt Current measurement isolation problem

Question: I am using shunt method to measure AC mains Current form circuit, attached image explain the systems. I am using a SMPS to isolated 120 VAC main form other control circuit. By i have some doubt, As i am measuring current using shunt, is i am breaking isolation somehow as per attached image.  Or Do i need op-amp with higher common mode voltage rating ( greater than 120 VAC)
Comment: Why did you choose shunt resistor instead of a current transformer or Hall effect sensor?
Comment: Creating a galvanic isolation when using a resistive shunt is really cheaper?
Comment: Reason of cost of current transformer
Answer: Yes, this will be a problem. Unless there is galvanic isolation between the "earthed" controller and the op-amp there will be instant smoke. The 3.3 volt supply (and its 0 volts) also need to be galvanically isolated from any electrical connection to the "earthed" controller.
Remember that live and neutral are not floating above earth - neutral is usually earthed and this means "live" rises and falls around earth at hundreds of volts peak to peak.

Do i need op-amp with higher common mode voltage rating ( greater than
  120 VAC)

The input common mode range of an op-amp is largely determined by its supply rails and so to achieve +/- 170 volts (peak) you would need to find a supply with very large power rail capabilities. However, you would still have a safety problem feeding the op-amp output to the controller - you ought to consider using either a CT (current transformer) or something like ADI's range of digital isolation products (typically ADuM5401 and an ADC): -

The ADuM5401 provides kV of isolation but, remember, when working on anything that connects to live voltages, death or injury are just around the corner for those who are not wary and careful.
Comment: There is no earth in circuit, that symbol is for circuit return ground. No earth coming in circuit.
Comment: digital isolation method look more costly than CT. look like measuring AC current using shunt is not possible in low cost because if you need isolator and other stuff , the cost goes more than CT method.
Comment: So you are quite happy that the "controller and other low power circuit" is at the same potential as your live wire? That's the implication of what you are saying.
Comment: No, they are isolated , since i am using SMPS. which has 4KV isolation. so my circuit ground and Line or neutral are not on same potential.
Comment: @ShortCircuit OK, but after you make the connection from the op-amp "shunt measure" circuit to your "controller", your circuit ground will acquire a potential that is equivalent to your live wire. This is "usually" a big deal but not always. It means that your controller has a live ground and is therefore unsafe for any connections not shown in your diagram unless those connections use isolation circuits.
Comment: I am sensing only the difference across shunt , that is going to not more than couple of mV. opamp use as a differential amplifier.
Comment: The whole op-amp circuit is rising and falling +/- 170 volts with respect to earth and that also means the local isolated 3.3 volt rail and local 0 volt rail. If you don't believe me, get hold of LTSpice (free gratis) and simulate it.
Answer: I'd have done this in comment, but it's too long.
You have badly misunderstood your circuit. From a comment

No, they are isolated , since i am using SMPS. which has 4KV isolation. so my circuit ground and Line or neutral are not on same potential.

Well, they were isolated - right up until you connected them to your current sense amplifier. Since the voltage across the shunt is very small, it can be ignored. Then your line voltage connects to your op amp + input through a single resistor. If your reference voltage does not float with the line voltage , then you'll get line voltage at the input of a 3.3 volt op amp, and that will not end well. If the reference voltage does float, then your entire circuit is, by definition, riding on the line voltage. You can't have it both ways. The only limitation on current through the op amp is the value of the input resistor.
To make things worse, your voltage will only manifest itself when the circuit actually connects to power ground. It's perfectly possible to have a test setup, using isolated power supplies, which itself floats, and so you don't see the voltage. Then some poor customer or test engineer is actually using it in the wrong setup and makes the connection, and ZAP!, there goes trouble.
Comment: Look like its not easy to measure current through shunt without providing isolation on Op-amp side. If So Current transformer will be cheaper that using this. Wbo say now shunt method is cheaper, how Multi-meter do this. strange hmm.
Comment: @ShortCircuit - Shunt method is cheaper with multimeter. Multimeter is electrically isolated, in plastic case, and readout is visual display. But that's not what you are trying to do.
Answer: It won't be easy finding a shunt amplifier with such a high common mode voltage.
Instead, you'd have to take one side of the shunt and short that to your ground or VCC. Or Ref Volt in your image. This depends on the common mode voltage of your amplifier, and other circuitry. Eg: is the circuit also measuring the L-N voltage? It isn't clear what Ref Volt is from your information.
With 10A and a 10mOhm shunt you have 0.1 AC, thus +-140 mV DC.
If you use an INA199 with a -0.3V to 26V common mode voltage you can either use the top or the bottom of the shunt as ground or Vcc since the specification will be within your +- 0.14V range.
If you have an amplifier that has no common mode voltage outside of it's supply range, then Ref Volt has to be within 0+0.14V to 3.3-0.14V.
Also, Ref Volt has to connect before the filter resistor.
The 10A is taken as absolute maximum here.
Depending on how you wire it up you're either measuring high-side or low-side.
Look at TI's Application Notes for in depth information about shunt placement.
So yes, the shunt method is indeed breaking isolation. They call it invasive for a reason. If you do not want that you'd have to trade price/resolution/accuracy and get magnetic measurement. From an ACS-712 sensor, a transformer or LEM*. Although, you could also use analog isolators like AMC1100.
Mandatory safety warning: your circuit is live (CAT II or CAT III). This means the ground of the oscilloscope, the USB chassis of your debugger, and thus your laptop, can be live too. Be aware of this. Otherwise sparks will occur, with death of equipment as a result.
*Magnetically shield your lem modules if they are not already!
Comment: This is a really dumb thing to advise: "Instead, you'd have to take one side of the shunt and short that to your ground or VCC. "
Comment: @Andyaka you have to, otherwise you'd have to build a high voltage differential amplifier. Which is very difficult at these signal levels.
Comment: Ref voltage use to shift the line AC measure waveform , because my Controller ADC will take any negative side voltage.


System of generators and surjective homomorphism

Question: Let $G$ and $G'$ be groups and $\varphi:G\to G'$ a group homomorphism and $(g_s)_{s\in S}$ an indexed collection of elements of $G$ and is also system of generators of $G$. If $\varphi$ is surjective does it imply that $(\varphi(g_s))_{s\in S}$ is a system of generators of $G'$ ? Is there a simple example that the free group $F_n$ cannot be generated by fewer than $n$ elements. For example I cannot take $G$ and $G'$ cyclic and $\varphi$ such that it is not surjective, I must have more than $1$ generator, is it correct ?
Comment: Yes. If $\varphi$ is surjective then image of the generators of $G$ generate $G^{\prime}$. I do not understand your sentence "Is there a simple example that the free group Fn cannot be generated by fewer than n elements." You cannot have an example of something which doesn't exist...
Answer: The answer to the first part of the question is yes: since $\varphi$ is surjective for each $g' \in G'$ exists a $g \in G$ such that
$$\varphi(g) = g'$$
since $(g_s)_{s \in S}$ are a family of generators for $G$ there's a finite sequence $s_1,\dots,s_n \in S$ and $i_1,\dots,i_n \in \{1,-1\}$ such that $g=g_{s_1}^{i_1}g_{s_2}^{i_2}\dots g_{s_n}^{i_n}$ and so
$$g'=\varphi(g_{s_1}^{i_1}\dots g_{s_n}^{i_n})=\varphi(g_{s_1})^{i_1}\dots\varphi(g_{s_n})^{i_n}$$
hence the system $(\varphi(g_s))_{s \in S}$ is a system of generators for $G'$.
To address the second part you can consider the free group on $1$ generator, i.e. $\mathbb Z$, clearly $\mathbb Z$ cannot be generated by less then $1$ element, the only group with $0$ generators is the trivial group $(1)$ containing just the unit, which isn't isomorphic to $\mathbb Z$.
For another non trivial example consider the group $F_2$ this group cannot be generated by $1$ element, because otherwise it should be cyclic and so abelian, but it's a well known fact that $F_2$ is not commutative.
Comment: You forgot inverses of the generators.
Comment: Thanks a lot, I thought the same but group with $0$ generators was a bit confusing for me.
Comment: @MartinBrandenburg ops... thanks for pointing out, I'm going  to edit immediately.
Answer: Let $\phi : G \to G'$ be a surjective homomorphism and let $E \subseteq G$ be a generating set. Then $\phi(E) \subseteq G'$ is also a generating set. You don't have to fiddle around with elements to see that (and the following argument also works in more general situations): If $H' \subseteq G'$ is a subgroup which contains $\phi(E)$, then $\phi^{-1}(H') \subseteq G$ is a subgroup which contains $E$. Since $E$ is a generating set, this means $\phi^{-1}(H') = G$ and hence $H' = \phi(\phi^{-1}(H'))=\phi(G)=G'$.


Why does King Schultz go to such distance in order to help Django?

Question: In Django Unchained, Dr. King Schultz, who is a bounty hunter, takes enormous risks and goes to a great distance in order to help Django. Although Django does help him nab the Brittle brothers, was this enough reason for Schultz to help Django?
I mean this was deep south in 1858 and Schultz decides to help a black man against immense odds. There must be a strong motivation for him to do that.
Answer: In the beginning, Django seem like only bounty help to Schultz but slowly Schultz and Django learn about each other and in a scene Django tells how his wife got sold in to the slavery and Schultz reveals about his wife's death. Schultz starts teaching Django how to shoot and becomes his mentor and also there were instances where Schultz admires Django's shooting abilities and says to himself "This kid's a natural."
This post says that Schultz can't stand slavery. This might also be the reason why Schultz keep helping Django to free his wife from slavery.

Schultz despised slavery and hated the sight of slaves being treated poorly and also killed. At some point in his life, Schultz was married. His wife supposedly died of an unknown cause.

On the other hand think of Schultz, he's a bounty hunter, he has no family other than the only person (Django) who he has recently befriended with. I think the reason why King Schultz go to such distance in order to help Django is because they both are friends.
Answer: In addition to the other answers Dr. Schulz tells Django in the movie why he help him: As a german Dr. Schulz feels obliged to help him to free Brunhilde after he told Django the story about Brunhilde and Siegfried. I would guess that this is a big part of his motivation, he is far from home and as others have mentioned Django is probably his only friend in a long time. Also Brunhilde and Django can speak german so that is a big plus in sympathy points for any german.


Surge Current on PCB

Question: When designing a PCB, do you need to worry about the inrush/surge current or just the continuous/RMS current on the board?  Everything I have seen including IPC documentation is for continuous current.  Is the assumption that if you are ok from a temperature/trace width stand point, you will be ok for an inrush current?
Answer: It all depends on what the surge current could do to the other circuitry on the board. The continuous current analysis generally settles itself around the acceptable voltage drop in the traces and safe operation to prevent fires or fusing of overloaded traces. Surge current on the other hand could be huge, as addressed by @Huisman in another answer, and could very well overrate the traces. If the duration is long enough then the surge current value should actually replace the current value used in the continuous current analysis.
But there is another consideration as well which can occur even if the surge current is on the same order of magnitude as the continuous current. This comes into play when the rate of change in the current flow is really fast.
[story time]
Many years ago I was working on a prototype of a product that had a two layer circuit board and power and ground for the DIP packages on the board laid out as shown below:

Fingered power and ground like this was very common in DIP board days and made it fairly convenient to place bypass caps along on the bus fingers between each DIP IC.
Well every thing was going along really fine with the prototype development till the software got to the point of using the relay. Switching the relay turned out to cause the microprocessor program to crash about 15% of the time. A long debug session led to learning that if the relay on / off command was placed inline in the code things were much better but when the relay command was at the end of a utility subroutine followed by a RET (return) instruction the software would crash. This led to creating a small test software that did nothing but switch the relay on and off about 10 times per second. This program would run and not crash at all and also permitted using a scope to be able to probe repetitive waveforms and find out what was going on. It turned out that the current draw of the relay coil, which was about 40mA and of similar magnitude as the current requirement of the SRAM in its active mode, was causing a current surge in the ground bus. The fast rate caused a ground level ringing of around a volt that lasted long enough to corrupt what the MCU would be trying to read out of SRAM if the value had '0' bits in it.
In these olden days the MCU did not have onboard RAM for its stack and data storage and the ground bus corruption was causing the subroutine return address to be read wrong. The fix turned out to be adding a big capacitor to the supply bus right at the relay and then adding a wire to the design to interconnect the right ends of the ground bus fingers as shown in the picture above.
[/story time]
So the big lesson here is that surge current analysis is very important for every design due to effects like described in the story or for other effects where fast current changes can couple to adjacent traces.
Answer: It depends how the surge current is related to the continuous current (is \$I_{surge} = 10*I_{cont}\$ or \$I_{surge} = 1000*I_{cont}\$ ?) and the duration of the inrush current. It's all about how much the temperature of the trace will rise.
Answer: Surge Current can be important.More than 10 years ago I saw a simple PCB with some relays that operated some 230VAC pumps .The PCB traces were rated from an internet table for 10 Amps.Steady state trace temps were fine running 24/7 .The pumps were protected with a 7.5 amp fuse which did not nuisence blow .The origional 5 Amp fuse was not reliable.One day a short circuit fault occurred in the pump wiring assembly .The fuse did not blow but the tracks did which is not good .So the tracks had to be heavier than what was first thought.

Surge Current on PCB