text:
Q: Findminimum fails in loops Introduction to the problem: the function F[x][u,v,w]
I'm currently dealing with a very strange minimalization problem. I have a function
F[x][u,v,w]

which is defined by a series of integrals, solutions of sets of equations and so on (2 pages of formulas). Despite this fact, the values of F are calculated in only a few seconds.
Now given the values for {u,v,w}, I want to know what value of x minimizes the function F[x][u,v,w]. This minimum exists, it's also the only minimum and it's not an extremely steep minimum. A plot of the minimum is given in the figure below. It took me about 30 seconds to make this plot, just to give an idea of timing.

Other remarks about the function F[x][u,v,w] are:

*

*F[x][u,v,w] is an even function in x

*The domain of x is restricted to the positive (real) values

The problem itself
In order to minimize the function F[x][u,v,w], given different values of {u,v,w}, I wrote a program that takes a list of {u,v,z} and minimizes it for all combinations of {u,v,w}. So first I define my list of u,v and w values that I want to run through:
ulist={*list of u input values*}
vlist={*list of v input values*}
wlist={*list of w input values*}

And then I write a small program that minimizes F[x][u,v,w] for all combinations of u,v,w. This program is given by:
minx[u_,v_,w_]:=
  Block[{results={},u=ulist,v=vlist,w=wlist,x},
    Do[
      xmin=x/.(FindMinimum[F[x,u[[i]],v[[j]],w[[k]]],{x,RandomReal[{0.95,1.05}]}]//Part[#,2]&)
    AppendTo[results,{u[[i]],v[[j]],w[[k]],xmin}],
    {i,Length[u]},{j,Length[v]},{k,Length[w]}];
    results
  ]

So basically the program runs trough the lists ulist, vlist and wlist and returns a matrix with on each row the supplied values of u,v and w together with the found minimum.
When I run the minimalisation without the loop it takes me less than 20 seconds and it yields the correct answer. The moment I put my minimalsation in the loop it takes me double the amount of time and yields $xmin\approx 0$ every time, which is (clearly from the plot) totally not the case.
My biggest question is thus what is going wrong? Is there something wrong with my definition of my variables, does this construct in general not work? I'm really puzzled. I have made som attempts in order to get the looping-construct going, but all failed.
Futile attempts towards a solution
A summary of my tried attempts are:

*

*I tried using Table in stead of do to immediately construct the matrix

*I tried using Module in stead of Block, to not mix up variables

*I tried to write the minimalization af a seperate program outside of the loop

*I tried using With[] around the minimalization

but all of these attempts failed. I'm clueless here and I don't know what to do to get rid of my wrong results ?


text:
Q: Getting only the id entity the other fields null Symfony 3 I have weird problem with Doctrine and Symfony 3, I've spent two days now without any result.
My problem is when I get an entity from my database, I get only the id and the other fields null or they have vales
Here is my code:
 $utilsateur = $em->getRepository('GestionAccesBundle:Client')->findBy(array('id_client'=>1));

here is the debug result:

and here is my data base row:

A: It's a proxy object generated by Doctrine. Real data will be loaded from database when you try to access it for the first time.
It's called lazy loading. It prevents unnecessary queries to DB.

redpajama_set_name: RedPajamaStackExchange


text:
Q: bootstrap nav bar search advanced search box align vertically

.dropdown.dropdown-lg .dropdown-menu {
                                    margin-top: -1px;
                                    padding: 6px 20px;
                                }
                                .input-group-btn .btn-group {
                                    display: flex !important;
                                }
                                .btn-group .btn {
                                    border-radius: 0;
                                    margin-left: -1px;
                                }
                                .btn-group .btn:last-child {
                                    border-top-right-radius: 4px;
                                    border-bottom-right-radius: 4px;
                                }
                                .btn-group .form-horizontal .btn[type="submit"] {
                                  border-top-left-radius: 4px;
                                  border-bottom-left-radius: 4px;
                                }
                                .form-horizontal .form-group {
                                    margin-left: 0;
                                    margin-right: 0;
                                }
                                .form-group .form-control:last-child {
                                    border-top-left-radius: 4px;
                                    border-bottom-left-radius: 4px;
                                }

                                @media screen and (min-width: 768px) {
                                    #adv-search {
                                        width: 100px;

                                    }
                                    .dropdown.dropdown-lg {
                                        position: static !important;
                                    }
                                    .dropdown.dropdown-lg .dropdown-menu {
                                        min-width: 500px;
                                    }
                                }

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        Toggle navigation

      </button>
      Brand

Link (current)

Link

          Dropdown

Action

Another action

Something else here

Separated link

One more separated link

                            <input type="text" class="form-control" placeholder="Search for ..." />

                                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>

                                            <form class="form-horizontal" role="form">

                                                Filter by

                                                    <select class="form-control">
                                                        <option value="0" selected>All Snippets</option>
                                                        <option value="1">Featured</option>
                                                        <option value="2">Most popular</option>
                                                        <option value="3">Top rated</option>
                                                        <option value="4">Most commented</option>
                                                    </select>

                                                Author

                                                    <input class="form-control" type="text" />

                                                Contains the words

                                                    <input class="form-control" type="text" />

                                              <button type="submit" class="btn btn-primary"></button>
                                            </form>

                                    <button type="button" class="btn btn-primary"></button>

bootstrap nav bar search advanced search box align vertically
Note that it worked for smaller devices but for desktop it wont display vertically.
show it in expand snippit mode.
i get the anvanced from bootsnipp.com

A:

<meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        Toggle navigation

      </button>
      Brand

Link (current)

Link

        Dropdown

Action

Another action

Something else here

Separated link

One more separated link

                            <input type="text" class="form-control" placeholder="Search for ..." />

                                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>

                                            <form class="form-horizontal" role="form">

                                                Filter by

                                                    <select class="form-control">
                                                        <option value="0" selected>All Snippets</option>
                                                        <option value="1">Featured</option>
                                                        <option value="2">Most popular</option>
                                                        <option value="3">Top rated</option>
                                                        <option value="4">Most commented</option>
                                                    </select>

                                                Author

                                                    <input class="form-control" type="text" />

                                                Contains the words

                                                    <input class="form-control" type="text" />

                                              <button type="submit" class="btn btn-primary"></button>
                                            </form>

                                    <button type="button" class="btn btn-primary"></button>

You have not added class="col-sm-2 control-label" for that particular label.
Now it is vertically aligned.


text:
Q: Find all solutions to $f(x+f(x))=2x$ Question: Find all solutions to $f(x+f(x))=2x$
Attempt: So $f(x)=x$ is pretty trivial, but by some trial and error I've also found $f(x)=-2x$. Are these the only solutions? If so, how could I go about proving that?

A: Here is an odd example of your functional equation, which is additive (that is, $f(x+y)=f(x)+f(y)$ for all $x,y\in\mathbb{R}$) but not of the form $f(x)=kx$.
Let $B$ be a Hamel basis of $\mathbb{R}$ over $\overline{\mathbb{Q}}$; that is, we will regard $\mathbb{R}$ as a vector space over the algebraic closure of $\mathbb{Q}$. It is known that we can decompose $B=B_0\cup B_1$ into disjoint linearly independent sets with same cardinailty. That is, we can find an index set $I$ such that
$$B_0 = \{a_i :i\in I\}\text{ and } B_1 =\{c_i : i\in I\}.$$
We will define $f$ over whole $\mathbb{R}$ via defining it over a basis. Take
$$f(a_i) = -\frac{1}{2}a_i+\frac{\sqrt{5}}{2}c_i \quad\text{  and   }\quad f(c_i) = \frac{\sqrt{5}}{2}a_i-\frac{1}{2}c_i.$$ We can see that $f(f(b))+f(b) = 2b$ for all $b\in B$, hence $f(f(x))+f(x)=2x$ for any $x\in\mathbb{R}$.
If $f(x) = kx$ for some $k\in\mathbb{R}$, then $k$ must be 0 or 2. Moreover, $(k-1)a_i-c_i=0$ for any $i$. However it is not possible as $\{a_i,c_i\}$ is linearly independent.

A: We can show that $f(x) = x$ and $f(x) = -2x$ are the only continuous solutions. We begin by explicitly mentioning this assumption.

Assumption. $f : \mathbb{R} \to \mathbb{R}$ is a continuous function that solves the functional equation
$$ \forall x \in \mathbb{R} \ : \quad f(x+f(x)) = 2x. $$

The idea is to consider the function $m(x) = f(x)/x$ on $\mathbb{R}\setminus\{0\}$. To investigate the property of this function, we show the following lemma.

Lemma. Let $f$ be as in the assumption. Then

*

*$f(x) = 0$ if and only if $x = 0$.

*$f(x) = -x$ if and only if $x = 0$.

Proof. If $f(x) = 0$, then $0 = f(x) = f(x+f(x)) = 2x$ and hence $x = 0$. For the other direction, notice that $f(f(0)) = 0$. So by the previous step, we find that $f(0) = 0$.
Now assume that $f(x) = -x$. Then $2x = f(x+f(x)) = f(0) = 0$ and hence $x = 0$. The other direction is clear from the previous step. ////
From this lemma, we know that $m(x) \notin \{-1, 0\}$ for  all $x \in \mathbb{R}\setminus\{0\}$. Since $m$ is continuous, either $m(x) > 0$ for all $x > 0$ or $m(x) < 0$ for all $x > 0$.

*

*Case 1. Assume that $m(x) > 0$ for all $x > 0$. This means that $f(x) > 0$ for all $x > 0$. Since $f$ is surjective, this implies that $f(x) < 0$ for some $x < 0$, then by the same argument, we find that $m(x) > 0$ for all $x \in \mathbb{R}\setminus\{0\}$.
Now notice that $m$ solves the following functional equation
$$ \forall x \in \mathbb{R}\setminus\{0\} \ : \quad m(x+f(x)) = \phi(m(x)), \qquad \phi(a) = \frac{2}{1+a}. \tag{*} $$
By the surjectivity and continuity of $f$, we easily check that $\{x+f(x):x \neq 0\} = \mathbb{R}\setminus\{0\}$. So by $\text{(*)}$, we know that $\mathsf{Ran}(m) := \{ m(x) : x \in \mathbb{R} \setminus\{0\} \}$ satisfies $\mathsf{Ran}(m) \subseteq \mathsf{Ran}(\phi\circ m)$.
Now, if $\mathsf{Ran}(m) \subseteq (a, b)$ for some $a, b \in [0, \infty]$, then $\mathsf{Ran}(m) \subseteq (\phi(b), \phi(a))$ holds as well. Then starting from $\mathsf{Ran}(m) \subseteq (0, \infty)$ and iterating the previous observation, we have
$$\mathsf{Ran}(m) \subseteq (\phi^{\circ(2n)}(0), \phi^{\circ(2n)}(\infty))$$
and by letting $n\to\infty$ shows that $\mathsf{Ran}(m) \subseteq \{1\}$. Therefore $f(x) = x$.

*Case 2. Assume that $m(x) < 0$ for all $x > 0$. The proof in this case will be quite similar as in the previous case, so we will skip some details.
Again, we easily find that $m(x) < 0$ for all $x < 0$ as well. Now rewriting $\text{(*)}$ as
$$ m(x) = \psi(m(x+f(x))), \qquad \psi(a) = \frac{2}{a} - 1 $$
we find that $\mathsf{Ran}(m) \subseteq \mathsf{Ran}(\psi \circ m)$. Starting from $\mathsf{Ran}(m) \subseteq (-\infty, 0)$ and iterating this relation, we easily find that
$$ \mathsf{Ran}(m) \subseteq (\psi^{\circ(2n)}(-\infty), \psi^{\circ(2n)}(-1)) $$
Letting $n\to\infty$ shows that $\mathsf{Ran}(m) \subseteq \{-2\}$, from which it follows that $f(x) = -2x$.


text:
Q: Font from origin as been blocked from loading by Cross-Origin Resource Sharing policy on multiple websites magento I have created two websites using one magento installation, like:

*

*abc.com (original)

*xyz.com (second domain)

Both are working fine except the fonts issue I got on sub domain (second website). Error is:

Font from origin 'abc.com' has been blocked from loading by
  Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin'
  header is present on the requested resource. Origin 'xyz.com' is
  therefore not allowed access.

I have add the following code to .htaccess of main site but not working.
.htaccess code:
<FilesMatch "\.(ttf|otf|eot|woff)$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "xyz.com"
    </IfModule>
</FilesMatch>
<IfModule mod_headers.c>
    <FilesMatch "\.(svg|ttf|otf|eot|woff|woff2)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>


text:
Q: Dice Game: Optimal Strategy Recently, we played a simple dice game at school. The objective of the game is to gain as many points as possible (have the largest expected value of points). Each round consists of several turns. At each turn, the
player rolls a dice. Then,

*

*If the die is not a two, the player adds the number to his pot.

*If the die is a two, the player loses everything and the round ends.

*At the end of each roll, the player is given a chance to cash out,
and receive the pot.

Finally, the player gets a free roll at the beginning (if the roll is a two, it is still added to the pot). What is the optimal strategy for winning?
I thought of two different ways to answer this question, but they gave different results.
1) Let $s_{t}$ be the current size of the pot. The expected value of taking the next turn is $$\mathbb{E}[s_{t+1}] = 5/6 * (s_{t} + 19 / 5)$$ where 19/5 is the expected value given that the roll is not a two, $19 / 5 = (1+3+4+5+6)/ 5$.
Therefore, the time to stop, or when the expectation as its maximum, is when $s_t$ equals $\mathbb{E}[s_{t+1}]$, which is $s_{t}= 19$.
2) Instead of looking at the final score, I looked at what number of turns gives the best return. The equation I created was this:
$$(19 / 5 n + 21 / 6) * (5/6) ^ n$$where n is the number of moves taken after the first free roll. The first part of the equation is the expected number of points gained from n moves given that each roll was not a two. The second part gives the probability of the person surviving until the nth decision. The maximum is obtained at around n = 4.38 with the equation equal to 9.38.
Here's where I try to compare the method 1 to method 2:
Since the each roll contributes an expected value of (19 / 5), the expected number of decisions to make to reach 20 is $$19 / (19/5) - 1$$ or 4. That is not equal to the number of moves obtained from the second method, 4.38.
Are any of these methods valid arguments? Is the comparison valid? If not, are the two methods equivalent to each other?

A: Both are valid arguments but they're not arguing the same thing. The first one is probably what you want.
The first argument is answering, "If I am facing a single decision on a single turn with $s_t$ in the pot, do I expect to make more by cashing out now or by cashing in after 1 more round?" dependent on the size of the pot.
The second argument is answering the question, "If I decide in advance that I'm going to play $n$ turns and then cash out, how much do I expect to make?" and then picking the $n$ that maximizes this. This throws away your ability to reevaluate each turn depending on new information. Staying in with $18 in the pot is a good idea, whether it's turn 1 or turn 7.
But be careful, games like this get a bit weird if they go on for a while. For example, suppose you start with a dollar and flip a coin, heads you triple your current total and tails you lose it all. Expected value for the first round is +$0.50, so you should play. And then if you win, why not play again? And again? But if you keep playing indefinitely, you're almost sure to lose everything. How many rounds do you play? See, for comparison, the St. Petersburg Paradox


text:
Q: How to trace count of events in two groups over time? I have those data:
require(tidyverse)

(df <- tribble( ~id,    ~group,          ~event,
                 1,        "A",    "2010/01/23",
                 2,        "B",    "2010/02/13",
                 3,        "A",    "2011/03/21",
                 4,        "B",    "2010/01/20",
                 5,        "B",    "2012/11/03",
                 6,        "A",    "2012/08/12"))

(df$event <- as.POSIXct(df$event, format = "%Y/%m/%d")

And I want to trace a graphic with x = time / y = count of events / color = group.

A: This is how I did it:
(
  df
  %>% group_by(group)
  %>% arrange(event)
  %>% mutate(N = row_number())
  %>% ggplot(aes(x=event, y=N, color=group))
   +  geom_line()
)


text:
Q: C++ Help - I can't seem to figure out the last part of this code I'm trying to get the program to display the current height of the child and the estimated height of the child.
I have it displaying the before and after for the first child but can't get it to display the estimated height for the rest of the children.
I would be very grateful if anyone could help me figure this out. Thanks!
Here is the code that I have:
#include <iostream>

using namespace std;

int main()
{
    double height [10];
    double chgHeight [10];

    for (int x = 0; x < 10; x = x + 1)
    {
        height[x] = 0.0;
        chgHeight[x] = 0.0;
    }

    cout << "You will be asked to enter the heights of ten children."<< endl;

    for (int x = 0; x < 10; x = x + 1)
    {
        cout << "Enter height of child " << endl;
        cin >> height[x];
    }

    chgHeight[0] = height[0] * .05 + height[0];

    for (int x = 0; x < 10; x = x + 1)
    {
        cout << "Child " << x+1 << ": Current " << height[x] << " Expected "<< chgHeight[x] << endl;
    }

    system("pause");
    return 0;
}

A: chgHeight[0] = height[0] * .05 + height[0];

You're only ever setting the first child's chgHeight.
Edit:
For your output, you're going through the array or heights, which is indexed by the child number (x):
for (int x = 0; x < 10; x = x + 1)
{
    cout << "Child " << x+1 << ": Current " << height[x]
         << " Expected "<< chgHeight[x] << endl;
}

Your estimated height is calculated from the child's current height, which you have in this loop ( height[x] ).  So, you have everything you need right there to output the estimated height.
If you have no need to save the calculation for later, there's really no need to create a second chgHeight[] array in your code; just calculate and output the estimated height in that loop for each child.

A: You are not setting the estimated height for the rest of the children, only the first:
chgHeight[0] = height[0] * .05 + height[0];

Put that in a loop.

A: chgHeight[0] = height[0] * .05 + height[0];

This line only calculates the estimated height of the first child. You'll need to put this in a loop as well (changing the indices to your loop variable) to calculate all 10.


text:
Q: If A is a subset of B and B complement isn't empty,is $ P(A)$ larger or smaller than $P(A|B)$? I wanted to know if my reasoning is right for the question so here it goes.
I said that $P(A)$ is smaller than $P(A|B)$ given that $P(A|B) = P(A \cap B)/ P(B)$ we see that the $P(B) > 0$ has to be greater than zero where $P(A)$ can be any number. Most of $A$ occurs in $B$ since $P(B)$ is greater by default more than $P(A)$.

A: More simply, you have $$ P(A|B) = \frac{P(A\cap B)}{P(B)} = \frac{P(A)}{P(B)} \ge P(A)$$ since $P(B)\le 1.$ The fact that $P(B)>0$ is necessary for $P(A|B)$ to even be defined so isn't worth hemming and hawing about (and it isn't really pertinent to the question). As bof said in the comments, in order to have strict inequality, what's important is that $P(B)<1,$ which means $B$'s complement has nonzero probability, not just that it's non-empty.


text:
Q: Why are neutrons present in an atom? I have a very stupid question perhaps, but please answer me. An atom consists of electrons, protons, neutrons. protons are positively charged and electrons are equally negatively charged. The charge of the electrons stabilizes the charge of protons. Why are neutrons present? My question is why physicists believe that neutrons are also present when the charge of electrons and protons can stabilize each other.

A: In simple terms:
There are four forces governing elementary interactions, their strength and ranges are given in the table.
The strong and the electromagnetic are involved in the nucleus. The other two, weak and gravity are not involved in the formation of a nucleus. Gravity is too weak and the weak interaction is involved in decays only.
The protons are in the nucleus, at the center of the atom, the size of the nucleus is of order of 10^-15 meters. The size of the whole atom is of order 10^-10meters.
Each proton has a positive charge and will repel each other proton. How is it possible that they can stay in one spherical locus called nucleus? The strong force is not strong enough to compensate for the repulsion of two protons. A neutron is attracted to the protons with the strong force and as neutral to first order does not interact with the charge of the proton. This allows it to go close enough so that the strong force gets stronger than the electromagnetic repulsion of another proton. The closer two hadrons get together the stronger the attraction of the strong force. Thus the neutrons shield the positive proton charges from each other and hold the nucleus together.
You might ask why don't the neutrons form a nucleus? It is because they decay, and outside the balanced forces within a nucleus the probability of decay is very high.  That is why if an isotope has too many neutrons it is liable to beta decay of the neutrons, and if too many protons it is unstable from the electric repulsion of the protons  , though it can pick up an electron and turn a proton to a neutron, and become stable ( electron capture).
The electrons 100.000 times further are  in orbitals and do not repulse each other because there exists a quantum mechanical solution for stable orbitals around the nucleus.
To complete the picture, the state of the nucleus is also a quantum mechanical state, and it has stable energy levels where the protons and neutrons reside, giving up energy to be bound in the nucleus. The difference between the atomic solutions which have orbitals for the electrons comes from the fact that it is the strong force that is dominant in the binding of the nucleons  in the nucleus, and not the electromagnetic.

A: We "know" that the neutrons are in the nucleus because they add to the weight of the atom. This is particularly visible in the case of isotopes. If you have some 12C (carbon with 6 protons and 6 neutrons in the nucleus) and some 13C (carbon with 6 protons and 7 neutrons in the nucleus), then both are definitely "carbon" (they engage in the same kind of reaction) so they have the same number of electrons, hence the same number of positive charges in the nucleus (since an atom is electrically neutral); but the 13C is definitely heavier (by about 8.3%). Thus, there must be some extra component in the nucleus, that does not add to the charge but has a definite mass.
Historically, the discovery of the neutron came first from an experiment from Rutherford, who was throwing alpha particles (helium nuclei) at a gold foil, and measuring how the particles were scattered. The scattering required that the gold nucleus was substantially heavier than the mass of its protons.
Later on we got a lot more data on neutrons, allowing us to not only be quite certain of their presence, but also measure a lot of their properties.

Within the nucleus, protons and neutrons stick together. The protons, being all positively charged, would very much like to fly apart from each other; but they are bound by the strong interaction which is much stronger than the electromagnetic repulsion (but with a very short range). That force also works on neutrons, which is why they stick (though, having a neutral charge, they are not so eager to leave).
A neutron, by itself, is not stable. It is slightly heavier than a proton, and, left alone, decays into a proton+electron after a few minutes (and an antineutrino). Within a stable nucleus, neutrons cannot decay because there is no room for an extra proton with the quantum state that would result from such a decay. When the nucleus has too many neutrons with regards to its number of protons, it is not stable, meaning that a neutron can morph into a proton, emitting an electron in the process (this is called beta decay).
Thus, neutrons stick to the nucleus because of the strong interaction, and they stay there indefinitely because the nucleus structure stabilizes them, preventing them from decaying.


text:
Q: In Python, when iterating through items in list, how to start at 0 if end is reached? I am iterating through a list in Python.
mylist = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
i = 0
while i <= 27:
    print mylist[i]
    i +=1

I am looking for a simple / elegant solutition so that when i is 11, it grabs 'a' from mylist.  I'd rather not use a complex set of if statments to check if the end of the list is reached.  Also, I would rather not make a new list with mylist duplicated numerous times, as these lists are rather long.
Is there a simple way to do this?

A: http://docs.python.org/library/itertools.html#itertools.cycle

A: Try modulo math:
mylist = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
i = 0
while i <= 27:
    print mylist[i % len(mylist)]
    i +=1

A: In the spirit of Falmarri's answer, I can't resist adding this:
def modrange(first, last, modulus, step = 1):
    for i in xrange(first, last, step):
        yield i % modulus

Now you can rewrite your while loop as:
for i in modrange(0, 27, len(mylist)):
    print mylist[i]


text:
Q: Which of the Insights shown in a Facebook Page are available through their API? I would like to get the insights data from my page on Facebook as can be seen from https://www.facebook.com/USERNAME?sk=page_insights . However I do not know which of these are available through the API, except of "number of fans" and "talking about".
I have print-screened the insights of my page and posted it as an album for better understanding here: http://imgur.com/a/hrL9z
Below is all the insights shown on the facebook page, so I will get a clear answer.
Thank you.
*Because the subject is similar to twitter api, how can I get the numbers of retweets made from my statuses each day? (answered)

Total number of fans.
Total number of friends of fans.
Weekly total reach.
People talking about this.
LIKES  (https://www.facebook.com/USERNAME?sk=page_insights_likes)
Demographics
Gender
Age
Country
City
Language
Where Your Likes Came From.
New Likes
Unlikes
Like Sources
REACH (https://www.facebook.com/USERNAME?sk=page_insights_reach)
Who You ReachedGenre + Age
How You Reached People.
Reach -> Organic, Paid, Viral, Total
Unique Users by frequency
Visits to your page
Page Views,
Unique Visitors
Total Tab Views
External Referrers
TALKING ABOUT (https://www.facebook.com/USERNAME?sk=page_insights_talking)
Who Is Talking About Your Page Genre + Age
How people are talking about your page
Talking about this
Viral Search

A: Information about the insights data available through the Facebook Graph API can be found here.

The Page, Application and Domain objects have an insights connection of this type. Post objects also have this connection where the Post was made by a Page.
Available metrics include application and page hits, adds, removes, and likes.

Note that you require the read_insights permission for the page.
Here is an example API response (with read_insights) for a test page I just created. All of the information you posted in the question would be there (except that the page has no users, so there won't be any proper data).
You can test this with one of your own pages using the Graph API explorer:

*

*Use https://graph.facebook.com/YOUR_PAGE_ID/insights/ as the URL.

*Get an access token with read_insights (on the 'Extended Permissions' tab) checked.

A: Twitter supplies an API to get the list of all your retweeted statuses:
https://dev.twitter.com/docs/api/1/get/statuses/retweets_of_me

If you poll that once a day, you should be able to get the updates with one or two API calls, which shouldn't impact your rate limits significantly.


text:
Q: Count Series of Values in Laravel I want to get the total occurrence of  values in a list. See the raw Data:

In Laravel, see the code i have written but it is not correct, so i need assistance:
public static function ServiceNo($service,$fltno,$type)
{
       $res =  DB::table('tbname')
        ->select(DB::raw('count(distinct(nextSvr)) as svr'))
        ->where(['fltno'=>$fltno,'mtype'=>$type,'serviceType'=>$service])
        ->get();
        foreach($res as $r){
          $cnn =  $r->svr;
        }

    return $cnn;

}

The above code, will only count the distinct nextsvr, however,what i want is better explained like this: from the above, the first three 7's are counted as 1, the next three series is 1, etc, at the end total count for service type A will be 9 services. Please, i need help in this regard.

A: You should try below example
$count = DB::table('tablename')->count(DB::raw('DISTINCT name'));

OR
DB::table('tablename')->distinct('name')->count('name');

A: Try this.
In MySQL it would be:
SET @prev := 0;
SELECT sum(col) as distinct_count
FROM (
    SELECT *, if(@prev = nextSvr,  0,  1) as col,
    @prev := nextSvr
    FROM tbname
) x

By using a variable I think you can look out for changes between rows and increment a counter accordingly. So if the row changes add 1.
You could translate this into eloquent and use it:
DB::statement(DB::raw('SET @prev := 0'));

$count = DB::select(DB::raw("
    SELECT sum(col) as distinct_count
    FROM (
        SELECT *, if(@prev = nextSvr,  0,  1) as col,
        @prev := nextSvr
        FROM tbname
    ) x
"))

A: Are you looking for something like this, perhaps?
public function countServices(Request $request)
{
   $counter = 0;
   $fltno = '';

   $foo = DB::table('bar')
    ->where([
        ['fltno', '=', $request->fltno],
        ['mType', '=', $request->type],
        ['serviceType', '=', $request->service]
    ])
    ->get();

    foreach( $foo as $bar )
    {
        if( $fltno != $bar->fltno )
        {
            $fltno = $request->fltno;
            $counter++;
        }
    }

    return $counter;
}


text:
Q: how can i Pass the Json Data from a local file to variable in JavaScript i have a json file with the below data mis.json
{
{"name": "lpcdpapp01.bmwgroup.net", "imagen": "server5.png"},
{"name": "lpcdpapp02.bmwgroup.net", "imagen": "server5.png"},
{"name": "lpcdpapp03.bmwgroup.net", "imagen": "server5.png"},
{"name": "lpcdpapp04.bmwgroup.net", "imagen": "server5.png"}
}

and I want to read this data in Javascript for search functionality . can some one help me how can i achieve this
   function form_submit() {
      var item = document.getElementById('ins').value;
      alert(item);
      var json = $.getJSON("mis.json", function(json) {
                    console.log(json);
                });
      alert(json);
}

Please help here and also greatful for search algorithm to


text:
Q: Deploying Strapi to Production Heroku database I have an updated Strapi site, running V3.1.4 - we've come from a V3.0.6 site, with minimal structural changes. Strapi can connect to Postgres on my local version, and everything is fine, but when deploying to Heroku it gets more complicated.
I have a staging site using a Heroku Hobby database, with the following packages:
"knex": "^0.20.10",
"pg": "^8.0.3",
"pg-connection-string": "^2.3.0",

and my config uses:
options: {
        pool: {
          min: 0,
          max: 18,
          createTimeoutMillis: 30000,
          acquireTimeoutMillis: 600000,
          idleTimeoutMillis: 30000
        }
      }

and SSL is set to false.
This runs fine, but if I then deploy this to 'live' (ie using a Production database that requires SSL) I get the following error:
[DATABASE] [10-1] sql_error_code = 28000 FATAL: no pg_hba.conf entry for host "3.249.190.208", user "XXX", database "XXX", SSL off

I've had this before, and as per this post, I've taken PG down to V7.4.3, but I then get this error:
error KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?

and no cannot get this to work by altering any of thee pool settings, including using:
ssl:true,
rejectUnauthorized: false,

Node and NPM are set to:
  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  },

I think I've read most posts around this subject but nothing seems to be working. Any ideas greatly received.

A: After a bit more searching and focusing on the Self Signed issue that is a result of no pg_hba.conf entry for host I came across https://github.com/strapi/strapi/pull/6050 which helped to resolve it.


text:
Q: Getting the e-mail of someone who clicked on a button? Not sure if this is even possible, but my (admittedly basic and tertiary) Googling has turned up a lack of results.
Is it possible to fetch the e-mail address of someone who clicks a button?
I'm trying to make a check-out spreadsheet that has a few functionalities Google Forms does not offer: specifically, graying out options in a list while those options are unavailable. I don't want people ignoring an e-mail box that they're meant to type in, or using another person's email, but I can't figure out if there is or is not a way to get the e-mail of someone who clicks a button.
Thanks in advance.

A: Shabnam got it.
[currentUser=Session.getActiveUser().getEmail()]
if you missed his comment.


text:
Q: Swift framework on Xamarin.iOS - Foundation.MonoTouchException has been thrown Xamarin iOS app was crashed while running swift framework.
In my .framework - Swift class
import Foundation

@objc(Member)
open class Member: NSObject {

    @objc
    func getMemberID() -> String {
        return "Hii, This is member code .framework"
    }
}

I have build a framework for simulator iPhone7 and added in Native framework on Visual studio Xamarin.iOS
And I have coded manually for interface class.
using System;

using ObjCRuntime;
using Foundation;
using UIKit;

namespace CustomLibrary {

    [BaseType(typeof(NSObject))]
    interface Member
    {
        [Export("getMemberID")]
        string MemberID { get; }
    }
}

After that I have add reference for Binding library to iOS App project.

In ViewController I have imported a Binding library and allocate a class and print in log.
using System;
using UIKit;
using CustomLibrary;

namespace SwiftFrameworkApp
{
    public partial class ViewController : UIViewController
    {
        public ViewController(IntPtr handle) : base(handle)
        {
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            Member memberObj = new Member();
            System.Diagnostics.Debug.Print(memberObj.MemberID());
        }

        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            // Release any cached data, images, etc that aren't in use.
        }
    }
}

When I build a project. Its was shown

Errors 0 and warning 1

After that When I run a project. App was launched in simulator and crashed with below error.

A: I mean in your Member interface, it should be something like this:
[BaseType(typeof(NSObject))]
interface Member
{
    [Export("getMemberID")]
    string GetMemberID ();
}


text:
Q: Is it correct to use 'for' after 'walk'? I would like to know whether it is correct to use 'for' after 'walk' in this sentence.

Everyday, we walk for 10 miles to the villages around our town.

A: It is correct but not required.

We walk for ten miles
We walk ten miles

have nearly the same meaning.  Slight difference in nuance, "walk for 10 miles" is more common when the distance is the purpose of the walk

Walk for 10 miles to raise money for cancer research.

But "walk 10 miles" when you are describing a walk for some other purpose

The car broke down and I had to walk ten miles to the nearest village.

Even so, you could remove "for" from the first and put it in the second and nobody would find it strange.


text:
Q: Looking for a way to copy a file that does not lock the file being copied I am aggregating together data that is being generated at a bunch of disparate sources, in a mixed environment of various versions of windows (xp/7) and one linux (centos). The data is available via network shares. The data is being produced by different software at each location, creating and appending to files at varying intervals. Most of the data sources are closed systems I do not have administrative access to, which really complicates the situation.
I am needing to periodically attach to the network shares and collect together the data into a central location, used for further distribution. The data is being generated and collected 24/7, for weeks at a time. This will be run from a Windows 2008 server machine.
The only hassle I am having with organizing this, is copying a file from a remote source without locking the file. I had initially set up a system that worked well using robocopy, until my testing found that the data source software would fail if it tried to append to a file currently being copied.
Unfortunately using vss is not an option as they are not volumes that are shared.
So, I am after some way to copy the file that will simply not lock the file while it is being copied. I am handling the files by checking modify times and sizes before and after copy, and flagging those with differences. Not having the exact most recent files is not an issue, but data loss at the source is.
I have looked into various backup software solutions but all that I have tested still lock files when they can't use vss.
I don't want to have to implement my own file copy software for something that should be pretty simple.

A: Not sure if XXCOPY can do what you want so you may want to read a post regarding its access to locked files. Otherwise, it sounds like XCOPY (and RoboCopy) on steroids. Not free for business use, although it is still being supported (latest version released on 12/27/2013)
Addition: The documentation says that XXCOPY itself does not lock the file while it copies it.

A: FileCopy.exe claims to be able to do this but it is rather old (2004) so I don't know if it will work for you. In addition, it isn't clear whether the copy would remain non-blocking when used over a network share.
It is, of course, quite dangerous to do non-blocking copies which is why most utilities don't support it. If the master application updates the file while you are copying, you are likely to end up with a corrupted copy.

A: Just to add another option, I have found FastCopy to copy files in shared read/write mode.
It seems fairly mature and has been around since 2004, and is open source under the BSD license found here. It is seeming like a good alternative, as not all the extra bells and whistles that XXCOPY provides are required.

A: try shadowspawn (with robocopy). It is quite good.
shadowspawn
Edit: i just realized that this is 2 years old. Sorry!


text:
Q: Secure spring webapp with cookies I am writing a little service which uses websockets (not topic!). I researched on how to secure websockets. But the documentations all say I have to secure the webapp like every other webapp (i.e. basic auth). I already tried basic auth and it seems to work. But I am in the need of securing the websocket service by cookies. So my question is:
How do you secure a spring webapp by cookies?
Regards

A: It can be done via servlet filters.
@Service
public class MyCookieAuthenticationFilter extends GenericFilterBean {

  @Override
  public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
    //set principal to request after request was validated...
  }
}

You have to register the filter too.


text:
Q: JAVAX @GET Annotation I am trying to get an ID from an url and, possibly the page and limit. What I currently have doesn't work and I am not seeing what I am doing wrong. Here is what I currently have.
    @GET
    @Path("venue/{locationid}?limit={limit}&page={page}")
    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
    @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8")
    public String locationDetail(@PathParam("locationid") String locationid,@QueryParam("limit") @DefaultValue("10") String limit,@QueryParam("page") @DefaultValue("1") String page ) throws IOException {
        return service.locationDetail(locationid,limit,page);
    }

}

The locationid is required, the other two are not really required and have to be their default values when not given. However when I look at the console I get the following error.

failed to execute: javax.ws.rs.NotFoundException: Could not find
  resource for full path: ./venue/175?limit=1&page=1

Does anyone know how to fix this? Thanks!


text:
Q: List of variables in jinja from csv file I need to print all items with identical names of columns in jinja2 template from csv file
csv file:
some1,letter,letter,letter,letter,some2
1,f,r,o,g,z
q,s,u,n,,a
a,f,a,c,e,q
z,n,a,n,o,1

i tried to use this jinj2 template:
{% for item in letter %}{{ item }}{% endfor %}

and result:
g

e
o

(only item from last "column" in csv)
but i need:
frog
sun
face
nano

A: I can suggest easy, elegant and flexible way to do this is with the help of the dictionary that can store values as a list for duplicate keys. See this SO answer for such dictionary class. But implementation of this class can be different, I don't insist that this one is the best.
import csv
import os
from itertools import groupby

class DictList(dict):
    def __init__(self, iterable, **kwargs):
        super(DictList, self).__init__()
        for k, v in iterable:
            self[k] = v
        self.update(**kwargs)

    def __setitem__(self, key, value):
        try:
            # Assumes there is a list on the key
            self[key].append(value)
        except KeyError: # if fails because there is no key
            super(DictList, self).__setitem__(key, value)
        except AttributeError: # if fails because it is not a list
            super(DictList, self).__setitem__(key, [self[key], value])

with open('test.csv') as csv_file:
    reader = csv.reader(csv_file, delimiter=',')
    header = next(reader)

    for row in reader:
        variables = DictList(zip(header, row))

This outputs:
{'some1': '1', 'letter': ['f', 'r', 'o', 'g'], 'some2': 'z'}
{'some1': 'q', 'letter': ['s', 'u', 'n', ''], 'some2': 'a'}
{'some1': 'a', 'letter': ['f', 'a', 'c', 'e'], 'some2': 'q'}
{'some1': 'z', 'letter': ['n', 'a', 'n', 'o'], 'some2': '1'}

A: You need something like this
import csv

with open('test.csv') as csv_file:
    data_lst = list(csv.reader(csv_file, delimiter=','))
    items = []
    data_without_header = data_lst[1:]
    for row in data_without_header:
        items.append("".join(row))

Use this in jinja
{% for item in items %}{{ item }}{% endfor %}

It would be displayed like this
frog
sun
face
nano


text:
Q: How to unmarshal json with unknown field and key From front-end I got this example of json:
{
  "properties":{"unknown key": "unknown value","unknown key2": "unknown value 2"}
}

I start to parse it with map[string]interface{} but it doesn't work. Also I don't know how much this fields I can got. It can be 10 or 1.
Code:
type test struct {
    p map[string]string `json:"properties"`
}

func main() {
    var t test

    body := `
    {
        "properties":{"unknown key": "unknown value","unknown key2": "unknown value 2"}
    }
    `

    json.Unmarshal([]byte(body), &t)

    fmt.Println(t.p)
}

This code always return an empty map.

A: You should export the field of the struct that should be Unmarshalled, like:
type test struct {
    P map[string]string `json:"properties"`
}

See https://go.dev/play/p/Fp91DTlrZpw


text:
Q: File Not Found Exception thrown for XML file possibly caused by Outlook I'm getting a file not found exception when my application is called by Outlook. It's called when an email is saved to the computer the app is called and performs an action on the saved message.
My app uses a XML file to store configurable settings but this file can't be found when Outlook calls to executes the application.  If I run the program manually then it works fine.
The interesting thing about the exception is this:
System.IO.FileNotFoundException: Could not find file 'C:\Program Files\Common Files\System\MSMAPI\1033\settingsOpened.xml'.
Why does Outlook think that the file is here ? This isn't the path for the file but I'm sure is related to Outlook. The way I'm referencing the path in the code is just:
XmlDocument xDoc = new XmlDocument();
xDoc.Load("settingsOpened.xml");

With the file being in the same folder as the .exe. I don't want to hard code the full path in for the XML files either.
Any help would be greatly appreciated.
Thanks,
Ross

A: From the code shown I would assume that it takes the current path as the location to look for the file. The current path is a bit unpredictable as certain operations effect its value and the value is persisted on each call. I.e. when another part of your application, or even another applciation, sets the current path this value is used the next time around. To set the current path it is enought to use a common dialog to browse for a certain file.
In your case I'd try to either to

*

*specify the path explicitly by deriving it from one of the well known folders (e.g. the user's app path - look for Environment.GetFolderPath and Environment.SpecialFolder)

or

*

*to resolve the path relative to your Dll's assembly path.

To find the assembly path for myType you can use the following code:
String strPath = System.IO.Path.GetDirectoryName(typeof(myType).Assembly.CodeBase);

In either case you should consider that in newer windows operating systems the user does not have write access to all paths of the system drive.


text:
Q: Showing two completions are the same. The problem is from Matsumura 8.5.

Let $A$ be a Noetherian ring and $I$ a proper ideal of $A$. Consider the multiplicative set $S=\{1+a: a \in I \}$. Then $A_{S}$ is a Zariski ring with ideal of definition $IA_{S}$, and its completion coincides with the $I$-adic completion of $A$.

My question is, how can one show $\tilde{A}=\tilde{A_{S}}$, where the left hand side is $I$-adic completion of $A$ and the right hand side is $IA_{S}$-adic completion of $A_{S}$?
What I found is that, using Theorem 8.12, if we let $I=(a_{1},\cdots, a_{n})$, then $IA_{S}$ is also generated by $a_{1}/1,\cdots, a_{S}/1$, thus
$$\tilde{A_{S}} \cong A_{S}[[X_{1},\cdots, X_{n}]]/(X_{1}-a_{1},\cdots, X_{n}-a_{n}),\quad \tilde{A} \cong A[[X_{1},\cdots, X_{n}]]/(X_{1}-a_{1},\cdots, X_{n}-a_{n})$$
However, I don't know how this two rings are isomorphic. Moreover, it seems that in general $A_{S}[[X_{1},\cdots, X_{n}]] \not\cong A[[X_{1},\cdots, X_{n}]]$, right? Do you have any idea for this statement?

A: To show that $A_S$ is a Zariski ring, we must verify $IA_S\subseteq \operatorname{rad}(A_S)$. This follows from the well-known characterisation (Matsumura, p.3) $$\operatorname{rad}(A_S)=\left\{x\in A_S\ \middle|\ 1+ax\text{ is a unit for all }a\in A_S\right\}\,.$$Indeed, every element $x\in IA_S$ is of the form $y/t$ for some $y\in I$ and some $t\in 1+I$, and every $a\in A_S$ can be written as $a=b/s$ for some $b\in A$ and $s\in 1+I$. Hence $1+ax=(st+yb)/(st)$, which is  a unit because $st+yb\in 1+I$.
To show that the natural map $\widehat{A}=\lim_{n\geq 0}A/I^n\rightarrow \lim_{n\geq 0}A_S/I^nA_S=\widehat{A_S}$ is an isomorphism, it suffices to check that all $A/I^n\rightarrow \lim_{n\geq 0}A_S/I^nA_S$ are isomorphisms. Observe that $A_S/I^nA_S$ is the localisation of $A/I^n$ at the image of $S$ in it, i.e., the localisation $(A/I^n)_{S_n}$ at the multiplicative subset $S_n=1+I/I^n\subseteq A/I^n$. But $1+I/I^n$ already consists of units! Indeed, an inverse for $1+x$ with $x\in I$ is given by $\sum_{i=0}^{n-1}(-1)^ix^i$. Hence $(A/I^n)_{S_n}=(A/I^n)$ and we are done.


text:
Q: How to write a complex number in polar form Complex number given:
$x = 1 + \cos \alpha + i \sin \alpha$
Desired form is something like $|x| \cdot e^{i \cdot \phi} = |x| \cdot (\cos \phi + i \sin \phi)$.
I somehow got completly stuck how to convert the number to the Euler style.
Maybe someone can help me.
I think I could write:
$x = \cos 0 + i\sin 0 + \cos \alpha + i \sin \alpha$
$x = (\cos 0 + \cos \alpha) + i (\sin 0 + \sin \alpha)$
Then $|x| = \sqrt{(\cos 0 + \cos \alpha)^2 + (\sin 0 + \sin \alpha)^2}$.
Is it then right to write $x = |x| \cdot e^{i \cdot \alpha} = \sqrt{(\cos 0 + \cos \alpha)^2 + (\sin 0 + \sin \alpha)^2} \cdot e^{i \cdot \alpha}$ ?
Is there a simpler way for the Euler style of $x$?

A: $$
\begin{align}
x & = 1 + \cos(\alpha) + i \sin(\alpha) = 2 \cos^2(\alpha/2) + i (2 \sin(\alpha/2) \cos(\alpha/2))\\
& = 2 \cos(\alpha/2) (\cos(\alpha/2) + i \sin(\alpha/2)) = 2 \cos(\alpha/2) e^{i \alpha/2}
\end{align}$$

A: The last step in your computation is quite wrong as well:
How is $\cos \alpha + \cos 0 + i ( \sin \alpha + \sin 0)$ equal to whatever you have written? Recall, $$\cos A + i\sin A = e^{iA}$$ is Euler's formula and not what you have just written.
This is a standard exercise, so here's the hint:
$$1+ \cos \alpha = 2 \cos^2\frac{\alpha}{2}$$
$$\sin \alpha = 2 \sin \frac {\alpha}{2} \cos \frac {\alpha}{2} $$


text:
Q: A word to describe low cost solutions that work well but lack aesthetics I am looking for a word to describe the products or solutions to problems that are made at a very low cost, often home-made or by a very small organization. The products or solutions perform their function very well, but lack the aesthetics found in major brands or finished products at retail stores designed just for that purpose.
Examples include:

*

*hand bags that are reasonably strong and functional, only a lot less attractive compared to expensive ones

*a home-made camera mount built by a few pieces of wood, glues and
rubber bands

*blocking sunlight from the window with aluminum sheets

EDIT: There have been a few suggestions with "hack" and "improvise". However I do not wish to convey the meaning that the solution is temporary or rushed under time pressure. The key point is low cost and sacrificing elegance, decorations which are unnecessary to make it functional. The goal is cost-effective. I think "utilitarian" comes pretty close.

A: serviceable, defined by Collins English Dictionary:

If you describe something as serviceable, you mean that it is good
  enough to be used and to perform its function.
His Arabic was not as good as his English, but serviceable enough.

*that will give good service, esp. in hard use; durable

Example (Made up):

My husband build the bookshelves for his office.   They are
  serviceable, especially for his heavy textbooks, but I wouldn't have them in the living room.

The definition I quoted does not explicitly mention low cost and devoid of frills, but I have never seen a luxury product described as serviceable.

A: There are several words you can use specifically for things that are home-made:

*

*Jury-rigged (North American) and its synonyms:

*

*
makeshift; improvised
Oxford Dictionaries

*Hack:

*

*
To jury-rig or improvise something inelegant but effective, usually as a temporary solution to a problem.
Urban Dictionary

*See also lifehack. Your last point is something I'd expect to see on Life Hacks SE.

A more general term would be cost-effective:

Effective or productive in relation to its cost.
Oxford Dictionaries

A: Homebrew

1.1 US informal as modifier
  Made at home, rather than in a shop or factory.
'a home-brew radio transmitter'
  — OD

Quoting wikipedia for the ham radio usage ...

Homebrew is an amateur radio slang term for home-built, noncommercial radio equipment. Design and construction of equipment from first principles is valued by amateur radio hobbyists, known as "hams", for educational value, and to allow experimentation and development of techniques or levels of performance not readily available as commercial products. Some items can be home-brewed at similar or lower cost than purchased equivalents.

A: A short phrase used in British English to describe this sort of solution or product is cheap and cheerful

not expensive and of reasonable quality

(Macmillan dictionary)
Another option could be no frills

A: Kludge (wiki)

A kludge is a workaround or quick-and-dirty solution that is clumsy, inelegant, inefficient, difficult to extend and hard to maintain.

In response to OP's EDIT:
Bare-bones (OXD)

Reduced to or comprising only the basic or essential elements of something.

A: Maybe hack might work:

*

*a piece of computer code providing a quick or inelegant solution to a particular problem.

*program quickly and roughly.

Source: ODO

A: "Streamlined" Often a prototype will be a no frills version of the intended finish product.  Off-brands are sometimes made by the same manufacturer as the product that carries all of the frill features and marketing costs.

A: 'functional'. Just about everything is 'functional' so when you use this word to describe an object, you're specifically conveying that the design/aesthetics are not worth mentioning.


text:
Q: double click doesn't work on win8 desktop from first time i have win8 and double clicking works fine after entering my computer. However, on the desktop when i double click any icon it doesn't open until the third click. i tried removing the domain user from profiles but the problem returned after running the programs i have. i thought it could be related to avcast or babylon so i uninstalled babylon and prevented avast from starting but the problem persists. i am suspecting it could be because of bwmeter which installs a network driver but what has the mouse driver to do with it? any ideas?

A: It could be the default Double Click Speed.
Go to Control Panel - Mouse - Buttons tab and play around with the Double Click Speed.
This could also be a hardware issue so the above may not work. You could also try re-installing the drivers for the mouse you are using.

A: The problem was with Yandex's Punto Switch which automatically switches languages when it detects which language you are typing with.
Up to now they haven't fixed the problem.


text:
Q: Check if entered text is valid in Xtext lets say we have some grammar like this.
Model:
    greeting+=Greeting*;

Greeting:
    'Hello' name=ID '!';

I would like to check whether the text written text in name is a valid text.
All the valid words are saved in an array.
Also the array should be filled with words from a given file.
So is it possible to check this at runtime and maybe also use this words as suggestions.
Thanks

A: For this purpose you can use a validator.
A simple video tutorial about it can be found here
In your case the function in the validator could look like this:
public static val INVALID_NAME = "greeting_InvalidName"

@Check
def nameIsValid(Greeting grt) {
    val name = grt.getName() //or just grt.Name
    val validNames = NewArrayList
    //add all valid names to this list

    if (!validNames.contains(name)) {
        val errorMsg = "Name is not valid"
        error(errorMsg, GreetingsPackage.eINSTANCE.Greeting_name, INVALID_NAME)
    }
}

You might have to replace the "GreetingsPackage" if your DSL isn't named Greetings.
The static String passed to the error-method serves for identification of the error. This gets important when you want to implement Quickfixes which is the second thing you have asked for as they provide the possibility to give the programmer a few ideas how to actually fix this particular problem.
Because I don't have any experience with implementing quickfixes myself I can just give you this as a reference.


text:
Q: Receiver registered but no intent is received in oreo My app will verify the SMS and fetch some data from it. Upto API 26 it was working fine. With Oreo they mentioned implicit broadcast receiver wont work from SO Q&As. I removed my receiver from Manifest and added in run time.
 registerReceiver(broadcast, new IntentFilter("android.provider.Telephony.SMS_RECEIVED"));

SMS permission also given in Run time and i am not sure why there is no intent received. I tried using Service but still same problem.  To get SMS permission am using this code.
 if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.RECEIVE_SMS)
            != PackageManager.PERMISSION_GRANTED)
   {

   ActivityCompat.requestPermissions(otpreadertwo.this, new String[]{Manifest.permission.RECEIVE_SMS},
                SMS_PERMISSION_REQ_CODE_SUBMIT);
    }

Getting overlay permission as well using the below code
 Intent intent = null;
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
            Toast.makeText(this,"Inside onclick",Toast.LENGTH_LONG).show();
            intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.setData(Uri.parse("package:" + getPackageName()));
            startActivityForResult(intent, 1234);
        }

my broadcast receiver
 public class Bcast extends BroadcastReceiver {
  private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
 public  Bcast(){ }
@Override
public void onReceive(final Context context, Intent intent) {
   if (intent.getAction().equals(SMS_RECEIVED)) {

     }
    }

Also i mentioned the permissions in Manifest. What changes do i need to made in order to receive the intent in Oreo. Please help.


text:
Q: Unable to run flutter command on MS VS code I have created a flutter project on VS, and could not run any command through VS code's terminal, I have reinstalled the VS code and still give me this error:

I have installed it again and don't know why it stays it is not installed!
Any idea how to solve it?
Thank you

A: From your image; you are using Visual Studio Code, not Visual Studio.
Flutter 2.10 arrives with stable support for building Windows app, for more.
Therefore, while running flutter doctor you are able to see this error. If you've plan to build Windows app, you need to install Visual Studio with Desktop development with C++. You need to download and install Visual studio if you wish to remove this error.
You can read more about build for window here.


text:
Q: Event triggered on MacBook when it is put on charge? I wanted to know if there is any event triggered by OS when MacBook is put on charging.
If yes, how can we capture the event real time using Python Script?


text:
Q: Is it possible to pass variable value from source file to makefile? I want to for example pass value which i have in main.c.
#define VERSION_MAJOR 1
#define VERSION_MINOR 1
#define VERSION_PATCH 0

That i can get these value in makefile variable for versiong my *.exe
For example then will my exe name look program_version_$(VERSION_MAJ)$(VERSION_MIN)$(VERSION_PAT).exe

A: It's possible, but way too complicated and not the best idea.
The better approach is to define the version in the makefile and then define the macros on the compiler command line (with -D in gcc).


text:
Q: bcp export command adds an extra column on 2 out of 400 records I am using bcp command to export a table out as a tab delimited text file.  Out of about 400 records, 2 records have an extra column and it's messing up those rows.
Here is the tsql code i've used to export.
DECLARE @bcpCommand varchar(2000)
DECLARE @FileName varchar(80)

 SET @FileName = 'c:\data\output.txt'
 SET @bcpCommand = 'bcp "SELECT * FROM  mytable" queryout "'
 SET @bcpCommand = @bcpCommand + @FileName + '" -T -c -S Localhost -f c:\format\myTable.fmt '

 EXEC master..xp_cmdshell @bcpCommand

All other recs are fine.  just these two.  There is an extra tab between the city field (#5) and the state field (#6).
Here is the format file.
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <RECORD>
  <FIELD ID="1" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="60" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="2" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="80" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="3" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="4" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="5" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="60" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="6" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="20" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="7" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="8" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="9" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="6" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
  <FIELD ID="10" xsi:type="CharTerm" TERMINATOR="\r\n" MAX_LENGTH="12" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
 </RECORD>
 <ROW>
  <COLUMN SOURCE="1" NAME="PlanTo" xsi:type="SQLNCHAR"/>
  <COLUMN SOURCE="2" NAME="DESCRIPTION" xsi:type="SQLNVARCHAR"/>
  <COLUMN SOURCE="3" NAME="ADDRESS1" xsi:type="SQLVARYCHAR"/>
  <COLUMN SOURCE="4" NAME="ADDRESS2" xsi:type="SQLVARYCHAR"/>
  <COLUMN SOURCE="5" NAME="CITY" xsi:type="SQLNCHAR"/>
  <COLUMN SOURCE="6" NAME="STATE" xsi:type="SQLNCHAR"/>
  <COLUMN SOURCE="7" NAME="ZIPCODE" xsi:type="SQLVARYCHAR"/>
  <COLUMN SOURCE="8" NAME="Status" xsi:type="SQLVARYCHAR"/>
  <COLUMN SOURCE="9" NAME="PriceList" xsi:type="SQLNCHAR"/>
  <COLUMN SOURCE="10" NAME="Broker" xsi:type="SQLNCHAR"/>
 </ROW>
</BCPFORMAT>

Can you help?


text:
Q: M1 MacBook Pro disconnects USB keyboard on sleep, needs restart MacBook Pro (13-inch, M1, 2020)
My keyboard usually looks like this in System Report:

After sleeping, the MacBook can't see any USB devices.

Unplugging and replugging the USB hub does not fix it. I have to restart the system to get it back.


text:
Q: How do I keep the aside element from causing my website to have to scroll to the right I've been trying to make my website responsive for devices with a maximum width of 600px using CSS. Everything works fine except for my aside element. When I put my website in a responsiveness simulator, I can scroll to the right (which is not supposed to happen).
Here is my code: https://codepen.io/xirokif/pen/OJpjNWO

/* https://codepen.io/xirokif/pen/zYZdqNg */

aside {
  float: right;
  width: 540px;
  background-color: #404653;
  border: 3px solid #30353f;
  padding: 15px;
  position: relative;
}

@media screen and (max-width: 600px) {
  aside {
    width: 200px;
    padding: 8px;
  }
  aside,
  li {
    padding: -3px;
    margin: 3px;
    margin-right: 30px;
    list-style-type: none;
  }
  aside,
  p {
    margin-right: 5px;
  }
  aside,
  summary {
    padding: 8px;
    margin: 3px;
  }
  aside,
  details {
    margin-right: -15px;
    margin-left: 5px;
  }
  p {
    margin-bottom: 15px;
  }
  hr {
    margin-top: 15px;
  }
  a {
    margin-top: 20px;
  }
}

/* table styling */

table,
th,
td {
  border: 2px solid #ffffff;
  border-collapse: collapse;
  padding: 5px;
}

tr:nth-child(even) {
  background-color: #3d4452;
}

HTML Forms

      HTML Forms

An HTML form is used to collect user input, and is most often sent to a server for processing.

Form tags

            Elements

form

input

label

input

            Attributes

text

radio

checkbox

submit

The form element

The element is used to create an HTML form for user input

The elment is a container for different types of input elements, such as text fields, checkboxes, radio buttons, submit buttons, etc.

The input element

input is the most used form element

The element can be displated in many ways, depending on the type attribute.

            Type
            Description

            text
            Displays a single-line text input field

            radio
            Displays a radio button (for selecting one of many choices)

            checkbox
            Displays a checkbox (for selecting zero or more of many choices)

            submit
            Displays a submit button (for submitting the form

            button
            Displays a clickable button

The label Element

The label tag defines a label for many form elements.

The for attribute of the label tag should be equal to the id attribute of the input element to put them together.

Note - It is useful for screen-reader users because the screen-reader will read the label out loud when the user focuses on the input element.

Text Fields

The
        defines a single-line input field for text input.

      Example Here

Radio Buttons

The
        defines a radio button.

Radio buttons let a user select ONE of a limited number of choices.

      Example Here

Checkboxes

The
        defines a checkbox.

Checkboxes let a user select ZERO or MORE options of a limited number of choices.

      Example Here

The Submit Button

The
        defines a button for submitting the form data to a form-handler.

The form-handler is typically a file on the server with a script for processing input data.

The form-handler is specified in the form's action attribute.

      Example Here

The Name Attribute for input

Each input field must have a name attribute to be submitted.

If the name attribute is omitted, the value of the input field will not be sent at all.

The image one the top is normal the one on the bottom shows the scroll

How do I fix this?

A: The negative margin on the aside element causes the overall body width to exceed 100%. That is why a scroll bar is shown by browsers.
Remove the line margin-right: -15px; in the declaration for the aside element and the scrollbar should be gone.

aside {
  float: right;
  width: 540px;
  background-color: #404653;
  border: 3px solid #30353f;
  padding: 15px;
  position: relative;
}

@media screen and (max-width: 600px) {
  aside {
    width: 200px;
    padding: 8px;
  }
  aside,
  li {
    padding: -3px;
    margin: 3px;
    margin-right: 30px;
    list-style-type: none;
  }
  aside,
  p {
    margin-right: 5px;
  }
  aside,
  summary {
    padding: 8px;
    margin: 3px;
  }
  aside,
  details {
    /* margin-right: -15px; This line must be gone! */
    margin-left: 5px;
  }
  p {
    margin-bottom: 15px;
  }
  hr {
    margin-top: 15px;
  }
  a {
    margin-top: 20px;
  }
}

/* table styling */

table,
th,
td {
  border: 2px solid #ffffff;
  border-collapse: collapse;
  padding: 5px;
}

tr:nth-child(even) {
  background-color: #3d4452;
}

HTML Forms

      HTML Forms

An HTML form is used to collect user input, and is most often sent to a server for processing.

Form tags

            Elements

form

input

label

input

            Attributes

text

radio

checkbox

submit

The form element

The element is used to create an HTML form for user input

The elment is a container for different types of input elements, such as text fields, checkboxes, radio buttons, submit buttons, etc.

The input element

input is the most used form element

The element can be displated in many ways, depending on the type attribute.

            Type
            Description

            text
            Displays a single-line text input field

            radio
            Displays a radio button (for selecting one of many choices)

            checkbox
            Displays a checkbox (for selecting zero or more of many choices)

            submit
            Displays a submit button (for submitting the form

            button
            Displays a clickable button

The label Element

The label tag defines a label for many form elements.

The for attribute of the label tag should be equal to the id attribute of the input element to put them together.

Note - It is useful for screen-reader users because the screen-reader will read the label out loud when the user focuses on the input element.

Text Fields

The
        defines a single-line input field for text input.

      Example Here

Radio Buttons

The
        defines a radio button.

Radio buttons let a user select ONE of a limited number of choices.

      Example Here

Checkboxes

The
        defines a checkbox.

Checkboxes let a user select ZERO or MORE options of a limited number of choices.

      Example Here

The Submit Button

The
        defines a button for submitting the form data to a form-handler.

The form-handler is typically a file on the server with a script for processing input data.

The form-handler is specified in the form's action attribute.

      Example Here

The Name Attribute for input

Each input field must have a name attribute to be submitted.

If the name attribute is omitted, the value of the input field will not be sent at all.


text:
Q: How to handle Dynamic JSON in Retrofit? I am using the retrofit efficient networking library, but I am unable to handle Dynamic JSON which contains single prefix  responseMessage which changes to object randomly, the same prefix ( responseMessage) changes to String in some cases (dynamically).
Json format Object of responseMessage:
{
   "applicationType":"1",
   "responseMessage":{
      "surname":"Jhon",
      "forename":" taylor",
      "dob":"17081990",
      "refNo":"3394909238490F",
      "result":"Received"
   }

}

responseMessage  Json format dynamically changes to type string:
 {
       "applicationType":"4",
       "responseMessage":"Success"
 }

My problem is since retrofit has built-in JSON parsing, I have to assign single POJO per request! but the REST-API unfortunately, is built on dynamic JSON responses. The prefix will change from string to object randomly in both success(...) and failure(...) methods!
void doTrackRef(Map<String, String> paramsref2) {
    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("http://192.168.100.44/RestDemo").build();

    TrackerRefRequest userref = restAdapter.create(TrackerRefRequest.class);
    userref.login(paramsref2,
            new Callback<TrackerRefResponse>() {
                @Override
                public void success(
                        TrackerRefResponse trackdetailresponse,
                        Response response) {

                    Toast.makeText(TrackerActivity.this, "Success",
                    Toast.LENGTH_SHORT).show();

                }

                @Override
                public void failure(RetrofitError retrofitError) {

                    Toast.makeText(TrackerActivity.this, "No internet",
                        Toast.LENGTH_SHORT).show();
                }

            });
}

Pojo:
public class TrackerRefResponse {

private String applicationType;

    private String responseMessage;          //String type

//private ResponseMessage responseMessage;  //Object of type ResponseMessage

//Setters and Getters

}

In above code POJO TrackerRefResponse.java  prefix responseMessage is set to string or object of type responseMessage , so we can create the POJO with ref variable with same name (java basics :)   ) so I'm looking for same solution for dynamic JSON in Retrofit.
I know this is very easy job in normal http clients with async task, but it's not the best practice in the REST-Api JSON parsing! looking at the performance Benchmarks always Volley or Retrofit is the best choice, but I'm failed handle dynamic JSON!
Possible solution I Know

*

*Use old asyc task with http client parsing. :(

*Try to convince the RESTapi backend developer.

*Create custom Retrofit client :)

A: The accepted answer seemed over complicated for me, I solve it this way:
Call<ResponseBody> call = client.request(params);
call.enqueue(new Callback<ResponseBody>() {
    @Override
    public void onResponse(Response<ResponseBody> response) {
        if (response.isSuccess()) {
            Gson gson = new Gson();
            ResponseBody repsonseBody = response.body().string();
            if (isEmail) {
                EmailReport reports = gson.fromJson(responseBody, EmailReport.class);
            } else{
                PhoneReport reports = gson.fromJson(repsonseBody, PhoneReport.class);
            }
        }
    }
    @Override
    public void onFailure(Throwable t) {
        Log.e(LOG_TAG, "message =" + t.getMessage());
    }
});

This is just an example in attempt to show you how you can use different model.
The variable isEmail is just a boolean for your condition to use the appropriate model.

A: I know I am very very late to the party. I had a similar issue and just solved it like this:
public class TrackerRefResponse {

    private String applicationType;
    // Changed to Object. Works fine with String and array responses.
    private Object responseMessage;

}

I literally just changed to type to Object. I chose this approach because only one field in the response was dynamic (for me, my response was way more complicated), so using a converter would have made life difficult. Used Gson to work with the Object from there, depending on if it was a String or Array value.
Hope this helps someone looking for a simple answer :).

A: Late to the party, but you can use a converter.
RestAdapter restAdapter = new RestAdapter.Builder()
    .setEndpoint("https://graph.facebook.com")
    .setConverter(new DynamicJsonConverter()) // set your static class as converter here
    .build();

api = restAdapter.create(FacebookApi.class);

Then you use a static class which implements retrofit's Converter:
static class DynamicJsonConverter implements Converter {

    @Override public Object fromBody(TypedInput typedInput, Type type) throws ConversionException {
        try {
            InputStream in = typedInput.in(); // convert the typedInput to String
            String string = fromStream(in);
            in.close(); // we are responsible to close the InputStream after use

            if (String.class.equals(type)) {
                return string;
            } else {
                return new Gson().fromJson(string, type); // convert to the supplied type, typically Object, JsonObject or Map<String, Object>
            }
        } catch (Exception e) { // a lot may happen here, whatever happens
            throw new ConversionException(e); // wrap it into ConversionException so retrofit can process it
        }
    }

    @Override public TypedOutput toBody(Object object) { // not required
        return null;
    }

    private static String fromStream(InputStream in) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        StringBuilder out = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            out.append(line);
            out.append("\r\n");
        }
        return out.toString();
    }
}

I have written this sample converter so it returns the Json response either as String, Object, JsonObject or Map< String, Object >. Obviously not all return types will work for every Json, and there is sure room for improvement. But it demonstrates how to use a Converter to convert almost any response to dynamic Json.

A: If it was not possible to change the backend API, I would consider the following variants (if Gson is used to convert JSON).

*

*We can use Gson type adapters to create a custom adapter for ResponseMessage type that dynamically decides how to parse the inoming JSON (using something like if (reader.peek() == JsonToken.STRING)).

*Put some meta information describing the response type into an HTTP header and use it to determine what type information must be fed to Gson instance.

A: For kotlin developers you can declare the type of your variable as Any
then convert it to Gson class with gson converter
data class SomeClass(
     ...somevariables,
     val respnseMessage : Any
)

Then in your activity or fragment wherever you want to parse and use it. based on your use case you can do something like this
 val gson = Gson()
 val data = gson.fromJson<YourDesireClass>
 (response.responseMessage.toString() , YourDesireClass::class.java)

A: RestClient.java
import retrofit.client.Response;
public interface RestClient {
  @GET("/api/foo") Response getYourJson();
}

YourClass.java
RestClient restClient;

// create your restClient

Response response = restClient.getYourJson();

Gson gson = new Gson();
String json = response.getBody().toString();
if (checkResponseMessage(json)) {
  Pojo1 pojo1 = gson.fromJson(json, Pojo1.class);
} else {
  Pojo2 pojo2 = gson.fromJson(json, Pojo2.class);
}

You must implement "checkResponseMessage" method.

A: Try custom deserialisation using gson-converter as below(updated answer for Retrofit 2.0)
Create three models as shown below
ResponseWrapper
public class ResponseWrapper {

    @SerializedName("applicationType")
    @Expose
    private String applicationType;
    @SerializedName("responseMessage")
    @Expose
    private Object responseMessage;

    public String getApplicationType() {
        return applicationType;
    }

    public void setApplicationType(String applicationType) {
        this.applicationType = applicationType;
    }

    public Object getResponseMessage() {
        return responseMessage;
    }

    public void setResponseMessage(Object responseMessage) {
        this.responseMessage = responseMessage;
    }

}

ResponseMessage
public class ResponseMessage extends ResponseWrapper {

@SerializedName("surname")
@Expose
private String surname;
@SerializedName("forename")
@Expose
private String forename;
@SerializedName("dob")
@Expose
private String dob;
@SerializedName("refNo")
@Expose
private String refNo;
@SerializedName("result")
@Expose
private String result;

public String getSurname() {
    return surname;
}

public void setSurname(String surname) {
    this.surname = surname;
}

public String getForename() {
    return forename;
}

public void setForename(String forename) {
    this.forename = forename;
}

public String getDob() {
    return dob;
}

public void setDob(String dob) {
    this.dob = dob;
}

public String getRefNo() {
    return refNo;
}

public void setRefNo(String refNo) {
    this.refNo = refNo;
}

public String getResult() {
    return result;
}

public void setResult(String result) {
    this.result = result;
}

}

ResponseString
public class ResponseString extends ResponseWrapper {

}

UserResponseDeserializer(custom deserialiser)
public class UserResponseDeserializer implements JsonDeserializer<ResponseWrapper> {
@Override
public ResponseWrapper deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {

        if (((JsonObject) json).get("responseMessage") instanceof JsonObject){
            return new Gson().fromJson(json, ResponseMessage.class);
        } else {
            return new Gson().fromJson(json, ResponseString.class);
        }

}
}

Retrofit 2.0 Implementation
Gson userDeserializer = new GsonBuilder().setLenient().registerTypeAdapter(ResponseWrapper.class, new UserResponseDeserializer()).create();

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("base_url")
            .addConverterFactory(GsonConverterFactory.create(userDeserializer))
            .build();

    UserService request = retrofit.create(UserService.class);
    Call<ResponseWrapper> call1=request.listAllUsers();

    call1.enqueue(new Callback<ResponseWrapper>() {
        @Override
        public void onResponse(Call<ResponseWrapper> call, Response<ResponseWrapper> response) {
            ResponseWrapper responseWrapper=response.body();
            Log.i("DYNAMIC RESPONSE", String.valueOf(response.body().getResponseMessage()));
        }

        @Override
        public void onFailure(Call<ResponseWrapper> call, Throwable t) {
        }
    });

Libraries Used

compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'

*****   Previous Answer (above answer is more recommended one) *****
Change your pojo like this
public class TrackerRefResponse {

  private String applicationType;
  private Object responseMessage;

  public Object getResponseMessage() {
  return responseMessage;
  }

  public void setResponseMessage(Object responseMessage) {
  this.responseMessage = responseMessage;
 }
}

and change retrofit's onResponse like this
 @Override
public void onResponse(Response<TrackerRefResponse > response) {
    if (response.isSuccess()) {
        if (response.getResponseMessage() instanceof String)
            {
            handleStringResponse();
         }
        else
            {
            handleObjectResponse();
         }
    }
}

you may also check this post for more details about dynamic json parsing

A: Any of your possible solutions will work. What you can also do is send the Retrofit api interface return type to response. With that response you get a body Inputstream which you can convert to a JSON Object and read as you see fit.
Look at: http://square.github.io/retrofit/#api-declaration - under RESPONSE OBJECT TYPE
Updated
Retrofit 2 is out now and with it some changes to the documentation and library.
Look at http://square.github.io/retrofit/#restadapter-configuration there are request and response body object that can be used.

A: In addition to what you told -
Use Callback
Then you can retrieve the fields using regular get method.
For more information, go through the javadoc of gson.
http://google-gson.googlecode.com/svn/tags/1.2.3/docs/javadocs/com/google/gson/JsonObject.html

A: I know I am late, but I just want to share my thought. I was working on a project where I am writing a method. The method uses retrofit to get data from server. Since other developers in my company will use this method, I could not use a POJO class (in your example, the TrackerRefResponse class). So I used JsonObject / Object like this:
interface APIService.java
public class APIService{
    @FormUrlEncoded
    @POST
    Call<JsonObject> myPostMethod(@Url String url, @Field("input") String input);
}

Then in my method, I wrote this:
Model1 model1 = null;
Model2 model2 = null;
Call<JsonObject> call = RetrofitClient.getAPIService().establishUserSession(post_request_url, someParameter);

call.enqueue(new Callback<JsonObject>() {
            @Override
            public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
                JsonObject jsonObject = response.body();
                // then do your stuff. maybe something like this
  try{
    model1 = new Gson().fromJson(jsonObject, Model1.class);
  }catch(Exception x){}
  try{
    model2 = new Gson().fromJson(jsonObject, Model2.class);
  }catch(Exception x){}

  if(model1 != null) { /*handle model1 */}
  if(model2 != null) { /*handle model2*/}
 // rest of the code
}

If you know that a certain attibute will tell you which type of response it is, you can use JsonObject , read that attribute and then cast the model like this way:
// ... retrofit codes
@Override
public void onResponse(Call<JsonObject> call, Response<JsonObject> response) {
  int number = jsonObject.get("applicationType").getAsInt();
  if(number == 1) {
    model1 = new Gson().fromJson(jsonObject, Model1.class);
  }
}
// ... rest of the code

You can also use Object instead of 'JsonObject`. Later, when you will know which kind of response it is, maybe you can cast this into desired object.

A: I too ran of this issue.
but i am not sure if this was your case , (i am using Retrofit2)
on my case i need to handle error, and success messages.
On Success
{
"call_id": 1,
"status": "SUCCESS",
"status_code": "SUCCESS",
"result": {
    "data1": {
        "id": "RFP2UjW7p8ggpMXzYO9tRg==",
        "name": "abcdef",
        "mobile_no": "96655222",
        "email": ""
    },
    "data2": [
        {
            "no": "12345"
        },
        {
            "no": "45632"
        }
    ]
}
}

On Error,
{
"call_id": 1,
"status": "FAILED",
"status_code": "NO_RECORDS",
"error": {
    "error_title": "xxx",
    "error_message": "details not found"
}
}

for this i just created another POJO Error,
public class ValidateUserResponse {
@SerializedName("call_id")
public String callId;
@SerializedName("status")
public String status;
@SerializedName("status_code")
public String statusCode;
@SerializedName("result")
public ValidateUserResult result;
@SerializedName("error")
public Error error;
}

Error.java
public class Error {
@SerializedName("error_title")
public String errorTitle;
@SerializedName("error_message")
public String errorMessage;
}

ValidateUser.java
public class ValidateUserResult {

@SerializedName("auth_check")
public String authCheck;
@SerializedName("data1")
public Data1 data1;
@SerializedName("data2")
public List<Data2> data2;
}

in the above case if the result key on json contains data1,data2 then the ValidateUserResult.java get initialised.
if error then the Error.java class get initialized.

A: Just look into the other options it works for me:-
Json
1.
{
   "applicationType":"1",
   "responseMessage":
   {
      "surname":"Jhon",
      "forename":" taylor",
      "dob":"17081990",
      "refNo":"3394909238490F",
      "result":"Received"
   }

}

2.
 {
       "applicationType":"4",
       "responseMessage":
    {
       "forename":" taylor",
       "dob":"17081990",
    }
 }
3.
{
       "applicationType":"5",
       "responseMessage":
    {
       "refNo":"3394909238490F",
       "result":"Received"
    }
 }

Pojo class will be:-
public class ResponseMessage
{
    private String surname;

    private String forename;

    private String dob;

    private String refNo;

    private String result;

    public void setSurname(String surname){
        this.surname = surname;
    }
    public String getSurname(){
        return this.surname;
    }
    public void setForename(String forename){
        this.forename = forename;
    }
    public String getForename(){
        return this.forename;
    }
    public void setDob(String dob){
        this.dob = dob;
    }
    public String getDob(){
        return this.dob;
    }
    public void setRefNo(String refNo){
        this.refNo = refNo;
    }
    public String getRefNo(){
        return this.refNo;
    }
    public void setResult(String result){
        this.result = result;
    }
    public String getResult(){
        return this.result;
    }
}

  public class Root
   {
    private String applicationType;

    private ResponseMessage responseMessage;

    public void setApplicationType(String applicationType){
        this.applicationType = applicationType;
    }
    public String getApplicationType(){
        return this.applicationType;
    }
    public void setResponseMessage(ResponseMessage responseMessage){
        this.responseMessage = responseMessage;
    }
    public ResponseMessage getResponseMessage(){
        return this.responseMessage;
    }
 }

now final code
 if(responseMessage.getSurname() !=null){
  ---do something---
 }
 if(responseMessage.getForename !=null){
   ----do something
 }
 if(responseMessage.getDob() !=null){
  ---do something---
 }
 if(responseMessage.getRefNo() !=null){
   ---do something---
 }
 if(responseMessage.getResult() !=null){
   ---do something---
 }


text:
Q: Flutter: Multiple Tap Gestures for Text I'm looking for a way to add multiple tap gestures to a block of text.
The block of text may consist of a hyperlink. The goal is that if a user taps on the link, navigate to that web page. If they tap anywhere else on the block of text, navigate to a detail view.
I am using Linkable to detect the links. That portion works as expected, but the other tap does not.
Here is what I have tried:
return InkWell(
    onTap: () {
        AutoRouter.of(context).push(
          // Detailed Page
        );
      }
    },
    child: Container(
      padding: const EdgeInsets.all(16.0),
      child: Linkable(
        text: myText,
        textColor: Colors.black,
        linkColor: Colors.blue,
     ),
   ),
);

A: You can use the RichText widget to break your texts into TextSpans. Add the following code to the TextSpan you want to make clickable.
 TextSpan(
   text: "Clickable text.",
   style: TextStyle(
   color: Colors.blue,
   ),
   recognizer: TapGestureRecognizer()
    ..onTap = () {
      doStuff();
    },
 ),


text:
Q: determine wether IP adresses can refer to same network I'm analysing a database of web visits wanting to determine the number of different places users log in from using their IP address (if possible).
So my database looks something like this:
prospect_id| ip.address
0          | 187.130.68.177
0          | 187.145.151.43
0          | 187.145.201.74
0          | 187.152.184.243

I know the first two octates denote the network's address.
From such example, would my number be 3?

A:
I know the first two octates denote the network's address.

Not necessarily.

From such example, would my number be 3?

You'll need to look them up on e.g. TCPIPUtils.com and check out the subnet range to find the "network's address".

*

*187.130.68.177 is in the range 187.130.64.0/19 (187.130.64.0 - 187.130.95.255).

*187.145.151.43 is in the range 187.145.128.0/19 (187.145.128.0 - 187.145.159.255).

*187.145.201.74 is in the range 187.145.192.0/19 (187.145.192.0 - 187.145.223.255).

*187.152.184.243 is in the range 187.152.160.0/19 (187.152.160.0 - 187.152.191.255).
However, the subnet only shows you the IP range and that all included IPs in the range belong to the same owner. To find the "administrative entity" that controls the ranges themselves you need to find the "Autonomous System". All of the above are part of the 8151 AS which is owned by Uninet, S.A. de C.V.

Uninet, S.A. de C.V. provides corporate networks and Internet access
  services. The company is based in Ciudad De Mexico, Mexico. Uninet,
  S.A. de C.V. operates as a subsidiary of Telefonos de Mexico, S.A.B.
  de C.V.


text:
Q: vector's destructor is called immediately and causes double free or corruption (out) I have a function in which vector's destructor is called immediately and causes error. I saw this with QtCreator's debugger

But when I comment out the next line, it works (not as expected but at least dont give error).
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <vector>

class Solution {
private:
    int min_cost(const std::vector<int>& costs, std::vector<int>& map, int start) const
    {
        //        if (map[start] > -1)
        //            return map[start];

        const int s = costs.size();
        if (start >= s - 2)
            return costs[start];

        int c1 = min_cost(costs, map, start + 1);
        int c2 = min_cost(costs, map, start + 2);

        int cost = std::min(c1, c2);

        if (start > -1)
            cost += costs[start];

        map[start] = cost;
        return cost;
    }

public:
    int minCostClimbingStairs(const std::vector<int>& costs) const
    {
        std::vector<int> map(costs.size(), -1); // from debuder, std::vector<int>::~vector is called here
        return min_cost(costs, map, -1); // commeting out this line out dont gives error
    }
};

int main()
{
    const std::vector<std::vector<int>> input = {
        { 10, 15 },
        { 10, 15, 20 },
        { 1, 100, 1, 1, 1, 100, 1, 1, 100, 1 },
        { 0, 0, 0, 0 }
    };

    const Solution Sol;

    for (auto const& i : input) {
        std::cout << ' ' << Sol.minCostClimbingStairs(i) << '\n';
    }
}

But How the min function can affect the vector's destructor? here is fiddle
I tested code with g++ 10.1.0 and clang++ 10.0.0

A: The program causes undefined behaviour:
map[start] = cost;

is executed when start is -1, which accesses out of bounds of the vector.

Also you are misinterpreting the debugger output.  The order of operations for the minCostClimbingStairs function is:

*

*Create map

*Call min_cost

*Destroy map

*Return

The first two things happen and then during the destruction of map, the heap corruption caused by the out-of-bounds write shows up as a runtime error when trying to destroy it.
If you step through the program line by line you should be able to follow this flow. I guess you ran the program in debugger without stepping and waited for it to stop, but didn't realize that the stop came after the call to min_cost. The stack trace output shows the current state of the stack, and min_cost does not appear in it since that function has already returned.