text:
Q: Leibniz's rule in $W^{1,\,p}(\Omega)\cap L^\infty(\Omega)$ Is it true?
If $\Omega\subset\mathbb{R}^n$ is bounded and $u,v\in W^{1,\,p}(\Omega)\cap L^\infty(\Omega)$, then $uv\in W^{1,\,p}(\Omega)\cap L^\infty(\Omega)$ and
$$\nabla(uv)=u\nabla v+v\nabla u.$$
I proved for $2\leq p$.

A: This is true for $p\geqslant 1$. The case $p=1$, being a limiting one,
requires more efforts. It will be sufficient to establish  the rule
$$
\partial_j(uv)=u\partial_j v+v\partial_j u,\quad j=,\dots,n,\tag{1}
$$
for the weak derivatives $\partial_j$ just in case $p=1$, with the equality
$(1)$ understood in a weak sense, i.e., as an integral identity
$$
\int\limits_{\Omega}uv\partial_j\varphi\,dx=
-\int\limits_{\Omega}(u\partial_j v+v\partial_j u)\varphi\,dx\quad \forall\,
\varphi\in C_0^{\infty}(\Omega)\tag{2}
$$
where $C_0^{\infty}(\Omega)$ denotes the space of infinitely differentiable
functions compactly supported in the domain $\Omega\subset\mathbb{R}^n$,
$n\geqslant 2$. The basic idea underlying the proof is to approximate
$u,v$ by smooth functions. While smooth functions are dense in the Sobolev
space $W^{1,1}(\Omega)$ w.r.t. its norm, it is not the case with the Lebesgue
space $L^{\infty}(\Omega)$. However, essentially bounded functions can be
approximated in $L^{\infty}(\Omega)$ by smooth functions in the weak$^\ast$-
topology which is enough to establish the identity $(2)$.
Denote by $\omega_{\varepsilon}$ a mollifier, i.e.,
let $\omega_{\varepsilon}=\varepsilon^{-n}\omega(x/\varepsilon)$, $\varepsilon>0$,
with some $\omega\in C_0^{\infty}(\Omega)$ such that
$$
\int\limits_{\mathbb{R}^n}\omega(x)\,dx=1,\quad
{\rm supp\,}\omega\subset B_1=\{x\in\mathbb{R}^n\colon\,|x|<1\}.
$$
 Take and fix an arbitrary test function $\varphi\in C_0^{\infty}(\Omega)$
 to be substituted into identity $(2)$, and notice there is some
 $\delta\overset{\rm def}{=}{\rm dist}({\rm supp\,}\varphi,\partial\Omega)>0$.
 Denote $\Omega_{\delta}=\{x\in\Omega\,\colon\,{\rm dist}(x,\partial\Omega)>\delta\}$
 and notice that ${\rm supp\,}\varphi\subset\overline{\Omega}_{\delta}$.
Extensions of $u,v$ by zero outside $\Omega$ denote by $\tilde{u},\tilde{v}$,
and let $u_{\varepsilon}=\omega_{\varepsilon}\ast\tilde{u},\;
v_{\varepsilon}=\omega_{\varepsilon}\ast\tilde{v}$. It is clear that
$u_{\varepsilon}\in C^{\infty}(\mathbb{R}^n)$ while
$$
\lim_{\varepsilon\to 0}\|u-u_{\varepsilon}\|_{W^{1,1}
(\Omega_{\delta})}=0.\tag{3}
$$
Convergence of $u_{\varepsilon}$ in the norm of $L^{\infty}(\Omega_{\delta})$
requires $u\in C(\Omega)$ which may not be the case, but it is clear that
$$
\lim_{\varepsilon\to 0}\int\limits_{\Omega_{\delta}}u_{\varepsilon}\psi\,dx=
\int\limits_{\Omega_{\delta}}u\,\psi\,dx\quad \forall\,
\psi\in L^1(\Omega_{\delta}),\tag{4}
$$
i.e., smooth functions $u_{\varepsilon}$ converge to $u$ in the weak$^\ast$-
topology on $L^{\infty}(\Omega_{\delta})$ being dual to $L^1(\Omega_{\delta})$.
The fact that $u_{\varepsilon},v_{\varepsilon}\in C^{\infty}(\Omega_{\delta})$ implies
$$
\int\limits_{\Omega_{\delta}}u_{\varepsilon}v_{\varepsilon}\partial_j\varphi\,dx=
-\int\limits_{\Omega_{\delta}}(u_{\varepsilon}\partial_j v_{\varepsilon}+
v_{\varepsilon}\partial_j u_{\varepsilon})\varphi\,dx,
$$
whence by $(3),(4)$ follows $(2)$.


text:
Q: Why does this python statement give this output? for i in range (1, 5):
    for j in range (1, 3):
        print (i*j, end= " ")

output= 1 2 2 4 3 6 4 8
I cannot understand how this output is worked out, can someone please break this statement down for me please?

A: You can learn more about Python nested for loops in W3Schools website

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ricci flow diffeomorphism invariance and evolution of curvature using Uhlenbeck's trick My question, while related to the posts Ricci flow preserves isometries, The invariance of the Ricci tensor under diffeomorphisms and its non-ellipticity., and Diffeomorphism invariance of the Ricci tensor, is slightly different. Namely, when using Uhlenbeck's trick in the Ricci flow the Riemann tensor evolves by:
$\frac {\partial } {\partial t} R_{abcd} = \iota_a^i \iota_b^j \iota_c^k \iota_d^l\Delta R_{ijkl} + 2(B_{abcd} - B_{abdc} - B_{adbc} + B_{acbd})$
where $\ B_{abcd} = h^{eg}h^{fi}R_{aebf}R_{cgdi}$ and $\iota : (V,h) \rightarrow (TM,g(t)) $ is a 1-parameter family of isometries from the fixed vector space V with metric h to the evolving tangent space TM with metric g(t) such that $ h=\iota^* g(t)$ for all t.
However, according to the diffeomorphism invariance of the curvature $\iota^* Rm[g(t)]=Rm[\iota^* g(t)] $ and $ h=\iota^* g(t) $ and h is fixed. Shouldn't then
$\frac {\partial } {\partial t} R_{abcd} = \frac {\partial } {\partial t} \iota^* Rm[g(t)]=\frac {\partial } {\partial t}Rm[\iota^* g(t)]=\frac {\partial } {\partial t}Rm[h]=0 ?$
Here $\ Rm[g(t)] $ denotes the Riemann tensor of the metric g(t).
Clearly I am not understanding something correctly. What am I missing?
My reference for this material is:
Andrews, Ben, and Christopher Hopper. The Ricci flow in Riemannian geometry: a complete proof of the differentiable 1/4-pinching sphere theorem. springer, 2010.


text:
Q: stable, mainline linux kernel My question is about understanding mainline, stable kernel versions. Let us take the example of a 5.18 mainline. My understanding is that 5.18 is the mainline and 5.18.1 is the stable kernel. For production companies use 5.18 or 5.18.1? From the kernel.org site:

Stable
After each mainline kernel is released, it is considered "stable." Any bug fixes for a stable kernel are backported from the mainline tree and applied by a designated stable kernel maintainer. There are usually only a few bugfix kernel releases until next mainline kernel becomes available -- unless it is designated a "longterm maintenance kernel." Stable kernel updates are released on as-needed basis, usually once a week.

What does this mean? Does it mean 5.18.1 bugfix release will be backported to 5.18?

A:
For production companies use 5.18 or 5.18.1?

The kernels on kernel.org are released or considered to be "stable" only by the kernel developers. Almost no distro or company uses them right away as is, without testing. "Stable" here is not what you think it is. It's a counterpart of RC (release candidates) or Linux-next kernels which are definitely not "stable", i.e. they undergo major changes and may contain serious errors or regressions.
For production-quality kernels you need to refer to distros which actually guarantee some sort of testing and stability, e.g. RHEL and its derivatives.
Usual community backed distros don't have the resources and money to guarantee their kernel releases are production ready.

A: At some point, a mainline kernel is declared stable, and is released. This is what your sample block states.
From this point on, only the mainline is developed further, and will be the candidate for the NEXT stable kernel.
Any bugfix though (a commit fixing exactly one thing https://docs.kernel.org/process/stable-kernel-rules.html) that is introduced to the mainline will be transferred to the stable branch also. This is called backporting.


text:
Q: Importing multiple .xlsx files into SQL Server using SSMS (Basic, not Enterprise) As the question states, I'm trying to upload roughly 2000 single-worksheet Excel files into a single SQL-Server database. The database has been set up using one of the excel files as a template and all the files have exactly the same layout. I'm hoping it's as simple as copying the rest of the data across from the files. Is there a way of moving all 2000 across at once instead of having to upload them individually using the SSMS import wizard.
Info:
Location of Excel files - C:\MyServer\MyUser\Desktop\Nominations
Database to add each excel table to - dbo.MyDatabase$
Using MS SQL Server Management Studio.
Can't add a diagram of the layout (too new to StackOverflow), but imagine a 12 column db and you're there. It's a really simple db.
I don't believe I have the multiple file option within the wizard unless I upgrade to Enterprise, which work won't allow until I complete a proof-of-concept test with these files.
Any help much appreciated.
Thanks, folks!

A: You don't need the wizard
INSERT DestinationTable
SELECT *
FROM OPENROWSET(
  'Microsoft.ACE.OLEDB.12.0',
  'Excel 12.0;Database=C:\path\to\file.xlsx',
  'SELECT * FROM [sheet1$]'
)


text:
Q: Access denied when running phinx command on Docker container I am running the official MySQL Docker container for my PHP app.  I am using Phinx for migrations.  The MySQL image seems to work fine as I can connect to it as 'dbuser' (non-root) using MySQL Workbench.  I can also connect with Docker exec as well.
Problem occurs when I try to run any Phinx command, such as status.  I'm getting:
[InvalidArgumentException]
There was a problem connecting to the database: SQLSTATE[HY000][1045] Access denied for user 'dbuser'@'localhost' (using password: YES)

My grants on the DB look like:
GRANT USAGE ON *.* TO 'dbuser'@'%' IDENTIFIED BY PASSWORD '*8232A1298A49F710DBEE0B330C42EEC825D4190A'
GRANT ALL PRIVILEGES ON `dbuser`.* TO 'app_db'@'%'

My development section of the phinx.yml file looks like:
development:
    adapter: mysql
    host: localhost
    name: app_db
    user: dbuser
    pass: '<no-hash-password>'
    port: 3306
    charset: utf8

Any ideas?

A: Solved it:  I had MySQL running on the host as well (different port 3307), so I shut that down.  I'm now able to run phinx within the container.  Looks like it might have been trying to connect to the host server via unix socket, instead of port 3306 on the container.


text:
Q: How can I use a variable name instead of addresses when debugging valgrind runs with gdb? Let's say I'm debugging with valgrind and gdb by doing:
$ valgrind --vgdb-error=0 ./magic

...and then in a second terminal:
$ gdb ./magic
...
(gdb) target remote | /usr/lib/valgrind/../../bin/vgdb

If I want to examine the defined-ness of some memory, I can use:
(gdb) p &batman
$1 = (float *) 0xffeffe20c
(gdb) p sizeof(batman)
$2 = 4
(gdb) monitor get_vbits 0xffeffe20c 4
ffffffff

Using three commands to do one thing is kind of annoying, especially since I usually want to do this a few times for many different variables in the same stack frame. But if I try the obvious thing, I get:
(gdb) monitor get_vbits &batman sizeof(batman)
missing or malformed address

Is it possible to get gdb to evaluate &batman and sizeof(batman) on the same line as my monitor command?

A:
But if I try the obvious thing, I get: missing or malformed address

This is from GDB doc (http://sourceware.org/gdb/onlinedocs/gdb/Connecting.html#index-monitor-1210) for the monitor cmd:

monitor cmd
This command allows you to send arbitrary commands
  directly to the remote monitor. Since gdb doesn't care about the
  commands it sends like this, this command is the way to extend gdb—you
  can add new commands that only the external monitor will understand
  and implement.

As you can see "gdb doesn't care about the commands it sends like this". It probably means that the command after monitor is not processed in any way and sent AS IS.
What you can do to evaluate your variable on the same line is to use user defined commands in gdb (http://sourceware.org/gdb/onlinedocs/gdb/Define.html). Define your own comand and use the eval gdb command to prepare your command with necessary values  (http://sourceware.org/gdb/current/onlinedocs/gdb/Output.html#index-eval-1744):
define monitor_var
  eval "monitor get_vbits %p %d", &$arg0, sizeof($arg0)
end

And then use it like this:
(gdb) monitor_var batman


text:
Q: Get working copy root path using pysvn When I run the SVN command 'svn info path', the SVN command line client (v1.8.4) spits out (among other things) a 'Working Copy Root Path'.
How would I get this same information using pysvn? Seems like it should be available using the either pysvn.Client.info() or pysvn.Client.info2(), but it doesn't seem to me that it's there.


text:
Q: Real-time streaming using Python I wish to develop a video encoder system using Raspberry Pi and I am using Python in order to do the encoding. Now I have to push this encoded video to a remote server live so that the server serves the video to the connected clients live. I have searched for a solution but didn't get a proper way to implement the same.

A: You can do this with sockets. Check out this question. The top answer has pretty good client/server code that might suit your needs.


text:
Q: Cannot read properties of undefined (reading '_id') while reading user from backend nodejs I am getting the following error in nodejs and expressjs, the code is given below
module.exports.forgotPassword = async (req, res) => {
  try {
    const email = req.body.email;
    const user = await User.findOne({ email: email });
    console.log(user);
    if (user === null) throw new Error("Please register first");
    if (user !== null) {
      const id = user[0]._id.toHexString();
      const token = crypto.randomBytes(64).toString("hex");
      let link = `${id}/${token}`;
      res.status(200).send(link);
    }
  } catch (err) {
    res.status(401).send({ error: err.message });
  }
};

A: try using
if (user === undefined) throw new Error("Please register first");

A: The mongo findOne command returns only one single document it does not returns an array . so you can access the id like

const id = user._id.toHexString();


text:
Q: Why does bold monoface shift vertically on Windows? In Firefox 3.6, IE7 and Opera 10 on Windows, this HTML has an odd behavior:

TextTextText

The bold span in the middle is shifted down by one pixel. That doesn't happen for other fonts.
Why is that? How can I fix it?

A:
Why is that?

Excellent question. Just spent half an hour trying to figure out the why, to no avail. Marcgg's solution doesn't seem to work, either, the offset is still there. Google turns up nothing. This only seems to happen on Windows, not just in the browsers you mention, but also in Opera 9 and IE6. Not in Firefox 2.0 though. Puzzling.

How can I fix it?

The only solution that has worked so far for me is this:
span {
    font-family: Courier; background-color: green;
}
span.b {
    font-weight: bold;
}

I.e., specifying Courier instead of monospace. This renders consistently in all browsers I tested (IE6, Opera 9, FF 2.0 under Windows 2000; Opera 10, FF 3, and Konqueror under Ubuntu). As to why, I still have no idea.

A: It's just an optical effect. Grab a screenshot and zoom in: you'll see the text baseline does not change at all.
It should fix itself if you choose a different colour contrast.
Update
alt text http://img690.imageshack.us/img690/421/opticaleffect.png

A: The problem is the font "Courier New" which is the default font used my most Windows browsers when "monospace" is requested. For the bold variant, the baseline is at a different offset:

TextTextText

With this code, you can see that the middle text is shifted up (= different baseline offset) but the background color is now aligned properly.
The solution is to request "Courier" as a font and to avoid "Courier New".


text:
Q: Change a string in xml into an array in xml easily I was wondering if anyone knew if there was a simple way to change all of my strings in my xml file to arrays?
Example:
//This is the string I need to change:
<string name="sample1">value1, value2, value3, value4, value5</string>
//This is the way I need it to be:
<array name="sample1">
    <item>value1</item>
    <item>value2</item>
    <item>value3</item>
    <item>value4</item>
    <item>value5</item>
</array>

My problem is not that I do not know how to manually do it. But I am looking for a way to simulate this process more easily because I have 120 strings with 25-90 values in each.
A good example would be converting multiple images extentions with a single click using an add-on to GIMP that simulates that process for you for each image.
Would anyone who understands what I am asking, know a way to do this for string to array?

A: This XSLT:
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <array>
        <xsl:attribute name="name">
            <xsl:value-of select="string/@name"/>
        </xsl:attribute>
        <xsl:apply-templates/>
    </array>
</xsl:template>

<xsl:template match="string/text()" name="tokenize">
    <xsl:param name="text" select="."/>
    <xsl:param name="sep" select="','"/>
    <xsl:choose>
        <xsl:when test="not(contains($text, $sep))">
            <item>
                <xsl:value-of select="normalize-space($text)"/>
            </item>
        </xsl:when>
        <xsl:otherwise>
            <item>
                <xsl:value-of select="normalize-space(substring-before($text, $sep))"/>
            </item>
            <xsl:call-template name="tokenize">
                <xsl:with-param name="text" select="substring-after($text, $sep)"/>
            </xsl:call-template>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
</xsl:stylesheet>

applied to this XML:
<?xml version="1.0" encoding="UTF-8"?>
<string name="sample1">value1, value2, value3, value4, value5</string>

gives this output:
<?xml version="1.0" encoding="UTF-8"?>
<array name="sample1">
<item>value1</item>
<item>value2</item>
<item>value3</item>
<item>value4</item>
<item>value5</item>
</array>

The XSLT is using a recursive template going through your string values and splitting them at the comma.

A: This can be done with XSLT 2.0 as simply as:
<xsl:stylesheet version="2.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:template match="/*">
  <array name="{@name}">
     <xsl:for-each select="tokenize(., ',\s*')">
      <item><xsl:value-of select="."/></item>
     </xsl:for-each>
    </array>
 </xsl:template>
</xsl:stylesheet>

When this transformation is applied on the provided XML document:
<string name="sample1">value1, value2, value3, value4, value5</string>

the wanted, correct result is produced:
<array name="sample1">
   <item>value1</item>
   <item>value2</item>
   <item>value3</item>
   <item>value4</item>
   <item>value5</item>
</array>


text:
Q: Are Xbase-dbf-files still common standard for shapefiles? For a Java application and for my personal understanding, I am exploring how to read and write shapefiles (at least shx, shp, dbf). The main purpose is to keep the resulting Shapefile-class and it's complimentary classes relatively lightweighted but with a backdoor to be able to react on changes of the different file formats as well.
The spatial information is well documented and clearly structured. This goes for the data table (dbf) to some extend as well. However, I am struggling with the different versions of dbf-files at the moment. I know that my version of QGIS Lisboa saves dbf-files as Xbase-files in a fashion which is described here. At the current stage, my Java classes are able to handle those. On the other hand I have read that different dBase-formats might be in use too. The respective file-specification is documented on e.g. this website.
Is the Xbase-format still dominant in comparison to the more complex but also more flexible dBase-formats?

A: The other dBase format you mentioned didn't exist when ESRI published the shapefile format.
Other software packages could certainly use the newer format, but it wouldn't be standard and it's likely that only that program could read the files it creates.
In my own experience, I've never encountered a non standard dbf accompanying a shapefile. This includes shapefiles created from QGIS, ArcGIS/Pad, FME Workbench, OGR (GDAL), AutoDesk products and various GPS utilities.
I wouldn't be concerned with supporting both formats, unless you are certain you will encounter the newer one.

A: The .dbf file used by shapefiles is dBase-III (without Memo fields).  There is no need to support more exotic forms, since they would be non-conformant to the specification (which is, admittedly, vague on which dBase format was used).  In fact, creating non-conformant "sort of shapefiles" would pollute the usefulness of the standard, and reading non-conformant files would encourage that pollution.
Shapefiles were great back in their day, but the 10 character field name limitation and lack of numeric NULLs, a second (or millisecond) resolution time type, UTF-16 strings, or BLOB & CLOB types hampers their use for modern data exchange.  I use ASCII (UTF-8, with Well-Known Text for geometries) before shapefiles for exchange between databases.


text:
Q: Non-trivial finite/infinite subgroups of infinite groups Does an infinite group whose every non-trivial subgroup is also infinite exist? If yes, what can be an example of such a group?
also,
Does an infinite group whose every non-trivial subgroup is finite exist? If yes, what can be an example of such a group?

A: Any group without non-trivial elements of finite order has this property (and the converse also holds). One example is $\mathbb{Z}$.
For your second question, one example is the group $\{x \in \mathbb{C} : \exists n \in \mathbb{N}\: \: x^{2^n} = 1\}$ under multiplication.

A: There exist infinite groups all of whose proper subgroups are finite.  Look here: http://en.wikipedia.org/wiki/Pr%C3%BCfer_group
The Tarski Monster is another example .. http://en.wikipedia.org/wiki/Tarski_monster_group


text:
Q: Extract json data with php doesnt works I have json data like this:

{"result":{"total":19,"hits":[{"keyword":"sidney webb"},{"keyword":"dr webb"}]},"status_msg":"OK","status_code":200,"left_lines":1196851}

I need to extract from json only keywords. I try without success with code:

$json = '{"result":{"total":19,"hits":[{"keyword":"sidney webb"},{"keyword":"dr webb"}]},"status_msg":"OK","status_code":200,"left_lines":1196851}';

foreach ($json['result'] as $keywords)
{
    echo $keywords['result']['keyword'];
}

A: Seems, you forgot to decode the string with json_decode. In addition, your likely would to loop over [result][hits] and not just [result]
$json = '{"result":{"total":19,"hits":[{"keyword":"sidney webb"},{"keyword":"dr webb"}]},"status_msg":"OK","status_code":200,"left_lines":1196851}';
$json = json_decode($json, true);

foreach ($json['result']['hits'] as $hit)
{
    echo $hit['keyword'];
}

A: TRY
    $json = '{"result":{"total":19,"hits":[{"keyword":"sidney webb"},{"keyword":"dr webb"}]},"status_msg":"OK","status_code":200,"left_lines":1196851}';
    $jsonp =json_decode($json,TRUE);

    foreach ($jsonp['result'] as $val)
    {
        if(is_array($val) ){
        foreach ($val as $k)
        {
            echo  $k['keyword'];

        }
        }

    }


text:
Q: the --now switch of `systemctl` As stated in the man page,
systemctl --now enable servicename

should enable and start the service.
But it never works for me, under many different distributions.
While the output of:
systemctl is-enabled turns enabled,
systemctl is-active is still inactive for the service.
What this switch is good for?
I've tried other combinations such as:
systemctl enable --now servicename

and:
systemctl enable servicename --now

but still the same; I have to manually systemctl start servicename every time, even if the previous command (ie the enable part) executes successfully.
Is it that the application's implentation of systemd service should support it implementing the feature somewhere in the unit files; what many well-known services do not follow, that made me think its entirely useless switch; I assume thinking over it.

A: I've found that annoying as well.
Looks like the --now switch was added in version 220 (see this line in the changelog), and CentOS 7 is currently on version 219. Hopefully soon then!
You can check your version of systemd with systemctl --version.


text:
Q: MXNET reshape calling ctypes Here trying to learn MXNET with "The Straight Dope". On Linear Algebra - Tensors, I get ctypes error when running,
X = nd.arange(24).reshape((2, 3, 4))

The error is,
C:\Anaconda2\lib\site-packages\mxnet\ndarray\ndarray.pyc in reshape(self, *shape, **kwargs)
   1060                                            c_array(ctypes.c_int64, shape),
   1061                                            reverse,
-> 1062                                            ctypes.byref(handle)))
   1063         return NDArray(handle=handle, writable=self.writable)
   1064

WindowsError: exception: access violation writing 0x00007FFB00000000

Why is this happening and how can I solve it?

A: Discussed the solution here: https://discuss.mxnet.io/t/reshape-error-calling-ctypes/1245/3
What helped is to downgrade to mxnet 1.2.0 and upgraded to Python 2.7.15.


text:
Q: prove existence of limit $\sum n/2^n$ I have to prove  limit  exist. i have to do it by the Cauchy criterion $|a_m-a_n| <\epsilon$.
Here is my attempt:
$$|a_m-a_n|=\left|\sum_{m=n+1}^m \frac{n}{2^n}\right|$$
and now i try to increase the expression but everything i try make it too high.
i recognize that $$\frac{n}{2^n} >\frac{n+1}{2^{n+1}}$$ and then increase the expression by changing all of it to $n/2^n$ is not helping.
if you have other option,without Cauchy,or how to make my way better,thank you.

A: Try the ratio test.
$$
\frac{n+1}{2^{n+1}}\cdot\frac{2^{n}}{n}=\left(1+\frac{1}{n}\right)
\cdot\frac{1}{2}\to \frac{1}{2}<1.
$$
Therefore, the series converges.

A: $$S=\frac{1}{2}+\frac{2}{2^2}+\frac{3}{2^3}...\frac{n}{2^n}$$
$$2S=1+\frac{2}{2}+\frac{3}{2^2}...$$
$$S=\qquad \qquad \; \frac{1}{2}+\frac{2}{2^2}+\frac{3}{2^3}...$$
So $2S-S= 1+\frac{1}{2}+\frac{1}{2^2}+\frac{1}{2^3}...=\frac{1}{1-\frac{1}{2}}=2$

A: Let $a_n=\frac{n}{2^n}$ and $S_n=a_1+\cdots+a_n$.  Then note that
$$
a_{n+1}=\frac{n+1}{2^{n+1}}=\frac{n+1}{2n}\cdot\frac{n}{2^n}=\frac{n+1}{2n}a_n=\left(\frac{1}{2}+\frac{1}{2n}\right)a_n.
$$
In particular, for $n\geq 2$, we see that
$$
a_{n+1}\leq\frac{3}{4}a_n.
$$
So, as a result, for $2\leq m\leq M$,
$$
\begin{align*}
\lvert S_M-S_m\rvert&=\sum_{n=m+1}^{M}a_n\\
&\leq a_{m+1}+\frac{3}{4}a_{m+1}+\left(\frac{3}{4}\right)^2a_{m+1}+\cdots\left(\frac{3}{4}\right)^{M-m-1}a_{m+1}\\
&=a_{m+1}\left[1+\frac{3}{4}+\left(\frac{3}{4}\right)^2+\cdots+\left(\frac{3}{4}\right)^{M-m-1}\right]
\end{align*}
$$
Notice that the quantity in brackets is bounded above the by geometric series
$$
\sum_{n=0}^{\infty}\left(\frac{3}{4}\right)^n=\frac{1}{1-\frac{3}{4}}=4.
$$
So, for any $m\leq M$, we have
$$
\lvert S_M-S_m\rvert\leq4a_{m+1}=4\cdot\frac{m+1}{2^{m+1}}.
$$
Clearly, you can make this 'sufficiently small' by making $m$ large enough. So, by filling in some further details, you can use the Cauchy criteria as you requested.
However, that being said, it is... a weird way to do this.  Because this exact same argument shows that $\sum_{n=2}^{\infty}a_n$ converges by comparison.  Or, if you don't feel you have the 'comparison test' yet, it converges because the sequence of partial sums is monotone inreasing and bounded above.

A: Let $S_n=\sum_{k=0}^n\frac{k}{2^k}$ and let $\varepsilon>0$ and choose $N$ so that for any $n\ge N$ we have $\frac{n+2}{2^n}<\varepsilon.$ Then for any $m>n\ge N$ we have
$$
\lvert S_m-S_n \rvert=\sum_{k=n+1}^m\frac{k}{2^k}<\sum_{k=n+1}^\infty\frac{k}{2^k}.
$$
Now let $T=\sum_{k=n+1}^\infty\frac{k}{2^k}$ and using the same kind of algebraic manipulation @Teh Rod used we get
$$
\begin{align*}
2T&=\frac{n+1}{2^{n}}+\frac{n+2}{2^{n+1}}+\frac{n+3}{2^{n+2}}+\frac{n+4}{2^{n+3}}+\cdots\\
-T&=\qquad~-\frac{n+1}{2^{n+1}}-\frac{n+2}{2^{n+2}}-\frac{n+3}{2^{n+1}}-\cdots\\\hline
T&=\frac{n+1}{2^{n}}+\frac{1}{2^{n+1}}~+\,\frac{1}{2^{n+2}}~~+\frac{1}{2^{n+3}}\\
&=\frac{n+1}{2^n}+\frac{1}{2^{n+1}}\left(1+\frac 12 + \frac 14 + \cdots\right)\\
&=\frac{n+1}{2^n}+\frac{1}{2^{n+1}}\cdot 2\\
&=\frac{n+1}{2^n}+\frac{1}{2^{n}}\\
&=\frac{n+2}{2^n}.
\end{align*}
$$
Thus when $n\ge N$ we have
$$
\lvert S_m-S_n \rvert<T=\frac{n+2}{2^n}<\varepsilon.
$$


text:
Q: Get Installation Sequence of Oracle Objects Ok, I have a complex recursion problem. I want to get a dependecy installation sequence of all of my objcts (all_objects table) in my Oracle 11g database.
First I have created a view holding all dependencies
create or replace
view REALLY_ALL_DEPENDENCIES as
select *
  from ALL_DEPENDENCIES
union
select owner, index_name, 'INDEX', table_owner, table_name, table_type, null, null
  from all_indexes
union
select p.owner, p.table_name, 'TABLE', f.owner, f.table_name, 'TABLE', null, null
  from all_constraints p
  join all_constraints f
    on  F.R_CONSTRAINT_NAME = P.CONSTRAINT_NAME
    and F.CONSTRAINT_TYPE = 'R'
    and p.constraint_type='P'
;
/

EDIT
I have tried do concate all dependencies by using this function:
create
 or replace
function dependency(
   i_name varchar2
  ,i_type varchar2
  ,i_owner varchar2
  ,i_level number := 0
  ,i_token clob := ' ') return clob
is
  l_token clob := i_token;
  l_exist number := 0;
begin
  select count(*) into l_exist
    from all_objects
    where   object_name  = i_name
      and   object_type  = i_type
      and   owner = i_owner;

  if l_exist > 0 then
    l_token := l_token || ';' || i_level || ';' ||
      i_name  || ':' || i_type || ':' || i_owner;
  else
    -- if not exist function recursion is finished
    return l_token;
  end if;

  for tupl in (
    select distinct
       referenced_name
      ,referenced_type
      ,referenced_owner
      from REALLY_ALL_DEPENDENCIES
      where name  = i_name
      and   type  = i_type
      and   owner = i_owner
    )
  loop
   -- if cyclic dependency stop and shout!
    if i_token like '%' || tupl.referenced_name || ':' || tupl.referenced_type || ':' || tupl.referenced_owner || '%' then
      select count(*) into l_exist
        from REALLY_ALL_DEPENDENCIES
        where   name  = tupl.referenced_name
          and   type  = tupl.referenced_type
          and   owner =  tupl.referenced_owner;
      if  l_exist > 0 then
        return '!!!CYCLIC!!! (' || i_level || ';' || tupl.referenced_name || ':' || tupl.referenced_type || ':' || tupl.referenced_owner || '):' || l_token;
      end if;
    end if;

    -- go into recursion
    l_token := dependency(
       tupl.referenced_name
      ,tupl.referenced_type
      ,i_owner /* I just want my own sources */
      ,i_level +1
      ,l_token);
  end loop;

  -- no cyclic condition and loop is finished
  return l_token;
end;
/

And I can query through
select
   object_name
  ,object_type
  ,owner
  ,to_char(dependency(object_name, object_type, owner)) as dependecy
  from all_objects
  where owner = 'SYSTEM'
;

Ok, maybe it is something like "cheating" but you can not do cyclic dependencies at creation time. So at least as a human beeing I am only able to create one object after another :-) And this sequence should be "reverse engineer able".
Now I am more interested in a solution than before ;-) And it is still about the tricky part ... "How can I select all soures from a schema orderd by its installation sequence (dependent objects list prior the using object)"?
It is just some kind of sorting problem, insn't it?

A: Usually you "cheat" by creating the objects in a particular order. For example, you might make sequences first (they have zero dependencies). Then you might do tables. After that, package specs, then package bodies, and so on.
Keep in mind that it is possible to have cyclic dependencies between packages, so there are cases where it will be impossible to satisfy all dependencies at creation anyway.
What's the business case here? Is there a real "problem" or just an exercise?
EDIT
The export tool we use exports objects in the following order:

*

*Database Links

*Sequences

*Types

*Tables

*Views

*Primary Keys

*Indexes

*Foreign Keys

*Constraints

*Triggers

*Materialized Views

*Materialized View Logs

*Package Specs

*Package Bodies

*Procedures

*Functions

At the end, we run the dbms_utility.compile_schema procedure to make sure everything is valid and no dependencies are missed. If you use other object types than these, I'm not sure where they'd go in this sequence.

A: Ok, I had some time to look at the job again and I want to share the results. Maybe anotherone comes across this thread searching for a solution. First of all I did the SQLs as SYS but I think you can do it in every schema using public synonyms.
The Procedure "exec obj_install_seq.make_install('SCOTT');" makes a clob containing a sql+ compatible sql file, assuming your sources are called "object_name.object_type.sql". Just spool it out.
Cheers
Chris
create global temporary table DEPENDENCIES on commit delete rows as
select * from ALL_DEPENDENCIES where 1=2 ;
/

create global temporary table install_seq(
     idx   number
    ,seq   number
    ,iter  number
    ,owner varchar2(30)
    ,name  varchar2(30)
    ,type  varchar2(30)
) on commit delete rows;
/

create global temporary table loop_chk(
     iter  number
    ,lvl   number
    ,owner varchar2(30)
    ,name  varchar2(30)
    ,type  varchar2(30)
) on commit delete rows;
/

create or replace package obj_install_seq is
  procedure make_install(i_schema varchar2 := 'SYSTEM');
end;
/

create or replace package body obj_install_seq is
  subtype install_seq_t is install_seq%rowtype;
  type dependency_list_t is table of DEPENDENCIES%rowtype;

  procedure set_list_data(i_schema varchar2 := user)
  is
    l_owner varchar2(30) := i_schema;
  begin
    -- collect all dependencies
    insert into DEPENDENCIES
      select *
        from (select *
              from ALL_DEPENDENCIES
             where owner = l_owner
               and referenced_owner = l_owner
             union
            select owner, index_name, 'INDEX', table_owner, table_name, table_type, null, null
              from all_indexes
             where owner = l_owner
               and table_owner = l_owner
             union
             select p.owner, p.table_name, 'TABLE', f.owner, f.table_name, 'TABLE', null, null
              from all_constraints p
              join all_constraints f
                on  F.R_CONSTRAINT_NAME = P.CONSTRAINT_NAME
               and F.CONSTRAINT_TYPE = 'R'
               and p.constraint_type='P'
               and p.owner = f.owner
             where p.owner = l_owner
           ) all_dep_tab;

     -- collect all objects
     insert into install_seq
     select rownum, null,null, owner, object_name, object_type
       from (select distinct owner, object_name, object_type, created
               from all_objects
              where owner = l_owner
              order by created) objs;
  end;

  function is_referencing(
      i_owner varchar2
     ,i_name varchar2
     ,i_type varchar2
     ,i_iter number
     ,i_level number := 0
  ) return boolean
  is
    l_cnt number;
  begin
    select count(*) into l_cnt
      from loop_chk
     where name  = i_name
       and owner = i_owner
       and type  = i_type
       and iter  = i_iter
       and lvl   < i_level;

    insert into loop_chk values(i_iter,i_level,i_owner,i_name,i_type);

    if l_cnt > 0 then
      return true;
    else
      return false;
    end if;
  end;

  procedure set_seq(
    i_owner varchar2
   ,i_name varchar2
   ,i_type varchar2
   ,i_iter number
   ,i_level number := 0)
  is
    -- l_dep all_dependencies%rowtype;
    l_idx number;
    l_level number := i_level +1;
    l_dep_list dependency_list_t;
    l_cnt number;
  begin
    -- check for dependend source
    begin
      select * bulk collect into l_dep_list
        from dependencies
       where name  = i_name
         and owner = i_owner
         and type  = i_type;

      if l_dep_list.count <= 0 then
        -- recursion finished
        return;
      end if;
    end;

    for i in 1..l_dep_list.count loop
      if is_referencing(
         l_dep_list(i).referenced_owner
        ,l_dep_list(i).referenced_name
        ,l_dep_list(i).referenced_type
        ,i_iter
        ,i_level
      ) then
        -- cyclic dependecy
        update install_seq
           set seq = 999
              ,iter = i_iter
         where name  = l_dep_list(i).referenced_name
           and owner = l_dep_list(i).referenced_owner
           and type  = l_dep_list(i).referenced_type;
      else
        --chek if sequence is earlier
        select count(*) into l_cnt
          from install_seq
         where name  = l_dep_list(i).referenced_name
           and owner = l_dep_list(i).referenced_owner
           and type  = l_dep_list(i).referenced_type
           and seq   > l_level *-1;

        -- set sequence
        if l_cnt > 0 then
          update install_seq
             set seq = l_level *-1
                ,iter = i_iter
           where name  = l_dep_list(i).referenced_name
             and owner = l_dep_list(i).referenced_owner
             and type  = l_dep_list(i).referenced_type;
        end if;

        -- go recusrion
        set_seq(
           l_dep_list(i).referenced_owner
          ,l_dep_list(i).referenced_name
          ,l_dep_list(i).referenced_type
          ,i_iter + (i-1)
          ,l_level
      );

      end if;
    end loop;
  end;

  function get_next_idx return number
  is
    l_idx number;
  begin
    select min(idx) into l_idx
      from install_seq
     where seq is null;

   return l_idx;
  end;

  procedure make_install(i_schema varchar2 := 'SYSTEM')
  is
    l_obj install_seq_t;
    l_idx number;
    l_iter number := 0;
    l_install_clob clob := chr(10);
  begin
    set_list_data(i_schema);
    l_idx := get_next_idx;

    while l_idx is not null loop
      l_iter := l_iter +1;

      select * into l_obj from install_seq where idx = l_idx;
      update install_seq set iter = l_iter where idx = l_idx;
      update install_seq set seq = 0 where idx = l_idx;
      set_seq(l_obj.owner,l_obj.name,l_obj.type,l_iter);

      l_idx := get_next_idx;
    end loop;

    for tupl in ( select * from install_seq order by seq, iter, idx ) loop
      l_install_clob := l_install_clob || '@' ||
        replace(tupl.name,' ' ,'') || '.' ||
        replace(tupl.type,' ' ,'') || '.sql' ||
        chr(10);
    end loop;

    l_install_clob := l_install_clob ||
      'exec dbms_utility.compile_schema(''' || upper(i_schema) || ''');';

    -- do with the install file what you want
    DBMS_OUTPUT.PUT_LINE(dbms_lob.substr(l_install_clob,4000));
  end;
end;
/


text:
Q: Conditional expectation on the product of squared Brownian motion with Doléans-Dade exponential (Radon-Nikodym derivatives) I try to compute the conditional expectation $E_{t}^{P}\left[B_{T}^{2} \ e^{-\frac{1}{2} \int_{0}^{T} \left( a + b B_{u}^{2}\right)^{2} d u+\int_{0}^{T} \left( a + b B_{u}^{2}\right) d B_{u}}\right]$ where

*

*$a$ and $b$ are deterministic

*$B_t$ is a P-Brownian motion

*$e^{-\frac{1}{2} \int_{0}^{T} \left( a + b B_{u}^{2}\right)^{2} d u+\int_{0}^{T} \left( a + b B_{u}^{2}\right) d B_{u}}$ is a P-martingale.

*$E_t$ means $E[...|  \mathcal{F}_t]$

*There is equivalent Q measure $B^Q_t = B_t - \int_{0}^{t} \left( a + b B_{u}^{2}\right) du$
It seems difficult to work with Q-expectation as there will always a P-Brownian motion involved, e.g.
$ E^Q_t B_t = E^Q_t B^Q_t - E^Q_t \left(\int_{0}^{t} \left( a + b B_{u}^{2}\right) du \right)$
$ E^Q_t B^2_t = E^Q_t \left( B^Q_t - \int_{0}^{t} \left( a + b B_{u}^{2}\right) du \right)^2$
My thought is to use linear approximation $e^x = 1+x$
But I  don't think my approach is correct. I was wondering if there is any clever way to derive this conditional expectation? I would really appreciate if anyone could show me how to solve this question.


text:
Q: Using forEach with a object I have this json data
myObj = {
 "job":[
  {
    "student":{
     "name" : "Agus"
   }
  },
  {
    "lecturer":{
     "name" : "Budi"
   }
  }
 ]
}

how to forEach the object and print out the property of "name" value

A: Here is a working example:

const myObj = {
  "job": [
    {
      "student": {
        "name": "Agus"
      }
    },
    {
      "lecturer": {
        "name": "Budi"
      }
    }
  ]
}

myObj.job.forEach((element) => {
  const keys = Object.keys(element);
  keys.forEach((key) => {
    console.log(element[key].name);
  })
});


text:
Q: Fatou Lemma extension for every measurable sequence (negative & non-negative) Let $(f_n)_{n\in \Bbb N}$ be a sequence of elements in $M(X,S)$, let $g\in M^+(X,S)$ such that $\int gd\mu<\infty$ and $f_n\ge-g\ $ $(a.e.- \mu)\ \forall n\in \Bbb N\ $ in $E\in S$. Then, it follows:
$$\int_{E} \liminf_{n\to \infty} (f_n)d\mu\le \liminf_{n\to \infty} \int_E f_nd\mu$$

I have a doubt in somepoint of my proof in the a.e.-$\mu$ part. It goes like this:
Lets define $\forall n\in \Bbb N\ h_n:X\rightarrow \Bbb R\ $ as $$\ h_n(x)=f_n(x)+g(x)\ \forall\ x\in X$$
So clearly $h_n$ is measurable $\forall n\in \Bbb N$, because $f_n\in M(X,S)\ \forall n\in \Bbb N\ $ and $g\in M^+(X,S)$.
And we get that $h_n\ge 0\ (a.e.-\mu)\ \forall n\in \Bbb N$
Now let $$l_m=\inf_{k\ge m} \{ h_k \}\ \forall m\in \Bbb N\ $$
thus $$l_m\le l_{m+1}\ \forall m\in \Bbb N$$
then $$\lim_{m\to \infty} l_m = \sup_{m\in \Bbb N} \{ l_m \} = \liminf_{n\to \infty} (h_n)$$
So we apply Fatou's Lemma and get that:
$$\int_{E} \liminf_{m\to \infty} (l_m)d\mu\le \liminf_{m\to \infty}\int_E l_md\mu$$
but, since the limit of $l_m$ exists, $$\liminf_{m\to \infty} (l_m)=\lim_{m\to \infty} l_m$$
so
$$\int_{E} \liminf_{n\to \infty} (h_n)d\mu = \int_{E} \lim_{m\to \infty} (l_m)d\mu =\int_{E} \liminf_{m\to \infty} (l_m)d\mu \le \liminf_{m\to \infty}\int_E l_md\mu$$
thus
$$\int_{E} \liminf_{n\to \infty} (h_n)d\mu\le \liminf_{m\to \infty}\int_E l_md\mu$$
Where $l_m\le h_n\ \forall n\ge m \Rightarrow\ \int_E l_m d\mu \le \int_E h_n d\mu\ \forall n\ge m \Rightarrow\ \int_E l_m d\mu \le \inf_{n\ge m} \int_E h_n d\mu\ \forall m\in \Bbb N\ \\ \Rightarrow\ \int_E l_m d\mu \le \sup_{m\in \Bbb N} \inf_{n\ge m} \int_E h_n d\mu = \liminf_{n\to \infty} \int_E h_n d\mu\ \\
\Rightarrow\ \liminf_{m\to \infty} \int_E l_m d\mu \le \liminf_{n\to \infty} \int_E h_n d\mu\ \\$ thus
$$\int_{E} \liminf_{n\to \infty} (h_n)d\mu\le \liminf_{m\to \infty}\int_E l_md\mu\le \liminf_{n\to \infty} \int_E h_n d\mu$$
Where $h_n=f_n+g\ \forall n\in \Bbb N\ \Rightarrow\ \liminf_{n\to \infty} (h_n)=g+\liminf_{n\to \infty} (f_n)\ \\ \Rightarrow\ \int_E \liminf_{n\to \infty} (h_n)d\mu =\int_E gd\mu +\int_E \liminf_{n\to \infty} (f_n)d\mu$
so
$$\int_E gd\mu +\int_E \liminf_{n\to \infty} (f_n)d\mu = \int_{E} \liminf_{n\to \infty} (h_n)d\mu\le \liminf_{n\to \infty} \int_E h_n d\mu$$
where
$$\liminf_{n\to \infty} \int_E h_n d\mu = \liminf_{n\to \infty} \int_E (f_n+g) d\mu = \liminf_{n\to \infty} \{ \int_E f_nd\mu +\int_E gd\mu \} =\int_E gd\mu + \liminf_{n\to \infty} \int_E f_nd\mu$$
so
$$\int_E gd\mu +\int_E \liminf_{n\to \infty} (f_n)d\mu \le \int_E gd\mu + \liminf_{n\to \infty} \int_E f_nd\mu$$
where $\int_E gd\mu< \infty$, so we can substract it from the inequality and thus
$$\int_E \liminf_{n\to \infty} (f_n)d\mu \le \liminf_{n\to \infty} \int_E f_nd\mu$$
I don't know where (or how) to use the fact that $h_n \ge 0\ \ (a.e.-\mu)\ \forall n\in \Bbb N$

A: Set
$$h_n := f_n + g.$$
As $h_n \geq 0$ we may apply Fatou's lemma and obtain
$$L := \int_E \liminf_{n \to \infty} h_n \, d\mu \leq \liminf_{n \to \infty} \int_E h_n \, d\mu =: R. \tag{1}$$
By the very definition of $h_n$, we have
$$\begin{align*} R &= \liminf_{n \to \infty} \int_E h_n \, d\mu \\ &= \liminf_{n \to \infty} \left( \int_E g_n+ \int f_n \, d\mu \right) \\ &= \int_E g \, d\mu + \liminf_{n \to \infty} \int_E f_n \, d\mu \end{align*}$$
where we have used in the last step that
$$\liminf_{n \to \infty} (c+a_n) = c+ \liminf_{n \to \infty} a_n$$
for any sequence $(a_n)_n$ and constant $c$. On the other hand,
$$\begin{align*} L &= \int_E \liminf_{n \to \infty} h_n \, d\mu \\ &= \int_E \liminf_{n \to \infty} (g+f_n) \, d\mu \\ &= \int_E (g+ \liminf_{n \to \infty} f_n) \, d\mu \\ &= \int_E g \, d\mu + \int_E \liminf_{n \to \infty} f_n \, d\mu. \end{align*}$$
Plugging this into $(1)$, we get
$$\int_E g \, d\mu + \int_E \liminf_{n \to \infty} f_n \, d\mu \leq \int_E g \, d\mu + \liminf_{n \to \infty} \int_E \, d\mu.$$
Subtracting $\int_E g \, d\mu < \infty$ on both sides finishes the proof.


text:
Q: Missed some reference from my asp.net application When I try to run my asp.net application, it gives me this error
Could not load file or assembly 'Microsoft.Data.OData' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I think I miss some assembly reference but I can't get which one is?
Please help me to solve this issue.

A: This could be related: Could not load file or assembly Microsoft.Data.OData Version=5.2.0.0 error in Azure Cloud Worker Role using Table Storage
Try adding this to your web.config:
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>


text:
Q: Loop in Thread that blocks the Script I'm having a problem that I can't figure out how to solve. Probably the solution is also simple, but at the moment it does not appear in my head. Ah, I didn't know what to write in the title, so if you want to change how you think it's lawful, do it =)
I put a simplified version of the code, where the problem appears:
from pyglet.gl import *
import threading, time, os

FPS = 120.0

class ucgm(pyglet.window.Window):

    window_on_show = False
    grid_set = 32, 18
    old_set = 1024, 576
    new_set = old_set

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.__video_set()

        self.__resource = Resource_Load(self)
        s_l = threading.Thread(target=self.__resource.start_load())
        s_l.start()

    def on_show(self):
        print("1")
        self.window_on_show = True
        print("2")

    def on_draw(self):
        self.clear()

    def update(self, dt):
        pass

    def on_close(self):
        os._exit(0)

    def __video_set(self):
        self.__platform = pyglet.window.get_platform()
        self.__default_display = self.__platform.get_default_display()
        self.__default_screen = self.__default_display.get_default_screen()

        self.set_size(self.new_set[0], self.new_set[1])
        self.location = self.__default_screen.width // 2 - self.new_set[0] // 2, self.__default_screen.height // 2 - self.new_set[1] // 2
        self.set_location(self.location[0], self.location[1])

class Resource_Load():

    def __init__(self, main):
        self.engine = main
        self.loop_load = True

    def start_load(self):
        while self.loop_load:
            if self.engine.window_on_show:
                self.loop_load = False
                print("3")
            else:
                print("4")
                time.sleep(1)
        print("5")

if __name__ == "__main__":
    uc = ucgm()
    pyglet.clock.schedule_interval(uc.update, 1 / FPS)
    pyglet.app.run()

Before talking about the problem, I would like to explain what my intention was. What I thought was to create a class parallel to the main one that took care of loading all the resources used. In the meantime, it had to "dialogue" with the main class and modify a variable of it that showed the progress of the upload. Some time ago I asked a similar question on Stackoverflow about something similar (Link Question). The difference is that in that question the parallel function was internal to the main class. But given the amount of resources to load, I decided to dedicate a separate class to him. Once everything was written, I thought of another problem. Although it was written later, the Thread started before the window appeared completely. I thought of adding a simple time.sleep set with a few seconds. But then I reasoned that there was the possibility of a delay, caused by excessive use of RAM by the user, and therefore the time set was not sufficient. So I modified, adding a while loop with the condition that if the window was visible, it would have ended the loop and continued loading, otherwise it would have waited a second. nd here we are finally in the problem. The script as it is written does not work. Or rather, it remains stuck in the cycle, despite being open in a Thread. I knew, from my previous question, that the Thread should not directly touch Pyglet, and in fact it does not happen, since it is only reading the status of a variable. So I don't understand why I'm getting this result. The cycle seems to be not happening in parallel and therefore blocks the on_show function which fails to update the variable and thus to break the cycle. Do you have any suggestions for me to solve the problem I'm having? Thanks for your help

A: Instead of passing a reference to the start_load function on this line:
s_l = threading.Thread(target=self.__resource.start_load())

...that line is actually calling that function (notice the ()), which is running that infinite loop on the main thread. Get rid of that (); threading.Thread will do the call for you:
s_l = threading.Thread(target=self.__resource.start_load)

Additionally, there are better ways to wait for something to happen in one thread from another. You should consider using one of the thread synchronization object provided in Python, for example, a threading.Event:
class ucgm(pyglet.window.Window):
    window_opened = threading.Event()
    // ...
    def on_show(self):
        self.window_opened.set()
    // ...

class Resource_Load():
    // ...
    def start_load(self):
        self.engine.window_opened.wait()
        print("done")
    // ...


text:
Q: Is "a+++i" equal to "(a++)+i" #include <stdio.h>

int main(void)
{
    int a = 1, i = 3, x, y, z;
    a = 1; i = 3;
    x = a+++i;
    a = 1; i = 3;
    y = a++ + i;
    a = 1; i = 3;
    z = a + ++i;
    printf("%d %d %d", x, y, z);
    scanf(" ");
    return 0;
}

This code output appears to be 4 4 5. But why is a+++i equals to a++ + i?
Is it because compilers always read source code from left to right?
Or is it because the operation follows the order of precedence?
And will it work the same on all compilers?

A: C11 standard, part 6.4 (Lexical elements)/4 says (and in C99 it's the same):

If the input stream has been parsed into preprocessing tokens up to a given character, the
  next preprocessing token is the longest sequence of characters that could constitute a
  preprocessing token.

There is also an example there:

The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
  increment operators, even though the parse x ++ + ++ y might yield a correct expression.

A: I can't say all, since C compiler implementation may be different. But generally yes, you are right. A C compiler is supposed to be greedy, i.e. read as much as possible, so +++ == ++ +.


text:
Q: Calculate angle between two edges to create polygon Currently I am trying to create an algorithm that will create polygons from given edges, I ran into a problem with creating vectors between three points. The algorithm calculates the angle for the candidates for the next edge, looking for the one that has the smallest angle, but I've noticed that it does not always calculate the angle from the right place, so the overall result of the algorithm is that it takes the correct values (minimum) and sometimes chooses the wrong calculations. Here is my code to calculate that:
        public Edge GetEdgeWithLowestAngle(Point basePoint, Point headPoint, List<Edge> connectedEdges)
        {
            var minValue = double.MaxValue;
            Edge minEdge = null;

            foreach (var edge in connectedEdges)
            {
                var radianAngle = CalculateAngle(headPoint, GetNextPoint(headPoint, edge), basePoint);
                if (minValue > radianAngle)
                {
                    minValue = radianAngle;
                    minEdge = edge;
                }
            }

            return minEdge;
        }

        public double CalculateAngle(Point pointA, Point pointB, Point pointC)
        {
            Vector2 ab = new Vector2((float)(pointB.X - pointA.X), (float)(pointB.Y - pointA.Y));
            Vector2 ac = new Vector2((float)(pointC.X - pointA.X), (float)(pointC.Y - pointA.Y));

            var cosinus = Convert.ToDouble(Vector2.Dot(ab, ac) / (ab.Length() * ac.Length()));
            //var atanValue = Math.Atan2(pointB.Y - pointA.Y, pointB.X - pointA.X) - Math.Atan2(pointC.Y - pointA.Y, pointC.X - pointA.X); <- that's the second option, return nearly the same value
            return Math.Acos(cosinus);
        }

Where it suposed to calculate every angle like that for every edge (headPoint and connectedEdges are changing every iteration but basePoint is still):

But sometimes it doesn't - I discovered that in some case it took the opposite vector and did angle calculation to that. Am I missing something crucial at geometrical level because calculations seems to be fine (i've checked few times with calculator). My intuition telling me that the problem is with creation of vectors (ab, ac). My algorithm operates on edges which has standard points A and B with X,Y coordinates and for edges creates polygons (algorithm supposed to do as small as possible circle through edges and makes polygons from it).
A significant problem is the lack of constancy of the calculated angles - it seems that it is calculated differently for each new edge - it takes the outside angle, sometimes inside. Because of that algorithm cannot make circle and freezes. Hope I explained the problem and thank you for your attention! :)

A: The problem with using the dot product formula to calculate the angle between two vectors is, that it will always calculate the enclosed angle and loose the information about the direction of the sweep. Which means that it will always return min(angle,opposite angle). You can easily verify this by, for example, calculating the angle between (1,0) and (-1,1) vs. the angle between (1,0) and (-1,-1). Both return 3/4pi, whereas one would probably expect 5/4pi in the second case.

EDIT: My comments where somewhat imprecise: You have to apply the range normalization to each atan2 call and only then subtract them.
I have illustrated this with a simple python script:
import numpy as np
import math
import itertools as it
from tabulate import tabulate

# list of the 8 cardinal and intercardinal points
Ps = np.array([[1,0],[1,1],[0,1],[-1,1],[-1,0],[-1,-1],[0,-1],[1,-1]])

# converts radian to degree, for easier reasoning
def to_degree(alpha):
    return alpha*180/math.pi

# calculates the angle between the vector v and the (positive) x-axis
# result is in [0,2pi]
def get_angle(v):
    phi = math.atan2(v[1], v[0])
    if (phi < 0):
        phi += 2*math.pi
    return phi

# for each combination of two cardinal points (named B and C)
#   calculate the directed angle BAC (named phi)
#   with A beeing the base point at [0,0].
# v1 is line segment AB
# v2 is line segment AC
# phi1 is angle between v1 and x-axis
# phi2 is angle betwwen v2 and x-axis
A = np.array([0,0])
data = []
for B, C in it.product(Ps, repeat=2):
    v1 = B-A
    v2 = C-A
    phi1 = get_angle(v1)
    phi2 = get_angle(v2)
    data.append((v1,to_degree(phi1),v2,to_degree(phi2),to_degree(phi2-phi1)))

print(tabulate(data, headers=["v1", "phi_v1", "v2", "phi_v2", "phi"]))

which prints
v1         phi_v1  v2         phi_v2    phi
-------  --------  -------  --------  -----
[1 0]           0  [1 0]           0      0
[1 0]           0  [1 1]          45     45
[1 0]           0  [0 1]          90     90
[1 0]           0  [-1  1]       135    135
[1 0]           0  [-1  0]       180    180
[1 0]           0  [-1 -1]       225    225
[1 0]           0  [ 0 -1]       270    270
[1 0]           0  [ 1 -1]       315    315
[1 1]          45  [1 0]           0    -45
[1 1]          45  [1 1]          45      0
[1 1]          45  [0 1]          90     45
[1 1]          45  [-1  1]       135     90
[1 1]          45  [-1  0]       180    135
[1 1]          45  [-1 -1]       225    180
[1 1]          45  [ 0 -1]       270    225
[1 1]          45  [ 1 -1]       315    270
[0 1]          90  [1 0]           0    -90
[0 1]          90  [1 1]          45    -45
[0 1]          90  [0 1]          90      0
[0 1]          90  [-1  1]       135     45
[0 1]          90  [-1  0]       180     90
[0 1]          90  [-1 -1]       225    135
[0 1]          90  [ 0 -1]       270    180
[0 1]          90  [ 1 -1]       315    225
[-1  1]       135  [1 0]           0   -135
[-1  1]       135  [1 1]          45    -90
[-1  1]       135  [0 1]          90    -45
[-1  1]       135  [-1  1]       135      0
[-1  1]       135  [-1  0]       180     45
[-1  1]       135  [-1 -1]       225     90
[-1  1]       135  [ 0 -1]       270    135
[-1  1]       135  [ 1 -1]       315    180
[-1  0]       180  [1 0]           0   -180
[-1  0]       180  [1 1]          45   -135
[-1  0]       180  [0 1]          90    -90
[-1  0]       180  [-1  1]       135    -45
[-1  0]       180  [-1  0]       180      0
[-1  0]       180  [-1 -1]       225     45
[-1  0]       180  [ 0 -1]       270     90
[-1  0]       180  [ 1 -1]       315    135
[-1 -1]       225  [1 0]           0   -225
[-1 -1]       225  [1 1]          45   -180
[-1 -1]       225  [0 1]          90   -135
[-1 -1]       225  [-1  1]       135    -90
[-1 -1]       225  [-1  0]       180    -45
[-1 -1]       225  [-1 -1]       225      0
[-1 -1]       225  [ 0 -1]       270     45
[-1 -1]       225  [ 1 -1]       315     90
[ 0 -1]       270  [1 0]           0   -270
[ 0 -1]       270  [1 1]          45   -225
[ 0 -1]       270  [0 1]          90   -180
[ 0 -1]       270  [-1  1]       135   -135
[ 0 -1]       270  [-1  0]       180    -90
[ 0 -1]       270  [-1 -1]       225    -45
[ 0 -1]       270  [ 0 -1]       270      0
[ 0 -1]       270  [ 1 -1]       315     45
[ 1 -1]       315  [1 0]           0   -315
[ 1 -1]       315  [1 1]          45   -270
[ 1 -1]       315  [0 1]          90   -225
[ 1 -1]       315  [-1  1]       135   -180
[ 1 -1]       315  [-1  0]       180   -135
[ 1 -1]       315  [-1 -1]       225    -90
[ 1 -1]       315  [ 0 -1]       270    -45
[ 1 -1]       315  [ 1 -1]       315      0


text:
Q: How can I have paragraph spacing for normal paragraphs, but no paragraph spacing within tables? I configured my "Normal" paragraph style to have 10pt spacing before and after.
Within word tables, however, I would like no (0pt) spacing before and after paragraphs.
The closest I came was by checking the table style paragraph setting called "Don't add space between paragraphs of the same style".
This only works to my satisfaction when I have a normal paragraph before a table. If the table comes immediately after a heading, the first cell still has this annoying spacing.
I know I could manually mark the cells of the offending table and override the paragraph spacing, but shouldn't this be achievable with some pretty straightforward style configuration?

A: After a lot of trial and error I have found a configuration that so far seems to work pretty well:
Standard style: 10pt before, 10pt after
Table style: 'Auto' before, 'Auto' after

And the result:

A: Assuming you haven't tried this already, consider creating a separate paragraph style for table Paragraphs.  Apply it to the first one, others should follow, or apply globally to the table.

A: Create a style for tables that is based on the regular style. "MyTableNormal". Edit the new style to override the spacing options - spacing before 0pt, spacing after 0pt. You'll get no vertical spacing but the table contents will otherwise be styled the same as un-tabled text. If you update Normal to use Arial instead of Calibri or size 9 instead of 11.5, etc., the MyTableNormal-styled table contents will update to match, and keep the right spacing.


text:
Q: Calculating Average Percent Change I'm trying to calculate the average percent change of 3 points in time that I have.
The time periods are from 2011 to 2013
I calculated the percent change for 2011 to 2012 (2012-2011)/(2011)
2012 to 2013 (2013-2012)/(2012)
and 2011 to 2013 (This is the part I'm worried about)--(2013-2011)/(2011(
After getting the results I decided to average them, but I'm worried that the percent change I got for 2011 to 2013 includes (though not seen) changes that happened in the middle period of 2012.
I know that each number is a stand alone, but I was just wondering if adding the three values I get for the percent change and dividing by 3 yields data that is actually useful or if it is incorrect to do so.

A: If the increase from $2011$ to $2012$ is $a$, the value in $2012$ is $(1+a)$ times the value in $2011$. Similarly if the increase from $2012$ to $2013$ is $b$, the value in $2013$ is $(1+b)$ times that in $2012$. Then the increase from $2011$ to $2013$ is $a+b+ab$. If the increases are small, the $ab$ term is quite small. It makes some sense to average $a$ and $b$, getting approximately the growth that (if repeated twice) results in the same growth from $2011$ to $2013$. It makes no sense to average the three.


text:
Q: Vanilla JS - How To Stop Sub-Element's OnClick Method From Calling Parent Elements OnClick Method Having to use VanillaJS (don't ask me why).
Struggling to wrap my head around this simple thing.
Here is my code:

        <input type="radio" id="img-1" name="images" checked="">

        <button class="mod-del-btn" onclick="deleteImage()">>Delete</button>

And view it on a codepen here: https://codepen.io/jacksonjack/pen/MWKgQQK
Now two things should happen:

*

*user should click image and it should popup with an alert "chooseImage".

This works as expected.
However the second thing does not work as expected.

*user should click image and it should popup with an alert "deleteImage".

However it shows "deleteImage" then the "chooseImage".
How do I stop this?

A: This is due to event bubbling.  Use event.stopPropagation() to stop the global event object from bubbling at that moment.  I would also recommend using js to add your event listener so you can grab the event object as an argument rather than having to access it globally.
function chooseImage() {
  alert("chooseImage");
}

function deleteImage() {
  event.stopPropagation()
  alert("deleteImage");
}

A: Like I already wrote in my comment, you may use stopPropagation() to stop the bubbling of events.
However, in this case it would suffice to just put the click event from the div to the img, which brings both events to separate siblings.

function chooseImage() {
  alert("chooseImage");
}

function deleteImage() {
  alert("deleteImage");
}
body {
  background: black;
}

        <input type="radio" id="img-1" name="images" checked="">

        <button class="mod-del-btn" onclick="deleteImage()">>Delete</button>

A:

function chooseImage() {
  alert("chooseImage");
}

function deleteImage(e) {
  e.stopPropagation();
  alert("deleteImage");
}

        <input type="radio" id="img-1" name="images" checked="">

        <button class="mod-del-btn" onclick="deleteImage(event)">Delete</button>

Firstly you need to call delete image with event. Then only stopPropagation would work.
<button class="mod-del-btn" onclick="deleteImage(event)">Delete</button>

function deleteImage(e) {
  e.stopPropagation();
  alert("deleteImage");
}


text:
Q: PHP break string into parts I have a string stored into $buffer which holds three informations
tweetid category tweet
eg.
123432 politics 'this is a political tweet'

I want to break it into parts such that 123432 is stored in one variable or array, politics into another array & this is a political tweet (without the quotes) into third array.
Additionally i want to read the third array word by word...
I tried using explode function  but the 'this is a political tweet' also got broken into parts...

A: Continue to use the explode() function but specify the maximum number of explodes to perform.
php.net description: array explode ( string $delimiter , string $string [, int $limit ] )
explode(' ', $buffer, 3);

This should then give you
array(3) {
    [0]=>123432
    [1]=>politics
    [2]=>this is a political tweet
}

Edit:
If you need to remove the ' from the beginning and the end of the tweet string then use the PHP trim functions.
rtrim(ltrim(array[2], "'"), "'");

A: explode accepts a limit number.
var_dump(explode(' ', "123432 politics 'this is a political tweet'", 3));

The result will be the following:
array(3) {
    [0]=> string(5) "23432"
    [1]=> string(8) "politics"
    [2]=> string(27) "'this is a political tweet'"
}


text:
Q: Data Structure for KeyBoardEvents C++ I am working on an input system as part of a tutorial I am watching, and much to my google searching, I find only one method online for handling input via a switch statement in your application loop.
I can't find examples where the tutorial really takes in mod keys like shift, alt and ctrl.  I found enough that I can properly pull what the current mods are but I can not find a convenient way to achieve what I would like to do.
My plan was to have an input class that is part of an application class.  The input can be passed to the window and game objects so that way I have a single input state system for the entire program. I wanted register callback functions from within the game or the window as necessary, and the only way I know how is via <functional>.  I thought I could have a std::map<key scancode,std::function<void()>> sort of situation.  However, since I need to account for modding of the key, is there a way to generate a unique key value combined of scancode and mods, for example a, shift + a and ctrl+a?
Right now my solution I think is a bit hacked as I would need to have a unique std::map set for each modifier combination.
Current Registration (minus implementation of inserting the key/func pair into the map), but I would essentially need an individual map for each if block below.  Is there a better way to manage this?
void Register(SDL_KeyboardEvent key, std::function<void()> func ) {

    if( !( key.keysym.sym == SDLK_LSHIFT || key.keysym.sym == SDLK_RSHIFT || key.keysym.sym == SDLK_LCTRL || key.keysym.sym == SDLK_RCTRL || key.keysym.sym == SDLK_LALT || key.keysym.sym == SDLK_RALT )) {

        if( (( key.keysym.mod & ( KMOD_LSHIFT | KMOD_RSHIFT )) > 0 ) && (( key.keysym.mod & ( KMOD_LCTRL | KMOD_RCTRL )) > 0 ) && (( key.keysym.mod & ( KMOD_LALT | KMOD_RALT ))  > 0  )) {
            std::cout << "Ctrl + Alt + Shift + " << key.keysym.sym  << std::endl;
        }
        else if ( (( key.keysym.mod & ( KMOD_LSHIFT |  KMOD_RSHIFT )) > 0 ) && (( key.keysym.mod & ( KMOD_LCTRL | KMOD_RCTRL )) > 0 )) {
            std::cout << "Shift + Ctrl + " << key.keysym.sym << std::endl;
        }
        else if ( (( key.keysym.mod & ( KMOD_LSHIFT |  KMOD_RSHIFT )) > 0 ) && (( key.keysym.mod & ( KMOD_LALT | KMOD_RALT ))  > 0 )) {
            std::cout << "Shift + Alt + " << key.keysym.sym << std::endl;
        }
        else if ( (( key.keysym.mod & ( KMOD_LCTRL | KMOD_RCTRL )) > 0 ) && (( key.keysym.mod & ( KMOD_LALT | KMOD_RALT ))  > 0 )) {
            std::cout << "Ctrl + Alt + " << key.keysym.sym << std::endl;
        }
        else if (( key.keysym.mod & ( KMOD_LSHIFT |  KMOD_RSHIFT )) > 0 ) {
            std::cout << "Shift + " << key.keysym.sym << std::endl;
        }
        else if (( key.keysym.mod & ( KMOD_LALT | KMOD_RALT )) > 0 ) {
            std::cout << "Alt + " << key.keysym.sym << std::endl;
        }
        else if (( key.keysym.mod & ( KMOD_LCTRL | KMOD_RCTRL )) > 0 ) {
            std::cout << "Ctrl + " << key.keysym.sym << std::endl;
        }
        else {
            std::cout << "Unmodded " << key.keysym.sym << " MODS: " << key.keysym.mod << std::endl;
        }

    }
}

Currently:
std::map<key,std::function<void()>> Callbacks;

struct key {
    SDL_Scancode code;
    Uint16       kmod;

    bool operator<( const key & okey) const {
        return std::tie( code,kmod ) < std::tie( okey.code,okey.kmod );
    }
};

void Input::RegCallBack(SDL_Scancode k, Uint16 kmod, std::function<void()> func) {
key tkey;
tkey.code = k;
tkey.kmod = kmod;

Callbacks[tkey] = func;  //Does not like this.

return;
}

Intellisense error is:

Error: no instance of overloaded function "std::map<_Kty,_Ty,_Pr,_Alloc>::insert [with _Kty=key,_Ty=std::function,_Pr=std::less,_Alloc=std::allocator>>]" matches the argument list argument types are:( std::pair>)
object type is: std::map, std::less, std::allocator>>>

And the following is from the compiler output
1>------ Build started: Project: 3D Game Tut, Configuration: Debug Win32 ------
1>Build started 7/22/2015 3:31:55 PM.
1>InitializeBuildStatus:
1>  Creating "Debug\3D Game Tut.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  Input.cpp
1>c:\users\frizzlefry\documents\visual studio 2012\projects\3d game tut\3d game tut\input.cpp(65): error C2679: binary '[' : no operator found which takes a right-hand operand of type 'Input::key' (or there is no acceptable conversion)
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(173): could be 'std::function<_Fty> &std::map<_Kty,_Ty>::operator [](key &&)'
1>          with
1>          [
1>              _Fty=void (void),
1>              _Kty=key,
1>              _Ty=std::function<void (void)>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(190): or       'std::function<_Fty> &std::map<_Kty,_Ty>::operator [](const key &)'
1>          with
1>          [
1>              _Fty=void (void),
1>              _Kty=key,
1>              _Ty=std::function<void (void)>
1>          ]
1>          while trying to match the argument list '(std::map<_Kty,_Ty>, Input::key)'
1>          with
1>          [
1>              _Kty=key,
1>              _Ty=std::function<void (void)>
1>          ]
1>  Generating Code...
1>  Compiling...
1>  Game.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\utility(201): error C2079: 'std::pair<_Ty1,_Ty2>::first' uses undefined struct 'key'
1>          with
1>          [
1>              _Ty1=const key,
1>              _Ty2=std::function<void (void)>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(498) : see reference to class template instantiation 'std::pair<_Ty1,_Ty2>' being compiled
1>          with
1>          [
1>              _Ty1=const key,
1>              _Ty2=std::function<void (void)>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(593) : see reference to class template instantiation 'std::_Tree_node<_Value_type,_Voidptr>' being compiled
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(592) : while compiling class template member function 'std::_Tree_node<_Value_type,_Voidptr> *&std::_Tree_val<_Val_types>::_Left(std::_Tree_node<_Value_type,_Voidptr> *)'
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *,
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(864) : see reference to function template instantiation 'std::_Tree_node<_Value_type,_Voidptr> *&std::_Tree_val<_Val_types>::_Left(std::_Tree_node<_Value_type,_Voidptr> *)' being compiled
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *,
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(766) : see reference to class template instantiation 'std::_Tree_val<_Val_types>' being compiled
1>          with
1>          [
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(884) : see reference to class template instantiation 'std::_Tree_alloc<_Al_has_storage,_Alloc_types>' being compiled
1>          with
1>          [
1>              _Al_has_storage=false,
1>              _Alloc_types=std::_Tree_base_types<std::pair<const key,std::function<void (void)>>,std::allocator<std::pair<const key,std::function<void (void)>>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(996) : see reference to class template instantiation 'std::_Tree_buy<_Ty,_Alloc>' being compiled
1>          with
1>          [
1>              _Ty=std::pair<const key,std::function<void (void)>>,
1>              _Alloc=std::allocator<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(1029) : see reference to class template instantiation 'std::_Tree_comp<_Pr_has_storage,_Traits>' being compiled
1>          with
1>          [
1>              _Pr_has_storage=false,
1>              _Traits=std::_Tmap_traits<key,std::function<void (void)>,std::less<key>,std::allocator<std::pair<const key,std::function<void (void)>>>,false>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(67) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<key,std::function<void (void)>,std::less<key>,std::allocator<std::pair<const key,std::function<void (void)>>>,false>
1>          ]
1>          c:\users\frizzlefry\documents\visual studio 2012\projects\3d game tut\3d game tut\input.h(21) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=key,
1>              _Ty=std::function<void (void)>
1>          ]
1>  Generating Code...
1>  Compiling...
1>  KApp.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\utility(201): error C2079: 'std::pair<_Ty1,_Ty2>::first' uses undefined struct 'key'
1>          with
1>          [
1>              _Ty1=const key,
1>              _Ty2=std::function<void (void)>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(498) : see reference to class template instantiation 'std::pair<_Ty1,_Ty2>' being compiled
1>          with
1>          [
1>              _Ty1=const key,
1>              _Ty2=std::function<void (void)>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(593) : see reference to class template instantiation 'std::_Tree_node<_Value_type,_Voidptr>' being compiled
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(592) : while compiling class template member function 'std::_Tree_node<_Value_type,_Voidptr> *&std::_Tree_val<_Val_types>::_Left(std::_Tree_node<_Value_type,_Voidptr> *)'
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *,
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(864) : see reference to function template instantiation 'std::_Tree_node<_Value_type,_Voidptr> *&std::_Tree_val<_Val_types>::_Left(std::_Tree_node<_Value_type,_Voidptr> *)' being compiled
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *,
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(766) : see reference to class template instantiation 'std::_Tree_val<_Val_types>' being compiled
1>          with
1>          [
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(884) : see reference to class template instantiation 'std::_Tree_alloc<_Al_has_storage,_Alloc_types>' being compiled
1>          with
1>          [
1>              _Al_has_storage=false,
1>              _Alloc_types=std::_Tree_base_types<std::pair<const key,std::function<void (void)>>,std::allocator<std::pair<const key,std::function<void (void)>>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(996) : see reference to class template instantiation 'std::_Tree_buy<_Ty,_Alloc>' being compiled
1>          with
1>          [
1>              _Ty=std::pair<const key,std::function<void (void)>>,
1>              _Alloc=std::allocator<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(1029) : see reference to class template instantiation 'std::_Tree_comp<_Pr_has_storage,_Traits>' being compiled
1>          with
1>          [
1>              _Pr_has_storage=false,
1>              _Traits=std::_Tmap_traits<key,std::function<void (void)>,std::less<key>,std::allocator<std::pair<const key,std::function<void (void)>>>,false>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(67) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<key,std::function<void (void)>,std::less<key>,std::allocator<std::pair<const key,std::function<void (void)>>>,false>
1>          ]
1>          c:\users\frizzlefry\documents\visual studio 2012\projects\3d game tut\3d game tut\input.h(21) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=key,
1>              _Ty=std::function<void (void)>
1>          ]
1>  Generating Code...
1>  Compiling...
1>  Source.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\utility(201): error C2079: 'std::pair<_Ty1,_Ty2>::first' uses undefined struct 'key'
1>          with
1>          [
1>              _Ty1=const key,
1>              _Ty2=std::function<void (void)>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(498) : see reference to class template instantiation 'std::pair<_Ty1,_Ty2>' being compiled
1>          with
1>          [
1>              _Ty1=const key,
1>              _Ty2=std::function<void (void)>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(593) : see reference to class template instantiation 'std::_Tree_node<_Value_type,_Voidptr>' being compiled
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(592) : while compiling class template member function 'std::_Tree_node<_Value_type,_Voidptr> *&std::_Tree_val<_Val_types>::_Left(std::_Tree_node<_Value_type,_Voidptr> *)'
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *,
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(864) : see reference to function template instantiation 'std::_Tree_node<_Value_type,_Voidptr> *&std::_Tree_val<_Val_types>::_Left(std::_Tree_node<_Value_type,_Voidptr> *)' being compiled
1>          with
1>          [
1>              _Value_type=std::pair<const key,std::function<void (void)>>,
1>              _Voidptr=void *,
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(766) : see reference to class template instantiation 'std::_Tree_val<_Val_types>' being compiled
1>          with
1>          [
1>              _Val_types=std::_Tree_simple_types<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(884) : see reference to class template instantiation 'std::_Tree_alloc<_Al_has_storage,_Alloc_types>' being compiled
1>          with
1>          [
1>              _Al_has_storage=false,
1>              _Alloc_types=std::_Tree_base_types<std::pair<const key,std::function<void (void)>>,std::allocator<std::pair<const key,std::function<void (void)>>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(996) : see reference to class template instantiation 'std::_Tree_buy<_Ty,_Alloc>' being compiled
1>          with
1>          [
1>              _Ty=std::pair<const key,std::function<void (void)>>,
1>              _Alloc=std::allocator<std::pair<const key,std::function<void (void)>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(1029) : see reference to class template instantiation 'std::_Tree_comp<_Pr_has_storage,_Traits>' being compiled
1>          with
1>          [
1>              _Pr_has_storage=false,
1>              _Traits=std::_Tmap_traits<key,std::function<void (void)>,std::less<key>,std::allocator<std::pair<const key,std::function<void (void)>>>,false>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(67) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<key,std::function<void (void)>,std::less<key>,std::allocator<std::pair<const key,std::function<void (void)>>>,false>
1>          ]
1>          c:\users\frizzlefry\documents\visual studio 2012\projects\3d game tut\3d game tut\input.h(21) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=key,
1>              _Ty=std::function<void (void)>
1>          ]
1>  Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.70
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

A: Add the meta keys to your maps key type:
struct Shortcut {
 bool shift;
 bool alt;
 // ...
 KeySym sym;
 struct Hasher {
  // some hash algorithm
 };
 // also add equality operator
};

using ShortcutsMap = unordered_map<Shortcut, function<void(void)>, Shortcut::Hash>;

Or, map the set of active / pressed keys to functions;
using ShortcutsMap = unordered_map<unordered_set<Key>, function<void(void)>>;

You need some Key class then, which is capable of holding every pressed key (including meta keys).


text:
Q: Importing Analysis Services 2008 KPI's in a PerformancePoint scorecard I am trying to import a KPI from Analysis Services into a PerformancePoint Scorecard, and when I do, The Dashboard Designer throws an error:

An unknown error has occurred. If the
  problem persists contact an
  administrator. There may be additional
  information in the server application
  event log.

When I examine the event log, I find the following exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AnalysisServices, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.AnalysisServices, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
   at Microsoft.PerformancePoint.Scorecards.Server.ImportExportHelper.GetImportableAsKpis(IBpm pmService, DataSource asDataSource)
   at Microsoft.PerformancePoint.Scorecards.Server.PmServer.GetImportableAsKpis(DataSource dataSource)

I have found this thread which recommends reinstalling Microsoft ADOMD.NET but the installer for that won't run because the server already has a newer version of the product (The server is running SQL Server Analysis Services 2008 which includes Microsoft.AnalysisServices.AdomdClient.dll version 9.0.3042.0)
Anyone have any ideas (short of finding the DLL myself and manually installing it to the GAC)?

A: I believe you want the SQLServer2005_ASOLEDB9 file from the SQL Server 2005 Feature Pack.  If that's not working for you, you could just grab the DLL off of an existing 2005 installation and use that.

A: I did install the SQLServer2005_ASOLEDB9 . Still it does not work. My issue is I could not not able to import KPI  from one database . in the same server i can able to import kpi from remaining databases.

A: http://macraem.wordpress.com/2010/08/25/issues-importing-ssas-2008-kpis-into-performancepoint-2007/

In .NET we can redirect the assembly bindings in the web.config.  I added the following to the Web.Config file for the PPS Monitoring WebService which Dashboard Designer uses to connect to SSAS:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1″>
    <dependentAssembly>
            <assemblyIdentity name="Microsoft.AnalysisServices" publicKeyToken="89845dcd8080cc91″ culture="neutral" />
            <bindingRedirect oldVersion="9.0.242.0″ newVersion="10.0.0.0″/>
    </dependentAssembly>
    </assemblyBinding>
  </runtime>


text:
Q: Edge detection using wavelet I had done Edge detection using wavelet transform using thus steps
      changing the image to Gray scale
       decomposing the image using dwt2(discrete wavelet transform,Haar wavelet filter  ) in to horizontal,vertical,diagonal and approximation(detail)
       further decomposing the horizontal part
       threshold (global threshold like canny Edge detection )
 i got the edge but i got a problem while locating the edge to complete image to mean recovering original image using only the Edges  so i need help concerning this either in concept ,mat lab code or references
           I hope i will get your help soon

A: Before your transformation to gray scale you could try filtering the image of specific color ranges which may simplify the problem.  This is a tactic used to weaken Captchas before sending it off to an OCR like Tesseract
Another tool that may help is a Flood Fill Algorithm.


text:
Q: Is there anything like certbot (auto-renewal) for paid SSL certs? For maximumum compatibility, I want to use simple DV PositiveSSL certs, similar to what Let's Encrypt does.
But the biggest pain in the neck is that I can't find anything which renews automatically when the time comes, like certbot/Let's Encrypt.
Are there any other CLI/script options for paid SSL certs to be auto-renewed, without me having to

*

*Paste in my CSR file

*Wait on an email to confirm

*Wait on an email to get my certs

*Paste in the contents of the cert files on my server

*Reboot apache

Certbot makes it so nice and simple, but only works with Let's Encrypt (which, after Sept 2016, loses a lot of compatibility with slightly older browsers/OSes).

A:
but only works with Let's Encrypt

No, that is not true. Although LE is Certbot's default service, the same ACMEv2 issuance protocol has been implemented by a few other CAs. For example, I have already used it with Sectigo OV certificates (who had a very similar cross-signing issue earlier this year) and with DigiCert OV.
(You just specify a different "--server" URL in Certbot, and when registering the ACME account for the first time provide an "--eab-hmac-key" for associating it with your actual ordering account on that service, a feature specifically added for use by commercial operators.)
The same goes for all other ACMEv2 clients, not just Certbot. The list of CAs supporting this protocol is short but non-zero, and with the recent push by browsers to reduce certificate lifetimes further and further (emphasizing automated renewals), it's only likely to grow.

Aside from ACME, some CAs do also offer the older SCEP protocol as well as custom ordering APIs (DigiCert has two). These may be limited to bulk/enterprise plans though, and you'll have more difficulties finding usable clients.


text:
Q: Is there a grace period for blacklisting in flask-jwt-extended library? I am refreshing access tokens for every requests and blacklisting the previous token. The problem is if there are multiple consecutive requests, the first token is invalidated by the next request. Is there a feature in flask-jwt-extended that implements a grace period before blacklisting a token?
I am reading the docs and can't find this feature. Can you guys direct me to the right path to attain my objective?

A: There is not a way to do this built into the extension. Because Flask-JWT-Extended doesn't have any knowledge of the store you are using to blacklist tokens it wouldn't really make sense to have that be a feature of this extension.
However, because you control the method that checks if a token is revoked or not this would be pretty easy to do. When you store a token to be blacklisted, you can store the timestamp for when it was blacklisted. Then in your callback function that checks if a token is blacklisted, you can compare that timestamp of when the token was blacklisted with the current time minus a timedelta to give the resulting check a grace period.
It might also be a good idea to read this for some alternatives for creating a new token on every request: Flask JWT extend validity of token on each request


text:
Q: Promises Sequenciais - Node Estou tentando criar uma cadeia de Promises sequenciais no Node.js e ele não esta executando uma de cada vez e sim todas!
Deveria executar da seguinte forma:
Promise1 -> (then) -> Promise2 -> (then) -> Promise3 ...
Mas no meu caso, ele está executando todas ao mesmo tempo.
O código é o seguinte:
router.post('/entrega', (req, res) => {

    let pedido = new PedidoDao(req.body);

    Promise.resolve(pedido.isEntregue())
    .then(pedido.setEntrega())
    .then(responseSuccess())
    .catch( err => responseError(err))

    function responseSuccess(){
        res.json({status:true, message: 'Entrega realizada com sucesso.'});
    }

    function responseError(message){
        res.json({status:false, message: message});
    }

});

Todas as funções de PedidoDao retornam uma promise(resolve, reject).
Eu fiz a função setEntrega() retornar um reject proposital, mas mesmo assim a função responseSucces é executada de cara. Depois de 1 segundo estoura o reject da função setEntrega e cai no catch, porém já houve uma resposta de sucesso na API.
Pode ser que eu esteja viajando, mas eu não queria usar async/await para fazer esse tipo de sequenciamento. Será possível fazer com Promise ou não?
Forte abraço.
EDIT: Possível solução
Fiz essa edição no código e agora ele está seguindo a sequência... Seria este o modo correto de escrever mesmo?
router.post('/entrega', (req, res) => {

    let pedido = new PedidoDao(req.body);

    Promise.resolve(pedido.isEntregue())
    .then(() => pedido.setEntrega())
    .then(() => responseSuccess())
    .catch( err => responseError(err))

    function responseSuccess(){
        res.json({status:true, message: 'Entrega realizada com sucesso.'});
    }

    function responseError(message){
        res.json({status:false, message: message});
    }

});

A: O problema é que você só está executando a função sem retornar a promessa da função subsequente. Então você pode mudar seu código para:
// ...
Promise.resolve(pedido.isEntregue())
  .then(function() { return pedido.setEntrega(); })
  .then(function() { return responseSuccess(); })
  .catch(err => responseError(err));
// ...

Ou:
// ...
Promise.resolve(pedido.isEntregue())
  .then(pedido.setEntrega)
  .then(responseSuccess)
  .catch(err => responseError(err));
// ...

Dessa forma você informa para o encadeamento qual a promessa que ele deve aguardar.


text:
Q: Can event listeners be used rather than an interval to check if a variable is a certain value? Currently, I am using an interval to find out whether the introductary music of my game has finished.
 Musictimeout = setInterval(function () {
                if (Initialmusic.currentTime > 313) {
                    Loopingmusic.play();
                    Loopingmusic = true;
                    clearInterval(Musictimeout);
                }
 }, 10);

However, this slows down the gameplay quite consideably until the interval is cleared. Can I use eventlisteners instead of an interval in this situation?

A: In answer to your main question, there are no generic, built-in event listener that will fire when the value of a variable in javascript changes.
But, if your variable is time related (which a property named currentTime sounds like it might be, then you could probably use a cleverly set setTimeout() to know exactly when to check it's value rather than trying to check every 10ms like you're doing now.  We'd have to know more about what exactly you're trying to do and what exactly Initialmusic.currentTime is to know what better to suggest.  For example, if you want to know when a particular point in playback is hit, you should be able to register for the start/stop events and just keep your own timer going that should tell you approximately when you get to the desired playback time.
If you are just waiting until the audio completes, then you can just register for the audio event for when it has ended which is the "ended" event.  See here for media events.
In addition, for modern browsers only, if you control the creation of Initialmusic.currentTime, then you could define a setter function that would trigger a notification to you any time its value is changed.  See this code example: https://gist.github.com/eligrey/384583.  I don't know if this type of solution would work for an audio host object (I'm guessing it probably would not).  You would have to try it in multiple modern browsers to see.


text:
Q: How to send a message from end device to multiple Application server in loRaWAN? I am trying to understand in LoRaWAN, how can send a message from an end-device to more than one Application server? Do messages reach the application servers by addressing AppEUI? If so, can we set more than one APPEUI as destination for LoRa end-device?

A: finally, I could get a reply from  the things network forum . The reply is that it is not possible. An end device can only be active in one LoRaWAN network and that network will only process the message on one application server. Once it gets to the application server multiple other servers could subscribe to the data feed using MQTT

A: AppEUI is not addressing an Application Server. AppEUI is addressing the JoinServer of the device. If the applied Network Server is not connected to any external Join Server, the AppEUI is not used for Join Server selection at all. In that case all Join Requests are answered by the default, embedded Join Server.
In the LoRaWAN1.1 spec the confusing name: AppEUI has been renamed to JoinEUI.
A LoRaWAN end device can communicate to several Application Servers. The message routing between the end device and Application Servers is done based on the FPort of the LoRaWAN uplink message. For example you can set on the NS that FPort=100 is routed to AS1 and FPort=101 is routed to AS2. It is also possible that the NS sends messages simultaneously to several AS. All these routing options are supported by Actility's ThingPark NS.


text:
Q: Javascript onclick/onload cross domain tracker I'm trying to build a 'function' tracker or something like that which sends a request to the server if the function is triggered.
I have just one problem, how to trigger the function on a button, which redirects to the other domain.
If I use the onclick='' the function is executed, but it doesn't have time to send(or get back) the request to server.
The main point would be to make it fire once the target url is loaded.
Is it possible to do so with Javascript? Something with target onload, set timeout somewhere, or if the target is loaded the execute this and that?
I've tried to do trigger it this way, but it doesn't work:
click here to load it

click here to load it

Any other ideas are welcomed:)
Thx for help.

A: You have to execute the javascript function first and do a redirection in the function itself.
function trackfunction() {
    /*
        Tracking code
    */

    window.location.href = "http://stackoverflow.com/";
}

Remove the href attribute from the  tag otherwise give href = "#".


text:
Q: Next 13 Image Sizing in Flexbox I am building a website with Next.js 13 and Tailwind. I am currently stuck with a simple flexbox size problem. However, can't find a solution. My goal is that the two FlexboxItems have the same width for medium and larger screens and the same height for smaller screen dimensions.
The one with the width on larger screens also works. Only on smaller screens are the items not of the same height.

Text

              <Image
                 src={FreeSquareImg}
                 alt="Sample"
                 className="rounded-3xl"/>

A: You can give equal height h-1/2 to both the div and control the width of the image so that it does not comes of the green div.
Below is the code that help you

Text

    <image src="http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/nebula_blue.s2014.png" alt="Sample" class="mx-auto w-1/2 rounded-3xl sm:w-full sm:p-12" />

You can also view the mobile and other screen view here