text:
Q: Flash hover caurina saturation I have a flash project that loads an image and applies a grey saturation over it. There is a button beneath the image that when highlighted or the mouse hovers over it removes the saturation and restores the original color to the image. This works fine in demo mode and in the stand-alone flash player, but when I try to use it online (HTML) page the hover of feature no longer restores the color to the image. My code is below, I hope someone smarter than me know's what the problem is.
Thanks.
    function parsXML()
{
    mainGalleryNode = gallery_xml.childNodes[0].childNodes;
    path = mainGalleryNode[_root.gallerySel - 1].attributes.path;
    lenGall = mainGalleryNode[_root.gallerySel - 1].childNodes.length;
    lenCat = mainGalleryNode.length;
    for (var _loc2 = 0; _loc2 < lenGall; ++_loc2)
    {
        arrayImage[_loc2] = path + mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.pic;
        arrayThumb[_loc2] = path + mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.thumbnail;
        arrayTitle[_loc2] = mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.name;
        arrayDescription[_loc2] = mainGalleryNode[_root.gallerySel - 1].childNodes[_loc2].attributes.description;
    } // end of for
} // End of the function

function arrayThumbs()
{
    for (var _loc3 = 1; _loc3 <= lenGall; ++_loc3)
    {
        _thumbs._thumbs.attachMovie("thumb", "thumb" + _loc3, _loc3);
        var _loc2 = _thumbs._thumbs["thumb" + _loc3];
        _loc2.index = _loc3;
        _loc2._y = Math.floor(_loc2._height + 1) * (_loc3 - 1);
        _loc2._mc._txt.text = _loc2.index;
        _loc2.onRollOver = function ()
        {
            this.gotoAndPlay("over");
        };
        _loc2.onRollOut = _loc2.onReleaseOutside = function ()
        {
            this.gotoAndPlay("out");
        };
        _loc2.onRelease = function ()
        {
            caurina.transitions.Tweener.addTween(_mc1._mc, {_saturation: 1, time: 5.000000E-001});
            mcLoader.loadClip(arrayImage[this.index - 1], _mc1._mc);
            currentIndex = this.index - 1;
            getDes();
        };
    } // end of for
    counter = 1;
} // End of the function

function menuCat()
{
    for (var _loc4 = 1; _loc4 <= lenCat; ++_loc4)
    {
        _category.attachMovie("btnCat", "btnCat" + _loc4, _loc4);
        var _loc3 = _category["btnCat" + _loc4];
        var _loc6 = _category["btnCat" + (_loc4 - 1)];
        _loc3.index = _loc4;
        arrayNameGall[_loc4 - 1] = mainGalleryNode[_loc4 - 1].attributes.name;
        _loc3._mc._txt.autoSize = true;
        _category["btnCat" + _loc4]._mc._txt.text = arrayNameGall[_loc4 - 1];
        _loc3._red._width = _loc3._mc._txt.textWidth + 10;
        _loc3._red._x = _loc3._mc._txt.textWidth / 2;
        _loc3._mask._width = _loc3._mc._txt.textWidth + 10;
        _loc3._mask._x = _loc3._mc._txt.textWidth / 2;
        for (var _loc5 = 1; _loc5 <= 3; ++_loc5)
        {
            _loc3["_arr" + _loc5]._x = _loc3._mc._txt.textWidth / 2 - 5;
        } // end of for
        _loc3._mask_red._txt.text = arrayNameGall[_loc4 - 1];
        _loc3._x = Math.floor(_loc6._x + _loc6._mc._txt.textWidth + intervalCat);
        if (_loc4 < lenCat)
        {
            _category._breakers.attachMovie("breaker", "breaker" + _loc4, _loc4);
            var _loc7 = _category._breakers["breaker" + _loc4];
            _loc7._x = _loc3._x + _loc3._mc._txt.textWidth + intervalBr;
        } // end if
        _category._x = 881 - _category._width;
        _loc3.onRollOver = function ()
        {
            if (this.index != _root.gallerySel)
            {
                btnCatOver(this._red, this._arr1);
            } // end if
        };
        _loc3.onRollOut = _loc3.onReleaseOutside = function ()
        {
            if (this.index != _root.gallerySel)
            {
                btnCatOut(this._red, this._arr1);
            } // end if
        };
        _loc3.onRelease = function ()
        {
            if (this.index != _root.gallerySel)
            {
                btnCatOut(_category["btnCat" + _root.gallerySel]._red, _category["btnCat" + _root.gallerySel]._arr1);
                clearThumbs();
                caurina.transitions.Tweener.addTween(_thumbs._thumbs, {_y: 0, time: 1, transition: "easeOutCubic"});
                yPos = 0;
                _root.gallerySel = this.index;
                parsXML();
                arrayThumbs();
                getDes();
                mcLoader.loadClip(arrayImage[0], _mc1._mc);
            } // end if
        };
    } // end of for
    btnCatOver(_category.btnCat1._red, _category.btnCat1._arr1);
} // End of the function

function btnCatOver(clip1, clip2)
{
    caurina.transitions.Tweener.addTween(clip1, {_y: 17, time: 3, transition: "easeOutCubic"});
    caurina.transitions.Tweener.addTween(clip2, {_y: -6, time: 5.000000E-001, transition: "easeOutCubic"});
    var _loc1 = new Sound();
    _loc1.attachSound("bt_snd");
    _loc1.start();
} // End of the function
function btnCatOut(clip1, clip2)
{
    caurina.transitions.Tweener.addTween(clip1, {_y: -27, time: 3, transition: "easeOutCubic"});
    caurina.transitions.Tweener.addTween(clip2, {_y: -24, time: 5.000000E-001, transition: "easeOutCubic"});
} // End of the function
function clearThumbs()
{
    for (var _loc1 = 1; _loc1 <= lenGall; ++_loc1)
    {
        _thumbs._thumbs["thumb" + _loc1].removeMovieClip();
    } // end of for
} // End of the function
function getDes()
{
    var _loc2 = new Object();
    _loc2.onMouseMove = function ()
    {
        if (_mask_des.hitTest(_root._xmouse, _root._ymouse))
        {
            caurina.transitions.Tweener.addTween(_descr, {_y: 407, time: 5.000000E-001, transition: "easeOutCubic"});
        }
        else
        {
            caurina.transitions.Tweener.addTween(_descr, {_y: 467, time: 5.000000E-001, transition: "easeOutCubic"});
        } // end else if
    };
    Mouse.addListener(_loc2);
    _descr._txt.text = arrayTitle[currentIndex];
} // End of the function
_thumbs._thumbs.setMask(_thumbs._mask);
_root.gallerySel = 1;
var lenGall;
var lenCat;
var mainGalleryNode;
var path;
var arrayImage = new Array();
var arrayThumb = new Array();
var arrayTitle = new Array();
var arrayDescription = new Array();
var arrayNameGall = new Array();
var currentIndex = 0;
var descStr;
var titleStr;
var sel = false;
var counter;
var intervalCat = 54;
var intervalBr = intervalCat / 2;
var yPos = 0;
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function (ok)
{
    if (ok)
    {
        parsXML();
        arrayThumbs();
        menuCat();
        getDes(); //Shows the Colour view bar
        _mc2._mc.unloadMovie();
        mcLoader.loadClip(arrayImage[0], _mc1._mc);

    } // end if
};
gallery_xml.load("cgal.xml");
btnTop.onRollOver = btnBottom.onRollOver = function ()
{
    this.gotoAndPlay("over");
};
btnTop.onRollOut = btnBottom.onRollOut = function ()
{
    this.gotoAndPlay("out");
};
btnBottom.onRelease = function ()
{
    if (_thumbs._thumbs._height > _thumbs._mask._height)
    {
        if (Math.abs(_thumbs._thumbs._y) < _thumbs._thumbs._height - _thumbs._mask._height && caurina.transitions.Tweener.isTweening(_thumbs._thumbs) != true)
        {
            yPos = yPos - (_thumbs._thumbs.thumb1._height + 1);
            caurina.transitions.Tweener.addTween(_thumbs._thumbs, {_y: yPos, time: 5.000000E-001, transition: "easeOutCubic"});
        } // end if
    } // end if
};
btnTop.onRelease = function ()
{
    if (_thumbs._thumbs._height > _thumbs._mask._height)
    {
        if (Math.abs(_thumbs._thumbs._y) > 0 && caurina.transitions.Tweener.isTweening(_thumbs._thumbs) != true)
        {
            yPos = yPos + (_thumbs._thumbs.thumb1._height + 1);
            caurina.transitions.Tweener.addTween(_thumbs._thumbs, {_y: yPos, time: 5.000000E-001, transition: "easeOutCubic"});
        } // end if
    } // end if
};
caurina.transitions.properties.ColorShortcuts.init();
_descr._btn_color.onRollOver = function ()
{
    caurina.transitions.Tweener.addTween(_mc2._mc, {_saturation: 1, time: 2});
};
_descr._btn_color.onRollOut = function ()
{
    caurina.transitions.Tweener.addTween(_mc2._mc, {_saturation: 0, time: 2});
};
var mcLoader = new MovieClipLoader();
var loadListener = new Object();
loadListener.onLoadStart = function (mcTarget)
{
    _root.loadImBig = true;
    _root._content.pages.page1.page1.attachMovie("mcPercents", "mcPercents", this.getNextHighestDepth());
    _root._content.pages.page1.page1.mcPercents._x = _mask_des._width / 2 - 10;
    _root._content.pages.page1.page1.mcPercents._y = _mask_des._height / 2 - 25;

};
loadListener.onLoadProgress = function (mcTarget, bytesLoaded, bytesTotal)
{
    var _loc2 = Math.ceil(bytesLoaded / bytesTotal * 100);
    _root._content.pages.page1.page1.mcPercents.txtPercents.text = _loc2 + "%";
};
loadListener.onLoadComplete = function (mcTarget)
{
    _root._content.pages.page1.page1.mcPercents.mcLoading.removeMovieClip();
    _root._content.pages.page1.page1.mcPercents.removeMovieClip();
};
loadListener.onLoadInit = function (mcTarget) //Controls the different tabs at the bottom
{
    caurina.transitions.Tweener.addTween(_mc2._mc, {_saturation: 0, time: 5.000000E-001});
    mask_mc.gotoAndPlay(2);
    _white.gotoAndPlay(2);
};
mcLoader.addListener(loadListener);

A: Edit:
After taking a look at snapplex's project files, it appears the issue may be a difference in behaviour between Flash versions when a mask is completely empty.
The grey saturation has a mask which animates and finishes on a blank frame. This hides the masked object in the test environment (targeting Flash Player 8), but shows the whole object in browser (with the latest player version).
A quick workaround is to add a shape to the mask which is off stage, which leaves the masked object invisible in both player versions.
(My original answer suggested Flash didn't receive rollover events without focus, but this was incorrect.)


text:
Q: Is $f(X)=X^7+6X^5+5X^2+9$ irreducible over $\Bbb{Z}$? Since $f(X)$ is monic, it is irreducible over $\Bbb{Z}$ iff it is irreducible over $\Bbb{Q}$. But Eisenstein Criterion is not applicable here. I was trying to reduce it to mod $p$ for some prime $p$ and check whether it is irreducible over $\Bbb{Z}/p\Bbb{Z}$. I was trying to shift and then apply Eisenstein but none of them seems working.
Can anyone give me any hint or wayout to solve the problem? Thanks for your help in advance.

A: Over $\mathbb{F}_2$, $f$ factors as $$(x^2 + x + 1) * (x^5 + x^4 + x^2 + x + 1),
$$
a degree $2$ times a degree $5$. Over $\mathbb{F}_{11}$, $f$ factors as
$$(x + 6) * (x^6 + 5*x^5 + 9*x^4 + x^3 + 5*x^2 + 8*x + 7).$$
This is a degree $1$ and a degree $6$. These are incompatible factorizations --- a factorization over $\mathbb{Z}$ descends to factorizations over any $\mathbb{F}_p$. Thus $f$ is irreducible.

Edit: a computational shortcut
Determining reducibility/irreducibility over finite fields is a finite, but possibly tedious, process. Thus one way to factor $f$ over $\mathbb{F}_{11}$ is to check for roots (giving the linear factor), and then check for quadratic factors, and then check for cubic factors. The degree $6$ part will either be irreducible or have a degree $1$, $2$, or $3$ factor.
But there is a slightly faster computational way to determine that $f$ is irreducible over $\mathbb{Z}$. The factorization over $\mathbb{F}_2$ gives a degree $2$ term and a degree $5$ term. Over $\mathbb{F}_{11}$, we identify the linear term quickly by looking for roots (by plugging in $11$ numbers). It is quick to verify that this is a single root and that $f$ has no other roots over $\mathbb{F}_{11}$.
Thus there is exactly one linear factor. To check compatible factorizations with the factorization over $\mathbb{F}_2$, it now suffices to check for an irreducible quadratic factor. Confirming that such a factor doesn't exist completes the demonstration that $f$ is irreducible. Note that it isn't necessary to look for cubic factors, or to completely verify that the sextic in the factorization is irreducible.

A: The polynomial is indeed irreducible over $\Bbb F_{29}$, hence also irreducible over $\Bbb Z$. Of course one still needs some work to show this for $p=29$. A short computation shows that $f$ has no root in $\Bbb F_{29}$, so that we have to look at the cases $f=(x^2+ax+b)(x^5+\cdots +a_0)$ and $f=(x^3+ax^2+bx+c)(x^4+\cdots +b_0)$.

A: This is is more a remark than an answer, but I thought you might be interested. It would take an impractically long time, but in principle there is a straightforward algorithm to decide whether any integer polynomial is irreducible.
Here's the idea. Suppose, for instance, that it is possible to write $f(X)=g(X)h(X)$ where $g$ has degree $3$ and $h$ has degree $4$. Now, for any integer $n$, there are only finitely possibilities for the values of $g(n)$ and $h(n)$ because there are only finitely ways to factor $f(n)$ as a product of two integers. On the other hand, to determine $g$ and $h$ uniquely, we only need $3$ evaluations of $g$ and $4$ evaluations of $h$.
So, all we need to do is look at $4$ values of $f$ and all the ways those values can be factored. We can use any $4$ values of $f$, but ideally we choose values with fewer factors. Let's look at:
\begin{align*}
f(0)&=9 \leftarrow \text{two prime factors} &&& f(1)&=21  \leftarrow\text{two prime factors} \\f(-1)&=7 \leftarrow \text{prime}&&& f(2)&=349 \leftarrow \text{prime}
\end{align*}
Now, we can consider one of the finitely many ways of factoring those numbers. Note the order of multiplication matters here as we associate the left factor with $g$ and the right factor with $h$.
\begin{align*}
9=3 \cdot 3 && 21 = 3 \cdot 7 && 7 = 1 \cdot 7 && 349 =349 \cdot 1 && (**)
\end{align*}
Now we ask:

*

*Which degree $3$ polynomial $g(X)$ has:  \begin{align*}g(0)=3 && g(1)=3 && g(-1)=1?\end{align*}

*Which degree $4$ polynomial $h(X)$ has: \begin{align*}h(0)=3 && h(1)=7 && h(-1)=7 && h(2)=1?\end{align*}
We come up with
\begin{align*} g(X)=-X^2+X+3 && h(X)=-3X^3+4X^2+3X+3.\end{align*}
However, the product of these is
$$3X^5 - 7X^4 - 8X^3 + 12X^2 + 12X + 9 \neq f(X).$$
so the choices $(**)$ did not lead us to a factorization.
Continuing in this way, you can eventually establish for certain whether it is possible to factor $f(X)$ as the product of a degree $3$ and a degree $4$ polynomial. Then, in a similar way, you can check whether it is possible to factor $f(X)$ as the product of a degree $2$ and a degree $5$ polynomial.
Obviously, it would take a very long time to carry out all these steps, but you might find it comforting to know that there is a deterministic procedure. There are also ways of doing this more efficiently which you can find out about by searching for "Newton polygon".

redpajama_set_name: RedPajamaStackExchange


text:
Q: Subquery returning multiple rows in coalesce This may seem a little dumb question but what happens if I have a subquery in COALESCE which returns 2 records like this:
select
coalesce(<some subquery>,'') as "result",
column2, column3, .....
from <table name>

Now if the subquery returns 2 results what will the output of whole query?

A: You will get an error saying that the subquery returns more than 1 row.


text:
Q: IIS Express applicationhost.config - authentication error I'm running IIS Express (not to be confused with the normal IIS) under Windows 10. My understanding is the settings are stored in "My Documents\IISExpress\config\applicationhost.config"
These settings can be overriden by a local web.config file when using creating an asp.net core project.
When attempting to use this web.config
<?xml version="1.0" encoding="utf-8"?>
 <configuration>
  <location path="" inheritInChildApplications="false">
    <system.webServer>
      <security>
        <authentication>
          <anonymousAuthentication enabled="false" />
          <windowsAuthentication enabled="true" />
        </authentication>
      </security>
    </system.webServer>
  </location>
</configuration>

I receive the following error.

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

identifying this line
<authentication>
**<anonymousAuthentication enabled="false" />**
<windowsAuthentication enabled="true" />

This in spite of changing this line to state allow
<section name="anonymousAuthentication" overrideModeDefault="Allow" />

Is there any other place I should be looking?

A: Based upon feedback received.
The correct location for the configuration file is  {ProjectDirectory}.vs\config\applicationhost.config when working within visual studio.
"My Documents\IISExpress\config\applicationhost.config" is incorrect


text:
Q: What really happened in the desert? This obviously contains spoiler for the Uncharted 3 plot, so proceed with caution.
I just completed Uncharted 3 for the second time, and playing the desert part again raised some questions.
Let's recap a bit. Drake's just been through the whole shipyard ordeal - escaping capture, fighting off pirates, getting on and off the cruise ship and finally being washed ashore -after getting back to Elena, they have "a couple of hours of sleep" and reach the airport before dawn to catch the airplane. After Drake gets on the plane, we are led to understand he gets a few more hours of sleep (the next time we see him it's daylight outside), he then crashes into the desert.
The next couple of chapters is what really bothers me. So Drake is in the desert, no water, no food (we don't know about the latter for sure but we aren't told otherwise), it seems like he spends two days (we see two day-night cycles) walking in circles in the desert's heat and cold until he finally by chance reaches the ghost town. Only after surviving the ghost town Drakes get's a proper sleep again and food.
I might be reading into it too much, but it seems to me there's more than meets the eye in the desert chapter. I know the Uncharted series storyline relies on coincidence and chance but the desert scene when viewed without any interpretation seems really far-fetched. Twice before that point in the game we see characters hallucinating stuff that's not there, is it possible Drake imagines part of that desert journey (aside from the obvious mirages we see), that it really lasted much shorter? That he didn't reach his destination just by chance? Was this ever addressed by the game developers or cast?

A: In the first few minutes of Uncharted II, Drake is jumping around and pulling himself up ledges after he's been shot in the stomach.  If he can do that, he can survive 2 days in the desert.  (My personal canon is that it's not blood, the bullet shattered the uncapped red Sharpie he previously showed he was carrying)
Drake would be in no shape to be running through the village and mowing down everyone in sight after two days without water.  Really, he should have been staying put during the day, and moving only at night.  Then at least he could keep his bearings, and he wouldn't get heat stroke.
In reality it's not possible to navigate by the stars alone like Sully supposedly is either.  The exact height of the North Star would tell you what latitutde you were looking for, but you would need an absolute date and time to know how far East or West on that line.

A: Parts of the desert journey were probably leftovers from the hallucinogenic substance and interrogation he had earlier in the game.
The voiceovers from Marlowe, the mirages, the red rock that he hides underneath, and Sully urging him on.
All of these happened late in the desert journey when he's dehydrated and tired. It doesn't seem that the day and night cycles were a hallucination though.
As far as I've seen this hasn't been addressed specifically by the developers.


text:
Q: how to realize game dots on canvas? I make game called dots on canvas.
this is the wiki of game:
https://en.wikipedia.org/wiki/Dots_(game)
I have a problem with drawing a polygon, someone can podskozat how to implement it?
Thanks in advance

<!doctype html>

<meta charset="utf-8">
<title>Документ без названия</title>

<canvas  id="my_canvas" width= 520px  height="520px" style="display:block; margin: 0 auto; background-image: url(2.png)"></canvas>

0

0


text:
Q: how to open usb port and receive data of it using asio library? I have a device that communicates with another application(not written by me) that I want to get value of it using my application. googling I found the ansio library,I installed it and found this tutorial for getting started.
the question: how I to get the device name to set in port name?
using lsusb, I get:
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 0ac8:305b Z-Star Microelectronics Corp. ZC0305 Webcam
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

I want to handle the webcam device:
Bus 001 Device 004: ID 0ac8:305b Z-Star Microelectronics Corp. ZC0305 Webcam

then I wrote:
try {
    SimpleSerial serial("/dev/ttyUSB4",115200); // get SimpleSerial class on link above
    cout<<serial.readLine()<<endl;
    return 0;

} catch(boost::system::system_error& e)
{
    cout<<"Error: "<<e.what()<<endl;
    return 1;
}

but it given an: Error: open: No such file or directory
how to fix this? thanks in advance.

A: Type ls /dev/tty* in the shell and choose one of the resulting ports. Unfortunately it can't be said for sure which one will be the right one. Otherwise you can try extracting the correct port by processing the output of dmesg.

A: Typically when a device is connected to a USB port, it is records a message in the kernel ring buffer.  This log will often give you the information you are looking for.  To find it,

*

*Connect your device

*run dmesg or dmesg | tail -20 to see the last 20 lines of the buffer.

The output of the dmesg command should be something similar to the following.
.
.
.
[ 1562.334350] usb 2-1: USB disconnect, device number 2
[ 1566.526225] usb 1-1: new full-speed USB device number 7 using xhci_hcd
[ 1566.652880] usb 1-1: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 4.00
[ 1566.652885] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1566.652888] usb 1-1: Product: USB-Serial Controller D
[ 1566.652891] usb 1-1: Manufacturer: Prolific Technology Inc.
[ 1566.655451] pl2303 1-1:1.0: pl2303 converter detected
[ 1566.656634] usb 1-1: pl2303 converter now attached to ttyUSB1

Notes:

*

*The last line tells you the appropriate ttyUSB device number.  This is driver specific.  Many USB devices are not accessible via /dev/ttyUSB#.


text:
Q: Significance of using Eigenvalues / Vectors in QM? A fundamental idea in Quantum Mechanics is that observable quantities are represented by linear, hermitian operators. Why is it that we represent distinguishable states as the eigenvectors of operators, and corresponding eigenvalues are the results of measurements of those states?
I am reading "Quantum Mechanics The Theoretical Minimum" by Leonard Susskind and Art Friedman, in which this is said:
"If the system is in the eigenstate $$|\lambda_i \rangle$$ the result of a measurement is guaranteed to be $$\lambda_i$$"
I understand the geometrical meaning of eigenvectors and eigenvalues in linear algebra, but why are they used and so important in Quantum Mechanics?

A: According to the postulates of QM,
1) observables are raised to the status of linear self-adjoint operators
2) the only measurable values of an obeservable are its eigen-values.
Now, self-adjoint(for finite dimensions, they are same as Hermitian)operators are guaranteed to have real eigenvalues. Hence the measurable quantities are the eigenvalues of the observable which are real(as they are obtained from experiment).
This is how eigenvalues stem in QM. Take the postulates as your guiding principle! Hope this helps.

A: As far as I know, this comes from the structure of the Schroedinger equation, the equation that rules a particle in non relativistic quantum mechanics (I have not read that book, but I think that this is its subject).
The time dependent Schroedinger equation:
$$ i \hbar \frac{\partial }{\partial t} \Psi = \hat{H} \Psi $$
with $\hat{H} $ hamoltonian operator of the problem and $\Psi$ time dependent solution of this equation. From this formulation one can show that it is possible to separate the variables of the problem, writing an equation for the temporal part and another one for the three spatial coordinates. The latter can be easily written as:
$$\hat{H} \psi = E\psi$$
with $\psi$ solution of the time independent equation and $E$ energy of the particle. From a mathematical point of view this problem is the same as looking for the spectrum of eigenvalues (the energies) and eigenvectors (the solutions of this equation, projected on a certain basis, also called eigenfunctions) of the hamiltonian operator, that is by definition the operator whose eigenvalues are the allowed energies.
Therefore, this kind of language is a direct consequence of the mathematical formulation of the problem.
(Note that in my answer I have skipped a lot of mathematic, that would have make my answer considerably longer. You can find it in most books of introductive quantum mechanics, such as Griffiths or Eisberg - Resnick ones. You may also find this Wikipedia's link quite interesting.)


text:
Q: Heroku - How to monitor requests and responses? I have several spring-boot based micro-services on Heroku platform.
They using http API to communicate each other.
And I need some tool (it can be heroku add-on, spring feature or other tool) to monitor how they communicate (see all requests and responses).
I know that I can implement custom spring http interceptors and store http messages somehow but it will be better to use already ready solution.

A: Probably the easiest thing is to log to stdout, using any logging library or simply printing, and have heroku logs display it on the command line.


text:
Q: In OpenCV should I round the CAP_PROP_FPS value for use in cv2.waitKey() I'm just getting started with video and OpenCV so I am working my way through some basic coding examples.
If I VideoCapture ("MyFile.mov") to load a video into OpenCV and then get the property CAP_PROP_FPS I get a value 24.998291482797672
Is it advisable to use that specific value or should I round up to 25?
Also, is the value
24.998291482797672a result of some decision made when producing the video and a result of some specific hardware and software combinations or is it more global and known as the more precise value for 25 fps video files?
Update: I evaluated a number of my source videos and most are 25 fps but 2 have fps rates that would round to 25 but are reported as 24.xyz to 10 decimal points.  I just added it for information, if someone does know why / how they could end up with frame rates of slightly less than 25


text:
Q: Import/read UIFileSharingEnabled I work with Xcode 7 and IOS 9.
I want to know how to read the file shared with iTunes (UIFileSharingEnabled).
I managed to share a file (Export) but I can not read a file is added by user ...
Thank you in advance !
UPDATE :
I managed to add my files, but can not access ay since my swift code.
When I try to retrieve the bundle, he referred me nil
let strBundle = NSBundle.mainBundle().URLForResource("DictionaryContents", withExtension: "cvs") // return nil


text:
Q: remember form tag input values I'm trying to create a filter form that user selects dates and sources. The problem is after clicking submit button, in the new page i see that input values are empty. Is there a way to make form remember its values ? Thanks.
<%= form_tag products_path, :method => 'get' do %>

<%= text_field_tag :from %>
<%= text_field_tag :to %>

<% Source.all.each do |source| %>
 <%= check_box_tag "sources[]", source.id %>
 <%= source.name %>

<% end %>

<%= submit_tag "Submit", :name => nil %>

<% end %>

controller
def index

 @from = params[:from] ? params[:from].to_datetime : (Time.now-3.day)
 @to = params[:to] ? params[:to].to_datetime : (Time.now)
 @sources = params[:sources] ? params[:sources] : 1..6

 @products = Product.where(:source_id => @sources, :created_at => @from.beginning_of_day..@to.end_of_day)

end

A: Can't you use the value and checked options from these tags? Here is an example :
<%= form_tag products_path, :method => 'get' do %>

<%= text_field_tag :from, @from %>
<%= text_field_tag :to, @to %>

<% Source.all.each do |source| %>
 <%= check_box_tag "sources[]", source.id, @sources.include?( source.id ) %>
 <%= source.name %>

<% end %>

<%= submit_tag "Submit", :name => nil %>

<% end %>


text:
Q: Predict the output with pointers In the code below, I'm confused about the working  of 3 line.If anyone explains it ,I will be very grateful.
Thank you.
#include< iostream >
using namespace std;

int main()
{
1. char s[]="abcdef";
2. char *p=s;
3. *p++=*++p;
4. cout<<s;
5. return 0;
}

A: Before the line *p++=*++p;, p points to the start of the array s.
The ++p in the right hand-side of the line will increment p by one and so it now points to b. Dereferencing it with * will give the value b and so the right hand side evaluates to b.
In the left hand side, since the post-increment operator is used, the value of p will not immediately change. Thus, the value b from the RHS will be set to the same memory location. Because of the post-increment operator, p will point to the character c of the array.
Thus, the char array will remain the same after this line and so abcdef will be printed. p however will point to the character c of the array.
Note that the above is valid only since c++17. From en.cppreference.com/w/cpp/language/eval_order: In every simple assignment expression E1=E2 and every compound assignment expression E1@=E2, every value computation and side-effect of E2 is sequenced before every value computation and side effect of E1


text:
Q: Error reordering backlog priority in TFS2015 In TFS at the backlog, you can reorder work items by selecting and dragging items according to the desired order.
When we try to do this with our recent TFS 2015 install, this error pops up:

Which says:

An error has occurred while attempting to save your changes. Click
  here to discard your changes and refresh your view of the backlog.
  Error details: TF400486: Unable to complete the operation because you
  or another user has modified, removed, or re-parented items, or you
  are trying to reorder an item outside of its immediate parent.

When we check the event log on the TFS machine, this exception is present:

Microsoft.TeamFoundation.Server.WebAccess.Agile.Models.BacklogChangedException:
  TF400486: Unable to complete the operation because you or another user
  has modified, removed, or re-parented items, or you are trying to
  reorder an item outside of its immediate parent. at
  Microsoft.TeamFoundation.Server.WebAccess.Agile.Utility.ProductBacklogReorderHelper.PerformReorder(ReorderOperation
  operation, WorkItemData previousItem, WorkItemData nextItem,
  WorkItemData reorderItem, List1 workItemsData) at
  Microsoft.TeamFoundation.Server.WebAccess.Agile.Utility.ProductBacklogReorderHelper.Reorder(ReorderOperation
  reorderOperation) at
  Microsoft.TeamFoundation.Server.WebAccess.Agile.Utility.ProductBacklogReorderHelper.<Reorder>b__0(ReorderOperation
  o) at System.Linq.Enumerable.<SelectManyIterator>d__142.MoveNext() at
  System.Linq.Enumerable.d__811.MoveNext() at
  System.Collections.Generic.List1..ctor(IEnumerable1 collection) at
  System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at
  Microsoft.TeamFoundation.Server.WebAccess.Agile.Controllers.ApiReorderWorkItemsController.ReorderWorkItems(ReorderOperation[]
  operations, String hubCategoryRefName, String iterationPath) at
  lambda_method(Closure , ControllerBase , Object[] ) at
  System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
  controllerContext, IDictionary2 parameters) at
  System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
  controllerContext, ActionDescriptor actionDescriptor, IDictionary2
  parameters) at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.b__41()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.b__33()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.b__49()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.b__36(IAsyncResult asyncResult) at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.b__20()
  at
  System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.b__22(IAsyncResult
  asyncResult) at
  System.Web.Mvc.Controller.<>c__DisplayClass1d.b__18(IAsyncResult
  asyncResult) at
  System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult
  ar) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult
  asyncResult) at
  System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult
  ar) at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
  at
  System.Web.Mvc.MvcHandler.<>c__DisplayClass8.b__3(IAsyncResult
  asyncResult) at
  System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.b__3(IAsyncResult
  ar) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult
  asyncResult) at
  System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
  Boolean& completedSynchronously)

What steps should we take to resolve this?

A: You can try:

*

*upgrade TFS 2015 to TFS 2015 Update 1.

*clean the file cache folder on your AT machine: C:\TfsData\ApplicationTier_fileCache

*restart the TFS application pool in IIS.

A: As it turns out, this was related to how we used TFS in the past versus TFS now.
The guidance here indicates that work item ordering should be done in the context of features.
That is, order by feature, then in the relevant Sprint backlog, order by the work items present.

A: I noticed this only happens if:
CASE 1:
I move a PBI with children and put it before another PBI or
CASE 2:
I move a PBI and put it after a PBI with children
The workaround I used for each case is this.

WORKAROUND:
Imagine this is the order:
PBIWithChildren
PBINoChild
PBIINeedToMove

and this is the order I want to achieve:
PBIINeedToMove
   PBIWithChildren
   PBINoChild
I moved PBIWithChildren one down. So the order became like this:
PBINoChild
PBIWithChildren
PBIINeedToMove

Then I moved PBIINeedToMove and dropped it before PBINoChild so the order became like this:
PBIINeedToMove
PBINoChild
PBIWithChildren

Then I moved PBIWithChildren one up and ended with this which is what I wanted to achieve:
PBIINeedToMove
   PBIWithChildren
   PBINoChild

I know that sounds like many steps but only when you need to write it. Otherwise, it is a quick workaround.

A: I just ran into this issue and resolved it by ensuring my feature iteration path was in the same iteration path assigned to the corresponding team's backlog.  This may not work in all cases but after making the change I was able to reorder my features with their children without error.

A: We experienced the same issue.
In our case, the error was caused by an accidental linking between features and requirements within a teams backlog:
A requirement, which already had a parent, had been made the parent of a different feature. Hence ordering of the backlog was no longer possible.
So in order to resolve this, we had to find the requirement, which had been made a parent of a different feature and remove this parent/child link. We were then able to reorder the requirement backlog.

A: This is still happening in VSTS on the Kanban board at the Stories level.  I was able to work around this problem by moving a user story to a different column then moving it back to the original column in the order I desired.  Annoying, but it seems to work.

A: Just to add to the list of experiences, I have just come across this in TFS 2018.1.
In my case, it occurred after one of our teams reorganised the way they were using boards, and made some sweeping changes to the area and iteration paths on PBIs, but not on tasks.
The root cause was that some (preexisting) open (New, Inprogress) tasks under the PBI were in a different iteration and area to new tasks added. Ensuring all open tasks were in the same areapath/iteration resolved the issue.

A: In my case, I had a features backlog view that choked. I discovered I had user stories as parents of bugs, which were set to be at the requirement level and not the task level (meaning they were nested). Fixing the bug/user


text:
Q: Trouble installing iTunes and reading USB DVD Drive on Ubuntu I am new to Ubuntu and struggling with a few things:
An error occurred when checking for updates whilst trying to install something to read iTunes, or at least read music from iPhone.
I've got this red 'no entry' mark next to my message on tab.
Another problem - I tried to read USB DVD drive, but got following message:
E: Type 'n' is not known on line 3 in source list /etc/apt/sources.list.d/pmcenery-ppa-maverik.list

A: iTunes can't be installed on Ubuntu.Try using some other music player such as RhythmBox or Amarock to manage the music on your iPhone.


text:
Q: Get remaining time and upload file speed - ajax jquery/js jQuery.ajax
({
    url: ajaxurl,
    type: "POST",
    xhr: function()
    {
        var xhr = new window.XMLHttpRequest();
        xhr.upload.addEventListener( 'progress', function( e )
        {
            if( e.lengthComputable )
            {
                // Append progress percentage.
                var loaded = e.loaded;
                var total = e.total;
                var progressValue = Math.round( ( loaded / total ) * 100 );

                // Bytes received.
                jQuery( '.recievedValue' ).html( '' );
                jQuery( '.recievedValue' ).append( formatFileSize( loaded ) + ' / ' );

                // Total bytes.
                jQuery( '.totalValue' ).html( '' );
                jQuery( '.totalValue' ).append( formatFileSize( total ) );

                // Percentage.
                progressElement.find( 'input' ).val( progressValue ).change();
            }
        }, false );
        return xhr;
    },
    success: function( data )
    {}
});

This is my ajax function. I can get loaded bytes, total bytes and percentage value. But I also need to get the remaining time and upload file speed in (kb/sec). is there any way i can get these two values. Any help would be appreciated.

A: Try something like this, it should get you in the right direction:
Although finalized code would be cleaned-up/organized differently, I'll leave my answer recognizable to your original question so it's easier to relate to.
jQuery.ajax({
    url: ajaxurl,
    type: "POST",
    xhr: function(){
        var xhr = new window.XMLHttpRequest();
        var started_at = new Date();
        xhr.upload.addEventListener( 'progress', function( e ){
            if( e.lengthComputable ){
                // Append progress percentage.
                var loaded = e.loaded;
                var total = e.total;
                var progressValue = Math.round( ( loaded / total ) * 100 );

                // Bytes received.
                jQuery( '.receivedValue' ).html( '' );
                jQuery( '.receivedValue' ).append( formatFileSize( loaded ) + ' / ' );

                // Total bytes.
                jQuery( '.totalValue' ).html( '' );
                jQuery( '.totalValue' ).append( formatFileSize( total ) );

                // Time Remaining
                var seconds_elapsed =   ( new Date().getTime() - started_at.getTime() )/1000;
                var bytes_per_second =  seconds_elapsed ? loaded / seconds_elapsed : 0 ;
                var Kbytes_per_second = bytes_per_second / 1024 ;
                var remaining_bytes =   total - loaded;
                var seconds_remaining = seconds_elapsed ? remaining_bytes / bytes_per_second : 'calculating' ;
                jQuery( '.timeRemaining' ).html( '' );
                jQuery( '.timeRemaining' ).append( seconds_remaining );

                // Percentage.
                progressElement.find( 'input' ).val( progressValue ).change();
            }//if
        }, false );
        return xhr;
    },
    success: function( data ){}
});

Supplemental (HTML & JavaScript)
Although the Original Question does not provide the accompanying HTML or formatFileSize() function, here's an assumed basic definition of each.
HTML

  <input name="percentage"/>

JavaScript
var progressElement = document.getElementById('progressElement');

function formatFileSize(bytes){
    //  You can make this into something that intelligently outputs B,KB,MB,etc...
    return `${Math.round(bytes/1024)}KB`;
}


text:
Q: Building C++ project using build-appveyor I do not know C++, but I need to build C++ application - Osmium tool. I have not known that it is really hard to build C++ programs.  What I want is just create .exe file to merge maps. That is my simple goal.
So docs says:

On Windows you can compile with the Visual Studio C++ compiler and nmake. The necessary dependencies can be installed with conda. See appveyor.yml for the necessary commands to compile osmium-tool.

appveyor.yml docs says:

environment: matrix:
    - config: Debug
    - config: Release
shallow_clone: true
Operating system (build VM template) os: Visual Studio 2015
platform: x64
scripts that are called at very beginning, before repo cloning init:
clone directory clone_folder: c:\projects\osmium-tool
install:
    - cd c:\projects
    - git clone --depth 1 https://github.com/osmcode/libosmium
    - git clone --depth 1 https://github.com/mapbox/protozero
build_script:
    - cd c:\projects/osmium-tool
    - build-appveyor.bat

I've done all the above steps and now I'm trying to run in Windows 10:
build-appveyor.bat

However,I see the error:
System cannot find the path specified

An image:

Guys what am I doing wrong? Please, help me! Any help would be greatly appreciated.

A: I just got osmium to compile for Windows after a bit of trial of error and research (wasn't very familiar with c++ when I started). Here are my notes -
Download and install prebuilt 64-bit boost
https://downloads.sourceforge.net/project/boost/boost-binaries/1.63.0/boost_1_63_0-msvc-14.0-64.exe

In C:\projects
git clone --depth 1 https://github.com/osmcode/libosmium
git clone --depth 1 https://github.com/mapbox/protozero
git clone https://github.com/osmcode/osmium-tool
    - Checkout latest osmium-tool tag

VS2019
- Install desktop development with c++
- Install MSVC v140 - VS 2015 C++ build tools (v14.00)

build-appveyor.bat
- Update vcvarsall.bat location for VS2019 install location (VC\Auxiliary\Build\vcvarsall.bat)
- Changed cmake_cmd "Visual Studio 14 Win64" to "Visual Studio 16"
- Changed toolsversion from 14.0 to Current
- ensure DBOOST_ROOT path matches installed path of DBOOST e.g.  C:/local/boost_1_63_0

VS2015 community edition
Download cmake, add to path e.g. C:\Program Files\CMake\bin
build-appveyor.bat
- Update vcvarsall.bat location for VS2019 install location (VC\vcvarsall.bat)
- ensure DBOOST_ROOT path matches installed path of DBOOST e.g.  C:/local/boost_1_63_0

Download latest nuget.exe and place in path (won't work in system32)

*

*Ensure nuget source is configured: nuget.exe sources Add -Name nuget.org -Source https://api.nuget.org/v3/index.json
Run build-local.bat
Copy 64-bit release DLLs from bzip2, libexpat nuget pacakges to the same directory as osmium.exe


text:
Q: GNOME Shell extension for different applications in Dash by workspace? I'm looking for a GNOME Shell extension that will make it so that there are different applications showing up in the Dash depending on which workspace I'm on. Essentially, I want favorites segmented by workspace.
For example:

*

*Workspace 1 Dash (Personal): Thunderbird, Firefox, accounting app

*Workspace 2 Dash (Work): Gmail, Slack, Citrix

There is a "Workspace Isolated Dash" extension, which gets part way there by only showing favorites + applications with open windows on that workspace in Dash. But this doesn't segment favorites by workspace.
Any extensions that could do this? Or other ways to customize the GNOME Shell in this way?


text:
Q: unicode character passing from java to xml &#145 is a unicode character which has to be passed to xml from java, so that the special character is displayed on the page. But, instead of special character, &#145 is displayed as it is on the page. I tried using escape sequence but of no help. Please help in this context.

A: &#145 is not a Unicode character. It looks a lot like a numeric character reference but it's incomplete without the terminating ;. Try ' to see if that fixes your problem.
If that doesn't work: Not all XML parsers convert numeric character references to Unicode by default. See the documentation for the options to enable/configure character entity processing.

A: I suspect (or rather, I guess, because you've left us with no choice but to guess) that you are passing the character string & # 1 4 5 to some API that expects a string value. That isn't going to be unescaped unless the interface is one that expects to be passed XML, and to parse the XML. Instead, just pass a string containing this character without escaping.


text:
Q: Get repeat answers when comparing facts in prolog Working with SWI-Prolog. I have a list of ranks say:
rank(London, 3.5).
rank(New York, 3.5).
rank(Seattle, 2.3).

And I am trying to get my head around making a rule that prints/returns any facts with the same rank. So in this case it would come back with London & New York.
Here's what I've come up with so far, the only problem is the duplicates I get with it (although they make perfect sense with the current rule). Would using recursion somehow help this?
equal_rank(_):-
    rank(U1, R1),
    rank(U2, R2),
    U1 \== U2,
    R1 == R2,
    print(R1), print(': '), print(U1), print(', '), print(U2), nl,
    fail.

The output would be:
3.5: London, New York
3.5: New York, London

I just can't figure out how to stop that second line.

A: A simple approach would be to replace the not-equal test between U1 and U2 with a less-than test:
U1 @< U2.

This way a given pair only appears once.

A: I would probably go for something that uses bagof/3, but I don't know whether that's the preferred or more apt approach for the problem you have at hand. With the facts you defined, the following goal seems to issue the result you want:
| ?- bagof(C, rank(C, X), Cs), length(Cs, L), L > 1.

Cs = [london,'new york']
L = 2
X = 3.5

yes

It needs some work on formatting, of course; the idea of collecting results in a list may or may not be useful to you. Oh, and by the way, I was unsure about city names needing to be variables, so as you can see I have asserted rank/2 facts using plain atoms.
For a little bit of additional information on bagof/3, you may consult the online SWI-Prolog manual page about it.


text:
Q: difference between $S^2$, $\sigma_x^2$. and $\sigma^2$? On $(5),$ $(6),$ and $(7),$ what's the difference between $S^2$ and $\sigma_x^2$?
Also, why does:
$$\sigma_X^2 = \sum \limits_{i=1}^{n} \frac{1}{n^2} \sigma^2 = \frac{\sigma^2}{n}$$
?
I'm assuming $\sigma^2$ is the population variance.
It seems like S is a random variable since I can take the expectation of it, but,  $\sigma_x$ is the same thing except not a random variable?

Let $(X_1, \cdots, X_n)$ be a random sample of $X$ having unknown mean $\mu$, and variance $\sigma_x^2$
\begin{align}
S^2 &= \frac{1}{n} \sum (X_i - \bar{X})^2 \tag{0}\\[4ex]
E[S^2] &= E\Big[\frac{1}{n} \sum (X_i - \bar{X})^2 \Big]\tag{1}\\[2ex]
&= E\Bigg[\frac{1}{n} \sum \limits_{i=1}^{n}\Big[~[(X_i - \mu)-(\bar{X}-\mu)]^2~\Bigg]\tag{2}\\[2ex]
&= E\Bigg[ \frac{1}{n} \sum \limits_{i=1}^{n} \Big[~(X_i-\mu)^2-2(X_i-\mu)(\bar{X}-\mu)+(\bar{X}-\mu)^2~\Big] ~\Bigg]\tag{3}\\[2ex]
&= E\Bigg[~\frac{1}{n} \Big[~\sum \limits_{i=1}^{n} (X_i - \mu)^2 - n(\bar{X} - \mu)^2 \Big]~\Bigg]\tag{4}\\[2ex]
&= \frac{1}{n} \sum \limits_{i=1}^{n} E\big[(X_i-\mu)^2\big] - E\big[(\bar{X}-\mu)^2\big]\tag{5}\\[2ex]
&= \sigma^2 - \sigma_X^2\tag{6}\\[2ex]
&= \sigma^2 - \frac{1}{n}\sigma^2\tag{7}\\[2ex]
&= \frac{n-1}{n}\sigma^2\tag{8}
\end{align}
Equation (8) shows that $S^2$ is a biased estimator of $\sigma^2$

A: $\sigma$ is the population standard deviation of the random variable $X$.
$X_i$ represents the value of the i-th sample. If you have $n$ different such samples, the standard deviation of the $n$ samples is the random variable $S$.
The average of a $n$ samples is the random variable $\bar{X}$. This variable will have a standard deviation $\sigma_X$.

A: You may find your answers both in the sample variance subheading of the variance entry in Wikipedia, or possibly in this answer in Stack Exchange CV.

Difference between $\sigma_X^2$ and $S^2:$

The standard deviation of the sampling distribution of the sample mean (standard error of the mean) is
$$\sigma_{\bar X}^2 = \frac 1 n E\left( \bar X - \mu \right)^2$$
and it carries a bar on top of the subscripted random variable $\sigma_{\color{red}{\bar X}}^2.$
The sample variance is
$$\sigma_X^2=\frac 1 n \sum_{i=1}^n (X_i - \bar X)^2$$
while the unbiased sample variance (Bassel's correction) is
$$S^2 = \frac{1}{n-1} \sum_{i=1}^n (X_i - \bar X)^2$$
although the $S^2$ notation applied to both of the above is most common.

Why $\sigma_X^2 = \sum \limits_{i=1}^{n} \frac{1}{n^2} \sigma^2 = \frac{\sigma^2}{n}$?

Probably, the right expression with the above bar on top of the $X$ should be:
$$\sigma_{\bar X}^2 = \frac{\sigma^2}{n}$$
with $\sigma^2$ representing the population variance.

It seems like $S$ is a random variable since I can take the expectation of it, but, $\sigma_x$ is the same thing except not a random variable?

A statistic is an observable random variable - a quantity computed from a sample. Both would be random variables.

Re-stating the equations in the OP with the caveats above, and going along with symbols in the OP which expresses $\sigma_X^2$ as $S^2,$
$$
\small
\begin{align}
\color{red}{\sigma_X^2} (\text{or }S^2) &= \frac{1}{n} \sum (X_i - \bar{X})^2 \tag{0}\\[4ex]
E[\color{red}{\sigma_X^2}] &= E\Big[\frac{1}{n} \sum (X_i - \bar{X})^2 \Big]\tag{1}\\[2ex]
&= E\Bigg[\frac{1}{n} \sum \limits_{i=1}^{n}\Big[~[(X_i - \mu)-(\bar{X}-\mu)]^2~\Bigg]\tag{2}\\[2ex]
&= E\Bigg[ \frac{1}{n} \sum \limits_{i=1}^{n} \Big[~(X_i-\mu)^2-2(X_i-\mu)(\bar{X}-\mu)+(\bar{X}-\mu)^2~\Big] ~\Bigg]\tag{3}\\[2ex]
&= E\Bigg[~\frac{1}{n} \Big[~\sum \limits_{i=1}^{n} (X_i - \mu)^2 - n(\bar{X} - \mu)^2 \Big]~\Bigg]\tag{4}\\[2ex]
&= \frac{1}{n} \sum \limits_{i=1}^{n} E\big[(X_i-\mu)^2\big] - E\big[(\bar{X}-\mu)^2\big]\tag{5}\\[2ex]
&= \sigma^2 - \sigma_{\color{red}{\bar X}}^2\tag{6}\\[2ex]
&= \sigma^2 - \frac{1}{n}\sigma^2\tag{7}\\[2ex]
&= \frac{n-1}{n}\sigma^2\tag{8}
\end{align}
$$


text:
Q: How to supply parameters to powershell script (System.Management.Automation.Powershell)? I have a need to run PowerShell scripts from C# application. I like using method AddScript for this. And it works quite nice. However, it does not seem to work as expected when I added parameters to script with method AddParameters.
Here is test payload (PowerShell):
param ([string]$Arg1, [string]$Arg2, [switch]$ArgParamless)
$filename = "payload_with_params.txt"
$filepath = $env:temp
$fullpath = Join-Path -Path $filepath -ChildPath $filename

$dt = Get-Date -Format "yyyy.MM.dd HH:mm:ss"
$val = $dt+' '+$Arg1+' '+$Arg2+' '+$ArgParamless
Add-Content -Path $fullpath -Value "$val"

It works just fine if I push it from PS like this:
.\payload_with_params.ps1 -Arg1 "Bla 1" -Arg2 "Bla 2" -ArgParamless

Result:
2023.01.19 16:58:10 Bla 1 Bla 2 True

The C# code (oversimplified):
string command = File.ReadAllText(pathToPS1);

List<CommandParameter> paramList = new List<CommandParameter>();
paramList.Add(new CommandParameter("Arg1", "Bla 1"));
paramList.Add(new CommandParameter("Arg2", "Bla 2"));
paramList.Add(new CommandParameter("ArgParamless"));

using (PowerShell ps = PowerShell.Create())
{
    //Adding script file content to object
    ps.AddScript(command);
    if (paramList != null)
    {
        if (paramList.Count > 0)
        {
            //Adding Params to object;
            ps.AddParameters(paramList);
        }
    }
    //Launching
    ps.Invoke();
}

And the result:
2023.01.19 16:54:00 System.Management.Automation.Runspaces.CommandParameter System.Management.Automation.Runspaces.CommandParameter False

So.. it's not working as I expected. How should I supply parameters to script?

A: For [switch] parameters, you'll want to bind a bool - PowerShell will interpret true as "Present" and false as "Absent":
paramList.Add(new CommandParameter("ArgParamless", true));

A: Well, it turns out AddParameter(CommandParameter) approach doesn't work.
This approach is working:
string command = File.ReadAllText(pathToPS1);
using (PowerShell ps = PowerShell.Create())
{
    //Adding script file content to object
    ps.AddScript(command);
    if (paramList != null)
    {
        if (paramList.Count > 0)
        {
            //Adding Params to object;
            ps.AddArgument("-Arg1 XXXXXX");
        }
    }
    //Launching
    ps.Invoke();
}

On PowerShell end this arguments can be extracted for usage from $args array:
$arglist = $args -join " "

Even better approach using hashtable:
string command = File.ReadAllText(pathToPS1);
using (PowerShell ps = PowerShell.Create())
{
    //Adding script file content to object
    ps.AddScript(command);
    if (paramList != null)
    {
        if (paramList.Count > 0)
        {
            //Adding Params to object;
            var hashtable = new Hashtable {
                { "Arg1", "XXXXXX" },
                { "Arg2", "YYYYYY" },
                { "ArgParamless", true }
            };
            ps.AddArgument(hashtable);
        }
    }
    //Launching
    ps.Invoke();
}

And that's what you do on PS side to use it:
function Wrapper-Test ([string]$Arg1, [string]$Arg2, [switch]$ArgParamless) {
    $Result = $Args1+' '+$Args2+' '+$ArgParamless
    return $Result
}

$MyArgs = "";
$MyArg = $args[0]
$MyArgs = Wrapper-Test @MyArg;

$filename = "payload_with_params.txt"
$filepath = $env:temp
$fullpath = Join-Path -Path $filepath -ChildPath $filename

$dt = Get-Date -Format "yyyy.MM.dd HH:mm:ss"
$arglist = $args -join " "
$val = $dt + " " + $MyArgs
Add-Content -Path $fullpath -Value "$val"


text:
Q: wrong size of IJVM chunk file in c question I am trying to implement an IJVM an read a binary file.
I understand that an .ijvm file contains a 32-bit magic number and any number of data blocks and that a data block has three parts.
My intention is to first read and store the magic number which is always of constant size and then the data block to a different array.
The .ijvm file looks like this:

1d ea df ad 00 01 00 00 00 00 00 00 00 00 00 00
  00 00 00 07 10 30 10 31 60 fd ff

with the first 4 bytes (1d ea df ad) being the magic n. and the rest the data block.
After reading the file I determine the total size being 27 bytes, thus the rest should be 23 bytes.
However, no matter what I try, despite storing and reading correctly the magic and data parts, I always get a wrong data part size and not 23 bytes as I think it should.
byte_t bufferMagic[4];
byte_t *dataBlock;

FILE *fp;
uint32_t filelen;
uint32_t dataBlocklen;
fp = fopen(binary_file, "r");

fseek(fp, 0, SEEK_END); //compute the size of the file
filelen = ftell(fp);
fseek(fp, 0, SEEK_SET);
fprintf(stderr,"file:%s is %d bytes long\n",binary_file,filelen); //outputs27

//read magic number
fread(bufferMagic,1,4,fp);
fprintf(stderr, "Magic number: 0x%02hhx%02hhx%02hhx%02hhx \n",
    bufferMagic[0],bufferMagic[1],bufferMagic[2],bufferMagic[3]);

//read data block
dataBlock = (byte_t*)malloc(sizeof(byte_t) * filelen - 4);
//dataBlocklen = ftell(fp); //outputs 4
dataBlocklen = sizeof(dataBlock); //outputs 8
fread(dataBlock,1,filelen - 4,fp); //reads data block correctly

can you please explain what am I missing? Why both dataBlocklen not giving 23 bytes?

A: //dataBlocklen = ftell(fp); //outputs 4

Returns 4 because current file offset is at 4th byte as you did fread for magicnumber prior to ftell.
fread(bufferMagic,1,4,fp);

and
dataBlocklen = sizeof(dataBlock); //outputs 8

Returns 8 because dataBlock is pointer, thus sizeof(pointer) is 8 byte on your machine.


text:
Q: Html5Boilerplate or Html5Boilerplate Mobile for mobile-first website? Now that Html5Boilerplate has reached version 2.0 and is oriented around mobile-first design, should Html5Boilerplate Mobile still be used for mobile-first sites?  Just wanted to ask b/f I dig through the code of each.
It appears one of the obvious differences is that Html5Boilerplate has switched from CSS reset to normalize, and added mobile-first aspects like respond.js and mobile media query sections.  Standard boilerplate appears more active on Github as well.  Anyone have any opinion about these two?

A: Stealing this answer mostly from our mailing list thread on the subject...

HTML5Boilerplate is the one you should use if you are getting started
  on websites. It is optimized to work and adapt on mobile browsers.
Mobile HTML5 Boilerplate is optimized for web apps that are explicitly
  written to have different UX while on devices other than the desktop.

*

*This means they might want to imitate the UI of native applications
  or be close to it.

*They may make heavy use of touch-based UI paradigms and other
  interactions that are not possible on a desktop browser.

*They explictly use media queries and other ways to detect a
  non-desktop browser and serve an experience that is different.

  When I say web apps, I mean websites that are used intensively to
  accomplish certain tasks (like twitter.com / gmail.com / facebook.com
  / admin interface of wordpress.com ). These sites are required to take
  advantage of the space available and help users accomplish their tasks
  with minimal effort no matter what device.
On the other hand, we do have websites that users visit occasionally
  because they found it on some friend's email or on reddit which has
  content but users rarely interact with it (other than just visiting it
  or at most leaving a comment), in which case html5 boilerplate would
  be a good template to use. This would be a good option for most sites
  that are content-rich and require minimal user interaction.
Unfortunately for us, mobile platforms are also creating silos by
  specifying custom meta tags to use to optimize for their platform.
  E.g. Apple recommends using apple-touch-icon meta tag to specify
  things specific to webkit mobile browsers. Nokia has its own. We did
  not want html5boilerplate to add such cruft to the defaults, but this
  would be necessary for someone writing an application tailored to take
  advantage of non-desktop devices. There is already a lot of
  consistency, but we wish there was more standardization of mobile
  optimizations.

We are planning an update to the mobile version with the newer files
as well, but there is no significant disadvantage to using it today. We do not yet have a meeting point where we could just have one project, but we are hoping in the future it does
merge into one :)

A: No, Html5Boilerplate Mobile should not be used for new projects; it is deprecated.
A deprecation notice was added in July 2015 to the project's GitHub repo (as of this answering -- Aug 2016 -- that was the most recent commit):

The H5BP team decided to no longer maintain Mobile Boilerplate since
  HTML5 Boilerplate seems to be a good starting point for any kind of
  project.

A: It depends on approach. Use HTML5 BP if you are going to have same mark-up for you mobile and desktop website. but if you are making separate website for mobile then go for Mobile Boiler Plate


text:
Q: Revealjs markdown, reveal code line by line I am making a Revealjs presentation based on markdown, and I want to reveal code line by line. I did the following :
    ```js [|1|1-2|1-3|1-4]
    let a = 1;
    let b = 2;
    let c = x => 1 + 2 + x;
    c(3);
    ```

But the issue is in the first highlight, it highlights everything and I want it to hide eveything instead. Is this a bug ? Or is there another way to accomplish what I want (First grey everything out, then show first line, and then show second line also, etc)
Thank you.


text:
Q: layout_weight doesn't take effect I'm trying to split the vertical space between views evenly using layout_weight but from some reason it doesn't work. I followed this answer and still the views's spaces aren't effected by that. What am I doing wrong?
<LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <Space
                    android:layout_width="1dp"
                    android:layout_height="0dp"
                    android:layout_weight="1" >
                </Space>

                <android.support.design.widget.TextInputLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <AutoCompleteTextView
                        android:background="@drawable/rounded_corners_white"
                        android:id="@+id/email"
                        android:paddingEnd="16dp"
                        android:paddingStart="16dp"
                        android:layout_marginRight="16dp"
                        android:layout_marginLeft="16dp"
                        android:layout_height="40dp"
                        android:layout_width="match_parent"
                        android:inputType="textEmailAddress"
                        android:maxLines="1"
                        android:singleLine="true" />

                </android.support.design.widget.TextInputLayout>

                <Space
                    android:layout_width="1dp"
                    android:layout_height="0dp"
                    android:layout_weight="1" >
                </Space>

                <android.support.design.widget.TextInputLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                <EditText
                    android:id="@+id/password"
                    android:layout_width="match_parent"
                    android:layout_marginRight="16dp"
                    android:layout_marginLeft="16dp"
                    android:paddingEnd="16dp"
                    android:paddingStart="16dp"
                    android:layout_height="40dp"
                    android:background="@drawable/rounded_corners_white"
                    android:imeActionId="@+id/login"
                    android:imeActionLabel="@string/action_sign_in_short"
                    android:imeOptions="actionUnspecified"
                    android:inputType="textPassword"
                    android:maxLines="1"
                    android:singleLine="true" />
                </android.support.design.widget.TextInputLayout>

                <Space
                    android:layout_width="1dp"
                    android:layout_height="0dp"
                    android:layout_weight="1" >
                </Space>

                <View
                    android:layout_marginTop="30dp"
                    android:layout_marginBottom="30dp"
                    android:layout_marginRight="15dp"
                    android:layout_marginLeft="15dp"
                    android:layout_width="match_parent"
                    android:layout_height="3dp"
                    android:background="@drawable/rounded_corners_white" />

                <Space
                    android:layout_width="1dp"
                    android:layout_height="0dp"
                    android:layout_weight="1" >
                </Space>

                <Button
                    android:id="@+id/sign_in_button"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_marginRight="16dp"
                    android:layout_marginLeft="16dp"
                    style="?android:textAppearanceSmall"/>
            </LinearLayout>

UPDATE:
if image is not shown (http://i.stack.imgur.com/MQaLm.png)
[

A: Just add below line to your linearlayout:
android:weightSum="4"


text:
Q: When user login, Call to a member function prepare() on null in Laravel 8.x I use Laravel Sanctum authentication system, and the user wants to log in, it says following error.
"message": "Call to a member function prepare() on null",
"exception": "Error",
"file":"C:\\wamp64\\www\\mylaravel\\mytest\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php", "line": 465

I use MongoDB as my database.
Versions i used:

*

*Laravel Version: 8.27.0

*PHP Version: 7.3.21

I try a lot of solutions but none of the solutions worked for me on Laravel 8.
Here is my User Model
namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
//use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use DB;
use Laravel\Sanctum\HasApiTokens;
use \MongoDB\Operation\FindOneAndUpdate;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;

use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Eloquent implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
{
    use HasFactory, Notifiable, Authenticatable, Authorizable, HasApiTokens, CanResetPassword;

protected $connection = "mongodb";
protected $collection = "users";

//  public $timestamps = false;

 public function nextid()
{
    // ref is the counter - change it to whatever you want to increment
    $this->_id = self::getID();
}

public static function bootUseAutoIncrementID()
{
    static::creating(function ($model) {
        $model->sequencial_id = self::getID($model->getTable());
    });
}
public function getCasts()
{
    return $this->casts;
}

private static function getID()
{
    $seq = DB::connection('mongodb')->getCollection('counters')->findOneAndUpdate(
        ['_id' => '_id'],
        ['$inc' => ['seq' => 1]],
        ['new' => true, 'upsert' => true, 'returnDocument' => FindOneAndUpdate::RETURN_DOCUMENT_AFTER]
    );
    return $seq->seq;
}

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [
    'name',
    'email',
    'password',
    'roles',
];

/**
 * The attributes that should be hidden for arrays.
 *
 * @var array
 */
protected $hidden = [
    'password',
    'remember_token',
];

/**
 * The attributes that should be cast to native types.
 *
 * @var array
 */
protected $casts = [
    'email_verified_at' => 'datetime',
];
}

And this my controller
namespace App\Http\Controllers;
use Validator;
use Auth;
use Arr;
use App\Models\User;

use Illuminate\Http\Request;

class ApiController extends Controller
{
    /**
     * Register User
     * @param Request $request
     * @return Boolean  $result
     */

    public function register(Request $request)
     {
        $validator = Validator::make($request->all(),[
            "name" => "required",
            "email" => "required|email",
            "password" => "required|min:8"
        ]);
        if($validator->fails()){
            return response()->json([
                'status' => 400,
                'message' => "Bad Request"
            ],400);
        }

        $user = new User();
        $user->nextid();
        $user->name = $request->name;
        $user->email = $request->email;
        $user->password = bcrypt($request->password);
        $user->roles = "user";
        $user->save();

        return response()->json([
            'status' => 200,
            'message' => "user registerd"
        ],200);

}

 /**
 * Login User
 * @param Request $request
 * @return User  $user with token
 */

    public function login(Request $request)
    {
       $validator = Validator::make($request->all(),[
           "email" => "required|email",
           "password" => "required"
       ]);
       if($validator->fails()){
           return response()->json([
               'status' => 400,
               'message' => "Bad Request"
           ],400);
       }
       if(!Auth::attempt($request->only('email','password'))){
        return response()->json([
            'status' => 401,
            'message' => "Unauthorized"
        ],401);
       }

       $user = User::where("email",$request->email)->first();
       $token = $user->createToken('user token')->plainTextToken;

       Arr::add($user, 'token', $token);
       return response()->json($user);

    }
}


text:
Q: What is "a blind computer beauty calculator"? Is it a correct phrase? Can anybody who happens to know this explain it for me, please?
Source: a web site that says this:

Am I Beautiful or Ugly?   Am I pretty? Am I ugly?   Why am I ugly? or
not pretty enough?   Online test for face beauty analysis.   Analyze
your face in 3 minutes.   Rate my face 1-100. How beautiful am I?
Are you pretty? Ask us with confidentiality.   Upload photo or use
webcam.


text:
Q: Google Spreadsheet - Not calculating numbers with space I am trying to do a calculation of two cells, where one of them contains a number like this: 1 250.
If the number is written like that, and not 1250, then I cannot get the spreadsheet to do any calculations with it. Google suddenly do not treat it as a legit number anymore.
Why not just type 1250 instead of 1 250?
Well, I am getting the cell values from a html import function.
Any good advice on how to get around this?

A: Try something like this:
=Substitute(A2," ","")

In this formula, A2 is a cell. You are finding any spaces in that cell and then replacing it with a "non-space".

A: Use the substitute function to transform your number before using it in a formula.  For instance, let's say you wanted to multiple F8 by 2, but F8 may contain spaces.  You would then do:
 =substitute(F8, " ","") * 2

A: Substitute didn't work form me. But these steps did:

*

*Select one or several columns of data

*Press Ctrl + H to get the "Find and Replace" dialog

*Make sure "Search using regular expressions" is checked ✅

*Enter \s to the "Find" field, and leave "Replace with" empty

*Click on the "Replace all" button

Explanation:
\s is a regular expression matching any kind of whitespace character. There may have been some other kind of whitespace in my spreadsheet, not a regular " " (space) character, and that's why regex worked for me, while SUBSTITUTE() didn't.
I've also tried the REGEXREPLACE(A2, "\s", "") function, but it didn't seem to to anything in my case.


text:
Q: Is there a way to tell all methods inside a class to do function call without writing those function calls to every method I'm coding request calls to tens of services which should be authorized.
I noticed I have written a lot of copy&paste code to the beginning of all methods inside service classes because they all must be authorized before using any services.
Little example...
class AuthorizationService {
  val authorized = List("James", "007")

  def authorize(user: String) = {
    if (!authorized.contains(user)) throw new RuntimeException(s"User '$user' not authorized")
  }
}

class Service1 {

  val authorizationService = new AuthorizationService

  def doThis(user: String) = {
    authorizationService.authorize(user)
    println(s"User '$user' did this")
  }

  def doThat(user: String) = {
    authorizationService.authorize(user)
    println(s"User '$user' did that")
  }
}

Now imagine there are 30 service classes with three methods each and I continue to do authorization like the way I have I end up writing 90 functions calls.

A: Something like this maybe ... It still requires your service to change, but not as much:
 object AuthToken {
    implicit def auth(s: String)(implicit service: AuthService) = {
      service.authorize(s)
      AuthToken(s)
    }
 }
 case class AuthToken private[AuthToken] (s: String) {
    override def toString = s;
 }

 class Service1 {
   implicit val authorizationService = new AuthorizationService
   def doThis(user: AuthToken) = {
     println(s"User '$user' did this")
   }
 }

Now, if you do new Service1().doThis("James"), it will implicitly call your auth service first to convert the name into token.

A: You could use it like this:
object Tester {

  class AuthorizationService {
    val authorized = List("James", "007")

    def authorize(user: String) = {
      if (!authorized.contains(user)) throw new RuntimeException(s"User '$user' not authorized")
    }
  }

  def authorize(businessLogic: => Unit)(implicit
                                        authorizationService: AuthorizationService,
                                        user: String): Unit = {
    // authorization logic
    authorizationService.authorize(user)
    println(s"User '$user' did this")

    // actual code that needs to be executed
    businessLogic
  }

  class Service1(implicit val authorizationService: AuthorizationService) {
    def doThis(implicit user: String) = authorize {
      println("doThis()")
    }

    def doThat(implicit user: String) = authorize {
      println("doThat()")
    }
  }

  def main(args: Array[String]) {
    implicit val authorizationService = new AuthorizationService
    val s = new Service1()
    s.doThat("James")
    s.doThat("007")
    s.doThat("Neo")
  }
}

A: you could use a crude composition pattern:
class ServiceAuthorizationExecutor {
   def call(user: String, delegate: DELGATE_TYPE) = {
      authorizationService.authorize(user)
      delegate()
   }
}

A: This is a classic AOP problem. The last time I looked at AOP was 12 years ago though, so I'm not sure what the state of it all is.


text:
Q: Преобразовать строку в имя переменной Имеется массив и переменная:
$array_hello = array('hello', 'world');
$array_text = "array_hello";
echo $$array_text[0]; // так не работает

Необходимо строку $array_text преобразовать в имя массива и вывести первый элемент массива.

A: PHP позволяет обращаться к произвольному выражению, как к имени переменной. Для этого выражение нужно обернуть в конструкцию ${...}.
Для обращения к имени переменной, которая содержится в элементе массива, можно использовать вот такую конструкцию:
$a = array('b');
$b = 'test';

echo ${$a[0]};

А для обращения к свойству объекта вот такую:
$a = new \StdClass();
$a->v = 'b';
$b = 'test';

echo ${$a->v};

В вашем же случае, вам нужно в явном виде отделить обращение к переменной от обращения к элементу массива, который в этой переменной содержится. А сделать это можно вот так:
$a = 'b';
$b = array('test', 'test1', 'test2');

echo ${$a}[0];


text:
Q: Getting auto increment ID in contact form 7 I'm struggling to have an auto increment ID working in a dynamic field when a user submits a form. How should the custom table get updated for every submission entry? & How should we get the id from the custom table?
Create Table with auto increment:
function create_db() {
    global $wpdb;

    $charset_collate = $wpdb->get_charset_collate();
    $table_name = $wpdb->prefix . "id_count";
    if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
        $sql = "CREATE TABLE $table_name (
                `id` mediumint(9) NOT NULL AUTO_INCREMENT,
                `name` mediumtext NOT NULL,
                UNIQUE KEY id (id)
        )$charset_collate;";

        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        dbDelta($sql);
    }

}
add_action("init", "create_db");

When form submit:
function your_wpcf7_posted_data( $posted_data ) {
    global $wpdb;
    $name = $posted_data['your-name'];

    $table_name = $wpdb->prefix . "id_count";
    $posted_data['cf7-counter'] = $wpdb->insert_id;
);

A: It seems your sql code is not working properly so you can try below code :
$sql = "CREATE TABLE IF NOT EXISTS  $table_name (
            `id` int(9) NOT NULL,
             `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

) ENGINE=MyISAM AUTO_INCREMENT=262 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ";

A: Hi If you are looking dynamic number generation into contact form 7 this WordPress guide will help you.
Steps:
Theme function.php add this code
function wpcf7_generate_rand_number( $wpcf7_data ) {
$properties = $wpcf7_data->get_properties();
$shortcode = '[rand-generator]';
$mail = $properties['mail']['body'];
$mail_2 = $properties['mail_2']['body'];
if( preg_match( "/{$shortcode}/", $mail ) || preg_match( "/[{$shortcode}]/", $mail_2 ) ) {
$option = 'wpcf7sg_' . $wpcf7_data->id();
$sequence_number = (int)get_option( $option ) + 1;
update_option( $option, $sequence_number );</code>
$properties['mail']['body'] = str_replace( $shortcode, $sequence_number, $mail );
$properties['mail_2']['body'] = str_replace( $shortcode, $sequence_number, $mail_2 );
$wpcf7_data->set_properties( $properties );
}
}
add_action( 'wpcf7_before_send_mail', 'wpcf7_generate_rand_number' );

Then use field [rand-generator]
Source:
https://www.banna360.com/contact-from7-dynamic-number-generation/


text:
Q: Sequences $p,p+d,p+2d,\dots,p+N\cdot d$ of prime numbers A conjecture that I believe is possible to prove:

For any $N\in\mathbb N$ there is a $d\in\mathbb N$ such that
  $p,p+d,p+2d,\dots,p+N\cdot d$ all are primes (for some prime $p$).

My context: it seems that greater $\omega(d)$ (number of different prime factors) gives greater $N$.

A: This has already been proven, and is called the Green-Tao theorem.
And yes, the longer chain you want, the more prime factors you require of $d$. Basically, if you want a chain to be $n$ long, $d$ must be divisible by all primes less than or equal to $n$.
The only exception to the above rule is if $p=n$, in which case $d$ doesn't have to be divisible by $n$ itself. For instance, $$5,11,17,23,29$$ is an arithmetic sequence of five primes, with $d=6$, and since the first prime in the sequence is equal to the number of terms in the sequence, it works out without $d$ being divisible by $5$. But for any other sequence of five primes, $d$ must be divisible by $5$ as well as $2$ and $3$.


text:
Q: Android Wear Preview app - which smartphones are compatible? I got invitation to the Android Wear Developer program but when I try to install the Android Wear Preview app I see information that my device (Samsung Galaxy S2) is not compatible with the app. Is there some kind of list of devices compatible with Android Wear Preview app?
Thank you,

A: You need a 4.3+ Android smartphone. Because the Notification listener functionality has been added with API level 18.
Tablets were stated to be supported but right now they're filtered out from the store. You can still manually install the APK though.
Bluetooth LE isn't mandatory - for the preview at least.

A: I don't think there is a device spesific restriction, but according to developer.android.com
Note: The Android Wear Preview app is compatible with Android 4.3 and higher and is not available for the Android emulator.

Edit: I think BLE is used for communication between smartphone and watch. So obviously that would be hardware restriction.


text:
Q: Triggering event from timer compare channel on ATXmega when timer is set to single-slope PWM mode I am writing firmware for an ATXmega. I have a timer configured in single-slope mode to output a PWM signal. I need one of the xmega's event channels to trigger in the middle of that signal. I thought I had it configured to do so, but I am suspecting that the event is actually triggering off of the period.
Some representative example C code:
TCF1.PER = 100;
TCF1.CCA = 20;
TCF1.CTRLA = TC_CLKSEL_DIV1_gc;     // timer will not run until this line
TCF1.CCB = 100/2; // middle of the waveform
TCF1.CTRLB = TC_WGMODE_SINGLESLOPE_gc | SWITCHING_SIGNAL_CHANNEL_ENABLE; // enable timer output to pin
// ... and then later ...
EVSYS.CH7MUX = EVSYS_CHMUX_TCF0_CCB_gc;

And then an diagram showing the situation and the desired and undesired behaviour of the event channel:

How do I get the event channel to behave in the desired way, and then verify that it is not behaving in the undesired way?

A: After testing with an independent test setup, I was able to confirm that the above code does indeed create the desired behaviour in the event channel.


text:
Q: Price is showing Unavailable in B2B commerce in System admin profile In Salesforce Commerce B2B after adding the price on product ,price is showing Unavailable in System admin profile but it is showing price in other profile user

A: There is a lot of factors to consider here.
I would start investigating with:

*

*The user you are using, does it belong to a buyergroup?

*Does that buyergroup from question #1 has the correct entitlements?

*Does that buyergroup from question #1 have the right pricebooks?

*Does the pricebook attached to that buyer group from question #2 and #3 within a valid one? Start date and end date.


text:
Q: XPath: axe following-sibling not accurate enough I navigate inside EDIFACT messages (bad) enveloped into XML messages, using standard XPath version 2.0 axes. Below is a short extract:
<Loop type="RFF">
    <RepeatingSegment type="RFF">
        <Segment type="RFF" name="REFERENCE">
            <Element type="1153" name="Reference qualifier" value="Order number (purchase)">ON</Element>
            <Element type="1154" name="Reference number">0104772302</Element>
        </Segment>
        <Segment type="RFF" name="REFERENCE">
            <Element type="1153" name="Reference qualifier" value="Delivery note number">DQ</Element>
            <Element type="1154" name="Reference number">052620228</Element>
        </Segment>
    </RepeatingSegment>
    <RepeatingSegment type="DTM">
        <Segment type="DTM" name="DATE/TIME/PERIOD">
            <Element type="2005" name="Date/time/period qualifier" value="Reference date/time">171</Element>
            <Element type="2380" name="Date/time/period">20180207</Element>
            <Element type="2379" name="Date/time/period format qualifier" value="CCYYMMDD">102</Element>
        </Segment>
    </RepeatingSegment>
</Loop>

The standard XPath axe "following-sibling", even forced with [1], returns the unique date (DTM) for the first reference (RFF), but this date belongs to the second reference (RFF)…
/Loop[@type='RFF']/RepeatingSegment[@type='RFF']/Segment[@type='RFF']/Element[@type=1153 and text()='ON']/../../following-sibling::RepeatingSegment[@type='DTM'][1]/Segment[@type='DTM']/Element[@type=2380]

returns "20180207". So, I am looking for a trick that could return the "Siamese" date (or nothing, if this date does not exist, as into the above extract).
The term « Siamese » is not clear: I am now using the term "couple". Ideally, if the XML message was completed, they should be two couples of Reference-Date, unfortunately into different RepeatingSegment groups (it is why I mentioned first that the EDIFACT message is bad enveloped, by a legacy system).
When there are two different Dates for each Reference, as the second extract below, the following-sibling axe is fine to pick them after each Reference:
<Loop type="RFF">
    <RepeatingSegment type="RFF">
        <Segment name="REFERENCE" type="RFF">
            <Element name="Reference qualifier" type="1153" value="Order number (purchase)">ON</Element>
            <Element name="Reference number" type="1154">0CDE922802</Element>
        </Segment>
    </RepeatingSegment>
    <RepeatingSegment type="DTM">
        <Segment name="DATE/TIME/PERIOD" type="DTM">
            <Element name="Date/time/period qualifier" type="2005" value="Reference date/time">171</Element>
            <Element name="Date/time/period" type="2380">20170619</Element>
            <Element name="Date/time/period format qualifier" type="2379" value="CCYYMMDD">102</Element>
        </Segment>
    </RepeatingSegment>
    <RepeatingSegment type="RFF">
        <Segment name="REFERENCE" type="RFF">
            <Element name="Reference qualifier" type="1153" value="Delivery note number">DQ</Element>
            <Element name="Reference number" type="1154">00000004</Element>
        </Segment>
    </RepeatingSegment>
    <RepeatingSegment type="DTM">
        <Segment name="DATE/TIME/PERIOD" type="DTM">
            <Element name="Date/time/period qualifier" type="2005" value="Reference date/time">171</Element>
            <Element name="Date/time/period" type="2380">20180726</Element>
            <Element name="Date/time/period format qualifier" type="2379" value="CCYYMMDD">102</Element>
        </Segment>
    </RepeatingSegment>
</Loop>

But when the first Date is missing, as into the first extract above, the following-sibling axe picks the Date of the second reference (which is well the first occurrence of a Date, as the first date is missing). So, yes, the above XPath expression is working normally.
It is why I am looking for another XPath expression, which would return nothing (empty string), instead of the first following "bad" Date. In fact, a kind of "following-adjacent-sibling" axe, which does not exist yet into XPath, should be useful.


text:
Q: Enabling bokeh y (x) axis ticks on both left and right (top and bottom) How can I activate bokeh axis ticks (not necessarily the tick labels nor the axis label, although that may be helpful too) on both sides of a plot simultaneously?
For reference, in matplotlib I would set tick_params (e.g. bottom, top and left, right) all to True.

A: The axis_location parameter to figure is a convenience for the common case of adding one axis. Multiple axes can always be added explicitly using Plot.add_layout e.g.
 plot.add_layout(LinearAxis(), 'left')
 plot.add_layout(LinearAxis(), 'right')

There is an extreme example that exercises the addition of many axes and titles here:
https://github.com/bokeh/bokeh/blob/master/examples/models/file/panels.py

A: As far as I can tell, for fixed lines you do:
p.xaxis.ticker = [2, 3.5, 4]

Here is a link with many more examples, in order to achieve the exact thing you are after, ticker examples . Hope this helps.


text:
Q: Avoid checks for each row, replace query by function? I have teams:
create table team (
    id      integer     primary key,
    type    text
);

Also, I have players:
create table player
(
    id      integer     primary key,
    age     integer,
    team_id integer     references team(id)
);

The type of a team can either be 'YOUTH' or 'ADULT'. In a youth team, only players starting from age 16 are allowed in official games. In an adult team, only players starting from age 18 are allowed in official games.
Given a team identifier, I want to find all allowed players for the upcoming game. I have the following query:
select    player.*
from      player
join      team
on        player.team_id = team.id
where     team.id = 1 and
          (
              (team.type = 'YOUTH' and player.age >= 16) or
              (team.type = 'ADULT' and player.age >= 18)
          );

This works. However, in this query, for every player I am repetitively checking the type of the team. This value will stay the same during the whole query.
Is there a way to improve this query? Should I replace it with a pgplsql function where I first store the team into a local variable, and then discriminate with following flow?
IF team.type = 'YOUTH' THEN <youth query> ELSE <adult query> END IF

For me, that feels like killing a fly with a bazooka, but I don't see an alternative right now.
I created a SQL fiddle: http://rextester.com/TPFA20157

A: Auxiliary table
In (strict relational) theory, you would have another table storing attributes of team types like the minimum age.
NEVER store "age", though, which is a function of the underlying constant  birthday and the current time. Always store the birthday. Could look like this:
CREATE TABLE team_type (
   team_type text PRIMARY KEY
 , min_age   int NOT NULL  -- in years
);

CREATE TABLE team (
   team_id   integer PRIMARY KEY
 , team_type text NOT NULL REFERENCES team_type
);

CREATE TABLE player (
   player_id serial  PRIMARY KEY
 , birthday  date NOT NULL   -- NEVER store "age", it's outdated the next day
 , team_id   integer REFERENCES team
);

Query:
SELECT p.*, age(now(), p.birthday) AS current_age
FROM   player    p
JOIN   team      t  USING (team_id)
JOIN   team_type tt USING (team_type)
WHERE  t.team_id = 1
AND    p.birthday <= now() - interval '1 year' * tt.min_age;

Using the function age() to display current age, which fits the conventional algorithm to determine age.
But using the more efficient expression p.birthday <= now() - interval '1 year' * tt.min_age in the WHERE clause.
Aside: the current date depends on the current time zone, so the result can vary +/- 12 hours, depending on the time zone setting of the session. Details:

*

*Ignoring timezones altogether in Rails and PostgreSQL
Alternative: function
But yes, you could replace the table team_tpye with the logic encapsulated in a function like this:
CREATE FUNCTION f_bday_for_team_type(text)
  RETURNS date AS
$func$
SELECT (now() - interval '1 year' * CASE $1 WHEN 'YOUTH' THEN 16
                                            WHEN 'ADULT' THEN 18 END)::date
$func$  LANGUAGE sql STABLE;

Calculating the maximum birthday to fulfill the minimum age for the given team type. The function is STABLE (not VOLATILE) as one might assume. The manual:

Also note that the current_timestamp family of functions qualify as
  stable, since their values do not change within a transaction.

Query:
SELECT p.*, age(now(), p.birthday) AS current_age
FROM   player p
JOIN   team   t USING (team_id)
     , f_bday_for_team_type(t.team_type) AS max_bday  -- implicit CROSS JOIN LATERAL
WHERE  t.team_id = 2
AND    p.birthday <= max_bday;

That's not the holy grail of relational theory, but it works.
dbfiddle here


text:
Q: how can i get title from bs4 python, this is the instagram total number of followers i am using this code to extract follower numbers
driver.get("https://www.instagram.com/test/?hl=en")
driver.implicitly_wait(5)
htmlcontent = driver.page_source
soup = BeautifulSoup(htmlcontent, 'html.parser')
followers = (soup.find_all('a', class_='-nal3'))

While i print followers it gives this output,
no i am not able extract title someone please help
[1m followers, 588 following]

A: If you want to grab the attribute from the HTML code returned by the soup you have to use [] brackets and between them enter a string which is the name of the Key which value you want to get. In your case, it will be
print(i['title'])

There is also the second method which will work like a try clause - it will avoid the error if the title is not in the element
print(i.get('title'))


text:
Q: anti piracy measures for software on USB sticks The problem:
I want to put a piece of software on a USB stick. The software needs to be effectively unusable without the USB stick in the drive, save perhaps for hardware tampering.
The software will not be mass produced; it has niche appeal, and we are therefore talking about maybe 1000-10000 units sold over its lifetime.
The USB stick can be non-standard in some manner, as a standard USB stick is normally user readable. The software will be running from the USB stick without any installation required, and ideally, it must function on computers without an active internet connection.
Is this possible ? Is there any way to achieve this, even to a limited extent ?
Thank you.

A: You could add a preregistered key to this USB and make it read only.
You can make it a read-only USB stick via software, via hardware or both (google have tons of ways of doing it)
This key could be as complicated as you please, a simple static word saved on a file, or a mathematical function that generates a key based on a common variable (software on the USB stick that runs when requested or when plug in, that generates a key based on the computer uptime for instance, something that can be verified by your software).
Your software only runs when this key is validated. On the software side you can also make it simple (search for a file in all available USBs and read static keys from a file). And you can make it more secure and complex, such as protecting the key with a asynchronous data encryption. And making the software only accept a specific versions or meta data coming from the USB device connected to the computer before reading the key from it, such as a specific serial number, driver and model name, (to make sure is one of yours).
All those things though can be hacked if a person wants to. Offline security validations are hardly failproof, but definitely you can keep most average ppl out of the loop.
You only need to evaluate how difficult you think is worth making it to crack. depends on your public and how bad it is to you if it is cracked (think about how many hours and effort a guy need to employ to be able to crack it, and if you believe that is more than what your target is willing to spend than you are probably safe)

A: Hardware solution: Put an USB hub, a commercial USB software protection device and your USB data stick into a neat little plastic case.
Note: Some commercial software protection sticks may have enough internal memory for your application included. Cannot recommend products here due to site rules.


text:
Q: Return Array as response in SoapUI Mock servcice I have to mock a soap webservice operation that returns string array as an output. I could only generate a string as an output from below script.
Any help is welcome.
//script
import groovy.xml.MarkupBuilder

// An array from which county and city will be drawn randomly

    def countryArray =
    ["ONE",
    "TWO",
    "THREE"
     ]

    context.countryArray=countryArray

--response definition
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:upm="http://xxxx">
   <soapenv:Header/>
   <soapenv:Body>
      <upm:signResponse>
         <upm:signReturn>${countryArray}</upm:signReturn>
      </upm:signResponse>
   </soapenv:Body>
</soapenv:Envelope>


text:
Q: How do I do a distinct join on a mysql db using conditions I have two tables I am trying to match. I want to have the referredbyname in sourcelist match the name column to targetjoin when the record is in the same groupname
I would like to join these two tables with one-one match. Contacts in targetjoin have multiple recordtypes with the same name. I want to do some type of distinct join based on a hierarchy set up of record type name
For example: If a record is matched with the two recordtypes for the same name the RecordType: TypeA will be matched only, and so forth.
sourcelist :
           ID  GroupName  Name          ReferredbyName
           1   A          John Smith    Sally Bosh
           2   A          Craig Miller  Sally Smith
           3   A          Fulton Fork   Spoon Knife
           4   B          Joe Sample    George Test

targetjoin :
   ID   GroupName     Name         RecordType
   101   A            Sally Bosh   TypeA
   102   A            Sally Bosh   TypeB
   103   A            Sally Smith  TypeC
   104   A            Sally Smith  TypeD
   105   B            George Test  TypeF

My Result:
    | id | groupname |         name | referredbyname |  id | groupname |        name | recordtype |
    |----|-----------|--------------|----------------|-----|-----------|-------------|------------|
    |  2 |         A | Craig Miller |    Sally Smith | 103 |         A | Sally Smith |      TypeC |
    |  1 |         A |   John Smith |     Sally Bosh | 102 |         A |  Sally Bosh |      TypeB |
    |  1 |         A |   John Smith |     Sally Bosh | 101 |         A |  Sally Bosh |      TypeA |
    |  2 |         A | Craig Miller |    Sally Smith | 104 |         A | Sally Smith |      TypeD |
    |  4 |         B |   Joe Sample |    George Test | 105 |         B | George Test |      TypeF |

This result gives me all the of possible matches one-many join with duplicate ID
I would like to have desired result like this:
    | id | groupname |         name | referredbyname |  id | groupname |        name | recordtype |
    |----|-----------|--------------|----------------|-----|-----------|-------------|------------|
    |  2 |         A | Craig Miller |    Sally Smith | 103 |         A | Sally Smith |      TypeC |
    |  1 |         A |   John Smith |     Sally Bosh | 101 |         A |  Sally Bosh |      TypeA |
    |  4 |         B |   Joe Sample |    George Test | 105 |         B | George Test |      TypeF |

This is what I have gotten so far
select a.*, b.*
from sourcelist a
join targetjoin b
on a.groupname=b.groupname
and
case
when b.recordtype in ('TypeA') and a.referredbyname=b.name then 1
when b.recordtype in ('TypeB') and a.referredbyname=b.name then 2
when b.recordtype in ('TypeC') and a.referredbyname=b.name then 3
when b.recordtype in ('TypeD') and a.referredbyname=b.name then 4
when b.recordtype in ('TypeE') and a.referredbyname=b.name then 5
when b.recordtype in ('TypeF') and a.referredbyname=b.name then 6
else 0
end in (1,2,3,4,5,6)
order by a.groupname

Schema: http://sqlfiddle.com/#!9/eb97f
Thanks for any help!

A: SELECT x.*
  FROM targetjoin x
  JOIN
     ( SELECT name
            , MIN(recordtype) recordtype
         FROM targetjoin
        GROUP
           BY name
     ) y
    ON y.name = x.name
   AND y.recordtype = x.recordtype;

The last part of this problem has been left as an exercise for the reader.