If the budget for an employee is accounted for at the start of the year, can that employee still be made redundant?

Question: In a company, if a manager says "I am budgeting X for this employee because of this business case", is it still possible that this employee will be made redundant later on because there is no work?
Answer: Sure. A business case is just a plan and plans can go wrong. Maybe the client cancels. Prices change. Life happens.
You will need to contact a local lawyer specialized in employment law to check if it's legal to be laid of under these circumstances, but from a business point of view, an employee can become redundant at any time.
Answer:
is it still possible that this employee will be made redundant later

Yes, of course. The decision to lay off workers isn't bound by the budgeting process.
I'm guessing that you are either fearful of being let go and are looking for "ammunition" for your case against them. Or that it has already happened.
Unfortunately, you won't be able to use the budget to bolster your case. It simply doesn't work that way.
Comment: @Monoandale You should raise these concerns with your boss. Start the conversation with something like: "*Since me and X have so much overlap, I was wondering how this will impact our workload...*" Maybe they're ramping up the projects, maybe you'll be reassigned, maybe they want a higher bus factor, it could be anything.
Comment: @Monoandale Maybe the fact that you had a very high workload is why they hired an additional employee?
Comment: This year I had a very high workload. Now, against company plans, somebody is hiring a redundant person who will work on most of my workload. My manager is happy and supportive, and he has work for me. However, I am still afraid that this overlapping person will represent a business case to get rid of me.
Comment: If my workload is 100, this person is taking 70. He/she will be dedicated to a very specific technology which was most of my workload. I asked for some help, but I could end up being the one helping...


Dracaena plant has less leaves

Question: I had planted a Dracaena plant few years back. Since then it has grown tall. The only problem is it has leaves only at the top. I have kept it near my window, so it gets proper sunlight. I water it whenever top layer is dry. Occasionally apply fertilizer also spray water on the leaves. My pot is of medium sized and I have not changed the soil since it was planted. Please advise how to get more leaves.
Comment: can you add a picture please?
Answer: I have had dracaena for many years. My experience is that the leaves live 3 or 4 years and then yellow and die. To get leaves lower , I plant a short cutting in the pot.

Dracaena plant has less leaves


Remote Java Development using IntelliJ or Eclipse

Question:
I have some code that only runs on a remote Ubuntu box with a gateway in between. Every time I have make some changes I have to make the change in my local Mac and push it to git and rebuild it on the box to see if it is working. Was wondering if there is a way to configure IntelliJ or Eclipse to modify code directly on the remote box and have it running there with debug etc. so that I minimize on the roundtrip?
Comment: So...you don't have a test suite, or a way to replicate the environment locally?
Comment: Nope there are linux related + environment related things that can't be replicated locally
Answer: The solution may be to mount the remote filesystem in your local machine.
Then run the IDE off the remote file mount in the local system.
That way, the IDE will access all the files as if it is local.
The IDE can connect to the process running in remote machine.
Also the IDE can remote debug the JVM easily.
Here is the how to of mounting the remote file system locally
https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh


Understanding the concept of Hexagonal Ports and Adapters with an example

Question: I am trying to understand what is meant by a Port and an adapter when talking about Hexagonal architectures.  I have read plenty of explanations tonight, however I have not found a code example.  Therefore I will devise one.  I understand a port to be an interface.  For example:
public interface IPerson
{
   string GetName();
}

and an Adapter to be a class that implements an interface:
public class Person : IPerson
{
  //Implementation of GetName here
}

I understand the concept of the Gang of four Adapter pattern.  However, I do not understand how this fits into DDD.
It would really help me to see a simple code example in the context of DDD.
Answer:
an Adapter to be a class that implements an interface

Not always. That's true for the driven side, but for the driver side, an adapter is a software component that uses the interface (calls its methods).
I've written a conceptual article about Ports and Adapter Pattern (Hexagonal Architecture):
https://softwarecampament.wordpress.com/portsadapters
There you can read about it.

I have read plenty of explanations tonight, however I have not found a
  code example.

Some code I've just invented, to explain to you what a port and what an adapter are in practice:
In an online shop, a driver port could be:
    public interface ForManagingShoppingCart {
        public void addProductToShoppingCart ( String productId );
        // ... more methods ...
    }

A driver adapter could be a controller, that takes user requests from the UI and calls the methods of the driver port:
    public class ShoppingCartController {

        private final ForManagingShoppingCart forManagingShoppingCart;

        // Injects port in the constructor
        public ShoppingCartController ( ForManagingShoppingCart forManagingShoppingCart ) {
            this.forManagingShoppingCart = forManagingShoppingCart;
        }

        // Method that executes when user selects a product in the view and clicks the "add product" button
        public void addProductOnClick ( String productId ) {
            this.forManagingShoppingCart.addProductToShoppingCart ( productId );
        }

    }

If the application sends you an email when you do a purchase order, a driven port could be:
    public interface ForNotifyingClients {

        public void sendPurchaseOrderConfirmation ( String recipient );

    }

The port is technology agnostic, it doesn't know if the message is sent by email. The driven adapter implements the port using an email system.

I understand the concept of the Gang of four Adapter pattern.

The adapter pattern fits because you are translating the port interface methods into email system interface methods.
    public class EmailNotificationAdapter implements ForNotifyingClients {

        private final EmailSystem emailSystem;

        // Inject the email system interface you want to use in the adapter constructor
        public EmailNotificationAdapter ( EmailSystem emailSystem ) {
            this.emailSystem = emailSystem;
        }

        // Implements the method using the email system to send an email
        @Override
        public void sendPurchaseOrderConfirmation ( String recipient ) {
            // ...code that sends an email to the recipient using this.emailSystem
        }

    }

I do not understand how this fits into DDD... It would really help me
  to see a simple code example in the context of DDD.

DDD fits well into Hexagonal Architecture:

Application Layer and Domain Model would be inside the hexagon.
Application Services API would be the driver ports of the hexagon.
Presentation Layer (UI) would be a driver adapter.
Infraestructure Layer would contain the driven adapters.
When the application layer or the domain model need to deal with technology, they define a driven port, that a driven adapter in the infraestructure would implement.
Answer: TLDR: ports and adapters isn't like usb plugs and usb sockets.  Adapters are USB to Lightning cables.

I am trying to understand what is meant by a Port and an adapter when talking about Hexagonal architectures.

It's a bit of a tangle, especially because

The pictures alone don't tell the story
The pictures look a lot like the onion, and tell the story a different way.

The two nested polygons (traditionally, two hexagons) represent logical boundaries.  The "core domain logic lives entirely within the inner polygon.  Outside of the outer polygon is the real world: message buses, databases, UI, file systems, and so on.  All of these things have ports.
For example, in the interactive shell, your ports are stdin, stdout, stderr.
The adapters are the things we put in place because the ports at the outer boundary and the ports at the inner boundary don't match.  My domain model doesn't speak SQL, so I have an adapter that sits between my domain model and my database client.  My domain model doesn't understand terminal formatting, so I have an adapter that sits between the domain model and the interactive shell.
Part of the magic here being that we can bring new components together by changing the adapter.  My domain logic doesn't know about HTML presentation either, but I should be able to replace the interactive shell adapter with a web browser adapter, and give users a new way to interact with the domain model.  I should be able to switch out persistence strategies by using a new adapter to communicate with a new stable storage appliance.
Ports are commonly going to be interfaces, because what we care about at the boundary is clearly defining the contract that needs to be satisfied, without coupling to a specific implementation.

I do not understand how this fits into DDD.

One reason that it is hard to see how this fits; ports and adapters is plumbing, not domain model.  All the bits that justify the work of doing domain analysis lives inside the inner polygon.
Repositories and Domain Services are common forms of adapters.  Domain Services are commonly ports, with the implementation provided by the application or infrastructure components.  Similarly, repositories are typically a form of adapter between the application and the stored collection of aggregates.
Recommended Reading:
* Ports and Adapters Architecture @c2 wiki
Comment: So a domain service is a port and an adapter?


Allow forking private repository on GitHub and integrate in Eclipse

Question: I'm working on a project in a team size of 9 and all my code is on my GitHub account as a public repository. I own the master branch and my team members have forked it, and they work on the project and make pull requests for their made changes.
Its a Java project and we're using Eclipse (Juno) with Egit. So far, workflow is understood by all members, i.e.

Code.
Commit changes.
Push to Upstream (from Project>Team)
Make a pull request on GitHub.
Requested changes are merged to master branch (by me).
Members do git fetch upstream and git merge upstream/master from shell, and then do Push to Upstream from Eclipse (Project>Team menu).

Also note that members have already synced their forks with master branch using git remote add upstream https://github.com/me/MyProject.git
On my end, when I encounter pull request, I just confirm merge from GitHub.com and then Pull it from Eclipse.
Everything works fine currently, but now entire project is to be moved to private repo (each member will have their own branch of project within their own Private repo). I understand that if I'll make my repo private, then I'll lost all members who have forked it.
So how can I make all of our repos private and continue the work in above manner?
Note:
This is my first GitHub collaborated project so I'm new to whole forking and branching concept, same is the case with my team members.
Answer: You don't want to have a private repo per team member. Instead you want to create an organization on github, put all team members into the organization and then have a private repository for the organization, which is accessible to all members. The team members can either work directly on that organization repository or create forks for personal development.
It is also possible to have a workflow with everyone using a personal private repository, but that would be really cumbersome, as every member of your project would have to add all other repositories as remote locations in his repository. And the management of the access rights of so many repositories would be a nightmare.
Comment: I'm a student and using GitHub's free microplan for student which gets me 5 private repos for free for 2 years. Do I have any other option?


Convert lat/lon to Mercator x/y, then measure distance

Question: I'm attempting to convert latitude/longitude coordinates to X/Y coordinates on a 52,000 sq. ft. grid according to a simple Mercator projection.  I used the following Python code to accomplish this, adapted from this post.
from math import pi, log, tan

latitude    = 42.374994
longitude   = -71.075891

mapWidth    = 52000.000000
mapHeight   = 52000.000000

x = (longitude+180)*(mapWidth/360)
print "x", x

latRad = latitude*pi/180
print "latRad", latRad

mercN = log(tan((pi/4)+(latRad/2)))
print "mercN", mercN

y     = (mapHeight/2)-(mapWidth*mercN/(2*pi))
print "y",y

Using the examples of 30th Street Station and 69th Street Terminal in Philadelphia, I get the following results:
30th Street Station
#39.955641,-75.181178
x 15140.4965111
latRad 0.697357490195
mercN 0.761899319942
y 19694.4777688

69th Street Terminal
#39.962156,-75.258626
x 15129.3095778
latRad 0.697471198396
mercN 0.7620476662
y 19693.2500467

If I calculate the distances between these X/Y coordinates using the Pythagorean theorem, I get a value of
sqrt((15129.30958-15140.49651)^2 + (19693.25005-19694.47777)^2)
= sqrt(125.1474774)
= 11.25410054

I am assuming that in this case the result would take the same units as my mapWidth and mapHeight, in feet in this case.  But, a value of 11.25 feet is not reasonable.  When measured on Google Maps, these two sites are roughly 4 miles apart.  What am I missing?
Comment: **Never** use Mercator for distance.
Comment: Take a look at [pyproj](https://jswhit.github.io/pyproj/) for converting coordinates from one CRS to another, or directly compute great circle distance with [haversine](https://pypi.python.org/pypi/haversine)
Answer: You have projected the whole globe to a 52000 x 52000 square. Obviously, the unit here cannot be feet as, 52000 feet would be equal to ca. 9.85 miles. But speaking of unit, it cannot really be defined in such length as on different parts of the maps it would mean different "real world" length. As per the grid:

"... on a 52,000 sq. ft. grid ..."

This is false, your grid is 2 704 000 000 sq. ft., as 52000 ft is one side of it.


Extend video monitors

Question: How can I extend video to have 2 different programs running on different screens on my dell inspiron 3847 with HD Graphics 4600? I have 2 monitors with VGA only inputs and
PC has only 1 VGA, 1 HDMI and available USB. I bought a VGA to VGA splitter that I hooked up to the back of PC VGA port but it hangs PC when I try to boot. Do I need another video card?
Answer: VGA splitters are a bit janky. Since you have HDMI - getting a HDMI to VGA adaptor would do the trick. You shouldn't need a second video card in this situation. The adaptors are active (and draw power from HDMI) but its still significantly cheaper and simpler than adding a video card.

Extend video monitors


I need help writing the expression $5(\sin 2x- \cos 2x)$ in terms of sine only.

Question: I need help writing the expression $5(\sin 2x- \cos 2x)$ in terms of sine only. Using the double angle  identity formula, I was able to get it to $5(\sin 2x - 1 + 2\sin^2x)$, but not sure how to move forward. I know the answer is $$5\sqrt{2}\sin\left(2x+ \frac{7\pi}{4}\right)$$ but I'm not sure how to get there. Thanks.
Answer: Given $a\sin(u)+b\cos(v)$, factor out whatever you need to to make the coefficients of $\sin$ and $\cos$ have sum of squares equal to $1$. Then a sum of angles formula applies. In this case,
$$5\sqrt{2}\left(\sin(2x)\frac{1}{\sqrt{2}}-\frac{1}{\sqrt{2}}\cos(2x)\right) $$
$$=5\sqrt{2}\big[\sin(2x)\cos(-\pi/4)+\sin(-\pi/4)\cos(2x)\big] $$
$$ =5\sqrt{2}\sin(2x-\pi/4).$$
(Of course, $-\pi/4$ works the same as $2\pi-\pi/4=7\pi/4$.)
Answer: Note that $\cos(7\pi/4) = 1/\sqrt{2}$ and $\sin(7\pi/4) = -1\sqrt{2}$ so your expression $$=5\sqrt{2}(\cos(7\pi/4)\sin 2x +\sin(7\pi/4)\cos(2x) = 5\sqrt{2}\sin(2x+7\pi/4).$$
Comment: Thank you for helping. I have been able to work this problem out to 5sqrt2(1/sqrt2sin2x - 1/sqrt2cos2x), but not sure how to derive result to be in quadrant 4 with sine positive and cosine negative (this would be quadrant 2 and 3pi/4, not 7pi/4). What am I missing?
Comment: I think I see this now, using the example below from artic tern. Thanks!
Answer: Write
$5(\sin2x-\cos2x) = a \sin(bx+c)$
Then
$5\sin2x-5\cos2x = a \sin(bx)\cos(c)+a \sin(c)\cos(bx)$
Choose $b=2$, $a\cos(c)=5$ and $a\sin(c)=-5$. So
$a^2\cos^2(c)+a^2\sin^2(c) = 25+25 = 50 \Rightarrow a^2=50 \Rightarrow a = \pm 5\sqrt{2}$
Choose $a = 5\sqrt{2}$
$\Rightarrow\cos(c) = \dfrac{5}{5\sqrt{2}}=\dfrac{\sqrt{2}}{2}$ and
$\sin(c) = \dfrac{-5}{5\sqrt{2}}=-\dfrac{\sqrt{2}}{2}$
Hence $c = \dfrac{7\pi}{4}$
Then
$5(\sin2x-\cos2x) = 5\sqrt{2} \sin\left(2x+\dfrac{7\pi}{4}\right)$


Tool for injecting data in existing tcp connection

Question: I would like to perform arp spoofing on an existing tcp connection between a server and a client and perform a mitm attack. In addition to altering existing packets, I would like to be able to inject my own packets into the connection without disturbing the legitimate flow of packets. As I understand, this would require handling seq and ack numbers that are out of sync between the client and the server, as the server will receive more packets than the client sent. Is there a good tool for this?
Answer: What you ask is far less straightforward than you think. However, you can start with Scapy which is a widely employed and a fairly easy to use python library. All you need to start is a decent knowledge of Python and the fundamentals of computer networks.
Answer: As suggested by @schroeder Scapy is a good tool, especially if your attack is quite specific and you need scripting capabilities. You can certainly alter a packet, while keeping seq and ack numbers, and recalculate checksums. Here is one post on SO that explains how to do it with Scapy.
Personally, in a physical pentest scenario, I would use a dual ethernet SBC (single board computer) such as an Orange PI or similar device, and I would set up a transparent bridge to intercept traffic and alter it selectively.
On a NAC-enabled connection (802.1x) an attack is more difficult but still possible, tools like Fenrir can help perform packet injection.
The MITM device could also, rather than relay or manipulate traffic from the client, spoof the client itself by cloning its MAC address.


There are two arrows spinning next to my Wifi

Question: There are two arrows moving in a circle next to the Wifi bars. I am confused. I was wondering if this means something is downloading because I just trying to sync music from my ITunes on PC, to my IPad, but everytime I click on a song, it says "Item Not Available." Do the arrows mean something is downloading? If not, what are they an indicator for?
Answer: This is the iTunes sync indicator, which indicates that the device is syncing with iTunes over USB or Wi-Fi.


Canon rebel t3i settings for pageant

Question: I am unfamiliar with this camera and will be shooting pictures of my daughter in a high school pageant. What is the best camera settings to use? Not certain if flashes will be allowed, so will need to know setting options for this as well.
Comment: What lenses do you have? Do you have the standard kit lens EF-S 18-55mm f/3.5-5.6 IS, or any additional lenses to chose from?
Comment: Ed's 55-250mm and 18-55mm
Answer: If you are totally unfamiliar the best thing to do would be to take photos in no flash mode which is beside the green auto. If you feel even that is blurry or too grainy then go ahead and use the full auto. In that case the flash would automatically popup.
If you know the camera a bit, try shooting in aperture priority with the lowest f number you get (will range from 3.5 to 5.6 on a kit lens depending on how much you are zooming). You might want to increase the f number a little if you are taking group photos or photos of the stage and settings. Keep the ISO around 800 if you don't have good lighting. If the place is well list you can go ahead with ISO200. The high ISO is to ensure that you get a fast shutter speed in aperture priority so that your photos are sharp.
And finally if you can lens some lenses I would suggest maybe a 50mm prime or a 85mm prime depending on how far your daughter is going to be. You will get really nice portraits with blurred backgrounds with a prime lens. But do rent it a day ahead and try it out.
Hope you are able to take awesome photos :)
Comment: Thank you so very much..big help! I did just learn that there is absolutely no cameras..so, of course I will have to opt for the "no flash" setting!

Canon rebel t3i settings for pageant


What can a Gabbai do if no one wants to Daven from the Amud?

Question: As a Gabbai Sheni I have noticed that often the Gabbai has a difficult time getting someone to daven from the Amud. Some Shuls have paid Chazonim, yet others can not afford that. What can a Gabbai do in order to get people to be willing to Daven from the Amud?
Comment: Why can't he daven himself?
Comment: The Gabbai Davened last night, last week, and two weeks ago. How often does he have to Daven himself?
Comment: Pay them. |||||
Comment: Ask the rabbi to speak about how people don't need to be [_that_ humble](http://judaism.stackexchange.com/q/18794/5).
Comment: Related: http://judaism.stackexchange.com/q/18794/3
Answer: I was talking to a friend of mine today about this question and he told me that recently he was in a Shul and no one wanted to Daven Musaf for the Amud. The Gabai has already Davened Shacharis and read the Kriyas HaTorah. So the Gabai made a loud announcement "Good Shabbos - Thanks for all of you joining with our Minyan. I am leaving now and will come back once someone goes to Daven Musaf" and he went out of the Shul. Within a minute someone went up to Daven.
Comment: +1. Similarly, I've seen a _gabay_ ask around, and, when no one accepted the role, simply stop asking and take his place.
Comment: In some shuls, it is a game of chicken. Everyone wants that someone should  daven mussaf so they can get home. It's just a matter of keeping calm and waiting. I suggest taking a sefer and learning.
Answer: I would arrange for a chazan ahead of time, not right before davening. You probably know who the good chazanim are, so simply ask them a few days in advance and make a schedule (for yourself).


Jed does pushups every week day. On Monday he does 7. He doubles his average every day he works out. How many push ups does he do next Monday?

Question: Jed does pushups every week day.
On Monday he does $7.$
He doubles his average every day he works out.
How many pushups does he do next Monday?
Comment: What do you mean by "doubles his average" ? Do you mean that on Tuesday he does $7/1*2=14$, on Wednesday he does $((7+14)/2)*2$ ?
Comment: Doubles the average number of push ups he has done. Just a question I tested on a year 7 class. Got kind of addicted to this and ran out of questions I needed the answer to
Answer: On Monday (day $1$) he does $7=7*1$. Let's assume by induction that till day $n$ he did $7*m$ on day $m$ for each $m\le n$. Then the average is
$$\left(\sum_{m=1}^n 7*m\right)/n=7/n*\sum_{m=1}^n m=\frac{7n(n+1)}{2n}$$ Since he doubles that average, he does $7(n+1)$ on day $n+1$. This completes the induction.
Answer: EDIT:
Taking "doubling his average" into account, rather than "average previous days, then double," we have $7$ on Monday, then an average of $14$ between Monday and Tuesday which makes $21$ for Tuesday's count, then $28$ for the average of Monday-Wednesday making Wednesday's count be $2*28=56$, then $56$ for the average of Monday-Thursday making Thursday's count be $5*28=140$ then $112$ for the average of Monday-Friday making Friday's count be $560-224=336$.
On Monday he doubles his average again.  What is his average?  If Saturday and Sunday are discounted, we double $112$ to get $224$ making Monday's count be $6*224-560=784$.
If Saturday and Sunday are not workout days, but are averaging days, then the previous average $112$ drops to $80$ and the new average for Monday is $160$, making Monday's count be $8*160-560=720$.
Answer: I'm going to try to first define the question more closely and then frame it more mathematically, for the lolz:
Question
Every weekday, Jed does some pushups. On the first day we'll consider, which is a Monday, Jed does $7$ pushups. Every weekday after that, Jed does some number of pushups such that the average number of pushups he's done per day since (and including) that first Monday is double this same quantity as computed the previous day.
So, for example, on Monday, this average is $7$. On Tuesday, Jed needs to do $21$ pushups so that this average is $\frac{7 + 21}{2} = 14$.
How many pushups must Jed do the Monday after the first Monday to satisfy this rule?
Rephrasing
Consider the sequence $s(n)$, representing the number of pushups Jed does on the weekday which is $n-1$ weekdays after the first Monday.
If we define the sequence $S$ as:
$$
S(n) := \frac{\sum_{k=1}^{n} s(k)}{n}
$$
Then we require that $s$ is a sequence such that ($\dagger$):
$$
s(1) = 7
$$
$$
\forall n > 1, S(n) = 2S(n-1)
$$

Can you provide (and prove) a general formula for the value of $s(n)$?
What is the value of $s(6)$ (the next Monday)?
Finally, can you prove that there is only one sequence $s$ satisfying $\dagger$?
Comment: Thats what I said
Answer: From wikipedia: "A weekday is any day of the week except Sunday and often also Saturday." So he doesn't work out on Sunday, and it's not clear if he works out on Saturday. It is also not clear whether the days where he doesn't work out are counted in the average.
So there are n days where he works out, and n is either 7 or 6. We calculate the average over m days, where m is either 8 or n.
The average on the first day is 7, and on the n-th day it is 7 * 2^(n - 1).
The total on Monday is m * 7 * 2^(n - 1).
The average on the last workout day before Monday is 7 * 2^(n - 2).
The total on the last workout day before Monday is (n - 1) * 7 * 2^(n - 2).
The pushups on the last monday are the difference between both totals, which is
<code>  7 * 2^(n - 2) * (2m - n + 1).
</code>
Comment: Wait, how many pushups is he supposed to do on Wednesday?


Evaluating the integral $\int_0^{2\pi } e^{i\theta} e^{- i e^{i n \theta}} \: d\theta$ using contours.

Question: From my complex analysis text there is an applicative question where we are asked to evaluate the integral;
$$ \int_0^{2\pi}  e^{i\theta} e^{- i e^{i n \theta}} \: d\theta$$
I figured this could be done in the usual way defining the unit circle as $\Gamma = \{z \in \mathbb{C} \mid |z| =1 \}$, with $z = e^{i \theta}$ and $d \theta = \dfrac{dz}{iz}$. Although I am not sure how to proceed from this setup;
$$  - i \oint_\Gamma  e^{-i z^n} \: dz  $$
Is this function not analytic everywhere in $\Gamma$ and thus by Goursat's theorem $=0$, or have I missed some relevant step?
Answer: Yes $f(z) = e^{-i z^n}$ is analytic on $|z| < 2$ (a simply connected open containing $\Gamma$) so that $\int_{|z| = 1} f(z)dz = 0$.
You can use the Cauchy integral theorem, or simply say that $f(z) = \sum_{k=0}^\infty c_k z^k$ converges uniformly on $|z| < 2$ so that $$\int_{|z| = 1} f(z)dz = \sum_{k=0}^\infty c_k\int_{|z| = 1} z^k dz = 0$$


Possible to reserve a network interface for exclusive use?

Question: Like the headline says: is this possible in Linux at all? How would one implement a completely silent packet sniffer? I would like to take the interface away and give it back to the OS at will, if this is possible. Currently the OS gets in the way because eth0 being the only network interface on the machine in question, Linux tries to ask for connectivity by DHCP.
Answer: Yes, this is at least partially possible.
First, you need to figure out the "interface name" of the interface.  The command ifconfig -a (possibly /sbin/ifconfig -a) shows you all the interfaces.  Choose wisely.
Second, you have to identify and stop the process that's using DHCP on that interface. This could be dhcpcd, dhclient or maybe even pump. Run ps -ef to try to identify the process IDs of such processes. Use kill -QUIT to stop them. Bear in mind that your setup may restart the DHCP client at the next reboot.
You should look in /var/run to find "PID files". For instance, my Arch linux laptop has a file /var/run/dhcpcd-wlp12s0-4.pid which contains the process ID of the dhcpcd process that manages the "wlp12s0" interface.  That's a wireless card, but the same sort of file will exist for an ethernet card.
If you're hoping to sniff wireless packets, you're better off using [kismet][1] or [airodump-ng][2]. Follow the tutorials - usage isn't exactly easy or obvious.
If you're hoping to sniff ethernet packets without being detected, you should be aware that some controversy exists about whether this is possible or not. Using a "read only" cable would prevent some of the methods of promiscuous-mode interface detection. This method worked for me, some people say it doesn't work all the time. You do need two ethernet interfaces to read traffic going both ways.
Comment: You could consider using something like the throwing star lan tap: https://greatscottgadgets.com/throwingstar/ which you place in-line in a network connection. You then need two free network interfaces, one for sniffing each direction. That way you are guaranteed not to send any data on that connection. Only gotcha is that the speed it limited to 100Mb/s.
Comment: There is no need to stay invisible, but as this is a ethernet used as bus between realtime-communicating PCBs I shouldn't disturb the data transmission. The task is to record the stream of measurement data.


Visual Studio workflow and StatusColumnCreated property

Question: Apparently you do not get a custom status column if you are using farm solutions in contrast to any SPD workflow or VS app based workflows.
However you can set "StatusColumnCreated" property to "1" in your Elements.xml and voilà the column is being created automatically upon deployment of the workflow.
That's the good thing. The bad thing is: the column isn't ever used by my workflow.
In SPD we have stages which the status column reflects any time. What about Visual Studio workflows? Do I have to write to the automatically generated status column myself? In that particular case I'd prefer to create a custom column on my own suiting my needs.
Or am I doing something wrong? How does my workflow automatically set its custom status column to something a little bit more meaningful? I tried State Machine workflows too - no status column update whatsoever.
Answer: I stumbled across a solution here
I'm not sure if that's really the best way to update the status column - it might not be a supported solution. It does work though.


Submit not working on my Pligg 2 site

Question: after researching this issue I removed all widgets and all modules and tried to create a new post, however it still didn't submit. The only posts that are showing are the ones I made about 2 weeks ago.
Then I thought it was a server side issue. So I have checked my disk space which is good, it appears mySQL is working ok as I deleted 18 discarded posts from it via the Pligg Admin panel. And my webhost has worked fine with Pligg so far so I imagine that it is compatible.
Does anyone have any ideas of how I can resolve this issue please? The site is: www.yuity.com. Cheers!
Answer: I also faced this issue sometime for some URL, pligg show error if the URL has space in between
There is way to solve it if you like, you put validate URL to false in setting panel

Submit not working on my Pligg 2 site


AC Voltage to Spark Plug

Question: To get a spark plug to fire I read that it requires approximately 12,000 Volts. If I have an ac generator giving a RMS Voltage of about 10 Volts (pretty small) what do I need to do to get the spark plug to fire? I was thinking about possibly adding a step up transformer but unsure whether or not that would even be possible. So what is typically done with an ac circuit to get enough voltage to allow the spark plug to fire? I would like the spark plug be able to fire periodically like an engine.
Comment: Will, give a bit more detail in your question (and not in the comments) about what you are trying to achieve. Is the end goal just improved understanding and the wild joy of creating a spark or are you trying to make something else that requires a spark. It may help if you research car ignition systems and magnetos.
Comment: What is  the wattage capacity of your AC generator at 10 volts?
Comment: What would you do if you knew the wattage?
Answer: The usual way that a spark plug is fired is to provide a low-voltage DC pulse to an ignition coil. An ignition coil is a pulse transformer that is specifically designed for that purpose. If you search "ignition coil spark circuit" or anything like that, you should be able to find lots of detailed information with diagrams. Very little power is required. Any simple AC to DC power supply will profide a good starting point if you must use AC. Here is the basic diagram:
Comment: So if you have commutator and a voltage dc of 1 volt. All you need is an ignition coil?
Comment: Ignition coils that are easily available will work with 6 volts. One volt would probably produce a spark across a very small gap.
Comment: So if I get it cranking up to 6 volts what should I be looking for in an ignition coil?
Comment: In ignition coil for a motorcycle, tractor or car can be found in a junkyard.
Comment: You may find an ignition coil from a magneto motor (old lawnmower etc) will also work, in parallel with its capacitor. Close the magnetic circuit with an iron bar across the pole pieces, spaced from them with a couple of sheets of paper. They would have been about 0.5mm from a permanent magnet in the flywheel. Connect a few volts across the primary.  Wait a few milliseconds until the current builds up (one coil I have here measures 0.7 ohms, so about 4A from 3V). Disconnect the voltage and the inductive kick should give a nice high voltage pulse from the secondary.

AC Voltage to Spark Plug


stressed VaR and VaR

Question: Can someone please explain to me how most banks calculate their stress VaR. is there a regulatory-defined time series, such as the 2008 to 2009 period, to apply to the current position? My understanding of the VAR calculation is a rolling window of 251 days. So, how would some credit spreads/ratings in 2008 affect the current VaR number for a credit bond portfolio?
Answer: Yes, my bank uses a stressed VaR period where the daily changes remain static to reflect that chosen period.
The regular VaR uses a rolling window.
The problem, and I think this is a general misapplication is that the "stressed period" is never recognised. I have known institutions whose regular VaR is higher than their stressed VaR yet there is no consideration that they are operating within a stressed period, even though it is evident that they are in one.

stressed VaR and VaR


sql server 2008 composite key

Question: How to set a field as a composite key in sql server 2008 and how to create a composite key in gui sql server 2008?
Answer: Here is an example in T-SQL. The first two columns comprise the composite key. In SSMS, just highlight the first columns you want to comprise the key and select the Primary Key button on the toolbar.
<code>CREATE TABLE [Security].[MemberRole](
        [MemberID] [int] NOT NULL,
        [RoleID] [int] NOT NULL,
        [VersionNumber] [timestamp] NOT NULL,
CONSTRAINT [PK_MemberRole] PRIMARY KEY CLUSTERED
(
        [MemberID] ASC,
        [RoleID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
</code>
Answer: You can't set "one field" as a composite key - by definition, "composite" means more than one.
In SQL Server Management Studio, you can highlight more than one column in the table designer, and choose "Set Primary Key" from the context menu:

That makes those selected columns a composite primary key.

sql server 2008 composite key


Do you get a proficiency bonus to AC?

Question: Do you get a proficiency bonus to AC when wearing armor you are proficient with?
Answer: No. Proficiency only allows you to don that type of armor without suffering  disadvantage on all rolls involving strength or dexterity. In that way it is mechanically identical to 3.5 armor proficiency, removing a penalty associated to doning an armor you are not proficient with, but serving to no other purpose, other than maybe being a requirement for certain feats.
Comment: With the Bounded Accuracy ( http://www.wizards.com/dnd/article.aspx?x=dnd/4ll/20120604) WOTC implemented in D&D Next, you AC doesn't goes up as you level up to ensure that you feel like you really get better at hitting things. The progression on dodging is included in your HP, because it's not because you were Hit (gameply term) that you were actually hit (roleplay term). A successful attack, can mean that the attack was close and you made a last second dodge and was barely bruised.
Answer: PCs get to improve their AC by being able to buy more expensive armor/raising their Dex mod by 2 and it is likely that someone who cares about their AC finds approximately a +2 or the equivalent benefit to AC over the course of 20 levels via magic items.
Monsters improve their to-hit by the equivalent of +6 over 20 levels(page 274 of DMG). So a CR 20 monster has a +2 advantage swinging at a 20th level PC compared to a CR 1 monster swinging at a 1st level PC. Oddly enough, given that CR 20 monsters have a +7 AC advantage over a CR 1 monster and PCs are likely to find a +3 weapon over that time period(page 133 of DMG's typical treasure), and raise stats by +2 modifier+get +4 proficiency for a total of +9...
i.e. from levels 1-20, you should expect that both Monsters and PCs hit more often by a total of +2.

Do you get a proficiency bonus to AC?


Can Gentiles practice idolatry if their lives are in danger?

Question: Can Gentiles do idolatry in case they are compelled by someone or a law of the land? And if so, if he doesn't, would that be seen by God as suicide or a good thing for not surrendering to idolatry? I've read in several places that Gentiles can practice passive idolatry and cited the case of Naaman, is this a peaceful point in Judaism or is there a division? And the question of not complying with the law of the land that happened to honor an idol, when he resisted and ended up dying, would he be committing suicide or disobeying the law of the land in which they say he has to obey?
Answer: H. Melakhim 10:2

בן נח שאנסו אנס לעבור על אחת ממצותיו, מותר לו לעבור, אפילו נאנס לעבוד
ע"ז עובד, לפי שאינן מצווין על קדוש השם
A Noahide who is forced by another person to violate one of his
commandments is permitted to transgress. Even if he is forced to
worship false gods, he may worship them. For Noahides are not
commanded to sanctify God's name.
Comment: So it's not just for idolatry, can all bnei noach commandments be ignored if the risk of life exists upon you? And is complying with the law of the land more important than not breaking Noahide laws? Now a Jew says he has to obey the laws of the land if they are not against the Torah, what makes the law of the land more important than keeping the 7 commandments of bnei noach? Wouldn't that be normalizing barbarism? I'm confused now.
Comment: @Thales "keeping the law of the land" is not more important than not breaking Noahide laws. "Not being killed" is. There is a difference.
Comment: But with regard to the Jews there are three prohibitions even at the cost of death, idolatry, murder and forbidden intercourse. Is there not this binding of any commandment with regard to the Gentiles? Is everything allowed if your life is in danger? And the question of non-compliance, for example, do they force the person to kill another or you will die, if you do not comply, the person will be committing suicide since by the celestial court he could violate to save himself? How would that person be seen? A suicide or a martyr?
Comment: @Thales **THAT** is an excellent question addressed by many commentaries. Even if Noahides aren't expected to give up their lives to avoid idolatry, they may not be allowed to murder to save themselves. There's a lot of discussion/debate about it -- ask it as a separate question, it is well-scoped! For instance, some (Gur Aryeh) say that the 400 men Esau has rounded up to go attack Jacob actually were only there because Esau threatened their families unless they'd go fight.
Comment: How would you ask this question separately? Is there anything else to analyze? What if moderation classifies it as a question that already has an answer that is mine?


Could you use shape water to cause erosion?

Question: On further study of the shape water spell (from Elemental Evil), it says that you are able to freeze water as an action, so if you transform it into ice (expanding the water in the process), could you repeat use of it to slowly erode such things as locks or hinges, breaking them enough so they become inoperable?
Answer: Purely at the permission of your GM.  It's physically reasonable, but clearly outside the wording of the spell.  Some GMs will look at that an say, "that's a clever idea, sure."  others will look at it and say "that's clearly more powerful than the spell is intended to be, no."  5e gives a lot of latitude to the GM in terms of rule interpretation.  So if it's not clearly covered by the spell description, it's up to the GM's interpretation.
As a comparison, Arcane Lock is a second level spells that locks doors and/or windows (with some other benefits) so you're talking about using a cantrip in place of a 2nd level spell, which a DM may say is over powered.
Comment: I'm not sure what you two are talking about, Arcane Lock specifically says that you need a Knock spell to suppress it. Arcane Lock has no use that unlocks anything that I can see.
Comment: Arcane Lock allows you to also unlock things.  Freezing locks/hinges so that they're inoperable is akin to nailing the door shut.
Comment: @Pyrotechnical, you are correct! I was going off the assumption that Kyle W was correct and I made an ass out of me. Deleting my comment.
Comment: I don't think that Arcane Lock is a good comparison since that allows who you designate to pass unhindered. If you jam a door, regardless of the method, you can't get through any easier than those you are trying to prevent ingress or egress save the use of Dimension Door and the like.
Comment: I think what Kyle W was saying was that with Arcane Lock, you're free to unlock it again. Using Shape Water to break the lock wouldn't be easily revertible. So the argument is that it's not quite as powerful as the equivalent 2nd level spell.
Answer: If I were GM I'd point out that a key part of this spell is "the water unfreezes in one hour".  This means that you'd need to wait for the water to unfreeze each "cycle" or find some other way to melt the water.  In this way it sounds possible and probably more difficult than dealing with the problem manually (a big rock) which is about on par with a cantrip.  It certainly sounds like a plan if your character was locked in a dungeon with no equipment for a few weeks.
Comment: Don't forget it says on the end of the spell, "you can dismiss such an effect as an action."


Nullables in Entity Framework Core on Xamarin iOS

Question: We are developing an Mobile app using Xamarin.Forms, which is backed by a Web app using ASP.NET Core. We load various models from databases on both the Web and Mobile apps, and recently we have transitioned to using EntityFramework Core (will refer to as EFCore) on the Web app.
We are currently looking at transitioning the Mobile app to also use the EFCore to allow us to share more code between the apps, but have run into problems with EFCore on iOS. It seems able to compile and run, and can load simple models, but fails to load nullable types which are used to specify optional relationships between models. This person seems to have EFCore running in iOS and provides a project for their code. I have pulled and ran the project myself to check it works, which it did, but after adding a nullable relation to his simple model, it subsequently failed to both load and create an item with this error:

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_void__this___int_byte_byte_byte_byte_byte_object_object_object_object_object_object_object_object_object_object_Nullable1 (object,intptr,intptr,intptr)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.

This error does not occur when running on the simulator, only on a device.
My question is whether anyone has had any success with getting Nullables working with EFCore on Xamarin iOS?
Many thanks, Will.
P.S. We are open to changing EFCore/Xamarin.iOS/Mono version to solve the problem.
Comment: You might be hitting this https://github.com/aspnet/EntityFramework/issues/9249
Comment: This also looks related https://bugzilla.xamarin.com/show_bug.cgi?id=58424 This issue is a blocking point for our project.
Comment: Yeah I found these two issues yesterday after posting. Currently in discussing it on the Xamarin Bugzilla.
Answer: This is a known issue.
iOS has some limitations on generics, nullables... because Apple disallow code generation at runtime.
The issue is referenced on github for entity framework : Xamarin iOS : Crash when i add row to table with nullable type or with a lot of columns
And on Xamarin's bugzilla : Bug 58424 - Xamarin iOS : EF Core crash when I add row to table with nullable type or with a lot of columns


Can't see the app in Windows Firewall to block its internet access

Question: I thought the way to block a program's internet access was to go to Windows Firewall and block it there, but the program I'm looking for isn't listed. Is there another way?
Comment: you may be able to find a way to add it?
Comment: @barlop yea I tried that right after posting. It seems kinda strange - the program already has access to the internet, yet I have to add it to a list of programs that are allowed to access the internet in order to remove it....confusedmonkeys.jpg
Comment: there are incoming connections and outgoing connections, and there are blacklists and whitelists. The default is that outgoing connections are on a blacklist and incoming connections are on a whitelist.  For a program to access the internet, that's an outgoing connection, so a blacklist. All programs are allowed to make outgoing connections unless they're on the blacklist that says they can't.
Answer: You are looking for the solution in a right direction, just a few steps up and you'll get it:
(I'm not using an English OS, so my description of menus and items may not be accurate)
1. Click "Advanced Settings" on the left panel of "Windows Firewall".
2. Click the second item on the left panel of the popup window, which should have an icon of a wall and a green arrow.
3. Click "Add a rule" on the right.
4. On the popup dialog box, click "Program" and then "Next".
5. Select the program path you want to block, and then "Next".
6. Select "Block connection", and then "Next".
7. Choose if you want to block this program on domains, on private network or public network, then "Next".
8. Name it as you want, and finish this dialog.
This approach is a bit complicated, but it works. Maybe there are simpler ways to block a program.


Phase on Hilbert Spaces

Question: Why, in somes cases, such as spin 1/2 systems like in the Stern-Gerlach experiment, the representation of some kets has a term with an complex exponential? For example:
$ \vert S_{x}; + \rangle = \dfrac{1}{\sqrt{2}} \vert + \rangle + \dfrac{1}{\sqrt{2}} \exp [i \delta] \vert - \rangle $
Answer: Dear Rodrigo, all amplitudes - the coefficients in front of the states such as $|+\rangle$ and $|-\rangle$ you mentioned - are complex numbers in quantum mechanics. See e.g.

http://motls.blogspot.com/2010/08/why-complex-numbers-are-fundamental-in.html
Why complex numbers are fundamental in physics

In particular, coefficients $1$ and $\exp(i\delta)$ for any real $\delta$ are physically equivalent if one places them in front of the whole wave function. It's because all predicted probabilities only depend on $\psi(x)\psi^*(y)$ where the phase cancels: note that $\exp(i\delta)^* = \exp(-i\delta)$ which is also the inverse to $\exp(i\delta)$.
The imaginary unit is necessary because the commutator of $[x,p]$ has to be $i\hbar$, to guarantee the uncertainty principle - one may show that the commutator of two Hermitian ("real") operators is antihermitian ("pure imaginary"). Also, Schrödinger's equation, Heisenberg equations, and Feynman path integrals have to contain $i$ in their basic form, too. That's because wave functions have to oscillate in the complex plane.
The relative phases between two basis vectors are very important and physical, however. They may be measured. It's because we may measure the probability that a given state vector has another property. That's given by the square of the absolute value of the inner product of this state vector with a particular eigenvector of the property. All phases influence the result because they influence the inner product.
The relative phases between component waves coming from the two slits in a double-slit experiment decide about the location of the interference maxima and minima. Phases decide about many other important things. Wave functions with energy $E$ depend as $\exp(i\delta)$ on time where $\delta = Et/i\hbar$; the dependence on space is $\exp(i\delta)$ where $\delta = px/\hbar$ where $p$ is the momentum. And I could go on and on and on (angular momentum $j_z$ and many other things).
The particular vector you wrote is the eigenstate of a component of the spin; it is the "up" eigenstate with respect to an axis in the $xy$ plane whose relative angle from the axis $x$ is $\delta$. It can be seen by writing the vector $(1,1)/\sqrt{2}$ which is the "up" eigenstate with respect to the $x$-axis. Then you may rotate this vector around the axis $z$ by angle $\delta$. This changes the two components differently because the $+$ and $-$ states have the opposite $j_z$ angular momentum. You get $(\exp(-i\delta/2),\exp(+i\delta/2))$ where the factor $1/2$ comes from the fact that we deal with a spin-1/2 system. After you multiply this vector by an overall phase $\exp(i\delta/2)$ that is physically irrelevant, as explained at the beginning, we obtain the vector you wrote. You should have perhaps used $x'$ in the description of the vector because it's not the normal $x$-axis but an axis whose direction depends on $\delta$.
Answer: Your notation is misleading. Certainly, the eigenvector of the $S_x$ operator:
\begin{equation}
S_x = \frac{\hbar}{2}\begin{pmatrix}0 & 1 \cr 1& 0\end{pmatrix}
\end{equation}
is:
\begin{equation}
\mid S_x,+\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\cr 1\end{pmatrix}
\end{equation}
With an arbitrary choice of global phase. Ok, so this is what I guess you meant by $\mid S_x,+\rangle$. Now, the most general state for this system is given by two numbers (the two original complex numbers need four real numbers, but one you remove by the normalization requirement and the second by the freedom of choosing a global phase). These are usually represented by the Bloch sphere. Your state is just a set of states in a circle on this sphere, but not necessarily an eigenvector of $S_x$.

Edit (01/27/2010): In view of the claim that I'm not answering the question, let's try to fully understand the origin of this phase. Let's say you want to measure the spin in a direction given by the unit vector:
\begin{equation}
\vec{n} = (\sin\theta\cos\varphi,\sin\theta\sin\varphi,\cos\theta)
\end{equation}
It is a common exercise in QM to show that the eigenvalues of $\vec{S}\cdot\vec{n}$ are
$\pm 1$ and that the eigenvector associated to the eigenvalue $+1$ is:
\begin{equation}
\mid\vec{S}\cdot\vec{n},+\rangle = \cos(\theta /2)\mid +\rangle + \sin(\theta /2)e^{i\varphi}\mid -\rangle
\end{equation}
where the basis are eigenvectors of $S_z$ and with the state written up to an arbitrary global phase, as I explained before. If you have have trouble finding this answer, look it up in Sakurai's book, chapter 3. He derives this result over and over again. Therefore, by looking at the state in the question, we immediately identify $\theta=\pi/2$ and $\varphi$ as the phase you left undetermined $\varphi = \delta$.
So, this state is a spin 1/2 system which, if you measure $\cos\varphi\; S_x + \sin\varphi\; S_y$ (meaning, if you align your Stern-Gerlach device in the direction $\vec{n}=(\cos\varphi,\sin\varphi,0)$), you will get always the result $+1$.
And that's the origin of your phase. But your notation is misleading, indeed.
Comment: Dear Rafael, you could have identified the state. It's an eigenstate with respect to an axis in the $xy$ plane that is separated from $x$ by angle $\delta$... Moreover, I don't think you're answering the question.
Comment: well, I "stole" the notation that I used from the JJ Sakurai "Modern Quantum Mechanics" Revised Edition, page 26. What I can't understand is: sometimes that exponential term don't appear, so could I choose arbitrarily $ \delta = 0 $ in this cases?
Comment: Oh, I see. The question there is that he hasn't yet determined which directon is the $x$ direction. He started with an experimental observation that if you have particles polarized perpendicularly to your device, the beam splits in two with equal "intensity" (probability). Let's, as Sakurai did, call the direction of the SG device the $z$ direction. Saying that is perpendicular means only that your are in a plane. This phase is exactly the freedom of choosing the $x$ direction any direction in this plane. This more geometric derivation is in chapter 3, keep on reading.
Comment: By the way, in this part where you are reading, he assumes yet another perpendicular direction to both the SG device and the previous polarization (call it the $y$ direction :) ). And he shows that the coefficients have to necessarily be complex, more or less the aspect of your question that Lubos explored in his answer.
Answer: You'll know the Pauli matrices $\sigma_1=\left(\begin{matrix}0 & 1\\1 & 0\end{matrix}\right)$, $\sigma_2=\left(\begin{matrix}0 & -i\\i & 0\end{matrix}\right)$, and $\sigma_3=\left(\begin{matrix}1 & 0\\0 & -1\end{matrix}\right)$. Take a spinor such as your $v=\frac{1}{\sqrt{2}}\left(\matrix{1 \\e^{i\delta}}\right)$, taking your basis vectors $\left|+\right>,\left|-\right>$ to be $\left(\matrix{1 \\0}\right)$ and $\left(\matrix{0 \\1}\right)$, and construct the 3-vector $(v^\dagger\!\sigma_1\! v, v^\dagger\!\sigma_2\! v,v^\dagger\!\sigma_3\! v)$, taking both the transpose of $v$ and the complex conjugate, which is called the Hermitian conjugate; you'll find that it's $(\cos(\delta),\sin(\delta),0)$. This is only saying what Rafael and Lubos already said.

Update: There's a significant
addition to this, pushing a little
beyond the level of your question,
which is that as well as the 3-vector
$(v^\dagger\!\sigma_1\! v,
   v^\dagger\!\sigma_2\!
   v,v^\dagger\!\sigma_3\! v)$, we can
also construct the null 4-vector
$(v^\dagger v, v^\dagger\!\sigma_1\!
   v, v^\dagger\!\sigma_2\!
   v,v^\dagger\!\sigma_3\! v)$, where
$(v^\dagger v)^2$ is the same as the
sum of the squares of the other three
components. This is important when we
come to relativistic systems. The
relative phase you asked about still
corresponds to a rotation of the
3-vector part of this null 4-vector,
but now there's also a possibility of
Lorentz boosts introducing a relative
phase, as well as rotations.

If you change the complex phase $\delta$, the new spinor corresponds to a different 3-vector, rotated through the difference between the angles. If you consider a spinor such as $\left(\matrix{\cos(\alpha) \\ \sin(\alpha)e^{i\delta}}\right)$ you get a vector somewhere between the $x-y$ plane and the $z$ axis. This turns out to be very useful and significantly different from other ways of constructing vectors. On the other hand, if you just multiply the spinor by $e^{i\alpha}$, you'll get the same 3-vector. In Physics we just throw away the overall complex phase of a spinor, but in Mathematics we can consider something like the real and complex parts of the complex 3-vector $(v^T\sigma_2\sigma_i v)$, which turn out to be two more 3-vectors that are always orthogonal to $(v^\dagger\sigma_i v)$ and the same length. Nice! The mapping $v^\dagger\mapsto v^T\sigma_2$ is known as the "charge conjugate" in Physics, $v\mapsto v^c$; it looks a little screwy in this notation, but it can be constructed more naturally.
The interpretation of spinors is a minefield, however. A spinor can as well represent rotations, or a triad of vectors, as a single vector, and for Dirac spinors there has at times been a whole industry devoted to trying to figure out ways to think about them, largely because there is not as simple a relationship between Dirac spinors and 4-vectors and rotations in Minkowski space. Perhaps best to think of them as just happening to be the right number of degrees of freedom, and being a representation of the Lorentz group in a useful way, when we're describing experimental results.

Phase on Hilbert Spaces


Do defective filaments still conduct in multi-filament superconductor wire ?

Question: In a super conducting multi-filament wire,  if a particular filament within the  wire has a break for instance from a nanometer size occlusion, will induction  partially or completely make up for the discontinuity and allow full conduction in that filiment or is that filament out of the circuit for conduction?
Comment: You mean displacement current filling the gap?
Comment: I don't have a clear idea about what to think actually does happen.. It seems  reasonable that there would be some type of coupling that could make up for the break since the filaments are so close together. On the other hand it seems that there should be some type of degradation. If you have 40 or 50 filaments on one wire drawn to such fine dimension it seems reasonable that not all of them would make the connection. I wouldn't think that current would flow across the actual gap. I would expect something more like induction between the filiments equalizing the current across the wire.
Answer: The filament with the occlusion will conduct by induction, but only when the current is increasing or decreasing. That means that during steady state operation as in a MRI magnet when the power supply is disconnected from the circuit, an occlusion will de-rate the current capacity of the wire by each filament that doesn't connect 100% completely from end to end. Each filament must be perfect to have maximum current carrying capacity.
Once a superconductive magnet or storage ring or other such device is in steady state conduction, the filament is out of the circuit. The defective filament will conduct only under the following three conditions.

during current rise of the circuit
during current fall of the circuit
during quench which will of course produce current rise and fall in various sections of the SC wire depending on the winding of the wire.


How to convert a pcap file to a raw file?

Question: I need to convert a pcap-ng/ now a pcap file to a raw file for being able to analyse it with multimon-ng. Any recommendations?
It should be possible, but I am not aware how it should be done.
Answer: If you want just the ASCII hex dump of all data and nothing else, then you can simply pipe the output of tshark through sed:
tshark -x -r mydata.pcap | sed -n 's/^[0-9a-f]*\s\(\(\s[0-9a-f][0-9a-f]\)\{1,16\}\).*$/\1/p'

Answer: Open Wireshark and go to:
Menu -> File -> Export Packet Dissections -> As Plain Text File

Select the packet range you want to see in your txt file:

If you are interested in the command line solution then you can check tshark documentation.
Answer: I don't see any of the transmission modes for Ethernet or for IEEE 802.11 listed in the multimon-ng README file, so I'm not sure how you'd analyze a network capture, done at OSI layer 2, with multimon-ng.
I.e., I'm not sure that you could convert an arbitrary pcap file to something multimon-ng can analyze.  If there's some protocol in the pcap file that contains waveforms of radio signals, there might be a way to dump the waveforms into a file that could then be analyzed by multimon-ng, but you can't, for example, turn an 802.11 capture into a radio waveform for the underlying 802.11 PHY - the analog radio signal has long since been turned into a bit stream and further processed by the 802.11 adapter, removing information at that layer.
Comment: Well, I need to analyse a pcapng- file for hidden information. It has potentially to do with DTMF. I tried it with Wireshark, but couldn't find anything. In the task description it is said, that multimon is a requirement for finding the hidden information. So, I don't really know what else to do. I mean, if you would be willing, I could send you the file. In that case just write to this email: email@example.com
Comment: The only DTMF you'll see in a Wireshark capture comes from various protocols that have "send this DTMF tone" messages in them or protocols that actually send waveforms.  In neither of those cases can you do a simple "convert the file to multimon raw format"; you would have to understand the protocols in question and somehow extract the waveforms.  I don't have time to do the analysis for you; you'll need to give a *much* more detailed task description in order for anybody to figure out what needs to be done.
Comment: It isn't a Wireshark capture, but a pre-made file, which intention it is, to have a hidden message between the tones. It is a pcap/pcapng file. I managed to get the hex dump of all the data and I could analyse it using multimon-ng. My problem is that I couldn't analyse the data using the DTMF demodulator. There is a way to get the hidden information, this is for sure, as others managed to do it. There must be a way to get to the hidden message, either by using multimon or some other tool.
Comment: So where are the "tones"?  Is this pre-made file just a random set of bits rather than a sequence of packets?  Or is does it include a protocol that carries tones?


Should the liquid be included in Kc expression?

Question: Should the concentration of liquid water be included in the $K_\mathrm{c}$ expression for the reaction
$$\ce{2 NO2_{(g)} + 7 H2_{(g)} -> 2 NH3_{(g)} + 4 H2O_{(l)}}$$
if water is liquid and all the other compounds are gasses?
Comment: I attempt to improve formatting. Yours was a bit "wierd".
Answer: In the equation that you stated initially, water would be omitted from the equilibrium constant expression.
Your second question (about esterification that you posted in a comment to one of the answers) is extremely interesting.
I have given it some thought: in the standard case of esterification water should be included  because it is responsible for causing the reverse process ( hydrolysis of ester formed).
But in the case of zeolites, which by virtue of their structure, probably act as shape selective catalysts..ester hydrolysis by the water would be affected. (in some cases, I have read that selectivity towards ester formation is nearly 100%) In a case such as this, one can safely remove water from the equilibrium constant expression.
(I am not be a 100% correct, please excuse me, since I am just a student myself. Perhaps, someone else can provide a better/clearer explanation)
Answer: No. If the water condenses it is effectively removed from the reaction equilibrium. Just as with solids that precipitate.
Comment: What about the water produced during an esterification process? With zeolites it doesn't participate in Kc, but without it does, right?


The roots of the cubic $x^3+qx+r=0$ are $a,b,c$. How can I find the equation whose roots are $la+mbc,lb+mca,lc+mab$

Question: The roots of the cubic $x^3+qx+r=0$ are $a,b,c$.
How can I find the equation whose roots are $la+mbc,lb+mca,lc+mab$?
Can anyone help me to solve this problem?
Answer: The long, brute-force way: Expand out $\left(x-(la+mbc)\right)\left(x-(lb+mca)\right)\left(x-(lc+mab)\right)$ to get its full form as a cubic; you should find that all of the coefficients are symmetric functions of $(a,b,c)$.  Then use the Fundamental Theorem Of Symmetric Polynomials to express those coefficients in terms of the basic symmetric polynomials $S_1(a,b,c) = a+b+c$, $S_2(a,b,c) = ab+bc+ca$, and $S_3(a,b,c)=abc$.  Finally, use the traditional theorems on expressing the coefficients of a polynomial in terms of its roots (e.g., $r=-abc$) to express the coefficients in terms of $q$ and $r$.
Answer: $la+mbc,lb+mca,lc+mab$ as our roots means that
From the given equation we have $a+b+c = 0$ since coefficient of $x^2$ is 0.
and $ab+ba+bc =q$
$x^3 + px^2+ qx + r$  (independent of the equation in your question)
$p = l(a+b+c) + m(bc+ca+ab)$
$p = l(0) + m(q) = mq$ where q is the coefficient of x in your expression
Similarly (I haven't really expressed it in terms of the coefficients of your given equation),
$q = (la+mbc)(lb+mca)+(la+mbc)(lc+mba)+lb(mca)(lc+mba)$
$r = (la+mbc)(lb+mca)(lc+mba)$
The cubic polynomial with these roots is of the form
$x^3 - (l(a+b+c) + m(bc+ca+ab)))x^2 + ((la+mbc)(lb+mca)+(la+mbc)(lc+mba)+lb(mca)(lc+mba)) x - (la+mbc)(lb+mca)(lc+mba)$


Where is my gas shutoff valve for my stove or do I need to have one installed?

Question: I am getting a gas stove delivered to replace my existing one. I am in a condominium unit, but I don't see a gas shutoff valve, there are ones for the water inside of my unit.
I thought it may be this brass nut piece sticking up in the middle, so I put some wd-40, but it doesn't seem to turn.
Should I try to turn it more or is there no shutoff valve here?
Thank you!
Answer: Yes, that appears to be a valve. Note that it can only turn 90 degrees (clockwise as it sits), constrained by the lugs on the side. The line indicates gas flow (in line with the pipe as pictured open, crossways to the pipe closed.)
If it requires excessive force to operate, better to have gas shut off upstream and replace it, rather than risk breaking it.
WD-40 is not really the appropriate thing to use on stuck items - it has a particular use (displacing water) and it's a poor excuse for either a penetrant or lubricant.
Comment: You are correct! just had to turn it with some more force thank you!
Answer: The brass nut piece is in fact your gas shutoff valve. You would have to turn it clockwise to turn off the gas. The engraved line shows the position of the valve: inline with the pipe, the valve is open; perpendicular to the pipe, the valve id closed. Try turning it with more force. Good luck


Pattern Matching in SQL Issue -- Finding the Right Query with PHP

Question: I'm in need of some quick help on matching a field in my database that stores all of the "parent" categories for my online store.  Here's an example of how my "parents" are stored in the table via one field named Parent:
MENS MENS-BRANDS MENS-SHIRTS MENS-T-SHIRTS
Here is my query in PHP to perform the call:
$query = "SELECT id FROM $usertable where parent like '".strtoupper($parent)."'";

The problem is, if I am on MENS-BRANDS, this will also return those products who are listed in every other category because it contains the word "MENS."  Since all of the parents are stored in one field, how can I make my SQL query only recognize each physical word that is separated by spaces in the field itself, instead of it trying to find every instance of different fragments of a word throughout the field?
I hope this makes sense, and any help is surely appreciated.
Answer: Ideally you can change your schema so that you have a separate table linking these categories to your existing entries. This way you can have one row per product and you can easily write a SQL query that looks for the specific word you want without the need for a LIKE match. Added bonus: this will improve performance.
However, if you absolutely cannot change this schema, your best bet is probably to use a regular expression like WHERE parent REGEXP '[[:<:]]MENS[[:>:]]'
I'm here using MySQL regular expressions. If you're using a different database management system the same concept will work, but the exact syntax may be different.


Send email to external user through workflow sharepoint hosted app

Question: I want send email to external user- not in sharepoint i.e to email@example.com through hosted app workflow.I found a solution to create Send email activity in SP2010 and call it in hosted app workflow but, how to create SP2010 workflow in hosted app(SP2013)?also not sure how do I create 2010 workflow in visual studio 2013.
I have also tried to do setting of allow "External sharing" to "Allow both external users who accept sharing invitations and anonymous guest links"but, still not working.Thank you in advance.
Answer: As far as I know, there is no way to deploy SP2010 workflow in SharePoint apps. However, you can use built-in Email Activity in SP2013 workflow. It doesn't matter whether you send email to an internal or to external user.
Please, take a look at the following article: Step-by-step: Sending email messages from a workflow in an app for SharePoint 2013
UPDATE 1. It seems you stumbled into by-design behaviour of 2013 WFs. Please, have a look at the following article: SharePoint 2013 - Unable to send emails to external email addresses (SharePoint 2013 workflows). Probably, the solution N1 in the article can work for you.
Comment: Thanks for Immediate response but I have already tried this didn't work.In this example email send to an user who initiates the workflow and only user having access/account in sharepoint can initiates the workflow.
Comment: Added update 1.
Comment: Thanks for update.  Now I have created SP2010 Reusable global site workflow using sharepoint Designer 2013 and exported as .wsp.  added this solution to site and activated this site features.But when I trying to add this workflow to **App List**(HostedApp) then it shows me "Change a workflow" page blank.I know this is permission related issue.I have tried to give workflow permission as "Elevate" in App manifest file but didn't work.what permission should I give to workflow or which permission steps should I follow? and how?


Why are text objects not mesh objects?

Question: Why are text-objects text objects, and why can they not be calculated like mesh objects? Why is Blender not able to calculate text-objects like mesh objects? If there is a way to completely edit a text-object as a mesh, but keep it a text, or some add-on to do the same thing, could you please tell me?
Comment: https://en.wikipedia.org/wiki/Computer_font
Answer: It has to do with specific font properties.
And also copyright rights :).

Modern computer fonts don't have fixed proportions like meshes do.
They're ever so slightly adjusted when you scale them up/down, to look optically correct.
In low resolutions, they also take advantage of hinting data, to avoid pixel distortion.
Good fonts also contain kerning data. This tells them how much space to put between different character pairs. And allows for ligatures.

When you convert text to mesh/rasterize it, it loses all of these important features.
That's why some font creators explicitly prohibit rasterizing.

Font characters slightly change when scaled, to keep their legibility

Ligature - joining two glyphs into one. Not possible to execute with rasterized text.
Comment: Possibly worth mentioning in  https://en.wikipedia.org/wiki/Computer_font how often "_bezier curve_" appears in refernce to some font types.... understandably the  font objects data part is a curve of type `'FONT`.
Answer: What you are asking for doesn't sound possible, a text object is based off the type face you are using if you want to edit it, it'll will have to be converted into a curve or mesh. If you want to keep as a text object and still be able to manipulate it some how you can still apply modifiers to it or mess around with the Geometry settings in the object data tab.

Why are text objects not mesh objects?


integral computed with respect to a sub-$\sigma$-algebra

Question: Let $\mathcal M_0$ be a $\sigma$-algebra that is contained in a $\sigma$-algebra $\mathcal M$ of subsets of a set $X$, $\mu$ a measure on $\mathcal M$ and $\mu_0$ the restriction of $\mu$ to $\mathcal M_0$. Let $f$ be a nonnegative real-valued function that is measurable with respect to $\mathcal M_0$ (and hence with respect to $\mathcal M$ as well). Then the set of all nonnegative simple functions $\phi\le f$ measurable with respect to $\mathcal M_0$ is a subset of the set of all nonnegative simple functions $\psi\le f$ measurable with respect to $\mathcal M$, and so
$$
\int_Xf\,d\mu_0\le\int_Xf\,d\mu.
$$
Can this inequality be strict?
Answer: No, you have equality.
This is because you can find a nondecreasing sequence of nonnegative, $\mathcal M_0$-measurable functions $(\phi_n)$ such that $\phi_n(x)\to f(x)$ for all $x\in X$. By the monotone convergence theorem applied to $\mu$ and $\mu_0$ it follows that $\int fd\mu=\int fd\mu_0$.
Comment: The functions $\phi_n$ must also be simple.
Comment: Thanks! This totally makes sense!
Comment: If we change the question to say "Let $f$ be a real-valued function...", dropping the adjective "nonnegative", do the integrals still have to be equal?  (I think the answer's yes, since you can probably just split $f$ up into positive and negative parts.)
Comment: Yes,the integrals remain equal, by splitting up indeed.
Comment: @user111 Agreed. If not, then this proof assumes the result!
Answer: The intuition here is that integrating $\mathcal M_0$-measuarble function w.r.t. $\mu_0$ is actually integrating it w.r.t. $\mu$ since you are doing everything on the restriction where both measures agree. Let me provide a formal way of proving this: consider "two" measurable spaces $(X,\mathcal M)$ and $(X,\mathcal M_0)$ - this trick is often used in topology to study different typologies on the same set. You have that
$$
  \mathrm{id}:X\to X \quad\text{ given by }\quad \mathrm{id}(x) = x \;\forall x\in X \tag{1}
$$
is a $\mathcal M/\mathcal M_0$-measurable map, and so induces the image measure $\mathrm{id}_*\mu$ on $(X,\mathcal M_0)$ define by
$$
  (\mathrm{id}_*\mu)(A) = \mu(\mathrm{id}^{-1}(A)) = \mu(A) \qquad\forall A\in \mathcal M_0. \tag{2}
$$
From $(2)$ it is clear that we can represent $\mu_0 = \mathrm{id}_*\mu$, so that for any non-negative $f\in \mathcal M_0$:
$$
\begin{align}
  \int f\,\mathrm d\mu_0 &= \int f\,\mathrm d(\mathrm{id}_*\mu) &\text{from }(2)
  \\
  &= \int (f\circ \mathrm{id})\,\mathrm d\mu  &\text{change of variables}
  \\
  &= \int f\mathrm d\mu  &\text{from }(1)
\end{align}
$$
where we used the change of variables formula.
Perhaps, there may be a more basic proof - but I believe it is important to learn techniques of dealing with different structures on the same set using the $\mathrm{id}$ map.
Comment: @mathreader: sure :) for some reason from your questions and answers I got a feeling that such level won't be of a much problem to you, but anyways. I've edited to give some intuition of what we are aiming to prove first.
Comment: Thank you! This is a little too advanced for me right now. But maybe I'll educate myself enough to understand it.


Does "un jus de pomme" really mean "a glass of apple juice"?

Question: When in French we say things such as un jus d'orange, un jus de pomme, etc., is it true that what we are really saying is a glass of orange juice, a glass of apple juice, etc.? So, that "un" implies that we are talking about those drinks served in a drinking container such as a glass?
Comment: Whenever in english-speaking countries, I order "a beer, please" they seem to provide the glass similarily. And fortunately, one should say. If they had just poured it into my lap I'd be less than satisfied. Usually it is because it is the only sensible result of combining a + (the beverage).
Comment: Same as English - "I'd like an orange juice, please".  It doesn't have to be a glass - it could be a bottle, etc.
Answer: Yes, in the context of a restaurant or café, when you order something like, "Un jus d'orange, s'il vous plaît," or "Je voudrais un café," you mean a glass of orange juice or a cup of coffee.  No need to say "un verre de jus d'orange."  This construct is similar in English; when you say you'd like an iced tea, you don't have to say a glass of iced tea.
It can depend on the drink; some are partitive, like de l'eau.
Comment: I'm probably wrong gramatically, but I do say "une eau gazeuse svp" very often when asking for a bottle of sparkling water in bars/restaurants! I wouldn't say "une eau" though.
Comment: C'est pour ça que j'ai lié la question de l'eau ; il y a plusieurs commentaires qui montrent des différences régionales.
Answer: Jus is a substance, not a countable noun. When you use the determinant un (equivalent to English "a" or "one") or another number in front of a substance, it usually implies an amount. For juice or milk it would be a glass, for beer it could be a bottle or a pint, for coffee it would be a cup. This is a form of synecdoche, a figure of speech where the part implies the whole, or the container implies the content.
This sort of phrasing also exists in English: "You passed out after drinking a third glass." You didn't drink glass, you drank a beverage served in a glass. It's a simple shortcut we use to avoid saying either the substance or the container, whichever can be gathered from the context.
Note that you could ask for orange juice without taking that kind of shortcut.

Je voudrais un verre de jus d'orange. I would like a glass of orange juice.
Je voudrais un jus d'orange. I would like (an implied glass of) orange juice.
Je voudrais du jus d'orange. I would like some orange juice.
Answer: When you order food it will mean what you suspect most of the time, a glass of juice ; this is so if the context in which the term is used clearly implies that a glass has been meant. However, it can also mean a particular type of juice; in this case you can sometimes also say "du jus d'orange".
In the food industry and in government agencies and other agencies in charge of controlling food standards, this will mean a particular type of juice very often, for instance a juice coming from Florida and subjected to a particular tax, or having a given content in vitamin C, etc.
For instance, someone who'd rather drink only orange juice from Florida might ask a question such as the following, although that is not likely to happen often in France.

Je voudrais un/du jus d'orange qui vient de Floride ; en avez-vous ?

Another possibility, more likely that one, is this one.

Nous voudrions  un/du jus d'orange fraichement pressé, mais pas si ce sont des oranges du Maroc ; auriez-vous ça/cela ?


File in binary form

Question: I want to write data into the file in binary form.
I was trying using the mentioned below
FILE *fp = fopen("binaryoutput.rgb888", "ab+");

for(int m=0; m<height; m++)
{
   for (int n=0; n< width; n++)
   {
    temp = (pOutputImg+m*3+n*3); // here pOutputImg & temp is a pointer to a unsigned char
    fprintf(fp,"%u",*temp);
   }
}
fclose(fp);

I am able to get data which is strored at pOutputImg but not in binary form.
Can anyone guide me the correct step..
Thanks in advance
Comment: It is very difficult to figure out the intent. What are the types of temp and pOutputImg? Why do you multiply both m and n by 3? Shouldn't one of them be multiplied by the other's dimension?
Comment: @Marcelo Cantos : That is for obtaining the data in correct format for RGB888.. by writing that file in binary format will give me the correct format for RGB888 image..
Answer: Replace fprintf() with fwrite().
Ex:
fwrite(temp, sizeof(*temp), 1, fp);

The whole purpose of fprintf() is to format binary data as readable ascii ... the exact opposite of what you want. fwrite() is for directly writing binary data.
Answer: If this is a pixmap of rgb triplets, you can write the binary data with one line:
fwrite(pOutputImg, 3, height * width, fp);

File in binary form


Nonlinear Regression with linear method from Python's scikit-learn/ sklearn using a polynom

Question: I am trying to do a regression analysis for some data, say 20 variables
$\left( {{x_1},{x_2},{x_3},...} \right)$ where the underlying probability distribution is known (e. g. ${x_1} \in {\rm N}({\mu _1},{\sigma _1})$ , ${x_2} \in U({a_2},{b_2})$ and so on).
The variables are assumed to be uncorrelated. The overall behavior of $y = f({x_1},{x_2},{x_3},...)$ is nonlinear.
Now, I would like to use a method of the scikit-learn module (e.g. Lasso, Lars, Ridge, Bayesian Regression etc.) for a metamodel-fit.
For taking into account the cross-influences and non-linear behaviour of some variables in y, I want to use a polynomial, i. e. I don't just give the vector $\overrightarrow x  = \left( {{x_1},{x_2},{x_3},...} \right)$ to the regression method, I rather feed it $\left( {{x_1},{x_2},{x_3},...,{x_1}*{x_1},{x_1}*{x_2},...} \right)$ which is a polynomial of degree two or more.
My question is: Which method (Lasso etc.) is best for this problem? How can I give the information to the regression method that the underlying distributions (mean and std deviation) and correlation of the higher order terms is known. For example ${{x_1}}$ and ${{x_1}*{x_1}}$ are highly correlated and both their distributions are known by ${\mu },{\sigma }$. How can I add this information to the regression analysis? Otherwise without this additional information, I guess it will fit a poor model.
Any ideas?
Answer: You wrote you want to use sklearn anyway, did you take a look at the sklearn.preprocessing.PolynomialFeatures class? This should solve the first part of your problem.
For the other part, why not actually try and measure? Run e.g. LassoCV on the polynomial dataset and check if holding out very correlated features changes performance?
Embedding this information sounds rather complicated, I'd go for the simpler approach of either removing correlated features beforehand or running a PCA on it. And see how things change.


Why the shell does not terminate when pressing Ctrl+C on the terminal?

Question: When the shell is not running any process, if I press Ctrl+C on the terminal, the shell will not terminate. Is this simply because the shell ignores the SIGINT signal, or is there another reason?
Answer: The shell ignores ctrl-C so that other programs that the shell is running can catch it. An EOF on a blank line exits (ctrl-D in *nix, ctrl-Z in Windows).
Comment: You mean if a process ignores the `SIGINT` signal, then this signal will go to its child process?
Comment: @Steve I think it is specific to interactive shell sessions. The shell is an interpreter, so anything you type is going through the shell to your program. The shell delivers keyboard interrupts intact, because in an interactive environment, programs may be expecting them, but in any other environment they won't.
Comment: No, I don't think anything goes through the shell, for example if the shell executed the `cat` program, then anything I type into the terminal is going directly to the `cat` program without going through the shell first (Assuming you mean by "shel" programs like `bash` and `sh`).


didReceiveRemoteNotification function doesn't called with FCM notification server

Question: I'm using FCM server for remote notifications, it worked perfectly with sending and receiving notifications.
My problem is when the device is in the background, this function func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) doesn't called.
Solutions that I've tried:

This function:
userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)

is called when user tapped on the notification. Otherwise, it's not triggered.

Adding "content-available": true, "priority": "high" to the payload. Also, I tried this value "content-available": 1.
This is my function code:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any],
                     fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

        print("userInfo: \(userInfo)")
      completionHandler(.newData);

    }
Comment: Sure! you deserve that.
Comment: If you are testing with **Postman** then try changing `"content-available": true` to `"content_available" : true`. **content-available** will send notification but it doesn't call `didReceiveRemoteNotification`.
Comment: Yes!! it solved with this solution! Thank you, you really helped me!
Comment: Glad it helped. Do you mind accepting it as an answer so it can help someone else too.
Answer: Just adding on accepted answer: in my case the problem was the same, but as I'm sending the Notification through an http "POST" NSMUtableRequest the way to apply the accepted answer was to actually add it in the notification parameters together with sound, badge, tiles etc etc..
let postParams: [String : Any] = [
                "to": receiverToken,
                "notification": [
                    "badge" : 1,
                    "body": body,
                    "title": title,
                    "subtitle": subtitle,
                    "sound" : true, // or specify audio name to play
                    "content_available": true, // this will call didReceiveRemoteNotification in receiving app, else won't work
                    "priority": "high"
                ],
                "data" : [
                    "data": "ciao",
            ]
                ]

Hope this will also help others, as I spent a long time trying to figure out how to apply this solution.
Many thanks.
Answer: If you are testing with Postman then try changing "content-available": true to "content_available" : true. content-available will send notification but it doesn't call didReceiveRemoteNotification.
Answer: All you need to see remote notification in background and foreground and show as alert when app run are this appDelegate.swift that i used in my code:
import Firebase
import UserNotifications
import FirebaseMessaging

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate  {
    var window: UIWindow?
    let gcmMessageIDKey = "gcm_message_id"
    var deviceID : String!

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // [START set_messaging_delegate]
        Messaging.messaging().delegate = self
        // [END set_messaging_delegate]

        if #available(iOS 10.0, *) {
            // For iOS 10 display notification (sent via APNS)
            UNUserNotificationCenter.current().delegate = self

            let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
            UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })
        } else {
            let settings: UIUserNotificationSettings =
                UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
            application.registerUserNotificationSettings(settings)
        }

        application.registerForRemoteNotifications()
        FirebaseApp.configure()
        Fabric.sharedSDK().debug = true
        return true

    }

    func showNotificationAlert(Title : String , Message : String, ButtonTitle : String ,window : UIWindow){
        let alert = UIAlertController(title: Title, message: Message, preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: ButtonTitle, style: .cancel, handler: nil))
        window.rootViewController?.present(alert, animated: true, completion: nil)

    }

    // [START receive_message] remote notification
    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {

        // Print message ID.
        if let messageID = userInfo[gcmMessageIDKey] {
            print("Message ID: \(messageID)")
        }

        // Print full message.

        print(userInfo)

    }

    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
                     fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        // Print message ID.
        if let messageID = userInfo[gcmMessageIDKey] {
            print("Message ID: \(messageID)")
        }

        // Print full message.
        print(userInfo)
        completionHandler(UIBackgroundFetchResult.newData)

    }

    func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
        print("Unable to register for remote notifications: \(error.localizedDescription)")
    }

    // This function is added here only for debugging purposes, and can be removed if swizzling is enabled.
    // If swizzling is disabled then this function must be implemented so that the APNs token can be paired to
    // the FCM registration token.
    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        print("APNs token retrieved: \(deviceToken)")

        // With swizzling disabled you must set the APNs token here.
        // Messaging.messaging().apnsToken = deviceToken
    }
}

// [START ios_10_message_handling]
@available(iOS 10, *)
extension AppDelegate : UNUserNotificationCenterDelegate {

    // Receive displayed notifications for iOS 10 devices.
    func userNotificationCenter(_ center: UNUserNotificationCenter,
                                willPresent notification: UNNotification,
                                withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        let userInfo = notification.request.content.userInfo

        // With swizzling disabled you must let Messaging know about the message, for Analytics
        // Messaging.messaging().appDidReceiveMessage(userInfo)
        // Print message ID.
        if let messageID = userInfo[gcmMessageIDKey] {
            print("Message ID: \(messageID)")
        }

        // Print full message.
        print(userInfo)

        // Change this to your preferred presentation option
        completionHandler([.alert, .badge, .sound])
    }

    func userNotificationCenter(_ center: UNUserNotificationCenter,
                                didReceive response: UNNotificationResponse,
                                withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfo
        // Print message ID.
        if let messageID = userInfo[gcmMessageIDKey] {
            print("Message ID: \(messageID)")
        }

        if let aps = userInfo["aps"] as? NSDictionary {
            if let alert = aps["alert"] as? NSDictionary {
                if let title = alert["title"] as? NSString {
                    let body = alert["body"] as? NSString
                    showNotificationAlert(Title: title as String, Message: body! as String, ButtonTitle: "Ok", window: window!)
                }
            } else if let alert = aps["alert"] as? NSString {
                print("mohsen 6 =\(alert)")
            }
        }
        // Print full message.
        print(userInfo)

        completionHandler()
    }
}
// [END ios_10_message_handling]

extension AppDelegate : MessagingDelegate {
    // [START refresh_token]
    func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
        print("Firebase registration token: \(fcmToken)")
        deviceID = fcmToken

        let dataDict:[String: String] = ["token": fcmToken]
        NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
        // TODO: If necessary send token to application server.
        // Note: This callback is fired at each app startup and whenever a new token is generated.
    }
    // [END refresh_token]
    // [START ios_10_data_message]
    // Receive data messages on iOS 10+ directly from FCM (bypassing APNs) when the app is in the foreground.
    // To enable direct data messages, you can set Messaging.messaging().shouldEstablishDirectChannel to true.
    func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
        print("Received data message: \(remoteMessage.appData)")
    }
    // [END ios_10_data_message]

}

Answer: As you tried i believe every thing , background permission is enable , content-available is the part of payload, you are also receiving notification in active state, last thing will be Power save mode,  you need to check is power saving is off; as if you Phone is in power saving mode, then background refresh and other process is gone in limited state, so app will not call didReceivedNotifcation in background.
Comment: I just tried your solution but unfortunately it doesn't called in the background.
Comment: `"content-available": 1`  should be the part of aps in payload ; Please check  apple documentation (https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1 ).
Answer: The first thing you need to check is the Background Mode > Remote Notification is on. If not, it will not be invoked in the background mode.
Comment: Yes it's checked in the project capabilities.
Answer: Step 1 – Add framework
import UserNotifications

Step 2 – Inherit AppDelegate with UNUserNotificationCenterDelegate
final class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {}

Step 3 – Make appropriate changes for registerPushNotifications and call it didFinishLaunchingWithOptions
private func registerPushNotifications() {
    if #available(iOS 10.0, *) {
        UNUserNotificationCenter.currentNotificationCenter().delegate = self
        UNUserNotificationCenter.currentNotificationCenter().requestAuthorizationWithOptions([.Badge, .Sound, .Alert], completionHandler: { granted, error in

            if granted {
                UIApplication.sharedApplication().registerForRemoteNotifications()
            } else {
                    // Unsuccessful...
            }
          })
    } else {
        let userNotificationTypes: UIUserNotificationType = [.Alert, .Badge, .Sound]
        let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
        UIApplication.sharedApplication().registerUserNotificationSettings(settings)
        UIApplication.sharedApplication().registerForRemoteNotifications()
   }
}

Step 4 – Implement new handlers
    // leave this for older versions
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
}

// For iOS10 use these methods and  pay attention how we can get userInfo
// Foreground push notifications handler
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, willPresentNotification notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void) {
    if let userInfo = notification.request.content.userInfo as? [String : AnyObject] {
        // Getting user info
    }
    completionHandler(.Badge)
 }

// Background and closed  push notifications handler
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, didReceiveNotificationResponse response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void)  {
    if let userInfo = response.notification.request.content.userInfo as? [String : AnyObject] {
        // Getting user info
    }
    completionHandler()
}

Comment: Unrelated, I don't want you to lose hope, Firebase has loads of problems in v5, this is, and was my method in Firebase 3 , when they messed it up; I had to switch to OneSignal. They also support CURL.
Comment: Yes, I think so. Because I have other problems that because of Firebase versions.
Comment: If you ever changed your mind, it's not much of a choice; I'll be here for any issues with OneSignal.