text:
Q: What is difference between U-Boot and BIOS ? What is difference between U-Boot and BIOS ?
Are both these devices present on a particular CPU or once a single device can be present at a time?
It would be nice if someone provides examples.

A: I believe that the difference is that U-boot is Open Source.
U-Boot was first created for a 8xx PowerPC. It was moved to sourceforge.net with the name of PPCBoot. Two years later it merged with ARMBoot, a bootloader for ARM cpu. Then, it evolved to support various other chips and platforms.
BIOS was created for IBM PCs. So I think it is closed source.

A: The main difference is that u-boot is just a bootloader. A Bios is a bootloader and functions to use the hardware on your board.

A:
What is difference between U-Boot and BIOS ? Are both these devices present on a particular CPU or once a single device can be present at a time?

There are numerous difference between U-Boot and a BIOS.
BTW these are both software, not "devices".

*

*BIOS is essentially a PC concept, having appeared in CP/M personal computers and the original IBM PC.
U-Boot tries to live up to its name ("Universal Boot"), and has been ported to many architectures/platforms.

*BIOS functions include basic system initialization after a reset or powerup, performing Power On Self Tests (aka POST), provide an interactive hardware configuration interface (aka BIOS setup) and bootstraping the PC.  The use of the integrated device drivers of the original IBM PC's BIOS has been abandoned in favor of OS device drivers.
U-Boot functions include basic system initialization and bootstraping the system.  The booting sequence can optionally be aborted to enter an interactive command-line session.  Since U-Boot is extensible, any number of features can be configured in or added, such as POST and other diagnostics, filesystem maintenance utilities, network capabilities such as retrieving time-of-day (SNTP) or an IP address (DHCP client), and reading/writing/modifying memory locations.  The actual features and capabilities of U-Boot will vary on system/installation to system.

*BIOS handles the initial startup of the PC as first-stage bootloader.  It typically executes in place (XIP) in the Flash memory that it resides in.
U-Boot is typically a second (or even third) stage bootloader.  It could be the 1st-stage bootloader like a BIOS, since it can XIP, but I'm not aware if any platform has actually done that.  Typically U-Boot is loaded from Flash memory and executed in main memory, e.g. SDRAM.

*As a first-stage bootloader the BIOS is rather limited as it what it loads and executes, such as the Master Boot Record (MBR) from a hard disk.  The BIOS does not typically load the actual OS image.
U-Boot, when it is provided the uImage file format, is aware of the OS it is loading, and can properly prepare memory buffers and parameters for proper OS initialization.

*BIOS, since it is PC based, typically uses the video adapter and keyboard as operator I/O devices.
U-Boot typically uses a RS232 serial port as the operator I/O device.

*The original IBM PC BIOS was published in the IBM PC technical documents as an x86 assembly language listing.  Modern versions sold by AMI, Award and Phoenix are proprietary.
U-Boot is released under the GNU GPL.
Linux on PCs typically use Grub as the post-BIOS bootstrap program.  I suppose U-Boot could be used in place of Grub, but I don't know the reasons for or against such an implementation.

A: Generally speaking there isn't a difference. Both U-Boot and BIOS are forms of boot loaders. You would not have both on one system, you take one or the other.
Your BIOS (Basic Input/Output System) is a complex set of flash stores software which runs on power-up to initialize your system hardware and load the operating system.
U-Boot is an open source boot loader which is used on various linux systems and I believe some ARM systems use it. Once again it is used to process hardware and operating systems on start up.
Apologies if this is a bit brief. If you want to read the full details around u-boot it is available through their github and the internet is covered in information regarding BIOS.


text:
Q: Name of the View or iOS Component used in the gif? This is the way i need to create (gif).

The Above gif shows a view which pops up from bottom while clicking on the moto g3 button overlaying the parent view with some gestures to control it.
I would like to know the name of this view if available in the iOS components or any specific ways to create it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Rendering to texture fills texture with color in XNA I'm working in XNA and I hit the following problem: My goal was to have a number of different textures be drawn to a texture and then draw the final texture to the screen with a given alpha value.
The problem is that the texture I draw to is full screen and filled with a color rather than transparency, so it blocks out everything behind it.
Everything is 2d, here is my code:
public void Draw(SpriteBatch sb)
            {
            if (opacity > 0)
                {
                gd.SetRenderTarget(formTexture);
                gd.Clear(Color.Transparent);
                for (int i=0; i<formItems.Count; i++)
                    {
                    ((FormItem)formItems[i]).draw(sb);
                    }
                sb.Begin(SpriteSortMode.Immediate, BlendState.Additive);
                    for (int i=0; i<formItems.Count; i++)
                        {
                        FormItem fi = (formItems[i] as FormItem);
                        if (fi.glow != null)
                            {
                            sb.Draw(fi.glow, new Rectangle((int) fi.location.X + fi.width/2 - fi.glow.Width/2, (int) fi.location.Y + fi.height/2 - fi.glow.Height/2, fi.glow.Width, fi.glow.Height), Color.White);
                            }
                        }
                sb.End();
                gd.SetRenderTarget(null);
                sb.Begin();
                sb.Draw(formTexture, new Rectangle(0, 0, gd.Viewport.Width, gd.Viewport.Height), Color.White*opacity);
                sb.End();
                }
            }

formTexture is a RenderTarget2D object, gd is the graphics device. This is how formTexture is initialized:
formTexture = new RenderTarget2D(this.gd, this.windowWidth, this.windowHeight);

A: The problem that you are experiencing is that setting a render target - and the backbuffer counts as a render target - will clear that render target.
At least if RenderTargetUsage.DiscardContents (MSDN) is set. It's the default because it's the only one that performs well on Xbox 360, where preserving the contents requires an expensive copy. (And it's the default on Windows just to keep the behaviour the same cross-platform).
Your backbuffer is being cleared to the "whoops this is a fresh buffer" colour (usually purple) on this line:
gd.SetRenderTarget(null);

There are two ways to solve this:
The preferred way is to order all your rendering so that you set up your render targets at the beginning of the frame, and then draw your scene to the backbuffer afterwards. Never touching a render target more than once.

The other way is to attach an event to GraphicsDeviceManager.PreparingDeviceSettings that sets the backbuffer to use RenderTargetUsage.PreserveContents:
void SetBackbufferPreserveContents(object sender,
                                   PreparingDeviceSettingsEventArgs e)
{
    e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage
            = RenderTargetUsage.PreserveContents;
}

// in your game constructor:
graphics.PreparingDeviceSettings += SetBackbufferPreserveContents;

You should only use this second method if your game exclusivly targets Windows.


text:
Q: If space is expanding, how can I see a galaxy 12 billion light years away where it is today? Assuming space is expanding (and that seems plausible), photons from a galaxy that have been traveling for 12 billion years must have been traveling on a curve to get to us due to the fact that where we see the light today is not where the object is now. And yet there is no distortion in the light from that galaxy. Why?

A: You and your buddy are standing on some kind of sheet of stretchy material.  Someone is slowly stretching the material in all directions at once, which causes you and your buddy to slowly get further and further apart.  Your buddy rolls a ball towards you.  When you rolled the ball, you and your buddy were 20 feet apart.  As the ball rolls, the sheet is, as described, expanding.  By the time the ball reaches you, you and your buddy are 25 feet apart.
Analogy key:

*

*you = telescopes observing distant stars

*buddy = distant star

*ball = photon

*stretchy sheet = space

*person stretching the sheet = dark energy??  TBD.

As you can see in this analogy, no curved paths or distortion are necessary.

A: Generally it does not travel on a curve. Just the space through which it travels has expanded. There is no need for curved trajectory to explain the expansion of space.


text:
Q: HTML5/JSON : UTF-8 cant read proper characters from json My HTML5 app is using JSON to fetch data.
The json contact characters like: ö
but the output in my browser is like: �
I used the following in HTML5 header:
<meta http-equiv="Content-Type"content="text/html;charset=utf-8">

and used this in the AJAX to read the JSON:
$.ajax({
    url: "items.json",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(response) {
    ..........

But its not helping me out. What will be the solution to it?
I even tried "ISO-8859-1" on both places.

A: Make sure your font family that you are using for your site supports the extended characters you are attempting to print.  Then use firebug or something similar to view what character set your backend json service is sending back.  It may not be sending it back.  Also, check to see if firebug is showing the correct character in the JSON response.  It's possible that the problem is even further back than you thought.


text:
Q: Sort dataframe column according to another dataframe's column I have 2 dataframes  df and df1 and both are having file paths like this.
    df = pd.DataFrame({"X1": ['f','f','o','o','b','b'],
"X2": ['fb/FOO1/bar0.wav','fb/FOO1/bar1.wav','fb/FOO2/bar2.wav','fb/FOO2/bar3.wav','fb/FOO3/bar4.wav','fb/FOO3/bar5.wav']})

    X1  X2
0   f   fb/FOO1/bar0.wav
1   f   fb/FOO1/bar1.wav
2   o   fb/FOO2/bar2.wav
3   o   fb/FOO2/bar3.wav
4   b   fb/FOO3/bar4.wav
5   b   fb/FOO3/bar5.wav

and another dataframe,
 df1 = pd.DataFrame({"X1": ['b','o','b','f','o','f'],
"X2": ['fb1/FOO3/bar5.opus','fb1/FOO2/bar2.opus','fb1/FOO3/bar4.opus','fb1/FOO1/bar1.opus','fb1/FOO2/bar3.opus','fb1/FOO1/bar0.opus']})

    X1  X2
0   b   fb1/FOO3/bar5.opus
1   o   fb1/FOO2/bar2.opus
2   b   fb1/FOO3/bar4.opus
3   f   fb1/FOO1/bar1.opus
4   o   fb1/FOO2/bar3.opus
5   f   fb1/FOO1/bar0.opus

Now I want to sort the 2nd dataframe df1's X2 column (filepath) according to the first dataframe df's filepaths. Such that, output should like this
    X1  X2
0   f   fb1/FOO1/bar0.opus
1   f   fb1/FOO1/bar1.opus
2   o   fb1/FOO2/bar2.opus
3   o   fb1/FOO2/bar3.opus
4   b   fb1/FOO3/bar4.opus
5   b   fb1/FOO3/bar5.opus

A: You might create a sorter dictionnary which would allow you to sort your values with a custom key:
#the following is creating a key with the name part of the filepath (could have been done with regex)
sorter_dict = dict(zip(df.X2.apply(lambda x : x.split('/')[-1].split('.')[0]),df.index))
#{'bar0': 0, 'bar1': 1, 'bar2': 2, 'bar3': 3, 'bar4': 4, 'bar5': 5}

#on df1, let's create a temp col with the name part of the filepath
df1['temp'] = df1.X2.apply(lambda x : x.split('/')[-1].split('.')[0])
#and apply our sorter dict
df1['sorter'] = df1.temp.map(sorter_dict)
#at the end, simply sort
df1 = df1.sort_values('sorter')
#and delete unecessary cols
del df1['temp'], df1['sorter']

Output
| X1   | X2                 |
|:-----|:-------------------|
| f    | fb1/FOO1/bar0.opus |
| f    | fb1/FOO1/bar1.opus |
| o    | fb1/FOO2/bar2.opus |
| o    | fb1/FOO2/bar3.opus |
| b    | fb1/FOO3/bar4.opus |
| b    | fb1/FOO3/bar5.opus |

A: This could work if the file path names are a consistent length within the dataframes. Simply create a new column with the part that you want to sort-by, sort-by that column and then drop the new column:
df['X3'] = df['X2'].astype(str).str[3:-4]
df1['X3'] = df1['X2'].astype(str).str[4:-5]

df1 = df1.set_index('X3')
df1 = df1.reindex(index=df['X3'])
df1 = df1.reset_index()

df1 = df1.drop('X3', axis = 1)
df = df.drop('X3', axis = 1)

df1


text:
Q: CmdExec Powershell Job Step Escape Double Quotes I have a PowerShell job step I'm trying to execute and it's failing with a syntax error I believe is because I'm trying to escape double-quotes in my code. Can anyone take a look and help me with getting the escape characters right, or tweaking my code.
powershell.exe "Compress-Archive -Path \\NAS\DB-backups\BackupFiles -DestinationPath `"\\NAS\DB-Backups\BackupFiles $(get-date -f yyyy-MM-dd).zip`" -CompressionLevel Optimal"

I've also tried it using \ as the escape character
powershell.exe "Compress-Archive -Path \\NAS\DB-backups\BackupFiles -DestinationPath \"\\NAS\DB-Backups\BackupFiles $(get-date -f yyyy-MM-dd).zip\" -CompressionLevel Optimal"

I tried running this script (with \ escape characters) in the command line and it ran fine. Thanks again for any help.

A: I believe the problem you're having has to do with SQL Server Agent Tokens as referred to by this Stack Exchange post SQL Agent - PowerShell step "syntax error"
Excerpting from that post

This is a not very intuitive and I was never able to find anything
  concrete on the explanation [e.g. no exact BOL or white paper was
  found]. The syntax error in the SQL Agent job is a T-SQL syntax error
  based on User Tokens. So that basically means that a PowerShell
  Sub-Expression Operator is treated as a Token to SQL Server Agent. So
  in PowerShell this $( ) appears to be treated as reserved character
  sequence for SQL Server Agent.

Referencing your attempts,
$(get-date -f yyyy-MM-dd).zip

notice the $( where you're trying to get the current date for the zip file.  That syntax is a Powershell sub-expression. This part is attempting to be interpreted by the SQL Server Agent as a token.
My suggestion would be to separate out the sub-expression into another Powershell variable ($ZipDate) first and then use that to finish the Powershell command.
Try this:
powershell.exe "$ZipDate = (get-date -f yyyy-MM-dd); Compress-Archive -Path "C:\TestCompress" -DestinationPath "c:\TestCompressOut\$ZipDate.zip" -CompressionLevel Optimal"


text:
Q: How to hide a Many2one field without any dependecies? I want to make a field invisible but without any other dependencies.
<field name="days_before" attrs="{'invisible': [('object', '=', '5')]}"/>

So without [('object', '=', '5')]
Is there a way?

A: Making a field invisible without any condition is much easier syntax.
<field name="days_before" invisible="1"/>
Same syntax works for readonly. Either value 1 or True can be used.

A: You can add invisible="1" in the xml file like:
<field name="field_name" invisible="1"/>

Also if you have inherited the view you can make an inherited field invisible without conditions by adding in the xml file:
<field name="field_name" position="attributes">
    <attribute name='invisible'>1</attribute>
</field>


text:
Q: cannot create /dev/stdout: No such device or address I'm want to run a shell command via node and capture the result of stdout. My script works fine on OSX, but not on Ubuntu.
I've simplified the problem and script to the following node script:
var execSync = require('child_process').execSync,
    result = execSync('echo "hello world" >> /dev/stdout');

// Do something with result

Results in:

/bin/sh: 1: cannot create /dev/stdout: No such device or address

*

*I have tried replacing /dev/stdout with /dev/fd/1

*I have tried changing the shell to bash... execSync('echo ...', {shell : '/bin/bash'})
Like I said, the problem above is simplified. The real script accepts as a parameter the name of a file where results should be written, so I need to resolve this by providing access to the stdout stream as a file descriptor, i.e. /dev/stdout.
How can I execute a command via node, while giving the command access to its own stdout stream?

A: On /dev/stdout
I don't have access to an OSX box, but from this issue on phantomjs, it seems that while on both OSX/BSD and Linux /dev/stdout is a symlink, nonetheless it seems to work differently between them. One of the commenters said it's standard on OSX to use /dev/stdout but not for Linux. In another random place I read statements that imply /dev/stdout is pretty much an OSX thing. There might be a clue in this answer as to why it doesn't work on Linux (seems to implicitly close the file descriptor when used this way).
Further related questions:

*

*https://unix.stackexchange.com/questions/36403/portability-of-dev-stdout

*bash redirect to /dev/stdout: Not a directory
The solution
I tried your code on Arch and it indeed gives me the same error, as do the variations mentioned - so this is not related to Ubuntu.
I found a blog post that describes how you can pass a file descriptor to execSync. Putting that together with what I got from here and here, I wrote this modified version of your code:
var fs = require('fs');
var path = require('path');

var fdout = fs.openSync(path.join(process.cwd(), 'stdout.txt'), 'a');
var fderr = fs.openSync(path.join(process.cwd(), 'stderr.txt'), 'a');

var execSync = require('child_process').execSync,
    result = execSync('echo "hello world"', {stdio: [0,fdout,fderr] });

Unless I misunderstood your question, you want to be able to change where the output of the command in execSync goes. With this you can, using a file descriptor. You can still pass 1 and 2 if you want the called program to output to stdout and stderr as inherited by its parent, which you've already mentioned in the comments.
For future reference, this worked on Arch with kernel version 4.10.9-1-ARCH, on bash 4.4.12 and node v7.7.3.


text:
Q: How can I create g-suite add-ons or share Appscripts that I've written with others? Every two weeks my boss posts the shift schedule on google sheets app. Using Appscript I built a program that scans the schedule for my name and updates my google calendars app so I can have my shifts automatically updated. I copy and paste the schedule into a personal spreadsheet and then run the program.
Is there a simple way I can share the program with my co-workers?
I figured the easiest way to do it would be to build an add-on, that takes their personal g-suite and does the same thing, but I have no idea how to do that.
Does anyone know where I can find sources to execute this?

A: One option here that would be a lot easier for you would be to make a template spreadsheet which has the code written in it, that your coworkers could make a copy of the spreadsheet and run the code. To make it more user-friendly, I would recommend using a UI menu to prompt them to enter their name, then it could scan the spreadsheet for their name, making calendar events accordingly.
Google has good documentation on publishing add-ons as seen here, but it would be a much more tedious and time-consuming process.


text:
Q: Julia implementation of Louvain algorithm I am trying to implement the Louvain Algorithm in Julia.
The paper describes the modularity gain as:

Where Sum_in is the sum of the weights of the links inside C, Sum_tot is the sum of the weights if the links incident to nodes in C, K_i is the sum of the weights if the links incident to node i, K_i_in is the sum of the weights of the links from i to nodes in C, and m is the sum of the weights of all the links in the network.

My implementation is:
function linksIn(graph, communities, c)::Float32
    reduce(+,
        map(
            e-> (communities[e.src] == c && communities[e.dst] == c)
                ? e.weight
                : 0
            , edges(graph)
        )
    )
end

function linksTot(graph, communities, c)::Float32
    reduce(+,
        map(
            e-> (communities[e.src] == c || communities[e.dst] == c)
                ? e.weight
                : 0
            , edges(graph)
        )
    )
end

function weightsIncident(graph, node)::Float32
    reduce(+,
        map(
            n-> get_weight(graph, node, n)
            , neighbors(graph, node)
        )
    )
end

function weightsIncidentComunity(graph,communities, node, c)::Float32
    reduce(+,
        map(
            n-> (c == communities[n])
                ? get_weight(graph, node, n)
                : 0
            , neighbors(graph, node)
        )
    )
end

function modulGain(graph, communities, node, c)::Float32

    # Calculate the variables of the modularity gain equation
    wIn = linksIn(graph, communities, c);
    wTot = linksTot(graph, communities, c);
    k = weightsIncident(graph, node);
    k_com = weightsIncidentComunity(graph, communities, node, c);
    m = reduce(+, map(e->e.weight, edges(graph)));

    # return the result of the modularity gain equation

    return ((wIn +k_com) / (2*m) - ((wTot+k)/(2m))^2 )
        - ((wIn/(2m)) - (wTot/(2m))^2 - (k/(2m))^2 )
end

If I compare the results of the funcion modulGain the the difference in modularity I get the following examples for the first pass where each node is in its own comunity in this graph.

*

*modulGain(graph, communities, 1, 1) -> 0.00010885417

*modulDifference(graph, communities, 1, 1) -> 0.0

and

*

*modulGain(graph, communities, 1, 3) -> 4.806646e-5

*modulDifference(graph, communities, 1, 3) -> 5.51432459e-5

When running the algorithm using the Modularity Gain equation it tends to get stuck in an infinite loop.
And I want to avoid to use the modularity difference since there is a clear performance improvement when using the Modularity Gain Equation.
Can someone explain me what is wrong with my implementation?
Thank you.


text:
Q: Invariance of mutual information under injective functions Let $X\colon \Omega\to\mathcal X$ and $Y\colon \Omega\to \mathcal Y$ be two random variables. In M.S. Pinkser's Information and information stability of random variables and processes mutual information is defined as:
$$I(X; Y) = \sup \sum_i  P_{(X,Y)}(E_i) \log \frac{ P_{(X, Y)}(E_i)}{ P_{X\times Y}(E_i),} ,$$
where the supremum is taken over all finite partitions $\{E_1, \dotsc, E_n\}$ of $\mathcal X\times\mathcal Y$ and one uses the usual conventions $0\cdot \log 0/a = a\log a/0 = 0$ for $a\ge 0$.
In particular, if $P_{(X, Y)}$ is not absolutely continuous w.r.t. $P_{X\times Y} = P_X\otimes P_Y$, then $I(X; Y) = \infty$. In the other case, mutual information becomes the well-known formula involving the Radon–Nikodym derivative:
$$I(X; Y) = \int_{\mathcal X\times \mathcal Y} \log \left( \frac{ \mathrm{d}P_{X,Y} }{ \mathrm{d}(P_X\otimes P_Y) }  \right)\, \mathrm{d}P_{X,Y}$$
and is finite.
One can prove that if $f\colon \mathcal X\to \mathcal X'$ and $g\colon \mathcal Y\to \mathcal Y'$ are measurable bijective mapping with measurable inverses, then $I(X; Y) = I(f(X); g(Y))$.
I wonder if this assumption can be weakened in the smooth case:

Assume that $\mathcal X = \mathbb R^m$ and $\mathcal Y = \mathbb R^n$ and $I(X; Y)$ is finite. Let $f\colon \mathbb R^m\to \mathbb R^{m+k}$ and $g\colon \mathbb R^n\to \mathbb R^{n+l}$ be smooth embeddings.
Is this true that $I(f(X); g(Y))$ is finite and that $I(f(X); g(Y)) = I(X; Y)$?

I know that for discrete random variables the situation is simpler and I tried to ask this question at MathSE, but it has not been answered there.
Any intuitions, counterexamples, or literature suggestions would be very much welcome.

A: It seems that the theorem is indeed true in the smooth case and follows from a more general result:

Let $\mathcal X$, $\mathcal X'$, $\mathcal Y$ and $\mathcal Y'$ be standard Borel spaces (this includes topological manifolds with their Borel $\sigma$-algebras) and $f\colon \mathcal X\to \mathcal X'$ and $g\colon \mathcal Y\to\mathcal Y'$ be continuous injective mappings.
Then, for every two random variables $X\colon \Omega\to \mathcal X$ and $Y\colon \Omega\to \mathcal Y$
$$I(X; Y) = I( f(X); g(Y)).$$

Proof: First, note that a continuous mapping between Borel spaces is measurable, so random variables $f(X)$ and $g(Y)$ are well-defined.
Then, observe that without loss of generality that it suffices to prove that
$$I(f(X); Y) = I(X; Y).$$
A variant of data processing inequality asserts that $I(f(X); Y)\le I(X; Y)$ for every measurable mapping $f$, so we will need to prove the reverse inequality.
Recall that
$$
        I(X;Y) = \sup_{\mathcal E, \mathcal F} \sum_{i, j} P_{XY}(E_i\times F_j) \log \frac{P_{XY}(E_i\times F_j) }{ P_X(E_i) P_Y(F_j) },
$$
where the supremum is taken over all finite partitions $\mathcal E$ of $\mathcal X$ and $\mathcal F$ of $\mathcal Y$ and we again take the same conventions for dealing with zero probabilities as in the question.
The proof will go as follows: for every finite partition $\mathcal E$ of $\mathcal X$ we will construct a finite partition of $\mathcal X'$, which (together with an arbitrary partition $\mathcal F$ of $\mathcal Y$) will give the same value of the sum.
Take any finite partitions $\mathcal E$ of $\mathcal X$ and $\mathcal F$ of $\mathcal Y$. First, we will show that sets
\begin{align*}
   G_0 &= \mathcal X'\setminus f(\mathcal X)\\
   G_1 &= f(E_1)\\
   G_2 &= f(E_2)\\
    &~~\vdots
\end{align*}
form a partition of $\mathcal X'$.
It is easy to see that they are pairwise disjoint as $f$ is injective and it is obvious that their union is the whole $\mathcal X'$. Hence, we only need to show that they are all Borel.
For $i\ge 1$ it is clear that $G_i$ is Borel from Lusin–Suslin theorem (Theorem 15.1 of Kechris' Classical Descriptive Set Theory).
Similarly, $f(\mathcal X)$ is Borel and hence $G_0 = \mathcal X'\setminus f(\mathcal X)$ is Borel as well.
Next, we will prove that
$$\sum_{i = 1}^n \sum_{j=1}^m P_{XY}(E_i\times F_j) \log \frac{P_{XY}(E_i\times F_j) }{ P_X(E_i) P_Y(F_j) } =
\sum_{i = 0}^n \sum_{j=1}^m P_{f(X)Y}(G_i\times F_j) \log \frac{P_{f(X)Y}(G_i\times F_j) }{ P_{f(X)}(G_i) P_Y(F_j)}.
$$
Note that $P_{f(X)}(G_0) = P_X(f^{-1}(G_0)) = P_X(\varnothing) = 0$, so that we can ignore the terms with $i=0$.
For $i\ge 1$ we have
$$P_{f(X)}(G_i) = P_X( f^{-1}(G_i) ) = P_X( f^{-1}(f(
E_i)) ) = P_X(E_i)$$
as $f$ is injective.
Similarly, $f\times 1_{\mathcal Y}$ is injective and maps $E_i\times F_j$ onto $G_i\times F_j$, so
$$P_{f(X)Y}( G_i\times F_j ) = P_{XY}( (f\times 1_{\mathcal Y})^{-1}( G_i\times F_j )  ) = P_{XY}(E_i\times F_j).$$
This finishes the proof.


text:
Q: Shares server user with startup scripts specific for each developer (using SSH) On LAMP for web apps in PHP we use common ownership: all files all owned by user webmaster and group www-data. User webmaster has full access, www-data (used by apache) mostly read-only. Multiple admins/developers connect to this server via SSH on this same user (webmaster).
What I would like is to allow multiple developers login to user webmaster via SSH to interactive shell, but have their own customized startup scripts.
Possible solutions:

*

*Modify .profile/.bashrc to recognize different remote users. But I don't know how, I can not use remore user IP (we work often from home).

*Use ssh the way it opens interactive shell on remote server and then calls specific command on remote server inside this shell. Even better if configurable in .ssh/.config so command line can still be simple ssh myserveralias. But I don't know how do do this either.

A: *

*I think what you should to is:

*

*to have all web files owned by real owner, uniq owner per specific user.

*I would put in ~webuser/.ssh/authorized_keys each users' public key 'command=/foo user1' string where user1 would be his real username. The command '/foo' would run some commands as described in a config wher you would defined that for user1 run that or that...
Anyway, isn't more better setup to use sudo and good ownership and have your users to login with user own login?

A: Solution I found: use SSH option SendEnv on client plus AcceptEnv on server to pass to server for example local user name variable. Then modify .profile/.bashrc on server to use this variable to modify behaviour.


text:
Q: Creating a new item in an existing SharePoint list using rest dynamically without hard coding the field name? I am trying to create a new list item in a SharePoint list using REST API.
I am hardcoding the field names I want to pass them through an array.
The array will be updated through another function.
I am trying to reuse the normal code but I hit a roadblock.
This code is not running at all, the metadata second value where I am trying to loop around the array and add the each element of an array value. Each element inside the array is my field name.

var favorite=[];
   //favorite is an array of fields title list is updated dynamically with another function
   //I want to dynamically add that dynamically when I create a new list item

var item = {"__metadata": {"type": "SP.Data.TestCatalogListItem"},for(int i=0; i<favourite.length;i++){favorite[i]:cells[i]}};

_createListItem(item);

function _createListItem( listItems,listname, success, failure) {
   $.ajax({
   url: "https://site/_api/web/Lists/getbytitle('MYLIST')/items",
   type: "POST",
   contentType: "application/json;odata=verbose",
   data: JSON.stringify(listItems),
   headers: {
   "Accept": "application/json;odata=verbose",
   "X-RequestDigest": $("#__REQUESTDIGEST").val()
   },
   success: function (data) {
   //success(data);
   },
   error: function (data) {
   //failure(data);
   }
   });
}

A: Have you tried moving the for loop into the _createListItem function.
I haven't used the ajax method before, I have just used the JSOM and built in SP functions, but for me I pass in an object with up to 7 keys: listName, folderName, fields, successFunctionCallback, succesFunctionParams, failedFunctionCallback, and failedFunctionParams. The fields value is just an array of field names and value like you have. Inside the create function I loop over the fields and set the specific value. For you, you'd just be doing the same thing but building a data variable.


text:
Q: White Screen Error when using jsx file to create a GLB in my react three canvas Heres the issue, I have been reading documentation on how to use a glb file with react three and three.js to have a 3D model on my site.
The issue is every tutorial seems to work fine, but nothing is working on my end.
My "Intro" component calls the "Char" function from a Model.jsx file
import "./intro.scss"
import Char from '../model/Model'
import { Canvas } from "@react-three/fiber"

export default function Intro() {
  return (

        <Canvas>
          <Char/>
        </Canvas>

Personal Site Test

  )
}

Model.jsx :
import React from "react";
import { useGLTF } from "@react-three/drei";

export default function Char(props) {
  const { nodes, materials } = useGLTF("/model.glb");
  return (
    <group {...props} dispose={null}>
      <group position={[0, 0, -0.2]}>
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002.geometry}
          material={materials.Voxel_mat249}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_1.geometry}
          material={materials.Voxel_mat233}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_2.geometry}
          material={materials.Voxel_mat225}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_3.geometry}
          material={materials.Voxel_mat242}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_4.geometry}
          material={materials.Voxel_mat235}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_5.geometry}
          material={materials.Voxel_mat234}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_6.geometry}
          material={materials.Voxel_mat241}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_7.geometry}
          material={materials.Voxel_mat244}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_8.geometry}
          material={materials.Voxel_mat250}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_9.geometry}
          material={materials.Voxel_mat243}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_10.geometry}
          material={materials.Voxel_mat226}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_11.geometry}
          material={materials.Voxel_mat227}
        />
        <mesh
          castShadow
          receiveShadow
          geometry={nodes.Cube002_12.geometry}
          material={materials.Voxel_mat228}
        />
      </group>
    </group>
  );
}

useGLTF.preload("/model.glb");

This is getting its GLB information from my /public/model/model.glb (In the picture I put an arrow to the three files I am talking about)
Here is also the error code from the react console that is not showing up in my terminal when working:
react-dom.development.js:86 Warning: You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".
printWarning @ react-dom.development.js:86
chunk-7EZKCG2T.js:34 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.
lct @ chunk-7EZKCG2T.js:34
2index.js:21 Uncaught Error: Could not load /model.glb: Unexpected token '<', "<!DOCTYPE "... is not valid JSON)
    at index-212b30d8.esm.js:1613:1
    at _onError (GLTFLoader.js:61:1)
    at Object.onLoad (GLTFLoader.js:82:1)
    at three.module.js:39938:1
react-reconciler.development.js:9747 The above error occurred in the <Char> component:

    at Char
    at Suspense
    at ErrorBoundary (http://localhost:3000/static/js/bundle.js:1535:5)
    at Provider (http://localhost:3000/static/js/bundle.js:3478:5)

React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.
logCapturedError @ react-reconciler.development.js:9747
2react-three-fiber.esm.js:138 Uncaught Error: Could not load /model.glb: Unexpected token '<', "<!DOCTYPE "... is not valid JSON)
    at index-212b30d8.esm.js:1613:1
    at _onError (GLTFLoader.js:61:1)
    at Object.onLoad (GLTFLoader.js:82:1)
    at three.module.js:39938:1
react-dom.development.js:18687 The above error occurred in the <ForwardRef(Canvas)> component:

    at Canvas (http://localhost:3000/static/js/bundle.js:3806:5)
    at div
    at div
    at Intro
    at div
    at div
    at App (http://localhost:3000/static/js/bundle.js:46:82)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
logCapturedError @ react-dom.development.js:18687
react-dom.development.js:26923 Uncaught Error: Could not load /model.glb: Unexpected token '<', "<!DOCTYPE "... is not valid JSON)
    at index-212b30d8.esm.js:1613:1
    at _onError (GLTFLoader.js:61:1)
    at Object.onLoad (GLTFLoader.js:82:1)
    at three.module.js:39938:1
three.module.js:27169 THREE.WebGLRenderer: Context Lost.

And here is a picture of how the site looks currently.
I have tried using gltf and obj files but none seem to work. I have tried many different methods including Suspense to hug the Char component.

A: I don't know if you managed to solve the issue but it seems related to the 3D model itself rather than the code. I tried to import the glb file of the basic cube shape from Blender and it is working just fine...
Not sure what is wrong with it though...
EDIT: I think it is because the 3D model was composed of various objects. I joined every parts into one and now this is working.

A: I was in the same case! I got these errors (chrome and firefox):
Uncaught Error: Could not load /cube.gltf: Unexpected token '<', "<!DOCTYPE "... is not valid JSON)
Uncaught Error: Could not load cube.gltf: JSON.parse: unexpected character at line 1 column 1 of the JSON data)

So, I understood the problem is about the path of ".gltf" (or .glb).
Put your 3d model in "./public/" and not in "./src/" or even in root.
This short video shows how to create a new project that's working!
https://www.youtube.com/watch?v=QaRIHrRclVk&list=WL


text:
Q: how to create Default Media Player in android I am developing an Music app in android which create MediaPlayer in android.Currently I have developed simple prototype for that it works well.
Now my main question is How can I set my mediaplayer to provide the default functionality to users or provide my media player in the list of application that are similar.
After reading on google I have found out that you have to use INTENT.setType() but how can I use that with service or when the user selects the file from filemanager of android.
Please provide some usefull pointers.
Thank you

A: I think you should take a look at intents and intent filters, here is the link to google developer website
http://developer.android.com/guide/components/intents-filters.html#Receiving
When the user clicks on the audio file from a file explorer program, if there is more than one program that could handling playing the file, the android os does intent resolution and brings up the list of compatible programs, and it is that the USER's choice to make an app the default, you cannot do this programmatically

A: Add this code in the manifest
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:scheme="file" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="application/ogg" />
                <data android:mimeType="application/x-ogg" />
                <data android:mimeType="application/itunes" />
            </intent-filter>


text:
Q: Find cluster/subgraph of nodes in dot I have a dot file that contains a graph having different clusters, something like:
subgraph cluster_bb_5020 {
            style=filled fillcolor=white
            label="label  [5020]"
            NODE230 [label="668"]
            ....

I wonder how I can get the cluster number of nodes (e.g. here cluster of  NODE230 is cluster_bb_5020) in the graph by networkx or pydot or pygraphviz? Or in general, how I can get cluster informations?
Thank you!

A: I found the answer:
import pydot
graph = pydot.graph_from_dot_file('graph.dot')
nodes_bb = {}
for cluster in graph[0].get_subgraphs():
     if cluster.obj_dict['name'].startswith('cluster_bb_'):
          basic_block_id = cluster.obj_dict['name'].split('_')[-1]
               for node in cluster.obj_dict['nodes'].keys():
                    nodes_bb[node] = str(basic_block_id)

print nodes_bb

However, pydot is really slow!!!


text:
Q: Selenium WebDriver with Java: testing a file upload site How can I test a site like http://www.megafileupload.com/ for testing file upload using Selenium WebDriver? . It does not contain an input box like most of the site in which I can use sendKeys() to send the path of the file.

A: To Test a site like http://www.megafileupload.com, you can test by Upload a file using Robot class.
Step 1 : By Clicking Select file option in http://www.megafileupload.com opens a pop-up.
Step 2 : From the Pop-up - you have find an option "Drag & drop file or Click here to Browse".
Step 3 : Click over the option opened a file select modal window.
Step 4 : Upload a file by using Robot class.
Step4 Example :
StringSelection ss=new StringSelection("C:\\path to file\\example.jpg");
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
            Robot rb=new Robot();
            rb.keyPress(KeyEvent.VK_CONTROL);
            rb.keyPress(KeyEvent.VK_V);
            rb.keyRelease(KeyEvent.VK_CONTROL);
            rb.keyRelease(KeyEvent.VK_V);
            rb.keyPress(KeyEvent.VK_ENTER);
            rb.keyRelease(KeyEvent.VK_ENTER);


text:
Q: Sql Server 2014 Valor Null Sou iniciante em Sql server, estou com dúvida em relação ao seguinte código:
declare @var nvarchar(50) = null

declare @bool bit

if (@var = null)
    set @bool = 1
else
    set @bool = 0

print @bool

A variável @bool retorna como 0, mesmo eu declarando a variável @var como nulo.
Não seria para retornar como 1 ?

A: Esta é uma das sutilezas mais particulares de se trabalhar com banco de dados.
Isto:
if (@var = null) -- Preste atenção aqui
    set @bool = 1
else
    set @bool = 0

É diferente disto:
if (@var is null) -- Preste atenção aqui
    set @bool = 1
else
    set @bool = 0

A comparação = null em bancos de dados sempre será falsa. Isto porque null é a ausência de valor, então não é comparável, diferentemente de verificar se o valor é null, o que faz o retorno ser 1.

A: Você não conseguirá compara um valor de um campo null com o operador =, para isso existe o IS NULL ou seja.
if (@var is null)
    set @bool = 1
else
    set @bool = 0

Há uma coisa também que tem que se atentar sua variável @var ainda pode ter um valor Empty onde você poderia checar da seguinte forma.
IF (@var IS NOT NULL) OR (LEN(@var) > 0)
    set @bool = 1
else
    set @bool = 0

Veja mais detalhes.


text:
Q: Azure PowerShell 1.0 - Where is Get-AzureSBNamespace? I've been following this blog to create a Service Bus namespace on Azure using PowerShell 1.0. However, after logging into Azure using the cmdlet Login-AzureRmAccount (as described here) and attempting to use the cmdlet Get-AzureSBNamespace returns a null reference exception, i.e.,
Get-AzureSBNamespace : Object reference not set to an instance of an object.
Looking at the documentation for Powershell 1.0, there appears to be no reference to any cmdlets for the Service Bus services on Azure, i.e., Get-AzureSBNamespace.
Does Azure PowerShell 1.0 support Azure Service Bus (specifically EventHubs)?

A: I followed the following link to create Service Bus Event hub and created it succesfully.
As mentioned in the above comments you cant assign an event hub to a resouce group it comes under Add-Azure Account cmd.
https://azure.microsoft.com/en-in/documentation/articles/service-bus-powershell-how-to-provision/


text:
Q: transpose csv based on one column I saw a lot of examples transposing the data but not something similar. I am trying to transpose my csv data which looks like--
Region,1989,1900,2000
new york,3,4,5
atlanta,7,9,0
chicago,8,9,10

to
Region,Year,value
new york,1989,3
new york,1900,4
new york,2000,5
atlanta,1989,7
atlanta,1900,9
atlanta,2000,0

A: You are trying to convert from wide data format to long data format. This can be done using melt function. If you have some columns that needs to be eliminated, you can slice the dataframe to the columns of interest.
Code:
#creating df
df = pd.DataFrame(data = {'Region':['new york', 'atlanta', 'chicago'], '1989': [3,7,8], '1900': [4,9,9], '2000': [5,0,10]})

#converting to long format
long_df = pd.melt(df, id_vars=['Region'], value_vars=['1989', '1900', '2000'], var_name='year', value_name = 'value')

Output:


text:
Q: How to create png from array of pixel color data in PHP? Lets say I have an arrays of pixels. Basically an array of this data {x,y,r,g,b,a} for each pixel.
How would I go about converting all this data into an actual image file (png preferably)?
Could not find a solution. Any help would be very appreciated.

A: I'll admit I haven't actually used this API, but looks like PHP has what you're looking for.
You create an image identifier with imagecreate or one of the related functions, then color in each pixel with imagesetpixel, using a color identifier created with imagecolorallocatealpha. From there you should be able to output as a PNG with imagepng.
It's worth noting that this image library seems to support drawing lines and shapes and other structures higher than the per-pixel level, so I'd also look into whether your code necessarily needs to build a big pixel array, rather than drawing the image some other way.

A: I had some time to code up a little example. You should be able to see and note that:

*

*the red component increases towards the bottom of the image

*the green component increases towards the right of the image

*the blue component is absent

*the alpha channel is random and between 0 (opaque) and 127 (fully transparent)

// Define width and height
$w=800;
$h=600;

// Create truecolour image so we can have infinitely many colours rather than a limited palette
$img=imagecreatetruecolor($w,$h);
imagesavealpha($img,true);
imagealphablending($img,false);

// Iterate over all pixels
for($y=0;$y<$h;$y++){
   for($x=0;$x<$w;$x++){
      $r     = round(255*$y/$h);
      $g     = round(255*$x/$w);
      $b     = 0;
      $alpha = rand(0,127);
      $color = imagecolorallocatealpha($img,$r,$g,$b,$alpha);
      imagesetpixel($img,$x,$y,$color);
   }
}

// Save result
imagepng($img,"result.png");


text:
Q: Java method for compiling Lua code with the LuaJ interpreter http://luaj.org/luaj/README.html
I'm using Luaj to run Lua code in a Java application. I'm getting some really slow results, so I want to try to compile the code before running it to calculate the actual proccesing time of a Lua script.
The problem is - Luaj does show an example how to compile Lua source to Lua or Java bytecode through the command prompt, but it doesn't show me the lines to compile a Lua script with a Java application.
It only shows how to compile AND run a Lua script:
import org.luaj.vm2.*;
import org.luaj.vm2.lib.jse.*;

String script = "examples/lua/hello.lua";
LuaValue _G = JsePlatform.standardGlobals();
_G.get("dofile").call( LuaValue.valueOf(script) );

I want to find the code that would only compile Lua to Lua or Java bytecode and would output a bytecode file.

A: LuaJ contains a Lua to bytecode compiler. So you can just look at the source code. I have extracted the most relevant portion here.
private void processScript( InputStream script, String chunkname, OutputStream out ) throws IOException {
    try {
        // create the chunk
        Prototype chunk = LuaC.instance.compile(script, chunkname);

        // list the chunk
        if (list)
            Print.printCode(chunk);

        // write out the chunk
        if (!parseonly) {
            DumpState.dump(chunk, out, stripdebug, numberformat, littleendian);
        }

    } catch ( Exception e ) {
        e.printStackTrace( System.err );
    } finally {
        script.close();
    }
}

Keep in mind that you can only really rely on byte code being compatible with the implementation of Lua that produced it.


text:
Q: Android ListView Subitems I recently created a new ListView object for an Android application, but I am encountering some errors. When I try using a Simple Adapter to create an Item that includes a subitem on my list, The newest item created overlaps the other ones. I am using a List of Maps to create the items.
For example, If I add an item to my map list that displays "1" with a subitem that displays "A1", the item and subitems will be displayed. But if I add an new item to my map list named "2" with a subitem "B2", the "1" and "A1" will be replaced with "2" and "B2". There will still be 2 items on the ListView, but one of them is empty and the other one is "2" and "B2"
Here is my code:
List<Map<String, String>> data = new ArrayList<Map<String, String>>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ListView lv = (ListView)findViewById(R.id.listView1);

        Map<String, String> datum = new HashMap<String, String>();
        datum.put("RouterName", "Test1");
        datum.put("RouterIP", "SubTest1");
        data.add(datum);

        Map<String, String> datum2 = new HashMap<String, String>();
        datum.put("RouterName", "Test2");
        datum.put("RouterIP", "SubTest2");
        data.add(datum2);

        SimpleAdapter adapter = new SimpleAdapter(this, data, android.R.layout.simple_list_item_2, new String[] {"RouterName", "RouterIP"}, new int[] {android.R.id.text1, android.R.id.text2});
        lv.setAdapter(adapter);
    }

Changing the list type will not work because the Simple Adapter specifically uses a Map List.

A: Hi I found some minor mistakes while storing in Hashmap. In that HashMap object is not creating. Previous instance is getting deleted.
Kindly use the below code. Hope it will help you.
    ArrayList<HashMap<String, String>> data;
    private String[] titleArray,subItemArray;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listview);
    ListView lv = (ListView)findViewById(R.id.listview);
    data = new ArrayList<HashMap<String, String>>();
    titleArray=new String[]{"Test1","Test2"};
    subItemArray=new String[]{"SubTest1","SubTest2"};
    for(int i=0;i<titleArray.length;i++){
        HashMap<String,String> datum = new HashMap<String, String>();
        datum.put("RouterName", titleArray[i]);
        datum.put("RouterIP", subItemArray[i]);
        data.add(datum);
    }
    SimpleAdapter adapter = new SimpleAdapter(this, data, android.R.layout.simple_list_item_2, new String[] {"RouterName", "RouterIP"}, new int[] {android.R.id.text1, android.R.id.text2});
    lv.setAdapter(adapter);
}


text:
Q: MVC Javascript Toggle TextInputFor Readonly based on checkbox value syntax? Tried a few different ways but can't get it right and now as you can see it's all mixed up! This JavaScript business is not the same as it was 15 years ago! Thank you.

@section scripts
{

}

        @Html.LabelFor(m => m.Fixture.BackOdds)
        @Html.TextBoxFor(m => m.Fixture.BackOdds, new { @id = "BackOdds", @class = "form-control", @readonly = "readonly" })

            @Html.CheckBoxFor(m => m.Fixture.IsCut, new { @id = "cut", @onchange = "AutoCalculateMandateOnChange(this)"}) Odds Cut?

A: You need to refer to your element (m.Fixture.IsCut and m.Fixture.BackOdds are not elements in your DOM)
$("#cut").click(function () {
    $('#BackOdds').prop('readonly', !$(this).is(':checked'));
});


text:
Q: Convert dot to dotx in JAVA I have a .dot file using which i will be creating doc file with values replaced.
eg: .dot file having <claimId>
I will replace <claimId> with real claim Id say 1234 and generate a doc file.
I am using Apache POI HWPFDocument, when using HWPFDocument i am getting issues when i replace text inside table.
So i tried XWPFDocument i can feed only .dotx files.
I have no issue when using dotx file with XWPFDocument and successfully generated docx files. Now i need to convert .dot files to .dotx files from java.
Can someone help me on this...

A: There is no automated way to do this conversion in Apache POI as far as I know.
You can manually convert .dot files to .dotx by opening the file in Microsoft Word and saving it in the newer format.


text:
Q: How can I import a part of a cocos2d project into another project How can I import a part of a cocos2d project into another (non-cocos2d) project?

A: You should take a look to the AttachTest in the cocos2d-ios project.
You can take a look to this link too.


text:
Q: Converting Java loop to C# how should I convert Java loop code to C#?
Java:
for (int i = 0; i < edges[index].length; i++) {
    edges[index][i] = 0;
    edges[i][index] = 0;
}

I'm stuck with the edges[index].length part, is there any similar method in C#?
For reference, edges is int[,] array, index is some integer.

A: Try using GetLength?
edges.GetLength(index);
http://msdn.microsoft.com/en-us/library/system.array.getlength.aspx

A: In C#, Properties and Methods should start with an uppercased letter. Try Length instead of length


text:
Q: Script works but has error: Uncaught TypeError: Cannot read property 'classList' of null at HTMLAnchorElement I'm trying to create a stylized navigation for a homepage slider but getting some console errors - even though the script is doing what I want it to for the most part. That's to add classes to the adjacent sibling elements on mouseover of the focused element.  Like the pen shows, its working for the most part, but I'm getting errors on every mouseover, saying it Cannot read property 'classList' of null.  Could anyone give me an idea of why this is and a fix?

var sliderNav = document.getElementById('sliderNav');
var paraIns = new Parallax(sliderNav);
var thumbs = document.querySelectorAll('.thumbnail');

thumbs[3].classList.add('active');

for (var i = 0; i < thumbs.length; i++) {
  thumbs[i].addEventListener('mouseover', function(){
    this.classList.add('active');
    this.previousElementSibling.classList.add('adjacent');
    this.nextElementSibling.classList.add('adjacent');
    this.previousElementSibling.previousElementSibling.classList.add('adjacentx2');
    this.nextElementSibling.nextElementSibling.classList.add('adjacentx2');
  });
  thumbs[i].addEventListener('mouseout', function(){
    this.classList.remove('active');
    this.previousElementSibling.classList.remove('adjacent');
    this.nextElementSibling.classList.remove('adjacent');
    this.previousElementSibling.previousElementSibling.classList.remove('adjacentx2');
    this.nextElementSibling.nextElementSibling.classList.remove('adjacentx2');
  })
}
html, body {
  margin: 0;
}
.slider {
  background-color: darkgray;
  width: 100%;
  height: 400px;
  position: relative;
  margin-bottom: 1200px;
}
.slider__navigation {
  pointer-events: unset !important;
  z-index: 1;
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  margin: auto;
  width: 1200px;
  height: 240px;
}
.slider__navigation .thumbnail {
  display: inline-block;
  width: 14%;
  height: 240px;
  float: left;
  padding: 20px;
  z-index: 2;
}
.slider__navigation .thumbnail .thumbnail__img {
  -webkit-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.12);
  -moz-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.12);
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.12);
  width: 100%;
  height: 100%;
  transition: all 0.3s ease-in-out;
  background: lightgray;
  transform: scale(0.7);
}
.slider__navigation .thumbnail:nth-child(2) {
  left: 13% !important;
}
.slider__navigation .thumbnail:nth-child(3) {
  left: 27% !important;
}
.slider__navigation .thumbnail:nth-child(4) {
  z-index: 5;
  left: 0;
  right: 0;
  margin: 0 auto;
}
.slider__navigation .thumbnail:nth-child(5) {
  left: 56% !important;
}
.slider__navigation .thumbnail:nth-child(6) {
  left: 71% !important;
}
.slider__navigation .thumbnail:nth-child(7) {
  left: 84% !important;
}
.slider__navigation .thumbnail:nth-child(3), .slider__navigation .thumbnail:nth-child(5) {
  z-index: 4;
}
.slider__navigation .thumbnail:nth-child(2), .slider__navigation .thumbnail:nth-child(6) {
  z-index: 3;
}
.slider__navigation .thumbnail.active {
  z-index: 5;
}
.slider__navigation .thumbnail.active .thumbnail__img {
  transform: scale(1);
}
.slider__navigation .thumbnail.adjacent {
  z-index: 4;
}
.slider__navigation .thumbnail.adjacent .thumbnail__img {
  transform: scale(0.9);
}
.slider__navigation .thumbnail.adjacentx2 {
  z-index: 3;
}
.slider__navigation .thumbnail.adjacentx2 .thumbnail__img {
  transform: scale(0.8);
}

A:

var sliderNav = document.getElementById('sliderNav');
var paraIns = new Parallax(sliderNav);
var thumbs = document.querySelectorAll('.thumbnail');

thumbs[3].classList.add('active');

for (var i = 0; i < thumbs.length; i++) {
  thumbs[i].addEventListener('mouseover', function() {
    console.log(!!this.previousElementSibling, !!this.nextElementSibling);
  });
}
html,
body {
  margin: 0;
}

.slider {
  background-color: darkgray;
  width: 100%;
  height: 400px;
  position: relative;
  margin-bottom: 1200px;
}

.slider__navigation {
  pointer-events: unset !important;
  z-index: 1;
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  margin: auto;
  width: 1200px;
  height: 240px;
}

.slider__navigation .thumbnail {
  display: inline-block;
  width: 14%;
  height: 240px;
  float: left;
  padding: 20px;
  z-index: 2;
}

.slider__navigation .thumbnail .thumbnail__img {
  -webkit-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.12);
  -moz-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.12);
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.12);
  width: 100%;
  height: 100%;
  transition: all 0.3s ease-in-out;
  background: lightgray;
  transform: scale(0.7);
}

.slider__navigation .thumbnail:nth-child(2) {
  left: 13% !important;
}

.slider__navigation .thumbnail:nth-child(3) {
  left: 27% !important;
}

.slider__navigation .thumbnail:nth-child(4) {
  z-index: 5;
  left: 0;
  right: 0;
  margin: 0 auto;
}

.slider__navigation .thumbnail:nth-child(5) {
  left: 56% !important;
}

.slider__navigation .thumbnail:nth-child(6) {
  left: 71% !important;
}

.slider__navigation .thumbnail:nth-child(7) {
  left: 84% !important;
}

.slider__navigation .thumbnail:nth-child(3),
.slider__navigation .thumbnail:nth-child(5) {
  z-index: 4;
}

.slider__navigation .thumbnail:nth-child(2),
.slider__navigation .thumbnail:nth-child(6) {
  z-index: 3;
}

.slider__navigation .thumbnail.active {
  z-index: 5;
}

.slider__navigation .thumbnail.active .thumbnail__img {
  transform: scale(1);
}

.slider__navigation .thumbnail.adjacent {
  z-index: 4;
}

.slider__navigation .thumbnail.adjacent .thumbnail__img {
  transform: scale(0.9);
}

.slider__navigation .thumbnail.adjacentx2 {
  z-index: 3;
}

.slider__navigation .thumbnail.adjacentx2 .thumbnail__img {
  transform: scale(0.8);
}

The first/last elements have no previousElementSibling/nextElementSibling. see console logs when you hover over the elements.


text:
Q: nodejs project build through jenkins Hi Iam new to nodejs projects.
I am building a cicd pipeline for jenkins. I configured git and in build section iam using npm install for build in jenkins.
The build shows success bot no node_modules or target getting generated. Below message shows package.jsonis missing but that is my jenkins workspace.
This is my error:
npm install
npm WARN saveError ENOENT: no such file or directory, open '/var/lib/jenkins/workspace/test2/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/workspace/test2/package.json'
npm WARN test2 No description
npm WARN test2 No repository field.
npm WARN test2 No README data
npm WARN test2 No license field.

up to date in 0.061s
Finished: SUCCESS

A: Please check if package.json file is present in folder /var/lib/jenkins/workspace/test2/


text:
Q: SoapHttpClientProtocol, does the method invoke open a new connection everytime? I have imported the wsdl. I got the class with web service's methods. The class
derives from SoapHttpClientProtocol.
Could anyone tell me if every method invocation opens a new connection or maybe the connection is reused?
If it is not reused how can be reused?
And the last question, Can I Make a client to be a WCF one? And How to import wsdl
for the wcf?
Thanks!

A: To make it a WCF service, you'll have to create an interface instead of simply decorating the methods. To import it into your project, it works the same way.
I'm not sure about 2.0 services, but with WCF, it depends on how you invoke the service client. As far as I know, in general, the connection stays open until you close it, or until it loses scope (inconsistently). So once it's a WCF service, instantiate the client, make all of your calls, then close it. I guess the best practice right now is to wrap it in a try/catch and have the catch block .abort the client. It has been my experience though, that if your service is loosely coupled, and you're not trying to pipe a huge amount of data, then the repeated connections aren't a huge deal.
A side thought though: if your service is doing something like opening a SQL connection, then keep that in mind that the sql connection will be made with every service call regardless of the client's connection state. This is one of those dirty situations where you might want to whore the sql connection around the inside of the service to complete your operations and return a dataset or some form of DTO to save yourself the tennis match between client and service.


text:
Q: If statement and h1 statement So I am trying to make it so when you put a text into a input box and press submit if it's the right text it will show the text "you are correct!" And if you are wrong it shows "you are wrong!"
I tried this:
<!doctype html>

<meta charset="UTF-8">

      <meta name="viewport" content="width=device-width, initial-scale=1">

<title>mathamatics</title>

Mathematics

1. if 20 = 1 letter

and G15 + D5 = L

what does K - G5 =
 <input id="Answer-1" type="text" placeholder="Enter the answer">

<button id="Answer-btn-1">Submit</button>


text:
Q: Android Wear 2.0 developing a complication I've got an existing Android app that I'd like to provide a wear 2.0 complication for. I do not wish to create a custom Wear Watch Face nor a companion Wear app - I simply wish to be able to create a complication that users should be able to add to an existing watch face. Is this possible? Reading the documentation it seems to me that I would need to create a custom Watch Face or an app in order to provide a complication. I'm now a little confused. Any directions on this would be appreciated.

A: You don't need to develop a watch face, but you do need an app running on the watch to deliver a complication. It doesn't need any other UI (such as an Activity) unless your complication requires it for configuration, but the ComplicationProviderService does need to be in an APK running on the watch.


text:
Q: Object is initialized before constructor's execution I want to execute the code present in constructor before object initialization.  Since object is initialize with some parameter, so the parameter carry it's values.
Calling function :
ABC as = new ABC (driver );

After Object initialization from calling function. "driver " value is passed to ABC constructor. But instead of executing code inside constructor ie  this.driver= driver;  . It jumps to initialized object of XYZ class . Due to which parameter of XYZ class has null value ie driver=null
public class ABC {
    public static WebDriver driver;

    public ABC(WebDriver driver) {
        this.driver = driver;
        System.out.println("**********");
    }

    XYZ st = new XYZ(driver);
}


text:
Q: Problemas importando proyecto Vue-cli como librería en un proyecto Vue-cli Estoy trabajando en un "Design System / Storybook" en un proyecto Vue-cli y quiero validar cómo se comportaría importándolo como librería en un proyecto Vue-cli simple.
Según la documentación de Vue-cli y algunas guías que he encontrado, he seguido los pasos siguientes:

*

*Cambiar el fichero "main.js" que exporta los componentes para formar la librería (código abajo)

*Construir la librería de componentes mediante el comando de vue-cli-service script con la opción de "pack" porque no puedo publicar este proyecto en NPM (debe ser privado), de modo que lo tengo que probar en local

*Importar el paquete en el proyecto simple vue-cli

Aparentemente todo funciona ok, el proyecto se compila bien, se genera el fichero comprimido, en el otro proyecto al instalarlo se importa de forma correcta, pero cuando renderizo el proyecto simple vue-cli me aparece en consola el error siguiente:
[Vue warn]: Failed to mount component: template or render function not defined.

found in

---> <Alert>
       <Home> at src/views/Home.vue
         <App> at src/App.vue
           <Root>

Nota: Alert es uno de mis componentes del proyecto Storybook
Algunos detalles de mi proyecto Storybook:
Storybook package-json.js
{
  "name": "my-custom-storybook",
  "version": "0.1.0",
  "private": true,
  "main": "dist/my-custom-storybook.common.js",
  "unpkg": "dist/my-custom-storybook.umd.min.js",
  "scripts": {
    "serve": "vue-cli-service serve --open",
    "build": "vue-cli-service build",
    "build-lib": "vue-cli-service build --target lib --inline-vue --name my-custom-storybook ./src/main.js && npm pack && mv ./my-custom-storybook-0.1.0.tgz ../",
    "test:unit": "jest -u",
    "lint": "vue-cli-service lint",
    "i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'",
    "storybook:build": "vue-cli-service storybook:build -c config/storybook",
    "storybook:serve": "vue-cli-service storybook:serve -p 6006 -c config/storybook"
  },
  "dependencies": {
    ...
  }
}

main.js

import Alert from '@/components/customComponents/Alert'
import Button from '@/components/uiComponents/Button'

export {
  Alert,
  Button
}

export default {
  install (Vue) {
    Vue.component('Alert', Alert)
    Vue.component('Button', Button)
  }
}

vue.config.js
module.exports = {
  transpileDependencies: [
    'vuetify'
  ],
  pluginOptions: {
    i18n: {
      locale: 'en',
      fallbackLocale: 'en',
      localeDir: 'locales',
      enableInSFC: true
    }
  }
}

Componente Alert
<template>
  <v-alert
    type="warning"
    close-icon="$vuetify.icons.small"
    light
    dense
    text
  >
     {{ title }}
    {{ message }}
  </v-alert>
</template>

En el otro proyecto, para instalar la librería e importarla en la página deseada utilizo las instrucciones siguientes:
<template>

    <HelloWorld msg="Welcome to Your Vue.js App" />
    <Alert message="Error on doing thingies" />

</template>

¿Qué está fallando? ¿Hay alguna configuración que no he tenido en cuenta? ¿Necesito añadir más configuraciones? Estoy totalmente perdida en este asunto, necesito ayuda por favor T_T
Gracias a todxs!
Saludos


text:
Q: Log and trace with Azure Application Insights only (instead of combining NLog and AppInsights) in Asp MVC I was going through several blog posts at stackoverflow and programmers and I am still a bit confused. You can install NLog (or some other logging lib) and start logging quite fast and then you can install the application insights and an adapter to actually gather the data into the Azure Application Insights.
Is it really necessary to use two approaches (NLog combined with AppInsights)? What if we simply use the AppInsight's TelemetryClient to log and trace. If I want to go fancy, I can wrap it with an interface, so I can easily change it later on. I can even wrap it in Common.Logging to be even fancier. (I would be really fancy there.)
Are there any benefits of using both NLog and Application Insights? Do you think logging into a "local" database and into Azure is superfluous? Are there any drawbacks of using only Application Insights for both logging and tracing (latency, too expensive to call either time wise or money wise)?
AppInsight's example - Imagine you have a DI container somewhere:
ILog.cs
public interface ILog
{
    void Exception(Exception ex);
}

TelemetryClientLog.cs
public class TelemetryClientLog : ILog
{
    private readonly TelemetryClient telemetryClient = null;

    public TelemetryClientLog(TelemetryClient telemetryClient)
    {
        this.telemetryClient = telemetryClient;
    }

    public void Exception(Exception ex)
    {
        this.telemetryClient.TrackException(ex);
    }
}

StarWars.cs
// somewhere in a code far far away with an injected logger
try
{
    this.CallJedi();
}
catch(LightSaberException lse)
{
   // log implements ILog interface, look above
   this.log.Exception(lse);
}

A: Having that ILog in your app is a good idea. This way you can just create a new implementation and swap it out. In your implementation you can do whatever you think is best. I hope you're using an IoC container to inject the ILog (or even better, injecting it into your pipeline without the ILog dependency everywhere). I typically only log to AI specific things I want to track. It does a great job out of the box already and tracing all requests even SQL calls, just about everything.


text:
Q: Ubuntu 18.04 doesn't connect to WPA/WPA2 Enterprise PEAP MSCHAPv2 network I recently got Ubuntu 18.04, but it doesn't connect to my school wifi. Details:

*

*WPA/WPA2 Enterprise

*PEAP

*MSCHAPv2

*Credentials are correct

I've seen others saying to remove system-ca-certs=true from the network configuration file found in /etc/NetworkManager/system-connections but I can't find that line anywhere. Is it because I haven't upgraded from 16.04 to 18.04 but got 18.04 clean? Or anything else? Is there another solution or a patch?

A: I have this same issue, and have tried many suggestions online to fix it. I believe this is something that the network administrators specify.
My solution was just to install Windows in VirtualBox and use that to sign into the network, and then I am able to access it in Ubuntu.
Messy and not an ideal solution but it works.


text:
Q: How to model Logical Expression using Protege OWL I have structure like below

Now I have some expression which states which Part combination is a valid one
like these
Logical representation:
(Part1_3 and Part2_A and (Part3_0 or Part3_1))
or
(Part1_4 and Part2_B and (Part3_0 or Part3_1))
or
(Part1_3 and Part2_B and Part3_0)

How should I model this using Protege?
Also My intension to model is to find if given a combination is it valid or not?
for eg Part1_3 Part2_B Part3_1 is an invalid combo
also Part1-4 and Part2-B is also invalid


text:
Q: Partition N items into K bins in Python lazily Give an algorithm (or straight Python code) that yields all partitions of a collection of N items into K bins such that each bin has at least one item. I need this in both the case where order matters and where order does not matter.
Example where order matters
>>> list(partition_n_in_k_bins_ordered((1,2,3,4), 2))
[([1], [2,3,4]), ([1,2], [3,4]), ([1,2,3], [4])]

>>> list(partition_n_in_k_bins_ordered((1,2,3,4), 3))
[([1], [2], [3,4]), ([1], [2,3], [4]), ([1,2], [3], [4])]

>>> list(partition_n_in_k_bins_ordered((1,2,3,4), 4))
[([1], [2], [3], [4])]

Example where order does not matter
>>> list(partition_n_in_k_bins_unordered({1,2,3,4}, 2))
[{{1}, {2,3,4}}, {{2}, {1,3,4}}, {{3}, {1,2,4}}, {{4}, {1,2,3}},
 {{1,2}, {3,4}}, {{1,3}, {2,4}}, {{1,4}, {2,3}}]

These functions should produce lazy iterators/generators, not lists. Ideally they would use primitives found in itertools. I suspect that there is a clever solution that is eluding me.
While I've asked for this in Python I'm also willing to translate a clear algorithm.

A: you need a recursive function to solve this kind of problem: you take the list, take a subportion of it of increasing length and apply the same procedure to the remaining tail of the list in n-1 pieces.
here is my take to the ordered combination
def partition(lista,bins):
    if len(lista)==1 or bins==1:
        yield [lista]
    elif len(lista)>1 and bins>1:
        for i in range(1,len(lista)):
            for part in partition(lista[i:],bins-1):
                if len([lista[:i]]+part)==bins:
                    yield [lista[:i]]+part

for i in partition(range(1,5),1):
    print i
#[[1, 2, 3, 4]]

for i in partition(range(1,5),2):
    print i
#[[1], [2, 3, 4]]
#[[1, 2], [3, 4]]
#[[1, 2, 3], [4]]

for i in partition(range(1,5),3):
    print i
#[[1], [2], [3, 4]]
#[[1], [2, 3], [4]]
#[[1, 2], [3], [4]]

for i in partition(range(1,5),4):
    print i
#[[1], [2], [3], [4]]

A: Enrico's algorithm, Knuth's, and only my glue are needed to paste together something that returns the list of lists or set of sets (returned as lists of lists in case elements are not hashable).
def kbin(l, k, ordered=True):
    """
    Return sequence ``l`` partitioned into ``k`` bins.

    Examples
    ========

    The default is to give the items in the same order, but grouped
    into k partitions:

    >>> for p in kbin(range(5), 2):
    ...     print p
    ...
    [[0], [1, 2, 3, 4]]
    [[0, 1], [2, 3, 4]]
    [[0, 1, 2], [3, 4]]
    [[0, 1, 2, 3], [4]]

    Setting ``ordered`` to None means that the order of the elements in
    the bins is irrelevant and the order of the bins is irrelevant. Though
    they are returned in a canonical order as lists of lists, all lists
    can be thought of as sets.

    >>> for p in kbin(range(3), 2, ordered=None):
    ...     print p
    ...
    [[0, 1], [2]]
    [[0], [1, 2]]
    [[0, 2], [1]]

    """
    from sympy.utilities.iterables import (
        permutations, multiset_partitions, partitions)

    def partition(lista, bins):
        #  EnricoGiampieri's partition generator from
        #  http://stackoverflow.com/questions/13131491/
        #  partition-n-items-into-k-bins-in-python-lazily
        if len(lista) == 1 or bins == 1:
            yield [lista]
        elif len(lista) > 1 and bins > 1:
            for i in range(1, len(lista)):
                for part in partition(lista[i:], bins - 1):
                    if len([lista[:i]] + part) == bins:
                        yield [lista[:i]] + part
    if ordered:
        for p in partition(l, k):
            yield p
    else:
        for p in multiset_partitions(l, k):
            yield p


text:
Q: How to build Imebra library using CMake for iOS? I tried to embed use the Imebra library as Dicom file viewer in my iOS app. But when I built the Imebra library via "cmake --build ." on command line after "cmake install...", Errors came out as the following
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      imebra::charsetConversionIconv::myIconv(void*, char*, unsigned long) const in charsetConversionIconvImpl.cpp.o
  "_iconv_close", referenced from:
      imebra::charsetConversionIconv::~charsetConversionIconv() in charsetConversionIconvImpl.cpp.o
  "_iconv_open", referenced from:
      imebra::charsetConversionIconv::charsetConversionIconv(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in charsetConversionIconvImpl.cpp.o
Can someone help me with it?

A: The cmake file does not specify the iconv library when it selects it by default. Try launching cmake explicitly specifying iconv:
Cmake -DIMEBRA_CHARSET_CONVERSION=ICONV

UPDATE
A bug in the CMakeLists.txt has been fixed in version 4.0.5.3 of the library.
Basically, while explicitly linking to iconv on Linux causes the build to fail, the opposite is true on OS-X. The resolution consisted in explicitly linking to iconv when running the build on OS-X.

A: i have just installed it successfuly without any error. here is what i did...
follow commandline instructions provided on imebra compilling documentation instead of gui.
if you are getting error at cmake command (for being not recognized as a valid command) then you have to install CMake command line tools.
Here is a tutorial: https://www.youtube.com/watch?v=sK4sVg4SRsg
To generate a library for the iPhone simulator, type the following (replace imebra_location with the path to Imebra):
mkdir imebra_for_ios
cd imebra_for_ios
cmake imebra_location -DIOS=SIMULATOR
cmake --build

To generate a library for iPhone, type the following (replace imebra_location with the path to Imebra):
mkdir imebra_for_ios
cd imebra_for_ios
cmake imebra_location -DIOS=IPHONE
cmake --build


text:
Q: JavaScript - Load many tiny files My JavaScript application has to load many micro text files from my web server asynchronously (there're about 200 * 5kB files). I know that downloading 1 large file is far more fast than downloading many tiny files. But I cannot predict which files are gonna be loaded (the client makes requests) and I have tons of files like this.
How can I speed up the transfer of those files?
I thought about concatenating requested files with PHP. Is that a good idea?

A: "I thought about concatenating requested files with PHP. Is that a good idea?"
We do the same thing in production with a servlet in java and it works quite well. But, to get it right we had to cache the concatenated files, don't read them for each request. The file IO  has a lot of overhead.
Here's a list of PHP cache tools. Given a highly cursory look at the doc for xcache you should be able to write a php file that collects all of your individual files and concatenates them and then store that in memory to be used as a resource.


text:
Q: Running awaitable task asynchronously in asp.net I have the following action in my controller:
[HttpPost("run")]
public Task<object> Run([FromBody] ResearchRequest researchRequest)
{
   researchService.RunAsync(researchRequest);
   return new{ queued = true   };
}

The controller needs to handle a task that takes several minutes.
Is this the correct way to release researchService.RunAsync to handle its job?
Or is there a better approach.
Thanks

A: If you are wanting to check that a process is already running, you could mark it as in progress somewhere on the server side (in a task in the database or such) and then when displaying the UI call a method on the server to check the state of your in progress flag.
that way the UI could navigate away from that page and return to still see that the process had been started

A: You can do that if RunAsync is making I/O requests, but you wouldn't return a Task:
[HttpPost("run")]
public object Run([FromBody] ResearchRequest researchRequest)
{
   researchService.RunAsync(researchRequest);
   return new{ queued = true   };
}

That will start running RunAsync on the same thread, just like any other method. At the first await in RunAsync that acts on an incomplete Task, RunAsync will return its own incomplete Task, at which point control returns back to your Run action and your object is returned. You won't be waiting for whatever I/O operation RunAsync makes.
If RunAsync is taking a long time because of CPU calculations (not I/O), then that won't do anything for you because, remember, it starts running on the same thread. You will have to start it on another thread, which you can do using Task.Run:
[HttpPost("run")]
public Task<object> Run([FromBody] ResearchRequest researchRequest)
{
   Task.Run(() => researchService.RunAsync(researchRequest));
   return new{ queued = true   };
}

But!
In both cases, ASP.NET will have no idea that RunAsync is running in the background. If the IIS app pool is shut down or recycled for any reason, that job will be killed part way through. Note that by default, IIS is configured to shut down an app pool after 20 minutes of no HTTP requests coming in.
If that is unacceptable to you, then you're better off writing the job to a queue in a database or something and doing that background processing in a Windows service.


text:
Q: Can't retrieve C# cookies from angular I am sharing a cookie value from one request to another in .net web api as mentioned bellow,
1st Request :-
[HttpGet]
[Route("api/MyAttendance/loginTask")]
public async Task<string> loginTask()
{
    //some code

    DateTime now = DateTime.Now;

    HttpCookie cookie = new HttpCookie("userAuth");

    cookie["sessionId"] = sessionID;
    HttpContext.Current.Response.Cookies.Add(cookie);
    cookie.Expires = now.AddYears(50);

    return "Successful";
}

2nd Request :-
        [HttpGet]
        [Route("api/MyAttendance/GetUser")]
        public string GetUser()
        {

            HttpCookie cookie = HttpContext.Current.Request.Cookies["userAuth"];
            var sessionId = cookie["sessionId"];

            //some code

            return sessionId;
        }

When I access the 1st request, the sessionID will be stored in the httpcookie so that I can get this cookie value from the 2nd request.I can do this process successfully from the .net web api(backend)and from postman.but when I do the same process from the angular(frontend),1st request works successfully but 2nd request will not execute it gives me following error because cookie value cannot be accessed.

System.NullReferenceException: Object reference not set to an instance
  of an object.

Calling Requests from the angular project(Frontend) :-
 getAuthentication(): Observable<any[]> {
    return this._http.get('http://localhost:2073/api/MyAttendance/loginTask').pipe(
      map((response: Response) => <any[]>response.json()));
  }

  getUserData(): Observable<any> {
    return this._http.get("http://localhost:2073/api/MyAttendance/GetUser").pipe(
      map((response: Response) => <any[]>response.json()));;
  }

I have no idea about this problem.Can someone explain me how to resolve this?

A: This is most probably a CORS issue. You need to user with credentials option
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
 let options = new RequestOptions({ headers: headers, withCredentials: true });

  getAuthentication(): Observable<any[]> {
    return this._http.get('http://localhost:2073/api/MyAttendance/loginTask', options).pipe(
      map((response: Response) => <any[]>response.json()));
  }

  getUserData(): Observable<any> {
    return this._http.get("http://localhost:2073/api/MyAttendance/GetUser", options).pipe(
      map((response: Response) => <any[]>response.json()));;
  }


text:
Q: force the text to start in the second column in each chapter of a two-column document I have tried without success to force the text to start automatically in the second column of each chapter including in the bibliography
\documentclass[twocolumn,spanish,10pt, letterpaper,openany]{scrbook}
\usepackage{lipsum}
\newcommand{\starthalfpage}{\quad \\[50em]}

\begin{document}
\chapter{Test}
\starthalfpage
\section{Test}
\lipsum[1-3]\cite{1}

\bibliographystyle{pain}
\bibliography{sample}
\end{document}

Can somebody help me? thanks

A: The (internal) command \@topnewpage should be the best place to insert some extra formatting commands (lacking an official "hook" for such insertion). That will apply to several similar places: after \maketitle and \part, as well as after \chapter -- whether explicit or hiding in the bibliography.  Scrbook uses a redefined version of \@topnewpage which ends with a command \@at@twocolumnfalse, so target that.
\newcommand{\starthalfpage}{\par\vspace*{\fill}\break}

\makeatletter
\g@addto@macro\@at@twocolumnfalse{\starthalfpage}
\makeatother

Don't use \starthalfpage explicitly in the document unless you are really forced to.


text:
Q: Linker Error when calling operator<<, how to fix this? Important Update: Removing the delegation of friend solved the problem Partially but why? and how may I keep it as friend...
Why the following code gets me linker error?
Dimensions dims2(3 ,14);//Fixed class 100% the bug isn't cause by it
Matrix<int> mat_2(dims2, 5);
std::cout << mat_2;

My class:
template<class T>
class Matrix {
public:
    friend std::ostream &operator<<(std::ostream &os, const Matrix<T> &matrix);

;}

in .h file I have:
template<typename T>
std::ostream &operator<<(std::ostream &os, const Matrix<T> &matrix) {}

I get the following:

Undefined symbols for architecture x86_64:
  "mtm::operator<<(std::__1::basic_ostream >&, mtm::Matrix const&)", referenced
  from:
        _main in main.cpp.o ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to
  see invocation)

A: friend std::ostream &operator<<(std::ostream &os, const Matrix<T> &matrix);

This declares a non-template function named operator<< (in the namespace enclosing Matrix definition). That function is never defined. In addition, a function template also named operator<< is defined. When doing overload resolution, the compiler prefers a non-template over the template, then the linker discovers there's no definition.
There are several ways to resolve this. One is to define the operator in-class:
template<class T>
class Matrix {
    friend std::ostream& operator<<(std::ostream& os, const Matrix<T>& matrix) {
      // Implementation here
    }
};

Another is to befriend the function template:
template <typename T> class Matrix;

template<typename T>
std::ostream &operator<<(std::ostream &os, const Matrix<T> &matrix);

template<class T>
class Matrix {
    friend std::ostream& operator<< <T>(std::ostream &os, const Matrix<T> &matrix);
};

Yet third is to not require friendship at all, e.g. like this:
template<class T>
class Matrix {
public:
    // Actual implementation here.
    void PrintMe(std::ostream &os);
};

template<typename T>
std::ostream &operator<<(std::ostream &os, const Matrix<T> &matrix) {
  matrix.PrintMe(os);
  return os;
}


text:
Q: Given a probability triple $(\Omega,\mathbf{F},P)$ where $\Omega=[0,1]$, why must $\mathbf{F}$ contain all the intervals? Given a probability triple $(\Omega,\mathbf{F},P)$ where $\Omega=[0,1]$, why must $\mathbf{F}$ contain all the intervals?
I am reading "A First Look at Rigorous Probability Theory" by Jeffrey S. Rosenthal and in section $2$ he discusses probability triples/probability space. There he mentions that if we were to define a probability triple $(\Omega,\mathbf{F},P)$ on an uncountable set say $\Omega=[0,1]$ which corresponds to the Uniform distribution $[0,1]$ then we certainly can't take all the subsets of $\Omega$ (as proved in a proposition given in section 1). I understand his point up until here. But he then says that it must be the case that $\mathbf{F}$ contains all the intervals, whereby intervals he means all the open, closes, half-open/singleton and empty intervals.
I know that the set of all intervals $J$ does not form a sigma-algebra because it is not closed under unions, but why must it be contained in $\mathbf{F}$ is something that I do not quite understand.

A: Of course it's not the case that any sigma algebra $\mathcal{F}$ would have to contain all the intervals (as you described). This is because the exact structure of $[0,1]$ need not be reflected in every probability triple - all that matters is that $[0,1]$ is an uncountable set. A little more precisely, you could, for example, take any bijection $f: [0,1] \to [0,1]$ and then form $\mathcal{F}$ based on the "intervals" $f((a,b))$ for any $(a,b) \subseteq [0,1]$. However, the point of the uniform distribution is to get a natural probability triple compatible with the nice ordering of $[0,1]$. We want the probability of $(\frac{1}{3},\frac{2}{3})$ to be $\frac{1}{3}$, etc.


text:
Q: Why does my motherboard manufacturer recommend that I use the A2/B2 memory channels before A1/B1? My motherboard has 4 memory slots, divided into two channels. In my motherboard's manual it is recommended that you use slots A2 and B2 before A1 and B1, as you can see in the image below. But why is this recommended? Running two RAM modules in A1 and B1 seems to work fine, so why is it recommended to use A2 and B2 first?
EDIT: The motherboard uses an Intel Z97 Express chipset.

A: That is probably because those two slots are used for dual channel operation.
Wikipedia page about multi-channel memory


text:
Q: Database stop sending data to node server after trying to deploy on heroku. I am just getting A pending promise I developed a node app server that get data requested through a postgres (sequelize ORM) which send the data to my react nextjs app when requested.
A few days ago I tried to host the application on heroku, which is when all hell broke loose. the application stopped working. I was getting a socket hangup error. I followed the error stack trace until i think i pinpointed the error on when my server request data from my database. I realized there are no more data coming through. Therefore, I am left hanging with a pending promise. I rebuild my backend. I also went back to previous commit when it was working and the application is still not working. The front-end is working bc it is running on a different host but my backend is not receiving data from my db anymore. I have tried everything i can think of and read a bunch of article on stack overflow and Github but have not figure it out yet. Also, I can no longer seed my seed file for some reason (also return pending promise).
ANY HELP WILL BE REALLY APPRECIATED.

A: I figure out what was the problem. My configuration on the server side with my database was not working. Therefore, I was getting an unresolved promise which caused the application to just keep loading while waiting for the data. By changing my config file to this:
`
const Sequelize = require("sequelize");
let database = process.env.DATABASE_URL;
let sequelize = "";

process.env.DATABASE_URL
  ? (sequelize = new Sequelize(database))
  : (sequelize = new Sequelize(database, "postgres", "", {
      dialect: "postgres",
      logging: false,
    }));

`module.exports = sequelize;
and adding my postgres database manually on my terminal when running heroku pg:psql to see and create my data base. I was able to make the application work once deployed on Heroku.


text:
Q: Scaling an SVG with complex animation paths I have this code for an SVG on my page. It's a track and I have a car that scrolls along the path as you go down the page.
<div class="my-svg-container">
<svg viewBox="-220 -219 1250 2212.5" style="
 position: absolute;
" class="my-svg" preserveAspectRatio="xMinYMin meet"><defs>
<style>.cls-1,.cls-10,.cls-11,.cls-12,.cls-13,.cls-14,.cls-15,.cls-16,.cls-17,.cls-3,.cls-4,.cls-5,.cls-6,.cls-7,.cls-8,.cls-9{fill:none;}.cls-2{clip-path:url(#clip-path);}.cls-3{stroke:#2d2d2d;stroke-width:100px;}.cls-10,.cls-11,.cls-12,.cls-13,.cls-14,.cls-15,.cls-16,.cls-17,.cls-4,.cls-5,.cls-6,.cls-7,.cls-8,.cls-9{stroke:#fad000;stroke-width:9px;}.cls-4{stroke-dasharray:12 11.54;}.cls-5{stroke-dasharray:12 10.64;}.cls-6{stroke-dasharray:12 12.26;}.cls-7{stroke-dasharray:12 13.27;}.cls-8{stroke-dasharray:12 12.67;}.cls-9{stroke-dasharray:12 10.99;}.cls-10{stroke-dasharray:12 12.24;}.cls-11{stroke-dasharray:12 13.42;}.cls-12{stroke-dasharray:12 12.63;}.cls-13{stroke-dasharray:12 10.47;}.cls-14{stroke-dasharray:12 11.73;}.cls-15{stroke-dasharray:12 11.95;}.cls-16{stroke-dasharray:12 12.17;}</style>
 <clipPath id="clip-path" transform="translate(4349 2519.5)"><rect class="cls-1" x="-4349" y="-2519.5" width="868.18" height="1964.5"></rect></clipPath></defs><title>Road(whole)</title>
 <g class="cls-2">

 <path id="theMotionPath" class="cls-3" d="M709.08 0.54v306s7,91-106,91h-461s-92-8-92,96v444s-6,78,64,78h606s98-10,98,90v394s5,84-84,84h-522s-90-3-90,90v290" ></path>
 <line class="cls-4" x1="709.08" y1="17.54" x2="709.08" y2="294.23"></line>

 <path class="cls-5" d="M-3640.93-2196.91c-3.89,25-21,69.87-93.68,74.09" transform="translate(4349 2519.5)"></path>
 <line class="cls-6" x1="584.81" y1="397" x2="154.21" y2="397"></line>

 <path class="cls-7" d="M-4226.14-2121.52c-25.35,3.77-67.35,19.56-72.3,82.4" transform="translate(4349 2519.5)"></path>
 <line class="cls-8" x1="50.08" y1="511.67" x2="50.08" y2="924.67"></line>

 <path class="cls-9" d="M-4298.32-1565.54c2.45,21,12.58,54.8,51.94,60.28" transform="translate(4349 2519.5)"></path>
 <line class="cls-10" x1="132.32" y1="1015" x2="707.96" y2="1015"></line>

 <path class="cls-11" d="M-3609.53-1504.15c26.79,2.72,72.47,16.34,78,77" transform="translate(4349 2519.5)"></path>
 <line class="cls-12" x1="818.08" y1="1123.63" x2="818.08" y2="1486.69"></line>

 <path class="cls-13" d="M-3532-1004.08c-3.44,22.94-17.31,62.35-71.73,67.11" transform="translate(4349 2519.5)"></path>
 <line class="cls-14" x1="716.35" y1="1583" x2="223.99" y2="1583"></line>

 <path class="cls-15" d="M-4154.73-934.92c-24.59,4.26-66.45,19.86-71.61,76.46" transform="translate(4349 2519.5)"></path>
 <line class="cls-16" x1="122.13" y1="1691.17" x2="122.13" y2="1950.92"></line>

 <path class="cls-17" d="M-4226.87-562.5
 v6m.13-296
 q-.14,2.93-.13,6
 v6
 m96-96
 h-6
 s-2.23-.07-6,.16
 m533.95-.29q-2.92.14-6,.13
 h-6
 m90-90
 v6
 s.13,2.24,0,6
 m-.09-406
 c.08,2,.12,4,.12,6
 v6
 m-104-96
 h6
 s2.22-.23,6-.27
 m-618,.07
 c1.94.13,3.93.2,6,.2h6m-70-84v6s-.18,2.26-.12,6m.22-456
 q-.11,2.94-.1,6v6m98-102h-6s-2.23-.19-6-.13m473,0q-2.94.09-6,.09
 h-6m112-97v6a57.48,57.48,0,0,1,0,6m0-312v6" transform="translate(4349 2519.5)"></path></g>

 <g class="shakyimage">
 <image speed="2" width="5%" height="5%" x="-65" y="-30" xlink:href="https://cdn3.iconfinder.com/data/icons/cars-28/512/Car_5-512.png" id="dot" ></image>

 </g>
 <g >
 <image width="45%" height="11%" x="423" y="-100" xlink:href="https://cdn0.iconfinder.com/data/icons/gpsmapicons/red/gpsmapicons07.png">
 </g>
 <g >
 <image width="30%" height="10%" x="-66" y="1782.17" xlink:href="https://cdn0.iconfinder.com/data/icons/gpsmapicons/red/gpsmapicons07.png">
 </g>
 </svg>

</div>

This functions very well as-is. My main issue is I have built the page to align with the track. This means that the end of the track perfectly aligns with the last section of the page. The problem is, when you make the page smaller the track shrinks in size.
Currently I have tried doing this:
.my-svg-container{
  display: inline-block;
  position: relative;
  width: 100%;
  padding-bottom: 38.5%; /* depends on svg ratio, for my zebra height/width = 1.2 so padding-bottom = 50% * 1.2 = 60% */

  vertical-align: middle; /* top | middle | bottom ... do what you want */
 }

 .my-svg{ /* svg into : object, img or inline */
   display: block;
   position: absolute;
   top: 0;
   left: 0;
   width: 100%; /* only required for <img /> */
 }

However this seems to have no effect on the responsiveness.
So is it possible to basically make this scale, but retain its position on the page? The height seems to be the main issue; positioning seems to be intact, but the height shrinks so everything isn't aligned any more.
Thanks! Let me know if you need more info

A: You are scaling the SVG image proportionally, which means that when the width changes (to adapt to the page width), the height must also change to keep the image proportions.
In part this is what you want, because scaling the image disregarding proportions would cause your traffic sign or the car to become stretched. On the other hand you want to keep the road height fixed, so here are your alternatives:
Alternative 1 — don't scale the image
This may seem counter to what you're looking for but it's definitely worth considering. You're not scaling the text around which the image revolves, so why scaling the image at all? Just keep both centered with constant size.
Alternative 2 — scale parts of your SVG separately
You can split your SVG into the parts you want with fixed proportion (like the traffic sign and vertical parts of roads) and variable proportion (like horizontal roads). You can use the preserveAspectRatio and viewBox attributes to. There's an example here (works on Chrome but not on current Firefox).
Alternative 3 — scale in discrete steps
If you really want the image to become bigger on a larger display, but don't feel like going through the complexity of alternative 2, you can prepare several SVGs for several width / height ratios and use media queries to display the appropriate one for the appropriate width interval.

A: Try changing your SVG to
preserveAspectRatio="xMinYMin slice"

It should mean that the SVG stays the same height as your content, but that the right hand side of the SVG gets clipped off as the page gets narrower.
If you want both sides (left and right) to get clipped off at the same rate, so the SVG remains centred, then use:
preserveAspectRatio="xMidYMin slice"


text:
Q: What is the correct term for streams we substitute in a parameter? Consider this code with my parameter:
for domain; do
    cat <<EOF > "/etc/nginx/sites-available/${domain}.conf"
        My \domain is ${domain}.
    EOF
done

Let's break the parameter in that code into parts: $ + { + STRWPAAIE + }.
STRWPAA stands for "Stream to Replace When Passing An Argument In Execution".
In this case the STRWPAAIE is domain but what is the general term to describe it? It surely isn't STRWPAAIE (a term I just invented to describe what I mean), so what is the "formal" or "common" term to use here?
Update:
I understand it is the STRWPAAIE is a variable, but it's not a variable in the general sense, rather, in quite a specific sense - a parameter's variable.

A: This is called a "variable". From man bash:

A variable is a parameter denoted by a name.  A variable has a value and zero or more  attributes.   Attributes  are  assigned  using  the  declare
  builtin command (see declare below in SHELL BUILTIN COMMANDS).


text:
Q: .net entity query I'm have an issue with this entity query that I am hoping to get some help with.
Overall what I am trying to do is query for entries in the GoalNotes table as well as include the Employee reference for each note. The GoalNotes table has a foreign key relating it to the Employee table.
I am then trying to query the GoalNotes table based on a specific goal id. The GoalNotes table has a relation setup to the Goal Table as well.
I have three tables that look like the following:
Employee
Id,
FirstName,
LastName
GoalNotes
Id,
Goal,
Description,
Employee,
CreatedDt
Goal
Id,
Description,
CreatedDt
The query I am trying to use looks like this:
public List<GoalNotes> LoadGoalNotes(int goalId)
{
    var notes = from note in GoalNotes.Include("Employee")
                where Employee.Any(e => e.Id == note.Employee.Id)
                where note.Goal.Id == goalId
                orderby note.CreatedDt descending
                select note;

    return notes.ToList();
}

This method exists in an EntityContext file that contains a partial class for my entity object.
The issue appears to be in how I am trying to include the Employee reference. The query works if I remove the where Employee.Any(e => e.Id == note.Employee.Id) line (excluding the employee reference)
Thanks in advance!

A: To include the employee, you just call Include -- nothing else:
var notes = from note in GoalNotes.Include("Employee")
            where note.Goal.Id == goalId
            orderby note.CreatedDt descending
            select note;

The EF already understands the relationship between GoalNote and Employee (it's in the EDMX), and you don't need to duplicate this information in every query you write.


text:
Q: How to set a Git serverA and another Git serverB are synchronous? How to set a Git serverA and another Git serverB are synchronous?
I need set 2 Git servers one is normal operation the anothers is backup.
User can git clone serverA or serverB because their repository are the same.
or another backup git server method?

A: You may want to have a post-commit script on Server A that will push all the changes to Server B.