text:
Q: Number of critical points of smooth functions on $S^1$ Let $u$ be a smooth function on the unit circle $S^1$ such that $\int_{S^1}ux_j=0$, for $j=1,2$. Is the number of critical points of $u$ strictly bigger than 2?

A: An elementary argument: write $u$ as a function of
 $\theta \in T^1 := {\bf Z} / 2 \pi {\bf Z}$,
where $(x_1,x_2) = (\cos \theta, \sin \theta)$.  Then each of
$$
\int_{T^1} u'(\theta) \, d\theta,
\quad
\int_{T^1} u'(\theta) \cos \theta \, d\theta,
\quad
\int_{T^1} u'(\theta) \sin \theta \, d\theta
$$
vanishes (the first is clear, and the other two are obtained from
$$
\int_{T^1} u(\theta) \sin \theta \, d\theta
 = \int_{T^1} u(\theta) \cos \theta \, d\theta
 = 0
$$
by integration by parts).
Thus if $u'$ has only finitely many zeros in $T^1$
then it has at least four sign changes, by an argument
that I already gave for
this
Math.SE question.
Assume $u'$ had only two sign changes in each period,
say at $\theta_1$ and $\theta_2$.  Then we could find reals $A,B,C$
such that $t(\theta) = A + B \cos \theta + C \sin \theta$ has sign changes
at the same $\theta_1$ and $\theta_2$ and nowhere else; but then
$u'(\theta) \, t(\theta)$ is either everywhere $\geq 0$ or everywhere $\leq 0$,
but is not everywhere zero, which contradicts
$\int_{T^1} u'(\theta) \, t(\theta) \, dx = 0$, and we're done.
(To find $A,B,C$ we can go back to the $S^1$ picture:
 consider the points
$(\cos \theta_1, \sin \theta_1)$ and $(\cos \theta_2, \sin \theta_2)$
on the circle $x_1^2 + x_2^2 = 1$, and join them by a line
$A+Bx_1+Cx_2 = 0$, which meets the circle at those two points
and thus nowhere else.)

A: Yes, in fact the number of critical points of $u$ is at least four.
Expand $u:S^1\to\mathbb R$ as a Fourier series:
$$u(\theta)=a_0+\sum_{i=1}^\infty a_j\cos(j\theta)+b_j\sin(j\theta)$$
Then your condition may be stated as $a_1=b_1=0$ (I assume by $x_1$ and $x_2$, you mean to be identifying $S^1$ with $\{x_1^2+x_2^2=1\}$, so $x_1=\cos\theta$ and $x_2=\sin\theta$ in the notation above).
Now let $u(t,\theta)$ be the solution to the heat equation $u_t=u_{\theta\theta}$ with initial value $u(0,\theta)=u(\theta)$.  By the maximum principle, we have:
$$\#\operatorname{crit}(u(\cdot))\geq\#\operatorname{crit}(u(t,\cdot))$$
for all $t\geq 0$.  On the other hand, we have the explicit solution:
$$u(t,\theta)=a_0+\sum_{i=1}^\infty a_je^{-j^2t}\cos(j\theta)+b_je^{-j^2t}\sin(j\theta)$$
Let $j_0=\min\{j\geq 1:(a_j,b_j)\ne(0,0)\}$.  If $j_0=\infty$ (i.e. only $a_0$ is nonzero), then $u$ is constant and there is nothing to prove, so therefore we have $1<j_0<\infty$.
Now the behavior of the function $u(t,\cdot)$ for large $t$ is evidently dominated by the leading terms:
$$u(t,\theta)=a_0+e^{-j_0^2t}\left[a_{j_0}\cos(j_0\theta)+b_{j_0}\sin(j_0\theta)\right]+\cdots$$
Writing $a_{j_0}\cos(j_0\theta)+b_{j_0}\sin(j_0\theta)=\Re\left[(a_{j_0}-ib_{j_0})e^{j_0\theta}\right]$, it follows that for sufficiently large $t$, we have:
$$\#\operatorname{crit}(u(t,\cdot))=2j_0$$
Since $j_0\geq 2$, this gives the desired result.


text:
Q: GW invariants for varieties with negative first Chern class  Does there exist any theorem claiming that if a variety with negative first Chern class has no rational curves then every GW invariant is zero?

A: EDITED.
The first version of this answer contained correct information, but was answering not the question that was asked:))
So here is the new version of the answer.
1) If a variety with ample canonical bundle does not have rational curves then, indeed, its RATIONAL GW invariants vanish. Because GW invariants can be counted via algebraic geometry and the corresponding moduli spaces will be empty.
But this will not imply that all GW invariants vanish. Indeed, you can take
minimal  complex surfaces of general type with $b_+>1$. Then the GW invariant is non-zero, the canonical curve gives a non-zero contribution. But of course it has a non-zero genus.

The following is a discussion of vanishing and non-vanishing of GW invariants of varieties of general type. This was my previous answer. This is not immediately related to the question, but I decided to leave it here because it may be helpfull (for somebody).
Hypersurfaces of degree $2n-1$ and less in $CP^n$  always contain lines. And for $2n-1>n+1$ this will be an example of a manifold with ample canonical bundle.
I think it should be possible to show that for these hypersurfaces their rational GW invariants are non-zero, though I am not aware if such a calculation has been done for all these examples.
There was a related discussion here:
Why is a variety of general type hyperbolic?
Nethertheless "morally" it is ture that for a large part of varieties of general type of dimesnion at least 4 with ample canonical bundle GW invarinats vanish. For example, it is conjectured that a "generic" hypersurfaces of degree $d\ge 2n+1$ in $CP^n$ does not contain rational curves (you need generic here becasue for every d there will be a hypersurface that contains a line). This is a hard conjecture. But it implies that rational GW invariant of such varieties vanishes.
A different thing that can be said about varieties of general type is that they are not projectively unirulled and this can be seen as vanishing of certain rational GW invariants. This follows from a result of Kollar and Ruan. You can see the discussion on page 4 of the following paper:
SYMPLECTIC BIRATIONAL GEOMETRY
http://arxiv.org/PS_cache/arxiv/pdf/0906/0906.3265v1.pdf

redpajama_set_name: RedPajamaStackExchange


text:
Q: Fixed points of $\phi_a(z)$
Prove that $\phi_a(z)=\frac{a-z}{1-\bar az}$ , $0<|a|<1$ has exactly two fixed points ; one inside the unit disc and the other outside the unit disc.

Putting $\phi_a(z)=z$ I find that there are exactly two fixed points which are $$\frac{1\pm \sqrt{1-|a|^2}}{\bar a}.$$
I am unable to find out the second part.
Let $z_1=\frac{1- \sqrt{1-|a|^2}}{\bar a}$. From $0<|a|<1$ , we get $z_1<\frac{1}{\bar a}=\frac{a}{|a|^2}$. Then , $|z_1|<\frac{1}{|a|}$. But how I show that $|z_1|<1$ so that I can say that $z_1$ lies inside the circle ?

A: You are solving the quadratic
$$\def\abar{\overline a}\abar z^2-2z+a=0\ .$$
By the usual product-of-roots formula we have
$$z_1z_2=a\,/\,\abar$$
and so
$$|z_1||z_2|=|a\,/\,\abar|=1\ .$$
Therefore one of $z_1$ and $z_2$ has modulus less than $1$, the other greater.
(It could be that both have modulus equal to $1$, but it is not very hard to see that this is impossible.)

A: $z_1\overline{a}=1-\sqrt{1-x^2}, x = |a|\to (|z_1||\overline{a}|)^2 =1-2\sqrt{1-x^2}+1-x^2\to bx^2= 2-x^2-2\sqrt{1-x^2}$. Thus we can prove: $2-x^2-2\sqrt{1-x^2} < x^2 \iff 1-x^2 < \sqrt{1-x^2}$ which is true since $0 < 1-x^2 < 1$. Thus $b = |z_1| < 1$


text:
Q: why $(window).load() is not working in jQuery? I'm learning jQuery using visual studio and testing my code in Chrome browser. This is my HTML code
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script src="jquery-3.1.0.js"></script>

    <script type="text/javascript">
        $(window).load(function () {
            alert("Window Loaded");
        });
    </script>
</head>
<body>

</body>
</html>

This is my solution explorer

Now why my browser doesn't alert "window Loaded"?

A: <script type="text/javascript">
   $(window).ready(function () {
      alert("Window Loaded");
   });
</script>

A: You're using jQuery version 3.1.0 and the load event is deprecated for use since jQuery version 1.8. The load event is removed from jQuery 3.0. Instead you can use on method and bind the JavaScript load event:
 $(window).on('load', function () {
      alert("Window Loaded");
 });

A: In short, the FIRST answer is the CORRECT one:
$(window).on('load', function () {
  alert("Window Loaded.");
});

I have to write a whole answer separately since it's hard to add a comment so long to the second answer.
I'm sorry to say this, but the second answer above doesn't work right.
The following three scenarios will show my point:
Scenario 1: Before the following way was deprecated,
  $(window).load(function () {
     alert("Window Loaded.");
  });

if we execute the following two queries:
<script>
   $(window).load(function () {
     alert("Window Loaded.");
   });

   $(document).ready(function() {
     alert("Dom Loaded.");
   });
</script>,

the alert (Dom Loaded.) from the second query will show first, and the one (Window Loaded.) from the first query will show later, which is the way it should be.
Scenario 2: But if we execute the following two queries like the second answer above suggests:
<script>
   $(window).ready(function () {
     alert("Window Loaded.");
   });

   $(document).ready(function() {
     alert("Dom Loaded.");
   });
</script>,

the alert (Window Loaded.) from the first query will show first, and the one (Dom Loaded.) from the second query will show later, which is NOT right.
Scenario 3: On the other hand, if we execute the following two queries, we'll get the correct result:
<script>
   $(window).on("load", function () {
     alert("Window Loaded.");
   });

   $(document).ready(function() {
     alert("Dom Loaded.");
   });
</script>,

that is to say, the alert (Dom Loaded.) from the second query will show first, and the one (Window Loaded.) from the first query will show later, which is the RIGHT result.
That's why the FIRST answer is the CORRECT one:
$(window).on('load', function () {
  alert("Window Loaded.");
});

A: in jquery-3.1.1
$("#id").load(function(){
//code goes here
});

will not work because load function is no more work

A: I am using latest 3.6.1 jQuery and the document.ready and window.load were not executed in correct sequence; sometime document.ready used to execute after window.load.  Using below script the sequence of execution is working fine for me.

//If you want the earliest event use native code (similar to document.ready function)
document.addEventListener("DOMContentLoaded", function () {
    console.log("01. DOMContentLoaded");
})

//If you want to trigger event after window load (after all assets are loaded)
window.addEventListener('load', function () {
    console.log("02. Window onload event");
});


text:
Q: Neo4J variable-length pattern Is it possible to write a Cypher query with a variable-length patter, that specifies that nodes between the start and end node can only be nodes with a certain property?
I think that a query like the following would match all of the below patterns:
MATCH p=(n:Node {foo:"True"})<-[:REL*0..2]-(:Node)<-[:REL]-(:Node {bar:"True"})
(n:Node {foo:"True"})                                        <-[:REL]-(:Node {bar:"True"})
(n:Node {foo:"True"})                    <-[:REL]-(:Node)    <-[:REL]-(:Node {bar:"True"})
(n:Node {foo:"True"})  <-[:REL]-(:Node)  <-[:REL]-(:Node)    <-[:REL]-(:Node {bar:"True"})

I imagine it "copying" the <-[:REL]-(:Node) part of the query 0 to 2 times in between the (n:Node {foo:"True"}) and  <-[:REL]-(:Node {bar:"True"}) query parts and constructing some kind of UNION of the matches.
Is this the right way to think about it? And how would i make the variable-lenght query match only paths where the middle nodes have the property {bar:"True"} in the middle nodes like so:
(n:Node {foo:"True"})                                                    <-[:REL]-(:Node {bar:"True"})
(n:Node {foo:"True"})                          <-[:REL]-({bar:"True})    <-[:REL]-(:Node {bar:"True"})
(n:Node {foo:"True"})  <-[:REL]-({bar:"True})  <-[:REL]-({bar:"True})    <-[:REL]-(:Node {bar:"True"})

Would the query below be the right approach?
MATCH p=(n:Node {foo:"True"})<-[:REL*0..2]-(:Node {bar:"True"})<-[:REL]-(:Node {bar:"True"})
It appears to me that this is not the case. Can somebody clearify on where I am going wrong in my thinking process?

A: I think it'd be easy if foo were a relationship property, instead of a node property.
Create a simple example:
MERGE (a:Node {name:"a", foo:True})
MERGE (b:Node {name:"b", bar:True})
MERGE (c:Node {name:"c", bar:True})
MERGE (d:Node {name:"d", bar:False})
MERGE (e:Node {name:"e", bar:True})
MERGE (a)<-[:REL]-(b)
MERGE (b)<-[:REL]-(c)
MERGE (a)<-[:REL]-(d)
MERGE (d)<-[:REL]-(e)

I think you want to match nodes b and c, but not e because we'd have to traverse d which has foo:False.
Make bar a property on the relationships:
MATCH ()<-[r:REL]-(n:Node)
SET r.bar = n.bar

Now you can write:
MATCH (:Node {foo:True})<-[:REL*0..2 {bar:True}]-(n:Node)
RETURN n.name

Which returns b and c as required.

A: MATCH path=(:Node {foo:True})-[:REL*0..2]-(n:Node {bar:True})
WHERE all(x in nodes(path) WHERE x.bar=True OR x.foo=True)
RETURN n.name


text:
Q: How do I change a specific div style using Jquery? the image represents the html code:
fullimage: http://i.stack.imgur.com/izqd6.png
and this is my jquery code:
$(".transaContentEdit").click(function(e) {
   alert($(this).closest(".transe_row").find(".edit_transa").attr("class"));
   $(this).closest(".transe_row").find(".edit_transa").show();

});

the alert returns me undefined; The main idea is when i click on .transaContentEdit, i want to "show" the .edit_transa class. What is wrong with my code ?

A: $(".transaContentEdit").click(function(e) {
   $(this).parents(".transe_row").parent().find(".edit_transa").show();
});

A: .transaContentEdit is at the same level with .edit_transa so you can't use .find() because .find() is use just to find childs from an element. You can try something like this:
$(".transaContentEdit").click(function(e) {
     alert($(this).closest(".transe_row").parent().find(".edit_transa").attr("class"));
     $(this).closest(".transe_row").parent().find(".edit_transa").show();
});


text:
Q: How to test xslt in camel route In my blueprint.xml from direct-vm I receive some xml1
<route trace="true" id="someRoute">
            <from uri="direct-vm:someRoute"/>
            <setBody>
                <simple>${body[0]}</simple>
            </setBody>
            //here I have xml1
            <to id="xslt1" uri="xslt:somefile.xsl"/>
            //here I have transformed xml1 to xml2
            <to uri="{{someSite}}"/>
            //here I receive response from someSite in xml3
            <to id="xslt2" uri="xslt:somefile2.xsl"/>//transform it to xml4
            <to uri="direct-vm:service"/>
</route>

How can I test every xslt in my route?
I don't understand how to mock xslt

A: If I understood the question, what you want is to test each XSLT transformation in isolation.
In that case, what you need to do is writing some unit tests. I find Juxy really useful for that purpose (have an eye on the 'samples' directory and you'll probably get the grasp in a minute).


text:
Q: If and or operator django admin models Im trying to make some kind of logic function  " sufficient_information_provided " which returns boolean. As for now im new to python syntax.. i would appreciate if anyone could help figure this out,  here is the model in django app
class FamilyMember(models.Model):
    transaction = models.ForeignKey(Transaction, on_delete=models.CASCADE)
    family_group = models.ForeignKey(FamilyGroup,
                                on_delete=models.CASCADE,
                                null=True,
                                blank=True)
    name = models.CharField(max_length=100, null=True, blank=True)
    date_of_birth = models.DateField(null=True, blank=True)
    relationship = models.ForeignKey(Relationship, on_delete=models.PROTECT)
    dependant_child_age_range = models.ForeignKey(DependantChildAgeRange,
                                            null=True,
                                            blank=True,
                                            on_delete=models.PROTECT)
    care_percentage = models.PositiveSmallIntegerField(
        null=True, blank=True, validators=[
            MaxValueValidator(100),
        ]
    )
    income = models.DecimalField(max_digits=6,
                            decimal_places=2,
                            null=True,
                            blank=True)

And here is the function in same .py folder
@property
def sufficient_information_provided(self):
    b = ('Tenant', 'Partner')
    if (
        self.name and
        self.date_of_birth and
        self.relationship and(
            (
            self.relationship.name not in b and
                self.dependant_child_age_range
            ) or (
                self.relationship.name in b and
                self.income
            )
        )
    ):
        return True
    return False

What i'm trying to do is:

*

*when relationship.name not in the tuple and dependant_age_range is not None

*and when relationship.name is in the tuple and self.income is not None
It returns True else returns False.
here is how the admin looks.

A: For code clarity, you can use a combination of all and any:

*

*all will return True if all elements of the iterable return True.

*any will return True if at least one element of the iterable returns True.

So your function – I just copied the algorithm without questioning it - could look like:
def sufficient_information_provided(self):
    b = ["Tenant", "Partner"]

    return all(
        [
            self.name,
            self.date_of_birth,
            self.relationship,
            any(
                [
                    (
                        self.relationship.name not in b
                        and self.dependant_child_age_range
                    ),
                    (self.relationship.name in b and self.income),
                ]
            ),
        ]
    )


text:
Q: Why am I not able to use "Routes" from react-router-dom even though it is version 6? It shows error I have been trying to us 'Routes' from react-router-dom like this import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';  And I call it here:
const NavPage = () => {
  return (
    <React.Fragment>
      <section>
        <Routes>
        <Route path="/home" element={<Home />} />
        <Route path="/goals" element={<Goals />} />
        <Route path="/meetings" element={<Meetings />} />
        <Route path="/tasks" element={<Tasks />} />
        <Route path="/reviews" element={<Reviews />} />
        <Route path="/feedback" element={<Feedback />} />
        <Route path="/recognitions" element={<Recognitions />} />
        <Route path="/notes" element={<Notes />} />
        </Routes>
      </section>
    </React.Fragment>
  );
};

And it throws an error:
export 'Routes' (imported as 'Routes') was not found in 'react-router-dom' (possible exports: BrowserRouter, HashRouter, Link, MemoryRouter, NavLink, Prompt, Redirect, Route, Router, StaticRouter, Switch, generatePath, matchPath, useHistory, useLocation, useParams, useRouteMatch, withRouter)
My react-router-dom version is 6
enter image description here
I tried using Switch but it is not working for me

A: According to the image you have react-router-dom@^5.1.2 installed.

The latest version is v6.8.0. It looks like your IDE is just informing you what the latest version is when you hover over that dependency.
If you want to use the v6.8.0 then you'll need to actually install it and update your project's package.json file.
From the terminal in the project's root directly run the following command to update to v.6.8.0 and update the package.json file.
npm install --save react-router-dom@latest

From here the project should have all the RRDv6 components available to it.
react-router-dom re-exports all of react-router so there's no need to have is listed additionally as a dependency, especially if it is still the previous version. If react-router is installed, uninstall it, then install react-router-dom@6.
npm uninstall --save react-router


text:
Q: Maya – Strokes on Live Mesh I searched for tutorials on how to achieve that effect that I can draw strokes onto live surfaces via API like that:

Also, I looked up to search for examples inside the "devkit" that Maya offers, the hint got was I have to use the class "mpxToolCommand", but to my surprise, those examples which use that class does not work with Maya 2020 because of the viewport 2.0 somehow.
I wish I could show some code but unfortunately, I actually don't know where to begin, does anyone have a little hint to guide me into the right direction?


text:
Q: plotting label names onto 3D plot generated by plot3d (rgl) I would like to plot results from a MDS analysis with 3 dimensions using plot3d() (rgl). Data and code look like this:
   threedim$points
              [,1]        [,2]      [,3]        [,4]
   Dutch      -6.45931417  -2.1589222 -5.829244  -0.4891066
   German     -7.27770201   0.2666916 -2.198595   6.8658602
   Albanian    4.11799731   0.6810336 11.356935  -2.2623921
   Armenian   13.58431670  21.6527626 -2.245146   6.3506665
   French     -0.24170759  -0.8579159 14.197611  -0.1871443

   threedim$points[,1] -> x
   threedim$points[,2] -> y
   threedim$points[,3] -> z
   library(rgl)
   plot3d(x,y,z)
   text(c("Dutch","German","Albanian","Armenian","French"))

I get the following error message:

"Warning message:
  In xy.coords(x, y, recycle = TRUE) : NAs introduced by coercion"

What am I doing wrong?

A: Use text3d rather than trying to mix text (base graphics) with rgl graphics ...
dat <- read.table(textConnection(
"nation    x y z w
Dutch      -6.45931417  -2.1589222 -5.829244  -0.4891066
German     -7.27770201   0.2666916 -2.198595   6.8658602
Albanian    4.11799731   0.6810336 11.356935  -2.2623921
Armenian   13.58431670  21.6527626 -2.245146   6.3506665
French     -0.24170759  -0.8579159 14.197611  -0.1871443"),
header=TRUE,as.is=TRUE)

library(rgl)
with(dat,plot3d(x,y,z))
with(dat,text3d(x,y,z,nation))


text:
Q: How to calculate mu on a rough inclined plane I'm sorry that I can only give the question here but I have no idea how to calculate $\mu$. Question is as follows:
A body is projected at $24\text{ft/sec}$ up a rough plane inclined at $\text{tan}^{-1} \frac{7} {24} $ to the horizontal. With what velocity does it return to the point of projection?
Despite several attempts, I have been unable to calculate  $\mu$ and therefore can not find retardation or acceleration. I have tried looking at the point where instantaneous velocity is zero but if I take retardation and acceleration as zero at this point then I end up in a bit of a pickle! If anyone can offer any helpful advice/hints then I would be extremely grateful.


text:
Q: Which was the very first music player application for Linux? I'm writing an article about FOSS and Linux music players. What was the very first music player application for Linux? Was there ever a time when the players didn't support proprietary formats like MP3s?

A: The first application that I ever came across that could play .wav or .mp3 files was sox. It was available on Solaris 2.5.1 when I first found out about it. I believe it predates that as well.
I was using sox in 1997.
The wikipedia page has it pegged at 1991. Incidentally the app is named SoX, for Sound Exchange.
excerpt from history section of wikipeidia page

SoX was created in July 1991 by Lance Norskog and posted to the Usenet
  group alt.sources as Aural eXchange: Sound sample translator. With the
  second release (in November the same year) it was renamed Sound
  Exchange. Norskog continued to maintain and release SoX via Usenet,
  FTP, and then the web until early 1995, at which time SoX was at
  version 11 (gamma). In May 1996, Chris Bagwell started to maintain and
  release updated versions of SoX, starting with version sox-11gamma-cb.
  In September 2000, Bagwell registered the project at SourceForge with
  project name "sox". The registration was announced on the 4 September
  2000[citation needed] and SoX 12.17 was released on 7 September 2000.
  Throughout its history SoX has had many contributing authors; Guido
  van Rossum, best known as creator of the Python programming language,
  was a significant contributor in SoX's early days

I should clarify on Solaris I was using sox to play .wav and .aiff files, not mp3s. It wasn't until years later that I used sox to play .mp3 files on some version of Red Hat. I must be getting old, but I seem to remember Red Hat v8.0 or v9.0, it's foggy now.
XMMS
Another application that I remember using was called XMMS, circa 1997. This was very ahead of it's time. Was light weight, skinnable, and included plugins.
screenshot

MP3 Copyright Issues
For most people using Linux with MP3 support it was something that you really wanted to do. You'd typically have to jump through several hoops to get it working.
For example: Why Linux don't support mp3 and selected wifi cards out of the box?
It was only in the last few years that you could legally obtain a license for playback from Fluendo.
As @derobert indicated in a comment, we believe the patents might be expired at this time. Seems to may be the case looking at the wikipedia page for the MP3 format. But I'm no lawyer.
excerpt from MP3 wikipedia page

The initial near-complete MPEG-1 standard (parts 1, 2 and 3) was
  publicly available on 6 December 1991 as ISO CD 11172.[52][53] In most
  countries, patents cannot be filed after prior art has been made
  public, and patents expire 20 years after the initial filing date,
  which can be up to 12 months later for filings in other countries. As
  a result, patents required to implement MP3 expired in most countries
  by December 2012, 21 years after the publication of ISO CD 11172.
An exception are the United States, where patents filed prior to 8
  June 1995 expire 17 years after the publication date of the patent,
  and a loophole known as submarine patents made it possible to extend
  the effective lifetime of a patent through application extensions. The
  various MP3-related patents expire on dates ranging from 2007 to 2017
  in the U.S.[54] Patents filed for anything disclosed in ISO CD 11172 a
  year or more after its publication are questionable; if only the known
  MP3 patents filed by December 1992 are considered, then MP3 decoding
  may be patent-free in the US by September 2015 when U.S. Patent
  5,812,672 expires which had a PCT filing in Oct 1992.

A: There probably was no "first  for Linux", the Linux kernel has been supplemented with userland programs collected from all over the place from the very start, the overwhelming majority of it originally developed for some propietary Unix system or one of the BSDs, and even in some case ported over from other operating systems. Much of this happened in parallel by separate groups working on (proto) distributions. I'm certain this happened (almost) simultaneously in different ways once some sort of audio driver came to be.


text:
Q: Materialize CSS Showing errors on form fields Is it possible to set the validation error color on form fields manually? I couldn't really figure out how it was doing the validation on their site. Seems like the browser is doing it automatically based on the type attribute. But what CSS would I need to attach to trigger that state? I need to do a custom validation on a text field and the one that browser does automatically is not enough.

A: As I already wrote as a comment.
You just need to add the invalid class to your element.
Next time you could use the inspect element tool which is built-in in Chrome.


text:
Q: Loop though json key to check if its value is empty I have this json object. Json key remarks and address is empty. If its empty then json prints undefine when extracting json. But i want replace empty json with - sign. I know I can use:
 if(msg.hasOwnProperty('remarks')== ""){
        alert("A");
   }

But how to loop through all the keys and check if its empty and replace with - rather than checking it individually.
[
{
    "id": "224",
    "booking_id": "1",
    "room_type": null,
    "no_of_rooms_booked": null,
    "check_in_date": "2014-12-23",
    "check_out_date": "2014-12-24",
    "room_id": "93",
    "hotel_id": "9",
    "status": "1",
    "user_id": "15",
    "payment_type": "",
    "payment_status": "",
    "hotelname": "sample hotel",
    "hoteladdress": "sample address",
    "hotelcontact": "056533977",
    "Id": "224",
    "full_name": "Hom Nath Bagale",
    "address": "",
    "occupation": "Student",
    "nationality": "Nepali",
    "contact_no": "9845214140",
    "email": "bhomnath@salyani.com.np",
    "remarks": "",
    "total_amount": "5000",
    "child": "0",
    "adult": "1",
    "verification_code": null,
    "roomname": "sample room2",
    "roomprice": "1.5",
    "roomdescription": "this is for demo",
    "roomimage": "2.jpg"
}]

A: Try this
data.forEach(function (el) {
  Object.keys(el).forEach(function (property) {
    if (el[property] === '') {
      el[property] = '-';
    }
  });
});

Example

Object.keys() - returns an array of a given object's own
  enumerable properties

A: Do
  var msg=
    {
        "id": "224",
        "booking_id": "1",
        "room_type": "",
        "roomimage": "2.jpg"
    };

 $.each(msg, function(k, v) {
         if(v===""){
           alert(k + ' is empty' + v);
           //do actions
         }else{
            alert(k + ' is ' + v);
          }
    });

DEMO

A: You can use the for...in loop to iterate through each property like
for (var key in msg) {
    if (msg.hasOwnProperty(key)) {
        if (msg[key] === '') {
            msg[key] = '-'
        }
    }
}

Since you have used jQuery, you could also use the $.each() method like
$.each(array, function (i, msg) {
    $.each(msg, function (key, value) {
        if (value === '') {
            msg[key] = '-'
        }
    })
});

A: Below I have provided 2 functions, first of which can handle your entire json. The second is a much simpler one where you have to pass a specific element from your array (since you know the keys you look for are only available in the first element of the array).
Speciality of both these solutions is that they don't modify (mutate) the original json which you pass to them.
var sampleJson = [{
  "id": "224",
  "booking_id": "1",
  "remarks": "",
  "address": "",
}];

var newJson = getNonEmptyArry(sampleJson);
var newObj = getNonEmptyObj(sampleJson[0]);

console.log('newJson: ' + JSON.stringify(newJson));
console.log('newObj: ' + JSON.stringify(newObj));
console.log('Original Json ' + JSON.stringify(sampleJson));

function getNonEmptyArry(json) {
  var cpyJson = JSON.parse(JSON.stringify(json));
  cpyJson.forEach(obj => {
    Object.keys(obj).forEach(key => {
      if (obj[key] === '') {
        obj[key] = '-';
      }
    });
  });
  return cpyJson;
};

function getNonEmptyObj(obj) {
  var obj = JSON.parse(JSON.stringify(obj));
  Object.keys(obj).forEach(key => {
    if (obj[key] === '') {
      obj[key] = '-';
    }
  });
  return obj;
};


text:
Q: Running a entire SQL script via python I'm looking to run the following test.sql located in a folder on my C: drive. I've been playing with cx_Oracle and just can't get it to work.
test.sql contains the following.
CREATE TABLE MURRAYLR.test
( customer_id number(10) NOT NULL,
  customer_name varchar2(50) NOT NULL,
  city varchar2(50)
);

CREATE TABLE MURRAYLR.test2
( customer_id number(10) NOT NULL,
  customer_name varchar2(50) NOT NULL,
  city varchar2(50)
);

This is my code:
import sys
import cx_Oracle
connection = cx_Oracle.connect('user,'password,'test.ora')
cursor = connection.cursor()
f = open("C:\Users\desktop\Test_table.sql")
full_sql = f.read()
sql_commands = full_sql.split(';')
for sql_command in sql_commands:
  cursor.execute(sql_command)
  cursor.close()
connection.close()

A: This answer is relevant only if your test.sql file contains new lines '\n\' characters (like mine which I got from copy-pasting your sql code). You will need to remove them in your code, if they are present. To check, do
print full_sql

To fix the '\n's,
sql_commands = full_sql.replace('\n', '').split(';')[:-1]

The above should help.
It removes the '\n's and removes the empty string token at the end when splitting the sql string.

A: MURRAYLR.test is not acceptable table name in any DBMS I've used. The connection object the cx_oracle.connect returns should already have a schema selected. To switch to a different schema set the current_schema field on the connection object or add using <Schemaname>; in your sql file.
Obviously make sure that the schema exists.


text:
Q: Disable ViewPager scrolling animation From the code here, I have a ViewPager that sets an adapter. Is there any way to disable the scrolling animation so that it just "jumps" to the new page when I swipe? I'm not looking to disable the whole scrolling function in onTouchEvent and onInterceptTouchEvent, just the sliding animation.
mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

// Set up the ViewPager with the sections adapter.
mViewPager = (CustomViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);

A: Kotlin:
viewpager.setPageTransformer(false, FadePageTransformer())

inner class FadePageTransformer : ViewPager.PageTransformer {
    override fun transformPage(view: View, position: Float) {
        view.translationX = view.width * -position

        if (position <= -1.0f || position >= 1.0f) {
            view.alpha = 0.0f
            view.setVisibility(View.GONE);
        } else if (position == 0.0f) {
            view.alpha = 1.0f
            view.setVisibility(View.VISIBLE);
        } else {
            // position is between -1.0F & 0.0F OR 0.0F & 1.0F
            view.alpha = 1.0f - Math.abs(position)
            view.setVisibility(View.GONE);
        }
    }
}

A: I do not know if there is a clean solution. But you can use a trick and undo the standard page transformer with another transformer. The NoPageTransformer would look like this:
private static class NoPageTransformer implements ViewPager.PageTransformer {
    public void transformPage(View view, float position) {
        if (position < 0) {
            view.setScrollX((int)((float)(view.getWidth()) * position));
        } else if (position > 0) {
            view.setScrollX(-(int) ((float) (view.getWidth()) * -position));
        } else {
            view.setScrollX(0);
        }
    }
}

To add it to your ViewPager, call:
mViewPager.setPageTransformer(false, new NoPageTransformer());

Will work in SDK version 16 and above.

A: the accepted answer still have a swipe animation
I was searching for disabling the swipe animation even swipe by the user
here is my implementation
1-Override Viewpager method onInterceptTouchEvent and onTouchEvent
2- create your own GestureDetector
3- detect the swipe gesture and use  the setCurrentItem(item, false)
ViewPager
public class ViewPagerNoSwipe extends ViewPager {
    private final GestureDetector gestureDetector;
    private OnSwipeListener mOnSwipeListener;

    public void setOnSwipeListener(OnSwipeListener onSwipeListener) {
        mOnSwipeListener = onSwipeListener;
    }

    public ViewPagerNoSwipe(@NonNull Context context) {
        super(context);
        gestureDetector = new GestureDetector(context, new GestureListener());

    }

    public ViewPagerNoSwipe(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        gestureDetector = new GestureDetector(context, new GestureListener());

    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        return true;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        gestureDetector.onTouchEvent(ev);
        return false;
    }

    public class GestureListener extends GestureDetector.SimpleOnGestureListener {

        private static final int SWIPE_THRESHOLD = 100;
        private static final int SWIPE_VELOCITY_THRESHOLD = 100;

        @Override
        public boolean onDown(MotionEvent e) {
            return true;
        }

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            boolean result = false;
            try {
                float diffY = e2.getY() - e1.getY();
                float diffX = e2.getX() - e1.getX();
                if (Math.abs(diffX) > Math.abs(diffY)) {
                    if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
                        if (diffX > 0) {
                            if(mOnSwipeListener!=null)
                            mOnSwipeListener.onSwipeRight();
                        } else {
                            if(mOnSwipeListener!=null)
                                mOnSwipeListener.onSwipeLeft();
                        }
                        result = true;
                    }
                } else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) {
                    if (diffY > 0) {
                        if(mOnSwipeListener!=null)
                            mOnSwipeListener.onSwipeBottom();
                    } else {
                        if(mOnSwipeListener!=null)
                            mOnSwipeListener.onSwipeTop();
                    }
                    result = true;
                }
            } catch (Exception exception) {
                exception.printStackTrace();
            }
            return result;
        }
    }

    public interface OnSwipeListener {

         void onSwipeRight();

        void onSwipeLeft();

        void onSwipeTop();

        void onSwipeBottom();
    }
}

the when you are set up the ViewPager set the swipeListener
postsPager.setOnSwipeListener(new ViewPagerNoSwipe.OnSwipeListener() {
            @Override
            public void onSwipeRight() {

              postsPager.setCurrentItem(postsPager.getCurrentItem() + 1,false);

            }

            @Override
            public void onSwipeLeft() {

            postsPager.setCurrentItem(postsPager.getCurrentItem() - 1, false);

            }
             ...
           }

A: viewPager.setPageTransformer(false, new NoPageTransformer());

private static class NoPageTransformer implements ViewPager.PageTransformer {
    public void transformPage(@NonNull View view, float position) {
        view.setTranslationX(view.getWidth() * -position);
        if (position <= -1.0f || position >= 1.0f) {
            view.setVisibility(View.GONE);
        } else if (position == 0.0f) {
            view.setVisibility(View.VISIBLE);
        } else {
            view.setVisibility(View.GONE);
        }
    }
}


text:
Q: Underline Hover on Form Submit Button? How can I make a hover state, preferably underline, with a Form submit button?
..or would it be easier to incorporate a simple JavaScript Img rollover - Ultimately I just need a hover underline state to assure the user the area is click-able.
Update: Currently have;
<input type="submit" onClick="javascript:validForm();" value="SUBMIT" class="subbtn" >

input.subbtn {

    width: 75px;
    height: 32px;
    background-color:#F00;
    font-family:Arial, Helvetica;
    color:#fff;
    border: 0px;
    font-weight: bold;
    font-size:14px;
}

input.subbtn:hover
{
/* when hover (mouse over)*/
    text-decoration:underline;
}

Why isn't this working; and why does it make it so the little clickable hand isn't displayed anywhere - so the users know even less that the area is clickable.
I just want a hover underline, what am I missing?

A: You can use css to style the buttons, no javascript needed. Make it a normal button:
<input type="button" class="button" onClick="javascript:validForm();">

And css:
input.button
{
/* style it*/
}

input.button:hover
{
/* when hover (mouse over)*/
    cursor:hand;
}

A: try without ".button"
this will apply to all the inputs on oyur page, maybe you must add an "ID".. or maybe not..
input {

}

input:hover
{
    cursor:hand;
}


text:
Q: find and get particular word using regular expression Am trying to find and get particular word from a data returnd
While i executing a partiular command console.log(stdout) prints below data
commit e6c4236951634c67218172d742
Author:ttpn <testuser@gmail.com>
Date:   Mon Jun 9 10:18:04 2014 -0700

    Fix it dersk reset

..........
...........

my code
var getemail = function (callback) {
  var command = "git show ec6c4236951634c67218172d742";
  exec(command, function (error, stdout, stderr) {
    if (error !== null) {
      console.log(error)
      callback(error, null);
    } else {
console.log(stdout) // prints the above data

    }
  })

;
}
from this how can i get email id testuser@gmail.com
using regular expression is it possible?

A: This regex will capture the data you want to Groups 1 and 2 (on the demo, look at the capture Groups in the right pane):
commit (\S+)[\r\n]*Author:[^<]*<([^>]*)>

Here is how to use this in JS:
var regex = /commit (\S+)[\r\n]*Author:[^<]*<([^>]*)>/;
var match = regex.exec(string);
if (match != null) {
    theid = match[1];
    theemail = match[2];
}

Explaining the Regex
commit                   # 'commit '
(                        # group and capture to \1:
  \S+                    #   non-whitespace (all but \n, \r, \t, \f,
                         #   and " ") (1 or more times (matching the
                         #   most amount possible))
)                        # end of \1
[\r\n]*                  # any character of: '\r' (carriage return),
                         # '\n' (newline) (0 or more times (matching
                         # the most amount possible))
Author:                  # 'Author:'
[^<]*                    # any character except: '<' (0 or more times
                         # (matching the most amount possible))
<                        # '<'
(                        # group and capture to \2:
  [^>]*                  #   any character except: '>' (0 or more
                         #   times (matching the most amount
                         #   possible))
)                        # end of \2
>                        # '>'


text:
Q: Deploy a .WAR to multiple Tomcat instances I have one .WAR to routinely deploy across various Tomcat Instances on different servers.
I believe FarmWarDeployer can only be used within a cluster. From what i understand, a cluster will require a HTTPD server with a mod_jk configured. Would anyone know of a way to achieve this without the need to configure a cluster? Ideally, i'd also like the context.xml to be distributable, so changing on one instance will update on all others...but i suspect this will require a cluster configured.
Any help/ideas appreciated!


text:
Q: Formula for the simple reapeted infinitely continued fractions I was thinking about infinite fractions of the form $1+\frac{a}{1+\frac{a}{1+...}}$ but realised it would be much more useful and satisfying and only a little bit harder to solve fractions of the form $a+\frac{b}{a+\frac{b}{a+...}}$. One thing that I realised is that solving that fraction should be equivilant to solving for $x$ in $x=a+\frac{b}{x}$. Working that out I got $x=\frac{1}{2}(a\pm\sqrt{4b+a^2})$, but this formula is not defined for all and $a$ and $b$ values because of the square root, and disagrees with the infinite fraction for many values of $a$ and $b$ but works for others. Is there another formula that I missed online, or is there no general formula (which I doubt), or is it just a simple mistake that I made. One thing that I noticed is that most of the inconsistencies are when $16a^2>b^4$.

A: A partial answer, in which the series of fractions is proved convergent if $4b + a^2 \ge 0$ and $a \neq 0$, but not proved divergent if $4b + a^2 < 0$ (though this is probably true). For given $a$ and $b$, the successive terms are defined by $x_0 = 1$, $x_{n+1} = a + b/x_n$ (provided $x_n \neq 0$). If $a = 0$, the terms are alternately $1$ and $b$, and hence converge iff $b = 1$. If $a + b = 1$ then all terms are $1$. From now on assume $a \neq 0$ and $a + b \neq 1$. First consider $4b + a^2 = 0$. We can put $a = 2c$ and $b = -c^2$ where (by the above assumptions) $c \neq 0, 1$. It's easily proved by induction that
$$x_n = {{(n + 1)c - nc^2}\over{n - (n - 1)c}} = {{c(1 - c + 1/n)}\over{1 - c + c/n}},$$
from which $x_n \rightarrow c$ as $n \rightarrow \infty$
(but the inductive definition fails if $c = 1 + 1/n$ for some $n$). Now consider $4b + a^2 > 0$. Define
$$r = {1\over2}(a + \sqrt{4b + a^2}),\quad s={1\over2}(a - \sqrt{4b + a^2}).$$
By induction, $x_n = p_{n+1}/p_n$ where $p_n$ is defined by the Fibonacci-like recurrence
$$p_0 = 1,\quad p_1 = 1,\quad p_{n+1} = ap_n + bp_{n-1}.$$
This is solved in the usual way as $p_n = Ar^n + Bs^n$, where $A = (1 - s)/(r - s)$, $B = (r - 1)/(r - s)$. Hence
$$x_n = {{(1 - s)r^{n+1} + (r - 1)s^{n+1}}\over{(1-s)r^n + (r - 1)s^n}}.$$
The above assumption $a + b \neq 1$ implies $r \neq 1$ and $s \neq 1$. If $a > 0$ then $|r| > |s|$, hence $x_n \rightarrow r$. If $a < 0$ then $|s| > |r|$, hence $x_n \rightarrow s$.


text:
Q: Unable To Store Values In Excel Worksheet, Was Working Yesterday The line Excel.Application.ActiveWorkbook.Worksheets(wkshtName).Range("A" & n + 1) = part_name_string is not working but doesn't generate any errors, so I can't see what the issue is.
I've debugged the program several times. All values are as they should be. In the final line the workbook is open and active, wkshtName has the correct value, and part_name_string is not empty.
Sub WordGrab()
    Dim n As Integer
    Dim SentenceWords
    Dim arrayofWords
    Dim Rng As Range
    Dim ID_array
    Dim part_name_string As String
    Dim ParagraphCount As Integer
    Dim part_name_array(6) As String

    Dim oXL As Excel.Application 'Requires loading "Microsoft Excel 16.0 Object Library" from Tools -> References
    Dim oWB As Excel.Workbook
    Dim oSheet As Excel.Worksheet
    Dim oRng As Excel.Range
    Dim ExcelWasNotRunning As Boolean
    Dim WorkbookToWorkOn As String 'Path of Excel workbook
    Dim wkshtName As String 'Name of Excel worksheet
wkshtName = "My Worksheet"

WorkbookToWorkOn = "C:\ …"

On Error Resume Next
Set oXL = GetObject(, "Excel.Application")

If Err Then 'If Excel was not started, starts Excel
    ExcelWasNotRunning = True
    Set oXL = New Excel.Application
End If

    Set oWB = oXL.Workbooks.Open(FileName:=WorkbookToWorkOn) 'Opens Excel workbook

   ''''' several lines later ''''''

ParagraphCount = ActiveDocument.Paragraphs.Count

    For n = 1 To ParagraphCount
            SentenceWords = ActiveDocument.Paragraphs(n) ' Takes all text in the n'th paragraph and stores in string / variant
            arrayofWords = Split(SentenceWords, "|") 'Cuts paragraph into different strings separated by |
            ID_array = Split(arrayofWords(0), " ") 'Stores the first string in arrayofWords in ID_array
            I = 1 'Initializes I at the second string in arrayofWords

            While Len(arrayofWords(I)) < 20 'Leaves off the last string separated by | since it will be long.
                part_name_array(I - 1) = arrayofWords(I) 'Puts the remaining strings into part_name_array
                I = I + 1
            Wend

        part_name_string = Join(part_name_array, " ") 'Combines part_name_array into one string
        part_name_string = Trim(part_name_string) 'Removes unnecessary spaces
        Excel.Application.ActiveWorkbook.Worksheets(wkshtName).Range("A" & n + 1) = part_name_string 'Pastes part_name_array into the first column in the excel worksheet.
        Next n

I expect the value of part_name_string should be stored in A2 and so forth of the worksheet. But the worksheet remains empty after I run the code.


text:
Q: SharePoint 2010 OWA Error when opening a Word Document We are having an issue for OWA when opening a word document, but it affect few documents only. Here is the error:

I have followed this blog.
And I deleted the Cache but it did not resolve the issue. I did enable verbose logging to re-produce the issue and here is the log:
Timestamp               Process                                     TID     Area                            Category                        EventID Level       Message     Correlation
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Logging Correlation Data        77a3    Verbose Starting correlation.   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Topology                        e5mb    Medium  WcfReceiveRequest: LocalAddress: 'http://serversp05ap.company.local:32843/b05c449f1b454bb4a30793d522efc18e/Conversion.svc' Channel: 'System.ServiceModel.Channels.ServiceChannel' Action: 'http://tempuri.org/IConvertingService/GetCachedItem' MessageId: 'urn:uuid:7afb0d7b-33b8-4cb2-8af5-c2d95cc534eb'  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Monitoring                      nasq    Medium  Entering monitored scope (ExecuteWcfServerOperation)    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Logging Correlation Data        77a3    Verbose Starting correlation. Transfer from f518e19f-674e-4142-b62f-ed030568b4eb    9f2cac88-ac40-4e62-861a-b379bead3336
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Logging Correlation Data        xmnv    Medium  Name=ExecuteWcfServerOperation  9f2cac88-ac40-4e62-861a-b379bead3336
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  Office Web Apps                 Logging Correlation Data        77a3    Verbose Starting correlation.   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  Office Web Apps                 Office Web Apps Configuration   bbw9    Verbose Trying to get setting APPLICATIONMANAGERISENABLED   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  Office Web Apps                 Office Viewing Architecture     9mk6    Medium  GetCachedItem() [Doc: Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m, Item docdata.xml, Format: Silverlight, ConvCalls: 0, DataCalls: 1   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  Office Web Apps                 Office Viewing Architecture     c7l7    Medium  GetCachedItem() result: InProgress for item docdata.xml, document Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  Office Web Apps                 Logging Correlation Data        77a3    Verbose Ending correlation. f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Monitoring                      b4ly    Medium  Leaving Monitored Scope (ExecuteWcfServerOperation). Execution Time=0.840120741602634   9f2cac88-ac40-4e62-861a-b379bead3336
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Logging Correlation Data        77a3    Verbose Ending correlation. Transfer to f518e19f-674e-4142-b62f-ed030568b4eb    9f2cac88-ac40-4e62-861a-b379bead3336
04/23/2015 09:57:10.33  w3wp.exe (serverSP05AP:0x2414)              0x6DD0  SharePoint Foundation           Logging Correlation Data        77a3    Verbose Ending correlation. f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           Logging Correlation Data        77a3    Verbose Starting correlation. Transfer from 29364b48-bc56-4f02-bf59-bbd22e825eb5    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           Logging Correlation Data        xmnv    Medium  Name=Request (GET:http://mysite.company.local:80/subsite/docs/hrebsint/_vti_bin/docdatahandler.ashx?d=Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m&z=706E2642-E37D-4BE4-98F1-0FE07F8CF2C75&type=sl&ui=en-US)    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           SQM                             97qu    Verbose SQM: Datapoint id 6693 marked as Increment datapoint.   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           Logging Correlation Data        xmnv    Medium  User=Domain\JohnDoe f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Logging Correlation Data        9gc5    Verbose Thread change; resetting trace level override to 0; resetting correlation to f518e19f-674e-4142-b62f-ed030568b4eb 29364b48-bc56-4f02-bf59-bbd22e825eb5  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Web Apps Configuration   bbw9    Verbose Trying to get setting WORDVIEWERISENABLED   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Web Apps Configuration   bbx0    Verbose Tried to obtain setting WORDVIEWERISENABLED but it does not exist in the list of known settings for this environment.   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           Logging Correlation Data        xmnv    Medium  Site=/subsite/docs  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Web Apps Globalization   cg8m    Verbose Created regional settings with ui = 1033 and data = 1033.   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     9rgn    Verbose DocDataHandler request: doc=Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m, tech=Silverlight  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     vjyu    Medium  Librarian.BeginGetItem(Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m, Silverlight, docdata.xml)  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     b4vj    Verbose DocumentInfoCache.GetDocumentCacheItem: docId=d=Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m&z=706E2642-E37D-4BE4-98F1-0FE07F8CF2C75, outputFormat=_v00000000-0000-0000-0000-000000000201, hashcode=1450402086  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     b4vk    Verbose DocumentInfoCache.GetDocumentCacheItem: Item found  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     vkay    Medium  ViewStore.TryGetItemFromBackend(Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m, Silverlight, docdata.xml, http://serversp05ap:32843/b05c449f1b454bb4a30793d522efc18e/Conversion.svc)  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     fx1t    Verbose OpenChannel for http://serversp05ap:32843/b05c449f1b454bb4a30793d522efc18e/Conversion.svc took 0.1662 ms    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     wydn    Verbose ConvertingServiceProxy created to uri=http://serversp05ap:32843/b05c449f1b454bb4a30793d522efc18e/Conversion.svc f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     b4vg    Medium  Requesting cached item docdata.xml from http://serversp05ap:32843/b05c449f1b454bb4a30793d522efc18e/Conversion.svc; DocId: Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           Topology                        e5mc    Medium  WcfSendRequest: RemoteAddress: 'http://serversp05ap:32843/b05c449f1b454bb4a30793d522efc18e/Conversion.svc' Channel: 'Microsoft.Office.Web.Conversion.Framework.Remoting.IConvertingService' Action: 'http://tempuri.org/IConvertingService/GetCachedItem' MessageId: 'urn:uuid:7afb0d7b-33b8-4cb2-8af5-c2d95cc534eb'    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.34  w3wp.exe (serverSP02W:0x8A78)               0x4188  Office Web Apps                 Office Viewing Architecture     fx1s    Verbose TryGetItemFromBackend took 0.4717 ms    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x3E28  Office Web Apps                 Logging Correlation Data        77a3    Verbose Starting correlation.   f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x3E28  Office Web Apps                 Office Viewing Architecture     vkbf    Medium  ViewStore.OnReceivedItemFromBackend(Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m, Silverlight, docdata.xml) - state InProgress  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x3E28  Office Web Apps                 Office Viewing Architecture     vkaw    Medium  ViewStore.SetCompleted(Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m, Silverlight, docdata.xml) - status = InProgress    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x3E28  Office Web Apps                 Office Viewing Architecture     vjzo    Medium  Librarian.SetCompleted(Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m, Silverlight, docdata.xml) - status = InProgress    f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x3E28  Office Web Apps                 Word Web App Viewer             bhl2    Verbose DocDataHandler Response is being sent.  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x3E28  Office Web Apps                 Logging Correlation Data        77a3    Verbose Ending correlation. f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Server               Logging Correlation Data        9gc5    Verbose Thread change; resetting trace level override to 0; resetting correlation to f518e19f-674e-4142-b62f-ed030568b4eb 29364b48-bc56-4f02-bf59-bbd22e825eb5  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Server               Unified Logging Service         cn4g    Verbose Trace level override is turned off. f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           Monitoring                      b4ly    Medium  Leaving Monitored Scope (Request (GET:http://mysite.company.local:80/subsite/docs/hrebsint/_vti_bin/docdatahandler.ashx?d=Fc24bb5cf47554a14b0509fd67859a26ema89d59704d14443f824f9fa001a81e56m706e2642e37d4be498f10fe07f8cf2c7m&z=706E2642-E37D-4BE4-98F1-0FE07F8CF2C75&type=sl&ui=en-US)). Execution Time=14.8252082317725  f518e19f-674e-4142-b62f-ed030568b4eb
04/23/2015 09:57:10.35  w3wp.exe (serverSP02W:0x8A78)               0x4188  SharePoint Foundation           Logging Correlation Data        77a3    Verbose Ending correlation. Transfer to 29364b48-bc56-4f02-bf59-bbd22e825eb5    f518e19f-674e-4142-b62f-ed030568b4eb

A: Have a look for SharePoint 2010 OWA Error when opening a Word Document issue.


text:
Q: How to associate LUKS2 key slots with users identities? LUKS2 offers the possibility to have several dozens of keyslots defined. This is great for enterprise use as this allows to have multiple people having access to the same encrypted volume, each with their own personal password.
However, how do you a link each keyslot to their owner? In particular, when an employee leaves the project or the company, how do you know which keyslot should be erased?
I did not find any notion of username or a way to assign some kind of label to keyslots. I also thought to maintain a separate list associating each keyslot number to their owner name, however keyslot allocation seems dynamic with LUKS2:

*

*I create a key in slot 0: as expected the dump shows a key in slot 0.

*I add two more keys: the dump shows 3 keyslots used, but they are numbered 1, 2 and 3, with the initially created key occupying the slot 3.

*I erase the slot 3 and update (luksChangeKey) the slot 1: the dump show 2 slots used, numbered 0 and 2.

Update: I've also submitted this question to the LUKS project team.


text:
Q: How to get 4 random images and use as 4 related posts' thumbnails in Wordpress? I would like to display 4 different images at related posts' thumbnails  on my page, that is picked randomly from the images in URLs.  However ,the thumbnails images are same for each related post.
I don't know how to add the different random image at each related posts to this code.
my PHP code:
<?php
/**
related posts
 */
$tags = wp_get_post_tags($post->ID);
$images = array(
    'https://img-blog.com/20200916142100590.jpg',
    'https://img-blog.com/20200915155348194.jpg',
    'https://img-blog.com/20200910152002780.jpg',
);
$image_url = $images[array_rand( $images, 1 )];
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'showposts'=>4,  // Number of related posts that will be shown.
'caller_get_posts'=>1
);

$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '

Related posts

';
while ($my_query->have_posts()) {
$my_query->the_post();
?>

<?php
if ( has_post_thumbnail() ) { ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?><?php the_title(); ?>

<?php } else { ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><img src="<?php echo $image_url ?>" width="196" height="110" alt="<?php the_title_attribute(); ?>" /><?php the_title(); ?>

<?php }
?>

<?php
}
echo '
';
}
}
$post = $backup;
wp_reset_query();
/**
 end
 */
?>

my related posts' thumbnails

A: Please use the following line inside your loop, instead of outside of the loop. So it will randomize the link every-time.
while ($my_query->have_posts()) {

$image_url = $images[array_rand( $images, 1 )];


text:
Q: How to get data from API and turn it into array list for Google Charts I'm pretty new to React and am currently trying to use the Nasa neo API to feed data into a react google chart.
The problem is when i send a get request with axios i end up with loads nested data objects that i somehow have to convert to a array to use with google charts.
class MainPage extends Component {
  state = {
    data: [['name', 'max estimated diameter', 'min estimated diameter']]
  };

  componentDidMount() {
    axios
      .get('https://api.nasa.gov/neo/rest/v1/neo/browse?api_key=DEMO_KEY')

      .then(response => {
        this.setState({ data: response });
      })
      .catch(function(error) {
        console.log(error);
      });
  }
}

this is what i have so far, i'm guessing i need to map through the data but everything i've tried so far doesn't seem to work.
anyone know how i should proceed ?
or got any pointers ?

A: Since you're using Axios, your get request will return an object with data key.
.then(({data}) => { // destructure data from response object
    // {name, estimated_diameter} from data
    const restructuredData = data.near_earth_objects.map(({name, estimated_diameter}) =>
        [name, estimated_diameter.metrics. estimated_diameter_max, estimated_diameter.metrics.estimated_diameter_min])

    this.setState({data: restructuredData});
})
.catch(function (error) {
  console.log(error);
})

Axios response schema for your reference https://github.com/axios/axios#response-schema

A: From the swagger documentation I can see that the endpoint /neo/browse returns something like this:
{
  "is_potentially_hazardous_asteroid": true,
  "is_sentry_object": true,
  "neo_reference_id": "string",
  "name": "string",
  "name_limited": "string",
  "designation": "string",
  "nasa_jpl_url": "string",
  "absolute_magnitude_h": 0,
  "estimated_diameter": {},
  "close_approach_data": [
    {
      "close_approach_date_full": "string",
      "close_approach_date": "string",
      "epoch_date_close_approach": 0,
      "relative_velocity": {},
      "miss_distance": {},
      "orbiting_body": "string"
    }
  ],
  "orbital_data": {},
  "sentry_data": "string"
}

This is a JSON so what you want to do is getting the fields and then save them in your state.
From the google react chart api I see we want data to be an array of arrays, like this:
const data = [
  ["Column1", "Column2"],
  ["row1_column1", "row1_column2"],
  ["row2_column1", "row2_column2"],
// ...
];

What I would do is:
      .then(response => {
        this.state.data
        this.setState({
            data: [
                ...this.state.data
                [
                    response.data.name,
                    response.data.estimated_diameter.kilometers.estimated_diameter_max,
                    response.data.estimated_diameter.kilometers.estimated_diameter_min
                ]
            ]
        })

Basically we are appending a new array with the three values we want to the already existing data. To extract the values from the JSON we have received from the API we just need to look at the response we receive by trying out the API on swagger.
Also remember that setState() is asynchronous.

A: This answer will help you...
<Chart
  data={[
    ['column1', 'column2', 'column3'],
    ...array.map(d => [ d.column1, d.column2, d.column3 ])
  ]}
/>


text:
Q: How to tell if a query will scale well? What are some of the methods/techniques experienced SQL developers use to determine if a particular SQL query will scale well as load increases, rows in associated tables increase etc.

A: don't make tables wide, keep them narrow as well as the indexes. Make sure that queries are fully covered by indexes and that those queries are SARGable.
Test with a ton of data before going in production, take a look at this: Your testbed has to have the same volume of data as on production in order to simulate normal usage

A: Some rules that I follow that make the most difference.

Don't use per-row functions in your queries like if, case, coalesce and so on. Work around them by putting data in the database in the format you're going to need it, even if that involves duplicate data.
For example, if you need to lookup surnames fast, store them in the entered form and in their lowercase form, and index the lowercase form. Then you don't have to worry about things like select * from tbl where lowercase(surname) = 'smith';
Yes, I know that breaks 3NF but you can still guarantee data integrity by judicious use of triggers or pre-computed columns. For example, an insert/update trigger on the table can force the lower_surname column to be set to the lowercase version of surname.
This moves the cost of conversion to the insert/update (which happens infrequently) and away from the select (which happens quite a lot more). You basically amortise the cost of conversion.

Make sure that every column used in a where clause is indexed. Not necessarily on its own but at least as the primary part of a composite key.

Always start off in 3NF and only revert if you have performance problems (in production). 3NF is often the easiest to handle and reverting should only be done when absolutely necessary.

Profile, in production (or elsewhere, as long as you have production data and schemas). Database tuning is not a set-and-forget operation unless the data in your tables never changes (very rare). You should be monitoring, and possibly tuning, periodically to avoid the possibility that changing data will bring down performance.

Don't, unless absolutely necessary, allow naked queries to your database. Try to control what queries can be run. Your job as a DBA will be much harder if some manager can come along and just run:
select * from very_big_table order by column_without_index;

on your database.
If managers want to be able to run ad-hoc queries, give them a cloned DBMS (or replica) so that your real users (the ones that need performance) aren't affected.

Don't use union when union all will suffice. If you know that there can be no duplicates between two selects of a union, there's no point letting the DBMS try to remove them.
Similarly, don't use select distinct on a table if you're retrieving all the primary key columns (or all columns in a unique constraint). There is no possibility of duplicates in those cases so, again, you're asking the DBMS to do unnecessary work.
Example: we had a customer with a view using select distinct * on one of their tables. Querying the view took 50 seconds. When we replaced it with a view starting select *, the time came down to sub-second. Needless to say, I got a good bottle of red wine out of that :-)

Try to avoid select * as much as possible. In other words, only get the columns you need. This makes little difference when you're using MySQL on your local PC but, when you have an app in California querying a database in Inner Mongolia, you want to minimise the amount of traffic being sent across the wire as much as possible.

A: Pull up the execution plan and look for any of the following:

*

*Table Scan

*[Clustered] Index Scan

*RID Lookup

*Bookmark Lookup

*Key Lookup

*Nested Loops

Any of those things (in descending order from most to least scalable) mean that the database/query likely won't scale to much larger tables.  An ideal query will have mostly index seeks, hash or merge joins, the occasional sort, and other low-impact operations (spools and so on).
The only way to prove that it will scale, as other answers have pointed out, is to test it on data of the desired size.  The above is just a rule of thumb.

A: In addition (and along the same lines) to Robert's suggestion, consider the execution plan.  Is it utilizing indexes? Are there any scans or such? Can you simply for the query in any way? For example, Eliminate IN in favor of EXISTS and only join to tables you need to join to.
You don't mention the technology -- keep in mind that different technologies can affect the efficiency of more complex queries.

A: I strongly recommend reading some reference material on this.  This (hyperlink below) is probably a pretty good book to look into.  Make sure to look under "Selectivity", among other topics.
SQL Tuning - Dan Tow


text:
Q: Sql Query change - 3 table join select
  DISTINCT(destination_name),
  count(dst),TIME_FORMAT(SEC_TO_TIME(sum(duration)), '%H:%i:%s'),
  TIME_FORMAT(SEC_TO_TIME(sum(billsec)), '%H:%i:%s'),
  ROUND((sum(billsec)*cost) ,2),
  tarrif_plan.planname from tarrif_rate_domestic
LEFT OUTER JOIN
  tarrif_plan ON (tarrif_plan.planname = tarrif_rate_domestic.planname)
LEFT OUTER JOIN cdr on (tarrif_plan.planname = tarrif_rate_domestic.planname)
where cdr.dstchannel REGEXP tarrif_plan.trunkname and
  cdr.dst REGEXP tarrif_rate_domestic.areacode and
  disposition = 'ANSWERED'
group by destination_name,tarrif_plan.planname;

Output:
  +------------------------+------------+-----------------------------------------------------+----------------------------------------------------+-------------------------------+----------------+
 | destination_name       | count(dst) | TIME_FORMAT(SEC_TO_TIME(sum(duration)), '%H:%i:%s') | TIME_FORMAT(SEC_TO_TIME(sum(billsec)), '%H:%i:%s') | ROUND((sum(billsec)*cost) ,2) | planname       |
 +------------------------+------------+-----------------------------------------------------+----------------------------------------------------+-------------------------------+----------------+
 | Mobile 2               |       3018 | 63:08:02                                            | 49:34:58                                           |                       3402.17 | Standard       |
 | Mobile 2               |         41 | 02:10:08                                            | 01:51:45                                           |                          0.00 | Other Provider |
 | On-Net                 |        455 | 16:30:37                                            | 15:19:22                                           |                        374.00 | Standard       |
 | On-Net                 |        712 | 50:45:15                                            | 49:51:03                                           |                          0.00 | Other Provider |
 | Special                |        143 | 11:51:49                                            | 11:43:07                                           |                        286.03 | Standard       |
 | Mobile                 |       3177 | 77:20:13                                            | 62:30:31                                           |                       4289.09 | Standard       |
 | Mobile                 |         80 | 03:28:29                                            | 02:52:08                                           |                          0.00 | Other Provider |
 +------------------------+------------+-----------------------------------------------------+----------------------------------------------------+-------------------------------+----------------+

However I will like to have an extra row to show values that didn't match: as maybe "Unknown"
I believe I need to make use of a CASE but I am not able to find where I need to add into the query.
Here is some data for the 3 tables:
Tarrif_plan:
 +----------+----------------+--------------+
 | uniqueid | planname       | trunkname    |
 +----------+----------------+--------------+
 |        1 | Standard       | IAX2/tmp     |
 |        2 | Other Provider | IAX2/myprov  |
 +----------+----------------+--------------+

Tarrif_rate_domestic:
 +----------+------------------------+--------------------------------------------------------------------------------------------+---------+----------------+
 | uniqueid | destination_name       | areacode     | cost    | planname       |
 +----------+------------------------+--------------------------------------------------------------------------------------------+---------+----------------+
 |        1 | Mobile 2               | 2[2]{9}      | 0.01906 | Standard       |
 |        2 | Mobile 2               | 2[2]{9}      | 0       | Other Provider |
 |        3 | Special                | 9[9]{9}      | 0.01906 | Standard       |
 |        4 | Special                | 9[9]{9}      | 0       | Other Provider |
 |        5 | Mobile                 | 1[1]{9}      | 0.00678 | Standard       |
 |        6 | Mobile                 | 1[1]{9}      | 0       | Other Provider |

CDR:
 +---------------------+------------+------------+-------------------+----------+---------+-------------+
 | calldate            | src        | dst        | dstchannel        | duration | billsec | disposition |
 +---------------------+------------+------------+-------------------+----------+---------+-------------+
 | 2016-06-20 03:28:23 | 100        | 2222222222 | IAX2/tmp-16938    |       28 |      21 | ANSWERED    |
 | 2016-06-20 04:39:11 | 7777777777 | 1111111111 |                   |       11 |      11 | ANSWERED    |
 | 2016-06-20 04:46:21 | 100        | 2222222222 | IAX2/tmp-22288    |       43 |      30 | ANSWERED    |
 | 2016-06-20 04:48:13 | 7777777777 | 1111111111 |                   |        9 |       9 | ANSWERED    |
 | 2016-06-20 04:53:15 | 100        | 4444444444 | IAX2/myprov-00d94 |        5 |       0 | NO ANSWER   |
 | 2016-06-20 05:01:03 | 100        | 9999999999 | IAX2/tmp-20367    |      914 |     893 | ANSWERED    |
 | 2016-06-20 05:12:47 | 100        | 200        | SIP/200-00000d98  |       16 |      13 | ANSWERED    |
 | 2016-06-20 05:15:38 | 100        | 9999999999 | IAX2/tmp-30597    |        1 |       0 | NO ANSWER   |
 | 2016-06-20 05:15:57 | 100        | 200        | SIP/200-00000d9c  |        3 |       0 | NO ANSWER   |
 | 2016-06-20 05:16:18 | 100        | 9999999999 | IAX2/tmp-22584    |       32 |       3 | ANSWERED    |
 | 2016-06-20 05:16:40 | 100        | 200        | SIP/200-00000da0  |        4 |       0 | NO ANSWER   |
 | 2016-06-20 05:17:58 | 100        | 1111111111 | IAX2/tmp-25515    |       23 |      14 | ANSWERED    |
 | 2016-06-20 05:19:39 | 100        | 200        | SIP/200-00000da4  |       29 |      24 | ANSWERED    |
 | 2016-06-20 05:20:45 | 8888888888 | 9999999999 | IAX2/myprov-00da7 |       81 |      81 | ANSWERED    |
 | 2016-06-20 05:21:13 | 100        | 4444444444 | IAX2/tmp-29717    |      339 |     311 | ANSWERED    |
 | 2016-06-20 05:21:25 | 100        | 2222222222 | IAX2/tmp-17460    |       40 |       3 | ANSWERED    |
 | 2016-06-20 05:21:45 | 100        | 200        | SIP/200-00000daa  |       21 |       0 | NO ANSWER   |
 | 2016-06-20 05:23:16 | 100        | 200        | SIP/200-00000dae  |       54 |      51 | ANSWERED    |
 | 2016-06-20 05:24:30 | 100        | 2222222222 | IAX2/tmp-19105    |       19 |       3 | ANSWERED    |
 | 2016-06-20 05:26:10 | 100        | 1111111111 | IAX2/tmp-24135    |       54 |      23 | ANSWERED    |
 +---------------------+------------+------------+-------------------+----------+---------+-------------+

So to recap:

*

*Using tarrif_plan to find only the records in the CDR where cdr.dstchannel match to tarrif_plan.trunkname (REGEXP)

*Using Tarrif_plan to get the destination name if the cdr.dst match tarrif_rate_domestic.areacode (REGEXP)
NB: If no match found display as "Unknown" exp: 4444444444

A: You may add CASE in select, I have tried below
select
  CASE
     WHEN destination_name IS NULL THEN 'Unknown'
     ELSE destination_name
     END as destination_name,
  count(dst),TIME_FORMAT(SEC_TO_TIME(sum(duration)), '%H:%i:%s'),
  TIME_FORMAT(SEC_TO_TIME(sum(billsec)), '%H:%i:%s'),
  ROUND((sum(billsec)*cost) ,2),
  tarrif_plan.planname from tarrif_rate_domestic
LEFT OUTER JOIN
  tarrif_plan ON (tarrif_plan.planname = tarrif_rate_domestic.planname)
LEFT OUTER JOIN cdr on (tarrif_plan.planname = tarrif_rate_domestic.planname)
where cdr.dstchannel REGEXP tarrif_plan.trunkname and
  cdr.dst REGEXP tarrif_rate_domestic.areacode and
  disposition = 'ANSWERED'
group by destination_name,tarrif_plan.planname;

Though am not sure which column you are preferring so adjust case in query per your need.
Solution Ref. - Joining two tables when there is a not matching record exist

A: I suspect I found my solution:
select
  count(dst),duration,TIME_FORMAT(SEC_TO_TIME(billsec), '%H:%i:%s') as talktime,
  ROUND((billsec*cost) ,2),
  CASE WHEN destination_name IS NULL
    THEN 'Unknown' ELSE destination_name END as Destname, tarrif_plan.planname
from cdr
LEFT OUTER JOIN tarrif_rate_domestic ON (cdr.dst REGEXP tarrif_rate_domestic.areacode)
LEFT JOIN tarrif_plan ON (tarrif_plan.planname = tarrif_rate_domestic.planname)
where
  (cdr.dstchannel REGEXP tarrif_plan.trunkname or tarrif_plan.trunkname is null) and
  disposition = 'ANSWERED'
group by destname,tarrif_rate_domestic.planname;

Need to try and figure out what's different.

A: The following I can confirm is working exactly as expected:
SELECT
   count(pf.dst),
   TIME_FORMAT(SEC_TO_TIME(sum(pf.duration)), '%H:%i:%s') as totaltime,
   TIME_FORMAT(SEC_TO_TIME(sum(pf.billsec)), '%H:%i:%s') as talktime,
   ROUND((sum(pf.billsec*f.cost)), 2),
   f.planname,
   f.destination_name
FROM cdr AS pf
  LEFT JOIN tarrif_plan AS p ON pf.dstchannel REGEXP p.trunkname
  LEFT JOIN tarrif_rate_domestic AS f ON pf.dst REGEXP f.areacode
WHERE
   trunkname is not null and
   (p.planname = f.planname or f.planname is null)
GROUP BY f.destination_name,f.planname;


text:
Q: unwanted page reload when dynamicly adding iframe Looks like its an Firefox Home strict problem, and as Mozzilla dropped the support for it and pulled it out if iStore, there is I guess no point in trying to get workaround (http://thenextweb.com/apps/2012/08/31/mozilla-retires-firefox-home-ios-releases-source-code-github/), anyway i ve posted bug to them (https://bugzilla.mozilla.org/show_bug.cgi?id=853377) if someone is interested in following/solwing

I ve got quite nice crossbrowsing library using iframe method to communicate.
And it works beatifull untill .. opened with Firefox on iPhone. Pages with library starts, and then magicly are redirected.
Well I ve went into the code and tried identify the problem:
After dynamically adding iframe parent reloads to iframe src. I have tested following:

*

*document.createElement('iframe') appending to document

*document.createElement('iframe') appending to precreated div

*.innerHTML method with precreated iframe code in it

*frames['iframe_name'].location.src with precreated iframe with empty src

*.location.assign()

*

*with document.getElementById()fails

*with frames['iframe_name'] redirect

*same with jquery
$('<iframe src="link"/>'). appendTo('#reportA');

*tried also first create iframe without src and then set it

*also update with $('#iframe').attr('src','link') cause redirect

Additionally, i see on logs (called page in iframe is logging status).
That infact there was like two calls, so it looks like first  the appended iframe reads in, then opends iframe src in new page.
While dissecting my code i found out that problem occurs when iframe is created in part of code, that was dynamically added by my js loader. I ve used following append scripts
var head = document.getElementsByTagName("head")[0];
var script = null;
script = document.createElement('script');
script.type = 'text/javascript';
var tag = Math.round(new Date().getTime() / 1000);
script.src =  GLOBAL_VARIABLE_WITH_PATH_TO_URL+'jsc/include.js?'+tag ;
head.appendChild(script);

also tried
 document.write("<script src='"+FUTUREclickINFOpathS+"fcijsc/fci-include.js?"+tag+"'><\/script>");

UPDATE
Also tried to append irame on jquery $(document).ready() - when used with document.write method it works fine, till calling the appending in setTimeout
What is even more strange, when used setTimeout() in main static js file the same things happen. I ll try today setInterval() and see whats happening.
So as it obvious that any change on src of iframe cause parent reload, even if iframe was precreated. Any ideas why?
ps. sorry for some uncomprehensive sentences but i got my head wrapped around that issue

A: Are you using postMessage to communicate from the iframe to the parent? I ran into this and noticed that removing parent.postMessage from the iframe's scripts fixed it. I'll update with a way to work around this if I find one.


text:
Q: VPS minecraft Putty I have turned on minecraft in my VPS via PuTTY.
screen sh minecraft.sh

How can I stop this process and how can I go there so that I can use all the commands?
I am very new to PuTTY and this.

A: PuTTY, if I remember right, is basically an emulator for Unix terminals. In PuTTY, you have the screen command which is wrapping sh minecraft.sh.
Try getting the process id of the screen:

screen -ls

This should get you a list of running screens and their process IDs. Odds are one of them will have your minecraft shell.
Open that screen:

screen -r [screen PID]

and you'll be in the minecraft server console.
Now that you're in, you can use the minecraft server commands like stop to stop your server.
If you want to leave the screen but keep the server running, type CTRL-a CTRL-d to exit.
Hope that helps!


text:
Q: load web page into div using jquery I need help. In my web page, I want that in the div "pagina", would open the link www.google.it when I click on the link without that the page executes the refresh. I've tried doing it this way but it does not work.

        <title>Home Page</title>

    <link rel="stylesheet" href="../jquery-ui-1.11.4.custom/jquery-ui.css">

                <form name="ricerca" method="POST" >
                    <input type="text" name="nome" size="35" placeholder="Cerca Titolo, Attore, Regista, Anno">
                     <input class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Accedi">
                </form>

                 Categorie:

Animazione

Avventura

Azione

Commedia

Documentario

Drammatico

Erotico

Fantascienza

Horror

Musical

Romantico

Thriller

Western

A: UPDATE: You would have to use an  to do that since it is not in the same domain.
You need to prevent the default action of anchor links when they are clicked by calling the event.preventDefault() method before performing the load operation.
$("a").click(function(event)
{
    event.preventDefault();
    $("#pagina").load($(this).attr("href"));

    // return false;
});

A: hope it's work for you:
  $("a").click(function(event){
      event.preventDefault();
      var url = $(this).attr('href');
      var iframe = '';
      $("#pagina").html(iframe);
  });


text:
Q: How to Remove Last digit of String in .Net? I want to eliminate B if i scan Serial number bar code: 21524116476CA2006765B
Output: 21524116476CA2006765

A: string foo = "21524116476CA2006765B";
string bar = foo.Substring(0, Math.Max(foo.Length - 1, 0));

A: If you can't be certain that the input barcode will always end with a B, do something like this:
char[] barcodeEnd = { 'B' };

string input = "21524116476CA2006765B";
string output = input.TrimEnd(barcodeEnd);

PUt the first line somewhere it'll only get run once, so you aren't constantly creating new char[] arrays.  You can add more characters to the array if you're looking for other specific characters.

A: string s = "21524116476CA2006765B";
string b = s.Substring(0, s.Length - 1);

A: string value= "21524116476CA2006765B";
string bar = value.Substring(0, 19);

A: string str = "Your String Whatever it is";
str = str.Substring(0, s.Length - 1);


text:
Q: check checkbox based on the array <input type="checkbox" value="1"  />
<input type="checkbox" value="2" />
<input type="checkbox" value="3"  />
<input type="checkbox" value="4" />
<input type="checkbox" value="5"  />
<input type="checkbox" value="6" />
<input type="checkbox" value="7"  />
<input type="checkbox" value="8" />
<input type="checkbox" value="9"  />
<input type="checkbox" value="10" />

 FilterArray=[
{member_Key: 1},
{member_Key: 4},
{member_Key: 7},
   ]

I want to check the all the checkboxs inisde based on the FilterArray. It should check the checkbox on the page load.

A: You can loop through the array, and then use the attribute selector method for getting the checkbox with a particular value.
$.each(FilterArray, function (index, value) {
    $("input[type='checkbox'][value=" + value.member_Key + "]").prop("checked", true);
});

Fiddle

A: Try this
$(document).ready(function () {
    var FilterArray = [1, 4, 7];
    $('#myForm').find('input').each(function () {
        $(this).prop("checked", ($.inArray(parseInt($(this).val()), FilterArray) != -1));
    });
});

Here is Fiddle Link


text:
Q: Incomprehensible "Uncaught TypeError: Cannot read property 'removeChild' of null" error In my app, clicking a certain button changes its caption to a different one, and clicking it again changes it back to the default caption.
When clicking it I get this error message:

Uncaught TypeError: Cannot read property 'removeChild' of null

This doesn't make sense to me because there's no DOM manipulation here. I simplified my code as much as possible while keeping the error:
data () {
  return {
    ctaCaptions: [
      'see case studies',
      'hide case studies'
    ],
    ctaCaption: ''
  }
},
methods: {
  handleClick () {
    this.ctaCaption = this.ctaCaptions[1]
  }
}

HTML:
<a
  @click="handleClick"
  v-html="ctaCaption"
/>

Any suggestion as to what causes this error?

A: methods: {
  handleClick () {
    this.ctaCaption = this.ctaCaptions[1]
  }
}

Inside event handlers, this points to the event.target (in your case the HTMLButtonElement).
In your case, you want a reference to your component. You can achieve this in different ways:
Use explicit binding:
methods: {
  handleClick () {
    this.ctaCaption = this.ctaCaptions[1]
  }.bind(this)
}

Or you can use an ES6 arrow function (these preserve the this at the moment of definition rather than at execution time):
methods: {
  handleClick: () => {
    this.ctaCaption = this.ctaCaptions[1]
  }
}

For a more specific and precise insight, you'd have to show the HTML snippet which uses the model code you've shown. Also, no line in your showcased code uses removeChild.


text:
Q: Text alignment in power point with R / officer I am experimenting with the automation of some reports and I would like to stick to the corporate power point style (at least as much as possible). Using directly the available template with
ppt <- read_pptx("myTemplate.pptx")

is quite complicated at least for me.
Therefore I am trying to work with the standard "Office Theme" and I am trying to make it look close to the company template. I would like to be able to left align ctrTitle, subTitle and title types.
If I run the example below the title is centered. Does anyone know how to left align it? I could not find in the documentation.
Thank you in advance.
require(officer)

require(magrittr)

ppt = read_pptx()

ppt = ppt %>% add_slide(layout = "Title Slide", master = "Office Theme")

ppt = ppt %>% ph_with_text(str = "Title String", type = "ctrTitle")

print(ppt, target = "first_example.pptx") %>% invisible()


text:
Q: A functional equation Let $u$ be a mapping from $(0,1)$ to its self. I m interested in a class of functions $u$ for which the following equation admits a solution $f: (0,1) \to R$ which is derivable in $(0,1)$ :
$$
f\circ u= f +1
$$

A: If you take for example
$u\;:\;x\mapsto x$
then, there is no solution.


text:
Q: Don't understand, IndexError: too many indices for array My task is to remove longitude and latitude coordinates if the distance between points are within a specific distance (5km or 10km or 30km). This is for modeling purposes and avoid clustering of points. I am using haversine equation to measure distance.
Below is my initial code:
load the geometry record from points,
then convert it to an array,
compare each coordinate pairs and measure distance.
After that, remove the longitude and latitude pairs that are
close to each other,

but got stuck on this step.
What I am planning is to update the item list of coordinate pairs and iterate again using new set of coordinate pairs.
Running the below script gives me this error:

IndexError: too many indices for array

It seems that the index in the iteration is not updating. It still getting the index during the first pass.
import math, easygui, shapefile, itertools, os
import pandas as pd
import numpy as np

filepath = easygui.fileopenbox()

input_dist = int(raw_input("Distance Filter Value?: "))
input_crop = raw_input("what crop?: ")

directory = os.path.split(filepath)[0]

def dist_haversine(shp,input_dist,input_crop):
    """
    Calculate the great circle distance between two points
    on the earth (specified in decimal degrees)
    """

    r = shapefile.Reader(shp)
    idx = np.arange(len(r.records()))
    coordinates = []
    for i in idx:
        geom = r.shape(i)
        coordinates.append(geom.points[0])

    acoords = np.array(coordinates)

    for r,n in itertools.izip(acoords[:,0],acoords[:,1]):

        coordinates_ = []

        for i,j in itertools.izip(acoords[:,0],acoords[:,1]):

            lon1=r
            lat1=n
            lon2=i
            lat2=j

            lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])

            # haversine formula
            dlon = lon2 - lon1
            dlat = lat2 - lat1
            a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2
            c = 2 * math.asin(math.sqrt(a))
            km = c*6371 #/1000.0

            if km > input_dist:
                coordinates_.append([i,j])

        coordinates[:] = coordinates_
        acoords = np.array(coordinates)

    df_coords_ = pd.DataFrame(coordinates).drop_duplicates().values
    df_coords = pd.DataFrame(df_coords_, columns=['Lon','Lat'])

    df_coords.insert(0, 'Crop', input_crop)

    return df_coords.to_csv(os.path.split(directory)[0] + "\\" + "%s_distFilter_%skm.csv" % (input_crop, input_dist), sep=",", index=None)

Traceback

File "<ipython-input-3-8e88eba2ab54>", line 1,  in <module>
  dist_haversine(filepath,input_dist,input_crop)
File "<ipython-input-2-d43a1f1da26a>", line 20, in
  dist_haversine
    for i,j in itertools.izip(acoords[:,0],acoords[:,1]):
IndexError: too many indices for array

A: This is the initial solution that I used to filter points. Its working, and a bit fast for a 1,000 - 3,000 points dataset. However, tried filtering 50,000 points, it took 2.5 - 3 hours to finish.
def dist_haversine(filepath,input_dist,input_crop):
    """
    Calculate the great circle distance between two points
    on the earth (specified in decimal degrees)
    """

    r = shapefile.Reader(filepath)
    idx = np.arange(len(r.records()))
    coordinates = []
    for i in idx:
        geom = r.shape(i)
        coordinates.append(geom.points[0])

    acoords = np.array(coordinates)

    index = []
    for r,n,l in itertools.izip(acoords[:,0],acoords[:,1],idx):
        if l in index:
            continue
        else:
            for i,j,k in itertools.izip(acoords[:,0],acoords[:,1], idx):
                if k in index:
                    continue

                else:

                    lon1=r
                    lat1=n
                    lon2=i
                    lat2=j

                    coord_check = ((lon1 == lon2) & (lat1 == lat2))*1

                    if coord_check == 1:
                        continue

                    else:
                        lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])

                        # haversine formula
                        dlon = lon2 - lon1
                        dlat = lat2 - lat1
                        a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2
                        c = 2 * math.asin(math.sqrt(a))
                        km = c*6371 #/1000.0

                    if km < input_dist:
                        if k in index:
                            continue
                        else:
                            index.append(k)

    filterList = [i for j, i in enumerate(coordinates) if j not in index]

    df_coords = pd.DataFrame(filterList, columns=['Lon','Lat'])

    df_coords.insert(0, 'Crop', input_crop)

    return df_coords.to_csv(directory + "\\" + "%s_distFilter_%skm.csv" % (input_crop, input_dist), sep=",", index=None)


text:
Q: Magento 2 Get Customer's Telephone after registration I am new to Magento2 and I was wondering if someone could help me echo out Customer's Address information in an activation email to Admin.  Below is the code I am using to build the Customer's information.
->setTemplateVars(
            [
                'email' => $customer->getEmail(),
                'firstname' => $customer->getFirstname(),
                'lastname' => $customer->getLastname(),
                'company' => $customer->getAddress()->getCompany(), //DOESN'T WORK!!
                'telephone' => $customer->getAddress()->getTelephone(), //DOESN'T WORK!!
                'taxvat' => $customer->getTaxvat(),
                'website' => $customer->getCustomAttribute('website')->getValue(),
            ]
        );

Email, Firstname, Lastname, TaxVat and Custom Attribute "Website" are all working and showing properly on my email.  However, I can't get the information for Company Name, Telephone, Address, etc.
I would appreciate it if anyone could help point me in the right direction.

A: To get customer phone number and company info you need to used this things.
$customer->getDefaultShippingAddress()->getTelephone(); // For Telephone

$customer->getDefaultShippingAddress()->getCompany(); // For Company