text:
Q: problemas para acceder a API curl con JS Un proveedor tiene una API que sería la siguiente
$ch = curl_init();
  curl_setopt($ch, CURLOPT_USERPWD, "xxxxx:yyyyyyy");
  curl_setopt($ch, CURLOPT_URL, "https://xxxx.yyyy.com/api/clientes");
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_FAILONERROR, false);
  $retorno = curl_exec($ch);
  $error = curl_errno($ch);
  if ($error) {
    echo "Error; " . $error;
  } else {
    curl_close($ch);
    return $retorno;
  }

la cosa está en que no consigo acceder a los datos, y el proveedor no da soporte para JS, tan solo da soporte para PHP, en php me funciona bien, pero lo que quiero es acceder diréctamente a través del front a los datos y simplemente mostrarlos.
Adjunto el código que estoy ejecutando:
(async () => {
    fetch("https://xxxx.dominio.com/api/clientes/1", {
        mode: "cors",
        method: "GET",
        headers: {
            Authorization: "Basic xxxxxx:yyyyyyyy",
        },
    })
        .then((response) => response.json())
        .then((json) => console.log(json));
})();

el código lo ejecuto desde el cliente, en mi navegador. Y tengo el plugin CORS habilitado y añado el mode: "cors" al header.
de hecho con la aplicación PAW for mac, creo la conexión y me da ok, me muestra los registros pero si lo ejecuto desde el js en el navegador me falla.
adjunto el Fetch JS exportado, si lo probais no funcionara porque esta limitada a ip.
// Request (GET https://citra.ispgestion.com/api/clientes/251)
fetch("https://citra.ispgestion.com/api/clientes/251", {
      "method": "GET",
      "headers": {
            "Authorization": "Basic bnJlZGVzOjVFbnViZUAyMDE4",
            "Cookie": "PHPSESSID=47977hfeq3lcvdrkshrpdrteea"
      }
})
.then((res) => res.text())
.then(console.log.bind(console))
.catch(console.error.bind(console));

A: Porque no consumes un archivo PHP que ejecute el curl y devuelves los datos en formato json o similar a tu Frontend de esa manera no deberías tener problemas, es más fácil y viable hacerlo así.
En vez de hacer el fetch a ellos lo haces a ese archivo PHP.
Espero mi respuesta te ayude.

A: el proveedor tiene capado el acceso JS por navegador. Peticiones por cliente y no por servidor.
gracias


text:
Q: Piecewise integral $f(x)=\begin{cases}x, 0\leq x \lt 1\\x-2, 1 \leq x \leq 2\end{cases}$ I've got stuck on a simple exercise after reading the first chapter on integrals in Spivak's Calculus. Decide if $f(x)$ is integrable and calculate the integral:
$$f(x)=\begin{cases}x, 0\leq x \lt 1\\x-2, 1 \leq x \leq 2\end{cases}$$
From the graph of the function I see that it's clearly $0$.
Also one of the theorems seems to come useful: if $f$ is integrable on $[a,c]$ and on $[c,b]$, then it's integrable in $[a,b]$ and $\int_a^b{f}=\int_a^c{f}+\int_c^b{f}$ for $a<c<b$.
Let $c=1$, it would seem that $$\int_0^2{f(x)dx}=\int_0^1{xdx}+\int_1^2{(x-2)dx}=\int_0^2{xdx}-\int_1^2{2dx}=2-2=0$$
The definition of the integral given in the chapter defines it in terms of a function $f$ on a closed interval $[a,b]$ as the the common value that equals the supremum of the set of all lower sums and the infimum of the set of all upper sums. But here I have $f(x)=x, x \in [0,1)$, it's not closed and $\int_0^1{xdx}$ doesn't really make sense. At this point I don't know anything about integrals defined on half-open intervals. And $f(x)$ on $[0,1]$ is not $x$, but also $x-2$ at $x=1$.
How to approach this problem knowing only the definition of the integral and the basic theorems like that above?

A: Indeed,$$\int_0^2f(x)\,\mathrm dx=\int_0^1f(x)\,\mathrm dx+\int_1^2f(x)\,\mathrm dx.$$On the other hand, if $x\in[0,1]$, then$$f(x)=\begin{cases}x&\text{ if }x<1\\-1&\text{ if }x=1.\end{cases}$$So, on $[0,1]$, $f(x)=g(x)-2h(x)$, with $g(x)=x$ and$$h(x)=\begin{cases}0&\text{ if }x<1\\1&\text{ if }x=1.\end{cases}$$But Spivak proves, right after theorem 2 of that same chapter, that a function similar to $h$ is integrable and that its integral is $0$. So, since $f|_{[0,1]}$ is the sum of integrable functions, $f|_{[0,1]}$ is integrable too.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Make a sentence from the term "computer literacy" Is it okay for me to write "having computer literacy", since the word literacy is a noun?

A:
We would like all students in our school to achieve basic computer
  literacy by the end of third grade.

--- Edit ---
I read your question more carefully.  I have a problem with having.  But if I change that word, and consider to have computer literacy, I would say, it's not wrong, but it's not mellifluous, and it would be better to say to be computer literate.

A: To be computer literate and to have computer literacy are both accepted when the first is strongly preferred.


text:
Q: Is this a bug for reputation on 'Top Answers' on my network page? I was recently suspended on Stack Overflow for a sockpuppet account that I used to upvote my questions and answers. On my network profile, it shows my top answer as being worth 5 vote score, but on SO, it shows it as being 4 (due to the sockpuppet's votes being removed). Is it just not updating the vote score?
Links: Sort array alphanumerically
https://stackexchange.com/users/13597334/jodast
Screenshots:


text:
Q: Firebase A/B Test User Distribution not correct, set 100% users but most users are remote config server side default value We are doing firebase remote config + AB test.  A/B test control group and variant: we set 100% users with value3 and Value4
When we check the data, for 100 users we see the distribution:

*

*value1 (in app default value):                    1 user

*value2 (remote config server side default value): 70 users

*value3 (ab test control group):                   14 users

*value4 (ab test variant A):                       15 users

We are not sure what's wrong. It suppose to be value3 50 users and value4 50 users.
We set the cache to be 24 hours and once get firebase server side value, we will override in app default value(value1)


text:
Q: Excel user form text box event I want to code a program that compares two columns in two sheets. The user will input the sheet names and ranges he/she wants to compare. If data are found in both sheets the first sheet will highlight the cells in green indicating that the value is available in the other sheet.
When I run the code it gives a run time '9' error: subscript is out of range
Note: When I run the code by entering the sheet name in the code instead of using the text box, it runs the program successfully.
 Private Sub FindBtn_Click()

 MsgBox (fromSheetTxtBox) ' it outputs the sheet name
'MsgBox (fromRangeFromTxtBox)
 'MsgBox (fromRangeToTxtBox)
'MsgBox (toSheetTxtBox)
'MsgBox (ToRangefromTxtBox)
'MsgBox (ToRangeToTxtBox)

'Dim toSheet As String
'Set toSheet = toSheetTxtBox.Value

Dim i As Integer
For i = 8 To 9331
    Set cell =       Worksheets(fromSheetTxtBox.Text).range("D8:D1427").Find(What:=Worksheets(toSheetTxtBox.Text).Cells(i, 2), lookat:=xlWhole)
If Not cell Is Nothing Then ' if jde cell value is found in tops then green jde cell
    Worksheets("toSheetTxtBox").Cells(i, 2).Interior.ColorIndex = 4

End If
Application.StatusBar = "Progress: " & i & " of 9331 " '& Format(i / 9331, "%")
Next i

End Sub

A: If toSheetTxtBox is a TextBox, change this line:
Worksheets("toSheetTxtBox").Cells(i, 2).Interior.ColorIndex = 4

to this:
Worksheets(toSheetTxtBox).Cells(i, 2).Interior.ColorIndex = 4


text:
Q: Seeding problem for a 3-way bracket I apologize in advance if this is not the correct place for this question. I'm going to be running a 36-person tournament in a certain activity, with the first two rounds being 3-way competitions (36->12->4).
My question is how to fairly seed these 3-way tournaments. Before the round of 36, I'll have a good idea of player strength, and the seeds will reflect that strength. I can either decide matchups by seed or by a rough estimation of player strength.
My idea was to give the highest strength of schedule to the 36th seed, the 2nd-highest to the 35th seed, etc. Is there any good method out there for figuring out matchups so that this can happen, or is there another method which would be appropriate for seeding such matchups?

A: Usually, scheduling based on seeding seems to be set up to improve the chance to retain the better players.
Here's one obvious possibility:
Going by seed, if we want to maximize the chances of keeping the top few seeds, we want the highest seed they face to be low and within that, the average seed they face to be fairly low.
One approach: Consider that the second-best player in each group is the 'main danger' to the top seeds. We can hold the average of the seedings of the 2nd and 3rd ranked player in each group constant, while keeping the lowest of the second-ranked seeds for the top seed, the second-lowest second-ranked player for the second seed and so on:
 1 24 25
 2 23 26
 3 22 27
 4 21 28
 5 20 29
 6 19 30
 7 18 31
 8 17 32
 9 16 33
10 15 34
11 14 35
12 13 36

This has the advantage that the top second-ranked players also have a reasonable chance to go through (it's not that much worse being 13th seed than 12th), so the difficulty of the draw for the top 2/3 of players seems to increase relatively smoothly. It might be particularly appropriate for the top 2/3 of players if the strengths in the bottom third are more nearly even than in the top groups (though the bottom-ranked players might then argue that the schedule for 36 is easier than for 25).
You could flip the third column top to bottom, but it's not clear to me that it's better. This would make the progression from easy to hard more rapid as you go down the first column of seed (weighting it more strongly to the top few seeds):
 1 24 36
 2 23 35
 3 22 34
 4 21 33
 5 20 32
 6 19 31
 7 18 30
 8 17 29
 9 16 28
10 15 27
11 14 26
12 13 25

This could be more suitable, for example, if the strength in the bottom third goes down more quickly than in the top groups (if the top seeds were more nearly evenly matched than the lowest-ranked 12 players were). If you want to focus on the task for the bottom 12 players, this makes the progression in difficulty more clear for them.
If you have some model for the chances of going through that might give you a better idea of which of those schedules will have the best chances of giving outcomes that are 'desirable'.


text:
Q: Multi Table Inheritance with rails 3 Are there standards or best practices yet when it comes to multi table inheritance in rails 3? So far the best article I could find was:
http://mediumexposure.com/multiple-table-inheritance-active-record/
But even that needed some changes(e.g. moving the requires to an initializer instead of the old /config/environment.rb)
Any better resources / standards?

A: I recently forked a promising gem to implement multiple table inheritance and class inheritance in Rails. I have spent a few days subjecting it to rapid development, fixes, commenting and documentation and have re-released it as CITIER (Class Inheritance and Table Inheritance Embeddings for Rails).
Consider giving it a look: https://github.com/PeterHamilton/citier
It actually takes some concepts from that article you mention.

A: There's a guy in the Melbourne Ruby group I attend that's written a couple of blogs on table inheritance in rails and the comments are really helpful as well. It's not specifically Rails 3 but there's definitely some decent pointers in there.
http://rhnh.net/2010/08/15/class-table-inheritance-and-eager-loading
http://rhnh.net/2010/07/02/3-reasons-why-you-should-not-use-single-table-inheritance
happy reading

A: For an easy way to do multi-table inheritance take a look at 'acts_as_relation' plugin https://github.com/hzamani/acts_as_relation.


text:
Q: form button issue in IE In Chrome and Firefox the text in the button is wrapped and takes two lines.
However in Internet Explorer text in the button is not wrapped and the button is extended.
See button download for $4.99 on
http://www.manual-buddy.com/p/technics/rs1500usvolume1-service-manual.html
CSS :
.paypalOrderSubmitButton {
    font-family: Arial,Helvetica,sans-serif;
    font-size: 14px;
    line-height: 100%;
    font-weight: normal;
    border-radius: 0.5em;
    padding: .5em 2em .55em;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
    color: white!important;
    border: solid 1px #DA7C0C;
    background: #FAA51A;
    white-space: normal;
}

thanks

A: Padding causes the button expands in IE, because IE will add the padding pixels.
You can use conditional tag to add the ie class depends on which IE browser. Then use the specific class to override your existing class to fix IE issues.
<!--[if IE ]><![endif]-->
<!doctype html>
<!--[if IE 7 ]>    <html lang="en" class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->

Then in your css file, you need to write some code like:
.ie7 .paypalOrderSubmitButton,
.ie8 .paypalOrderSubmitButton,
.ie9 .paypalOrderSubmitButton {
      width: 120px;
}

You can set the width, or you just set the padding to 0 for IE browsers.
This is a light-weighted way to fix IE issues.

A: What version of IE are you using? IE always has problems unless you are using the latest version. Not sure if it will work, but try adding this to your CSS.
        clear:both;

If that doesn't work, JFIDDLE it and let me see.
Updating answer, older versions of IE don't accept new CSS, actually IE is touch to work around. Sometimes javascript has to be implemented, but that won't work even sometimes. Another thing you could try is
      word-wrap: normal;
      word-wrap: break-word;
      word-wrap: inherit;

If all else fails, JFIDDLE your website and i'll take a look.

A: Set the width and height of the button and explicity add white-space: normal on element
style="width: 120px; height: 40px; white-space: normal"

You don't need char line breaks on the text. On IE it will be rendered wrong: "Downloadfor $4.99". Also, this trick doesn't work for some other browsers, as you can see here.

A: You can also try adding this to the list of CSS properties:
display: table\9;

That is a CSS hack to target IE only.
I'd suggest doing something like Harry Roberts' suggestion to use a shame.css file that is IE hack specific. That way it's easier to maintain your CSS as IE version support is slowly dropped.

A: Does it is a problem if you use width ?
.paypalOrderSubmitButton {
    font-family: Arial,Helvetica,sans-serif;
    font-size: 14px;
    line-height: 100%;
    font-weight: normal;
    border-radius: 0.5em;
    padding: .5em 2em .55em;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
    color: white!important;
    border: solid 1px #DA7C0C;
    background: #FAA51A;
    white-space: normal;
    width: 120px;  // I have added one here additional
}

Of course: the fiddle

A: Its because you have give padding in em (padding: .5em 2em .55em;)
Try giving it in px


text:
Q: Poisson random measure and $\alpha$-stable processes Let $N$ be a Poisson random measure in $(0,\infty)^2$ with intensity $\eta$ given by
$$\eta(ds, dx) = \mathbb{I}_{\{x>0\}} \dfrac{C}{x^{\alpha + 1}} ds \, dx.$$

*

*Find the values $\alpha$ for which $\eta$ is a $\sigma$-finite measure.

*Let $X_t = N(f_t)$ with
$$f_t(s,x) = \mathbb{I}_{\{s\leq t\}}\cdot x.$$
Find the values $\alpha$ for which $X_t<\infty$ for all $t\geq 0$ a-s.

*Compute $\mathbb{E}\left[e^{-\lambda X_t}\right]$

*Prove $X_t \overset{d}{=} t^{1/\alpha}X_1$.
Here is the problem, I have read a bit about stable Levy $\alpha$-processes and I can realize that the $\eta$ measure is related to a $\alpha$-stable process, which means that $\alpha$ must be between 0 and 2 for the $\eta$ measure to be $\sigma$-finite.
My problem with the first question is that I don't know how to prove that alpha must take those values mentioned. I understand that for a measure to be sigma-finite we must find a succession of countable sets with finite measure covering all $S = (0,\infty)^2$ and that is easy considering the intervals $A_n = \left(\dfrac{1}{n}, n\right)$. So my reasoning (which I think is not correct) is the following
$$\eta\left(A_n\times A_n\right) = \int_{1/n}^{n} \int_{1/n}^{n}\mathbb{I}_{\{x>0\}} \dfrac{C}{x^{\alpha + 1}} \, ds \, dx$$
but here we can conclude that this measure is finite for any value $\alpha \in \mathbb{R}$, which I believe is incorrect to assume from what I have already said about $\alpha -$stable processes.
For questions 2 and 3 I am using Campbell's theorem: in question two I had no problem finding that $\alpha \in (1,2]$ (this is assuming I had concluded that $\alpha \in (0,2]$ in question 1).
For question 3, again using the result of Campbell's theorem and assuming $\alpha \in (1,2]$, I have the following calculation:
\begin{align*}
        \mathbb{E}\left[e^{-\lambda X_t}\right] &= \exp\{-\int_S (1-e^{-\lambda f_t(s,x)})\ \eta\left(ds,dx\right)\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \int_0^\infty \left(1-e^{-\lambda f_t(s,x)}\right) \mathbb{I}_{\{x>0\}} \dfrac{C}{x^{\alpha+1}}\ ds\,dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \int_0^\infty \left(1-e^{-\lambda \mathbb{I}_{\{s\leq t\}}x}\right) \mathbb{I}_{\{x>0\}} \dfrac{C}{x^{\alpha+1}}\ ds\,dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \int_0^\infty \left(1-e^{-\lambda \mathbb{I}_{\{s\leq t\}} x}\right) \dfrac{C}{x^{\alpha+1}}\ ds\,dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \dfrac{C}{x^{\alpha+1}}\left[ \int_0^\infty \left(1-e^{-\lambda \mathbb{I}_{\{s\leq t\}}x}\right)\ ds\right]\,dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \dfrac{C}{x^{\alpha+1}}\left[ \int_0^t \left(1-e^{-\lambda x}\right)\ ds\right]\,dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \dfrac{C}{x^{\alpha+1}}\left[ \left(1-e^{-\lambda x}\right) \int_0^t \ ds\right]\,dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \dfrac{C}{x^{\alpha+1}} \left(1-e^{-\lambda x}\right) \cdot t\  dx\}\\[0.2cm]
        &= \exp\{-C\cdot t \int_0^\infty \left(1-e^{-\lambda x} \right) \dfrac{1}{x^{\alpha+1}} \, dx\}
    \end{align*}
However, once that point is reached, I am stuck, since I don't know how to calculate that remaining integral, I am almost sure that the development up to that point is correct, but I would appreciate some comment in case something is wrong or some alternative how to conclude the calculation.
Finally, for question 4, I think it is enough to find the expectation of the Laplace transform of $t^{1/\alpha} X_1$, and see that it matches the previous calculation, but again I run into a problem when developing the calculation
\begin{align*}
        \mathbb{E}\left[e^{-\lambda t^{1/\alpha} X_1}\right] &= \exp\{-\int_S \left(1-e^{-\lambda t^{1/\alpha} f_1(s,x)}\right)\ \eta\left(ds,dx\right)\}\\[0.2cm]
        &= \exp\{-\int_{0}^{\infty} \int_{0}^{\infty} \left(1-e^{-\lambda t^{1/\alpha} \mathbb{I}_{\{s\leq 1\}}x}\right)\ \mathbb{I}_{\{x>0\}} \dfrac{C}{x^{\alpha + 1}}\ ds \, dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \int_0^1 \left(1-e^{-\lambda t^{1/\alpha} x}\right)\ \dfrac{C}{x^{\alpha + 1}}\ ds \, dx\}\\[0.2cm]
        &= \exp\{-\int_0^\infty \dfrac{C}{x^{\alpha + 1}} \left[\int_0^1 \left(1-e^{-\lambda t^{1/\alpha} x}\right)\ \ ds\right] dx\}
    \end{align*}
Again, I would appreciate any comments or observations that may help me to proceed.

A: 1. For $\alpha>0$, the integral,
$$
\int_0^\infty(1-e^{-\lambda x}){dx\over x^{1+\alpha}}
$$
converges if and only if $0<\alpha<1$, because the integrand is $\sim \lambda x^{-\alpha}$ for $x\to 0+$. This is precisely the range of $\alpha$s for which $X_t<\infty$ a.s.
For   $\alpha\in(0,1)$,  the change of variables $u=\lambda x$ results in
$$
\int_0^\infty(1-e^{-\lambda x}){dx\over x^{1+\alpha}}=\lambda^\alpha\int_0^\infty(1-e^{-u}){du\over u^{1+\alpha}}.
$$
Now write $1-e^{-u} =\int_0^u e^{-t} dt$ and use Fubini:
$$
\eqalign{
\int_0^\infty(1-e^{-u}){du\over u^{1+\alpha}}
&=\int_0^\infty\int_0^t e^{-t}dt {du\over u^{1+\alpha}}  \cr
&=\int_0^\infty\int_t^\infty {du\over u^{1+\alpha}} e^{-t} dt\cr
&=\int_0^\infty t^{-\alpha}e^{-t} dt\cr
&=\int_0^\infty t^{(1-\alpha)-1}e^{-t} dt\cr
&=\Gamma(1-\alpha).\cr
}
$$
2. The measure $\eta$ is $\sigma$-finite for each $\alpha>0$. Indeed
$$
\eta\left( (0,n)\times (1/n,n)\right)=\lambda n\cdot{C\over\alpha}(n^\alpha-n^{-\alpha})<\infty
$$
for each positive integer $n$.


text:
Q: Activemq broker not starting in Servicemix 5.3.0 I created the below activemq broker configuration and tried to install in servicemix 5.3.0.
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:broker="http://activemq.apache.org/schema/core"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />

    <broker:broker brokerName="myBroker1" dataDirectory="${karaf.data}/activemq/myBroker1"
        useShutdownHook="false" startAsync="true">

        <broker:destinations>
            <broker:queue physicalName="SOME.QUEUE" />
        </broker:destinations>

        <!-- The transport connectors ActiveMQ will listen to -->
        <broker:transportConnectors>
            <broker:transportConnector name="openwire" uri="tcp://localhost:61617" />
            <broker:transportConnector name="stomp" uri="stomp://localhost:61614" />
        </broker:transportConnectors>

    </broker:broker>

</beans>

I get the following error in servicemix 5.3.0 logs

2014-12-17 14:03:17,959 | ERROR | xtenderThread-13 |
  ContextLoaderListener            | 121 -
  org.springframework.osgi.extender - 1.2.1 | Application context
  refresh failed
  (OsgiBundleXmlApplicationContext(bundle=com.att.ebiz.mq-broker-broker1,
  config=osgibundle:/META-INF/spring/*.xml))
  org.springframework.beans.factory.BeanDefinitionStoreException:
  Unrecognized xbean namespace mapping:
  http://activemq.apache.org/schema/core    at
  org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:284)[88:org.apache.xbean.spring:3.16.0]
    at
  org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:156)[88:org.apache.xbean.spring:3.16.0]
    at
  org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)[88:org.apache.xbean.spring:3.16.0]
    at
  org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:195)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)[76:org.apache.servicemix.bundles.spring-beans:3.2.9.RELEASE_1]
    at
  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:164)[120:org.springframework.osgi.core:1.2.1]
    at
  org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:136)[120:org.springframework.osgi.core:1.2.1]
    at
  org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)[78:org.apache.servicemix.bundles.spring-context:3.2.9.RELEASE_1]
    at
  org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)[78:org.apache.servicemix.bundles.spring-context:3.2.9.RELEASE_1]
    at
  org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)[120:org.springframework.osgi.core:1.2.1]
    at
  org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)[120:org.springframework.osgi.core:1.2.1]
    at
  org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[120:org.springframework.osgi.core:1.2.1]
    at
  org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)[120:org.springframework.osgi.core:1.2.1]
    at
  org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)[121:org.springframework.osgi.extender:1.2.1]
    at
  org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)[121:org.springframework.osgi.extender:1.2.1]
    at
  org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)[120:org.springframework.osgi.core:1.2.1]
    at
  org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)[121:org.springframework.osgi.extender:1.2.1]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]

The broker isnt starting. Please help. Thanks.

A: I found solution for the problem for not specifically for the error. I used blueprint and its working fine. Below is the blueprint broker configuration
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
    xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
    xmlns:broker="http://activemq.apache.org/schema/core">

    <bean
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />

    <broker:broker brokerName="myBroker1"
        dataDirectory="${karaf.data}/activemq/myBroker1" useShutdownHook="false"
        startAsync="true">
        <broker:destinations>
            <broker:queue physicalName="SOME.QUEUE" />
        </broker:destinations>

        <broker:transportConnectors>
            <broker:transportConnector name="openwire"
                uri="tcp://localhost:61617" />
            <broker:transportConnector name="stomp"
                uri="stomp://localhost:61614" />
        </broker:transportConnectors>
    </broker:broker> </blueprint>

A: We have currently an issue in ServiceMix 5.3.x and 5.4.x with missing Spring Deployer in Karaf 2.4.x (https://issues.apache.org/jira/browse/SM-2414).
As a workaround you can install it manually on ServiceMix 5.3.0
osgi:install -s mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.spring/2.4.0

and on 5.3.1 and 5.4.0:
osgi:install -s mvn:org.apache.karaf.deployer/org.apache.karaf.deployer.spring/2.4.1

I hope it helps.


text: Q: Auto-leveling bug with mothership modes in arras.io Sometimes when I enter a Mothership arena in arras.io, even with Auto Level-Up enabled and constantly pressing the key n, I still do not level up. This is only the case sometimes, so I presume this is a bug. Is this really a bug or intended, and should this be fixed?


text:
Q: images on canvas are being stack on each other I am using a for loop to put several images on a canvas.
My for loop generates positions with
         var posx= i*(50);
         var posy = i*(50);

         img.src = "./path/img.png";
         img.onload = function() {
         var canvas = document.getElementById("canvas").getContext('2d');

             canvas.drawImage(this, posx, posy);
}

even though I am changing my posx and posy , all of the images are being drawn at the same location.
I printed to the console their posx, posy , and they are different at each iteration.
any ideas?
thanks

A: Its a scope issue
You need to create a closure to keep all the calls from using the same (the last) posx and posy values.
Something like
img.onload = (function(x,y) { return function() {
        var canvas = document.getElementById("canvas").getContext('2d');
        canvas.drawImage(this, x, y);
    };
  })(posx, posy);

and it is also wise to use set the src of the image object after you define its onload to avoid issues with cached images.


text:
Q: Cannot Open Specified Excel File I am getting an error for my hyperlink saying "cannot open the specified file". I have checked for answers on other forums but nothing has worked so far. I just trying to make a dynamic hyperlink that opens something based on a cell's value. I am not sure if the syntax is wrong or can the only reason be the file path.
Public Sub add_hyperlink()
Dim arr() As String
arr = Split(Range("A11"), "_")
Range("F11") = arr(2)
ActiveSheet.Hyperlinks.Add anchor:=Range("F12"), Address:="C:Users\risha\Downloads\" & Range("A12"), ScreenTip:="Open file", TextToDisplay:="Open File"
End Sub


text:
Q: Transferring white label name servers from one Amazon Web Services account to another I have a domain (call it mydomain.com) registered at one AWS account (call it account A).  The DNS for mydomain.com is also handled by AWS at the same account A: there is a hosted zone in account A for mydomain.com, where the NS records are proprietary (white label) name servers (call them ns1.mydomain.com, ns2.mydomain.com, ns3.mydomain.com, ns4.mydomain.com) set up on aws cli using an AWS reusable delegation set.
I want to transfer registration and the DNS for my domain.com from account A to account B, so that in future the people controlling account B (I am an administrator of both accounts, but the other administrator of account B doesn't control account A) can change the DNS for my domain.com without having to ask me every time.
Transferring registration of a domain between two AWS accounts is simple: AWS has a support document explaining that they will cay out such internal transfers on request if you open a support ticket.
The issue I have is with transferring the hosted zone, and more specifically keeping the same white label name servers as before the transfer.
AWS also provides a support document for this topic, where it suggests that if you want to migrate a hosted zone from one AWS account to another, you must can programmatically list the records in the old hosted zone, edit the output, and then programmatically create records in a new hosted zone using the edited output.
While the special case of migrating a hosted zone with white label name servers isn't dealt with specifically in the document, I'm assuming the solution, since reusable delegation sets can't be migrated from one AWS account to another, is to (1) recreate a new reusable delegation set in account B, (2) using the ID in that reusable delegation set, programmatically create a hosted zone for mydomain.com in account B, and (3) create glue records connecting ns1.mydomain.com, ns2.mydomain.com, ns3.mydomain.com, ns4.mydomain.com.
That would suffice to make the DNS for mydomain.com to work without any interruption being caused by the transfer.  My problem is I don't know what I should be to keep using the same white label name servers (ns1.mydomain.com, ns2.mydomain.com, ns3.mydomain.com, ns4.mydomain.com) before and after the transfer, and without interruption.
In yet another AWS support document regarding domain transfers, which AWS says is "typically used when you're transferring domains from another registrar to Route 53, but the process is the same when you're transferring domains from one AWS account to another", AWS recommends that to make Route 53 the DNS service for your domain, you update the registration for the domain to use these four name servers.
The difficulty here is that when I will be creating those glue records in account B in order to prepare for the transfer, the glue records for the name servers will still be pointing to the IP addresses associated with the old reusable delegation set in the hosted zone in account A (which, as I understand, can't be transferred out of account A). Therefore, if I recreate identical records for the my domain.com hosted zone in account B, I must do one of the following, before sending AWS a support ticket requesting they carry out the transfer of the domain from account A to account B:

*

*include glue records in the account B hosted zone for mydomain.com pointing to the IP addresses matching the name servers in the account A reusable delegation set, or

*include glue records in the account B hosted zone for mydomain.com pointing to the IP addresses matching the name servers in the account B reusable delegation set.

Which is the correct way to do this?


text:
Q: How to batch add to collection in angular firestore? How to batch add to collection in angular firestore?
Following function tries to create new users inside a collection:
  batchCreate() {
    const batch = this.firestore.collection('users').ref.firestore.batch();

    this.users.forEach((user) => {
      const ref: any = this.firestore
        .collection('users')

// even if  reference a doc like this (it doesnot works):
//      const ref: any = this.firestore
//        .collection('users').doc(user.id)

//this collection and documents doesnot exists on the db.

      batch.set(ref, user);
    });

batch.commit()
  }

But the above logic is not working.
Not sure why!
The idea was to create a collection (which formally doesnot exists but created on the go), and push the whole list of users in a single transaction, instead of single post requests. Is that possible?
The idea was to bulk add or update a collection

A: Try this:
const batch = this.firestore.firestore.batch();
this.users.forEach(user => {
    const insert = this.firestore
        .collection('users')
        .doc(user.id).ref; // Don't forget this ".ref"
    batch.set(insert, user);
});
return batch.commit();


text:
Q: Django CreateView redirect to ListView when form invalid i have views.py like this
class InventoryListView(ListView):
    context_object_name = 'inventorys'
    model = models.Inventory

    def get_context_data(self, **kwargs):
        context = super(InventoryListView, self).get_context_data(**kwargs)
        context['form'] = InventoryForm()
        return context

class InventoryCreateView(CreateView):
    fields = ('name', 'sn', 'desc', 'employee')
    model = models.Inventory

and here my models.py
class Inventory(models.Model):
    name = models.CharField(max_length=255)
    sn = models.DecimalField(max_digits=20, decimal_places=0)
    desc = models.TextField(blank=True, null=True, default='Empty')
    employee = models.ForeignKey(Employee, null=True, on_delete=models.SET_NULL, related_name='employee')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True, null=True)

    def __str__(self):
        return self.name

    def get_absolute_url(self):
        return reverse("system:inventory_list")

and here my urls.py
url(r'^invn/$',views.InventoryListView.as_view(), name='inventory_list'),
url(r'^invn/create$',views.InventoryCreateView.as_view(), name='inventory_create'),

and here my inventory_list.html
{% for inventory in inventorys %}
  {{ inventory.name }}
{% endfor %}

<form method="post" action="{% url 'system:inventory_create' %}">
  {% csrf_token %}
  {{ form.as_p }}
</form>

if the form is valid, its work well.
But if the form is invalid it will redirect to inventory_form.html that will cause TemplateDoesNotExist since Django CreateView need inventory_form.html (CMIIW).
simple solution create inventory_form.html but that not what I want.
how to make it redirect to my ListView when the form is invalid with error messages ?...

A: It's easy to redirect to ListView.
Just override form_invalid() in CreateView.
Default form_invalid() is below
def form_invalid(self, form):
    """If the form is invalid, render the invalid form."""
    return self.render_to_response(self.get_context_data(form=form))

You can redirect to your ListView.
But the problem is, when redirect, you cannot pass any context or message to them. It just redirects to your listview.
So you have few choices.
First, you can keep form_invalid() the same, and if form is invalid (you can check it with error with form.errors) show alert error message in the CreateView page with alert or confirm, and when click ok, redirect to listview page.
Second, you can use session. Before redirect to listview, you can give some session data for deciding it's from invalid CreateView.
I think first one is better approach for web.
If you have any question, just comment it.

A: Possible to redirect User inside form_invalid() method, and use the Django Message Framework, to alert the user (Error Message).
from django.contrib import messages
from django.shortcuts import redirect

class InventoryCreateView(CreateView):
    fields = ('name', 'sn', 'desc', 'employee')
    model = models.Inventory

    def form_invalid(self, form):
        'form is invalid'
        messages.add_message(self.request,messages.WARNING,"Form is invalid")
        return redirect('inventory_list')

To retrieve the message in template:
{% if messages %}

    {% for message in messages %}

{{ message }}

    {% endfor %}

{% endif %}


text:
Q: Type hint function where return type depends on input list item type What is the best type hint for a function that returns an item from an input argument which is a list?
Here is the function:
def ask_mcq(title: str, prompt: str, options: list) -> ???:
    ...snip...
    v = tk.IntVar()
    for i, option in enumerate(options):
        tk.Radiobutton(root, text=option, variable=v, value=i).pack(anchor="w")
    ...snip...
    return options[v.get()]

I tried checking other questions, like this one, but none of them seem to answer this question in specific. I am not an expert.

EDIT: By reading the comments and answers, I realize now that the question doesn't really make sense in the case where I ask the user to choose an option. It's better to return a string and handle it afterwards. I accepted @balderman's answer because it's the most applicable to this unlikely situation.

A: See the example below (assuming options is a list of Any)
from typing import List,Any

def ask_mcq(title: str, prompt: str, options: List[Any]) -> Any:
    return options[0]

A: The question's answer you are linking specifies the solution rather clearly. You should use function overloads to return a value from the list, and inside the function check what possible values it can take (with the if statement in the question's answer), and returning a typed variable.
I think your code would look something like this:
from typing import overload

# ...snip...

@overload
def map_type(value: int) -> MyEnum: ...

@overload
def map_type(value: str) -> MyCustomClass: ...

def ask_mcq(title: str, prompt: str, options: list) -> Union[MyEnum, MyCustomClass]:
    ...snip...
    v = tk.IntVar()
    for i, option in enumerate(options):
        tk.Radiobutton(root, text=option, variable=v, value=i).pack(anchor="w")
    ...snip...

    if isinstance(options[v.get()], int):
        return MyEnum(options[v.get()])
    elif isinstance(options[v.get()], str):
        return MyCustomClass(options[v.get()])
    raise TypeError('Invalid input type')

EDIT: If the list can take any value, @balderman's answer is more adequate.


text:
Q: Zend_Validate good strategy to avoid repetition of code I'm am currently building two custom validators that extends Zend_Validate_Abstract which are named respectively Lib_Validate_TimeAfter and Lib_Validate_TimeBetween. The names a pretty straight forward, the first one is used to test if a date/datetime/time comes after an other one and the second is used to test if a date/datetime/time comes between two other date/datetime/time.
Both of those validators would rely on the same method named _buildDate($value) which take a value in the form of a datestamp, a hourstamp(either hh:mm or  hh:mm:ss), a timestamp or an ISO_8601 timestamp and convert it in a usable date format.
Since I dont want to repeat myself and copy/paste the method in both of my validator, I was looking for the best way to do it.
The avenues I am looking at right now would be to develop somekind of class helper that my validators would be able to use (kind of messy way of doing things since it add unessesary dependencies) or I could add an other layer of abstraction by building an other validator that validate date/datetime/time and then extend my two validators on that since I could share the method _buildDate($value), but then I don't think I would really need the validator.
So, what would be a good way (I am not really looking for the "Way of the gods" of doing thing) to structure that kind of code to avoid repetition (DRY)?

A: You might want to build one validator instead of two, where you can pass in a dateBefore, dateAfter which are both optional. If you pass only dateBefore, your $value will be valid if it is after that date, if you pass in both, it will have to be between them and if you pass in only dateAfter, the value will have to be before that date.
This would be flexible, clear, generic, less code and even cover one more case.

A: What about a class Lib_Validate_Common which extends Zend_Validate_Abstract which has your common method. And Lib_Validate_TimeAfter and Lib_Validate_TimeBetween extends Lib_Validate_Common .


text:
Q: Meeting multiple conditions that aren't set simultaneously in componentWillReceiveProps I need to use componentWillReceiveProps() to call a method in my component once three conditions are met. Two of these conditions compare current props to next props, and those two receive their values via an Ajax request. The problem is not all conditions will be true at the same time.
For example.
export class Styles extends Component {
    componentWillReceiveProps(nextProps) {
        if (
            !_.isEmpty(nextProps.one) &&                    // set via ajax request
            !isEqual(this.props.two, nextProps.two) &&
            !isEqual(this.props.three, nextProps.three)     // set via ajax request
        ) {
            this.myMethod();
        }
    }

    myMethod() {
        … do something
    }

    render() {
        return (
            <div />
        )
    }
}

Because two of the props are being set with an Ajax response, I can't be sure when those values are set and when they'll fulfill the condition. I obviously need to achieve three true values in order to call this.myMethod(), but instead I get various combinations of true/false at any given time. It's a bit of a lottery scenario.
Do I ultimately need to manage each of these conditions temporarily in state, then clear them out when they're met?

A: You could do this without the deprecated componentWillReceiveProps with something like this:
export class Styles extends Component {
  isDirtyTwo = false;
  isDirtyThree = false;
  ..
  componentDidUpdate(prevProps) {
    this.isDirtyTwo = this.isDirtyTwo || !isEqual(prevProps.two, this.props.two);
    this.isDirtyThree = this.isDirtyThree || !isEqual(prevProps.three, this.props.three);
    if (!_.isEmpty(this.props.one) && this.isDirtyTwo && this.isDirtyThree) {
      this.isDirtyTwo = false;
      this.isDirtyThree = false;
      this.myMethod();
    }
  }
  ..
}

This will call myMethod when one is empty and both other props have changed at some point. (I'm assuming that once one is empty it stays that way, but if not, you could add another property for it.)


text:
Q: What workflow should I use for JavaScript editing? Warning: I have very little JavsScript experience.
In my past programming experience, I usually have a standalone interpreter/compiler, a text editor and a command line to compile/run my software or my tests (I love test driven development). I really like it this way, since I have the feeling of being in complete control over the tools. However, editing JavaScript I need to put statements in a text file , open my web browser and click on reload. I don't feel comfortable with it, as I cannot really see what is going on (besides some alert boxes).
Can you suggest me (I'm on a Mac) another workflow? Perhaps with a debugger? Is there a standalone JavaScript interpreter?

A: Opera, Internet Explorer, Chrome and Safari all come with good debuggers built in (links go to information about the debuggers).
They are all modeled after Firebug, an extension for Firefox (and the existence of which is why Firefox doesn't have one built in).

A: Firebug has a javascript debugger,a console, and a command line. I couldn't live without it.
Firebug is a firefox extension. They do have firebug lite for other browsers.
As far as workflow goes... Ctrl+S, Alt+Tab, F5 over and over again.

A: I would throw in validation there as well, use jslint either via one of the available command line tools, or via eg. Aptana which has builtin validation.
Setting up a simple build script is also preferable. I do it with all my projects and lets it handle validation, conditional code (debug versions etc) and minifying.
This http://github.com/oyvindkinsey/easyXDM/blob/master/build.xml is for instance the build setup for easyXDM. It does everything from pushing out new versions to the website to creating documentation and zip files..


text:
Q: File system on SD card using STM32MP157D-DK1 Dear Stackoverflow community,
I am working on a project using STM32MP157D-DK1 and currently trying to create a File System using SD card.
I am not getting the option for FATFS in the CubeMX configuration. (see in picture)
Please help me out!
I am following the instructions of a video on ST's official Youtube page:
https://www.youtube.com/watch?v=I9KDN1o6924
picture: https://imgur.com/a/bN5oR3p

A: I think FatFs is included with the STM32Cube MCU Package for STM32MP1.  On the STM32CubeMX Pinout & Configuration Page, drop down the Software Packs menu and select Manage Software Packs.  In the Embedded Software Packages Manager dialog box, on the STM32Cube MCU Packages tab, expand the STM32MP1 row and ensure that the latest STM32Cube MCU Package for STM32MP1 is checked and installed.


text:
Q: Trouble getting the correct pay response from the PPMessage.php Core File when using PPMessage::init() function? I'm working in a custom PAYPAL adaptive payments gateway and I'm having problems getting the right pay response (new PayResponse) in php. I have tracked the error and I found it in the core file PPMessage.php. My payment gateway can create the following paykey with Paypal adaptive payments:
$resp = array (
  'responseEnvelope.timestamp' => '2016-02-05T06:57:57.098-08:00',
  'responseEnvelope.ack' => 'Success',
  'responseEnvelope.correlationId' => 'e24f3c602852a',
  'responseEnvelope.build' => '17820627',
  'payKey' => 'AP-62K58588W7248331V',
  'paymentExecStatus' => 'CREATED',
);

when I want to translate it to a pay response I do the following:
    $ret = new PayResponse;

    $ret->init($resp);

PayResponse extends PPMessage which defines the method init. However, the core file PPMessage gives me the following answer:
ret=PayResponse::__set_state(
        array(
            'responseEnvelope' => NULL,
            'payKey' => 'AP-62K58588W7248331V',
            'paymentExecStatus' => 'CREATED',
            'payErrorList' => NULL,
            'paymentInfoList' => NULL,
            'sender' => NULL,
            'defaultFundingPlan' => NULL,
            'warningDataList' => NULL,
            'error' => NULL,
        ))

The problem is with the responseEnvelop key, since it should be an array and I'm getting NULL. I don't know how to modify the PPMessage::init method in order to fix the problem. Can anyone help me? The correct pay response should be as follows:
PayResponse::__set_state(array(
   'responseEnvelope' =>  ResponseEnvelope::__set_state(array(
          'timestamp' => '2016-02-05T06:57:57.098-08:00',
          'ack' => 'Success',
     'correlationId' => 'e24f3c602852a',
     'build' => '17820627',
  )),
   'payKey' => 'AP-62K58588W7248331V',
   'paymentExecStatus' => 'CREATED',
   'payErrorList' => NULL,
   'defaultFundingPlan' => NULL,
   'error' => NULL,
))

Note that in the correct response, the responseEnvelope is an object.
Here is a link to the PPMessage file form GitHub. Any help from someone who knows the paypal core files would be appreciated. Could anyone check that this error is general or if the problem is unique to my setup?
thanks.

A: After looking more into my setup, I found out that the problem is on my PayPal installation. I'm failing to load the ResponseEnvelope class. There is an error, and the class is not loaded. So I'm closing out this question. Thank you for reading this.


text:
Q: Socle of tilting modules in the BGG category $\mathcal{O}$ over a semisimple Lie algebra Suppose that $\mathfrak{g}$ is a finite dimensional, complex, semisimple Lie algebra. Let $\mathcal{O}$ be the BGG category over $\mathfrak{g}$.
Tilting module theory play an important role in the study $\mathcal{O}$. They are sometimes projective covers and hence injective since the duality functor preserve tilting modules. Is it true that every tilting module has simple socle?
Thanks!

A: EDIT: Following a conversation with Ivan Losev, the situation is clearer now. Consider the principal block of $\mathcal{O}$. Recall two facts:
1) the socle of any Verma module is $L_{w_0}$,
2) taking the socle is a left exact functor.
Thus the socle of any object with Verma flag (in particular a tilting module) is isomorphic to a direct sum of copies of $L_{w_0}$.
Now if $T_x$ is an indecomposable tilting module we have
$\dim Hom(L_{w_0}, T_x) = P_{id, xw_0}(1)$
where $P_{y,z}$ is a Kazhdan-Lusztig polynomial. Thus the socle is simple if and only if $P_{id, xw_0} = 1$ which is the case if and only if the Schubert variety $xw_0$ is rationally smooth.
The formula is a consequence of the more general formula (which Peter reminded me of):
$dim Hom(\Delta_x, T_y) = P_{w_0x,w_0y}(1)$
See e.g. "Tilting exercises" or Soergel's papers on tilting modules.
(I deleted the longer version of the answer, because this seems much cleaner than earlier attempts.)


text:
Q: MATLAB: flushing event queue with drawnow The function drawnow

causes figure windows and their children to update, and flushes the system event queue. Any callbacks generated by incoming events (e.g., mouse or key events) are dispatched before drawnow returns.

I have the following script:
clear all;
clc;

t = timer;
set(t, 'Period', 1);
set(t, 'ExecutionMode', 'fixedSpacing');
set(t, 'TimerFcn', @(event, data) disp('Timer rollover!'));

start(t);

while(1)
    %# do something interesting
    drawnow;
end

With the drawnow in place, the timer event will occur every second. Without it, no callback function occurs because the while loop is "blocking".
My questions:
1) Is there a way to flush the queue without updating figure windows?
2) When we say "flush the event queue", do we mean "execute everything in the event queue", "execute what's next in the queue and drop everything else out of the queue", or something else entirely?
I have multiple callback functions from multiple separate timers happening in the background of my program. Not having one of these callbacks executing is not an option for me. I just wanted to clarify and make sure I'm doing the right thing.

A: 1) Not to my knowledge - at least, I believe the only way to flush the queue is to call drawnow. Depending on what you mean by 'update figure windows', you may be able to prevent drawnow from having an undesirable effect (e.g. by removing data sources before calling drawnow).
2) I can't test this right now, but based on how I've used it before, and the description you gave above, I'm pretty sure it's "execute everything in the queue".
Another thing I'm not sure about is whether you need while 1; drawnow - don't events work as you would expect if you just end the script after start(t)? I thought drawnow was only necessary if you are doing some other stuff e.g. inside the while loop.

A: If you also place a small pause in the loop, that also frees up some time for the timer.  For example pause(0.001).  Some examples:
start(t); while(1);  end;              %No timer events occur
start(t); while(1); pause(0.001); end  %Timer events occur
start(t); while(1); drawnow; end       %Timer events occur (your original example)
start(t); while(1); pause(0); end      %No timer events (just thought I'd check)


text:
Q: Any reason why this javascript blink code won't work? I have the below code in the second of two js files from a web-app.
It works fine, until I combine the two js files into one. Then the js breaks.
function oBlink()
{
return window.setInterval
(
    function()
    {
        $("#sOr").css("background-color", function (){ this.switch = !this.switch; return this.switch ? "#F90" : ""  });
    }
    , 500
);
}

I've isolated the problem to the code
this.switch = !this.switch; return this.switch ? "#F90" : ""

If I take that out, the rest of my js works fine.
I understand there are a lot of external variables that could be coming into play here, but I just wanted to check with you guys that the above function code doesn't have any errors in it.
Thanks for taking a look.

A:
it's working fine in the browser, but failing when checking it on certain devices in the Android emulator.

That's probably because you are using switch in your code which is a reserved word in JavaScript. Only ECMAScript5-based browsers allow using reserved words as object's properties.
Instead of using a flag you can declare a CSS class and use the jQuery's toggleClass method.

A: Make sure you define somewhere

switch = false

Then Try

$("#sOr").css("background-color", function (){ this.switch =
  !this.switch; return (this.switch ? "#F90" : "#FFF" ) });


text:
Q: PHP, jQuery & Chartist.Js: Display live data from database into Chart I'm trying to make a chart where I can see the number of players of a server during 24h.
I want the chart to display from 00:00 to 11:59PM from 30 to 30 minutes. (00:30, 1:00, 1:30 etc.)
Code I'm using to send the array to the jQuery.
$json = array();
$stmt = $link->query("SELECT * FROM online WHERE time > $date");
$stmt->execute();

while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
  $row['time'] = date("H:i", $row['time']); //translate unix to human
  array_push($json, array('labels' => $row['time'],
    'series' => $row['players']
    ));
}

echo json_encode(array("json" => $json));

output:

This is the jQuery I'm using to display the chart
var url = "settings.php"
  var resp = jQuery.parseJSON(
    jQuery.ajax({
        url: url,
        async: false,
        dataType: 'json'
       }).responseText
     );

    var JSONObject = JSON.parse(resp);

    var data = {"labels":JSONObject.labels, "series":[JSONObject.series]};

  optionsPlayersOnline = {
    lineSmooth: Chartist.Interpolation.cardinal({
      tension: 0
    }),
    low: 0,
    high: 50,
    chartPadding: {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0
    },
  }

  var PlayersOnline = new Chartist.Line('.ct-chart', data, optionsPlayersOnline);

My problem is that I can't figure how to make the chart work and display.


text:
Q: Consul with Spring Cloud Gateway - Inter Service Communication The setup:
I have a set of Spring Boot based microservices that are fronted by Spring Cloud Gateway, meaning every request that comes from UI or external API client first comes to Spring Cloud Gateway and is then forwarded to appropriate microservice.
The routes are configured in Consul, and Spring Cloud Gateway communicates with Consul to get the routes accordingly.
Requirement:
There is a need of some microservices communicating with each other with REST APIs. I would prefer this communication to happen via the Spring Cloud Gateway as well. This will help in reducing multiple services going to Consul for getting other service's details.
This means every service should know Gateway's detail at least. And there can be multiple instances of Gateways as well. How is this dealt with in bigger architectures?
Any example that I look up contains one service using Consul, or Gateway using the consul with one microservice. Couldn't understand how to extrapolate that design to a bigger system.


text:
Q: access dbcontext in custom Newtonsoft JsonConverter class I created an JsonConverter for mapping children entitys to list of ids in json
for example childrens:[1,2,3]
public class IdsJsonConverter : JsonConverter
{
    public override bool CanConvert(Type objectType)
    {
        return objectType==typeof(ICollection);
    }

    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        //problem convert ids back to entities because i can not get db context here so I unable to get the tracked entities from context
        return existingValue;
    }

    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
    {
        IEnumerable collection = (IEnumerable)value;
        List<long> ids = new List<long>();
        foreach (var item in collection)
        {
            dynamic itemCollection = (dynamic)item;
            ids.Add(itemCollection.ID);
        }
        //successful convert to list of ids
        serializer.Serialize(writer, ids);
    }
}

the problem is i can not get db context in ReadJson()
the dbcontext is added to the services container using the Scoped lifetime
 public void ConfigureServices(IServiceCollection services)
    {
        services.AddScoped((_) => new MyDatabase(Configuration.GetConnectionString("DefaultConnection")));

this is how I use IdsJsonConverter
    [JsonConverter(typeof(IdsJsonConverter))]
    public virtual ICollection<TAG> TAGs { get; set; }

A: You can call below code in your ConfigureServices
var serviceProvider = services.BuildServiceProvider();

Then assign this serviceProvider as a static variable in some place. Eg: App.ServiceProvider.
In your ReadJson
App.ServiceProvider.GetService<MyDatabase>();

You need Microsoft.Framework.DependencyInjection for this to work.


text:
Q: Permanent and temporary shock income, variance decomposition I have a balanced panel data (N= 190, T=5) on income and personal characteristics of the householder.
I would like to estimate the coefficients and variances of a temporary and of a permanent income shock.
I fitted an OLS regression model as follows:
$log(income)=sex+age+age^2+study+ public administration + type of house + country$
I then took the residuals and regressed them on a ARMA (1,1) model. The coefficient of AR(1) should be the permanent part and should be around 1, the MA(1) should be the temporary part. I also found that the AR(1) coefficient is only 0.2 instead of about 1. Moreover, AUTOARIMA fits them with an ARMA(2,2). How can I read the coefficients of the ARMA (2,2) to find out the temporary and permanent shock on the income?
I would like also to find the variance of the income (which is the residuals of the ARMA regression) but is it right even if the model is not correct?


text:
Q: Parse Server on Managed Azure Services with DocumentDB for a mobile GIS app I am wondering if using a NoSQL database such as Azure's DocumentDB would be appropriate for an Android GIS app. To better explain my needs, here is a quick breakdown of my app:

*- Android app that uses the Google Maps Android API to allow users to
   view and submit blocked bike lane incidents in Philadelphia

*- Users will be able to submit incidents to a cloud database, as well
   as view incidents submitted by other users. Each incident includes
   info on location, date/time, as well as a photo that will be stored
   in the database

*- The app is part of a master's thesis project, and funding is limited.
Based on advice I received from Microsoft Azure support, I am considering using Parse Server on Managed Azure Services with DocumentDB. However, one of my thesis advisors has raised concerns that this solution might not be wise, because DocumentDB is a NoSQL database. He says that SQL databases with spatial data support are much more efficient and can perform more spatial queries.  I am wondering if someone might be able to address these concerns and whether or not a NoSQL database would support the needs of my app?  In order to have my thesis approved, I need to be able to justify my choice of technologies. To help better explain my app, here are a few potential use cases that the database will need to facilitate:

*- Upon opening app, automatically display all stored blocked bike lane
    incidents within the past 30 days as markers on the app's Google Map
    (please note that the app is limited to Philadelphia)

*- When the user selects a marker, the info window should display the
    incident's location, date/time and a photo

*- Allow the user to search for bike incidents within a given polygon or
    search radius

*- When a user submits a new incident to the database, they should also
    have the ability to Tweet a summary of the incident to
    #UnblockBikeLanes (which is a Twitter hashtag commonly used by cyclists in Philadelphia)

*- Display geotagged #UnblockBikeLanes Tweets (that weren't submitted
    using the app) in the app's map

*- Perform coordinate system transformations, if needed
Any advice about whether or not a NoSQL database like DocumentDB would be appropriate for my app's use cases would be greatly appreciated.

A: DocumentDB is actually quite efficient regarding spatial data and spatial queries while being a NoSQL database service. DocumentDB supports GeoJSON, and behind the scene it generates spatial indexes for your JSON documents. Thus it would allow you to perform spatial queries efficiently by leveraging spatial indexes.
Here are two links about DocumentDB geospatial support:
https://azure.microsoft.com/en-us/blog/announcing-geospatial-support-in-azure-documentdb/
https://azure.microsoft.com/en-us/documentation/articles/documentdb-geospatial/
If you are curious, here is the paragraph describing how we index and query geospatial data behind the scene:

In a nutshell, the geometry is projected from geodetic coordinates
  onto a 2D plane then divided progressively into cells using a
  quadtree. These cells are mapped to 1D based on the location of the
  cell within a Hilbert space filling curve, which preserves locality of
  points. Additionally when location data is indexed, it goes through a
  process known as tessellation, i.e. all the cells that intersect a
  location are identified and stored as keys in the DocumentDB index. At
  query time, arguments like points and polygons are also tessellated to
  extract the relevant cell ID ranges, then used to retrieve data from
  the index.


text:
Q: How to change kubelet configuration via kubeadm I'm fairly new to Kubernetes and trying to wrap my head around how to manage ComponentConfigs in already running clusters.
For example:
Recently I initialized a kubeadm cluster in a test environment running Ubuntu. When I did that, I found CoreDNS to be in a CrashLoopBackoff which turned out to be the case because Ubuntu was configured to use systemd-resolved and so the resolv.conf had a loopback resolver configured. After reading the docs for coredns, I found out that a solution for that would be to change the resolvConf parameter for kubelet - either via commandline arguments or in the config.
So how would one do this properly in a kubeadm-managed cluster?
Reading [this page in the documentation][1] I didn't really get a clue, because it seems to be tailored to the case of initializing a new cluster or joining new nodes.
Of course, in this particular situation I could just use "Kubeadm reset" and initialize it again with a --config parameter but that doesn't seem to be the right solution for a running cluster.
So after digging a bit deeper I found several infos:

*

*I could change the /var/lib/kubelet/kubeadm-flags.env on the node directly, but AFAICT this only makes sense for node-specific changes.

*There is a ConfigMap in the kube-system namespace named kubelet-config-1.14. This seems promising for upcoming nodes joining the cluster to get the right configuration - but would changing that CM affect the already running Kubelet?

*There is a marshalled version of the running config in /var/lib/config/kubelet.yaml that I could change, but AFAIU this would be overriden by kubelet itself periodically (?) or at least during a kubeadm upgrade.

*There seems to be an option to specify a configmap in the node object, to let kubelet dynamically load the configuration from there, but given that there is already an existing configmap it seems more sensible to change that one.

I seemingly had success by some combination of changing aforementioned CM, running kubeadm upgrade something afterwards and rebooting the machine (since restarting the kubelet did not fix the CoreDNS issue ... but maybe I was to impatient).
So I am now asking:

*

*What is the recommended way to carry out changes to the kubelet configuration (or any other configuration I could affect via kubeadm-config.yaml) that works and is upgrade-safe for cases where the configuration is not node-specific?

*And if this involves running kubeadm ... config --config - how do I extract the existing Kubeadm-config in a way that I can feed it back to to kubeadm?

I am entirely happy with pointers to the right documentation, I just didn't find the right clues myself.
TIA

A: What you are looking for is well described in official documentation.
The basic workflow for configuring a Kubelet is as follows:

*

*Write a YAML or JSON configuration file containing the Kubelet's configuration.

*Wrap this file in a ConfigMap and save it to the Kubernetes control plane.
Update the Kubelet's corresponding Node object to use this ConfigMap.

In addition there is DynamicKubeletConfig Feature Gate is enabled by default starting from Kubernetes v1.11, but you need some additional steps to activate it. You need to remember about, that Kubelet's --dynamic-config-dir flag must be set to a writable directory on the Node.


text:
Q: apt-get remove package that didn't install properly I accidentally installed zabbix-frontend-php that pulled apache2 as a dependency.
I don't want to use either, and I want to completely delete both packages.
Unfortunately, it seems that apt-get won't let me remove zabbix until I make apache2 work properly for zabbix. I really don't want to spend time fixing broken packages I'm about to delete.
How can I override apt-get and proceed with deletion?

$ apt-get remove apache2 zabbix-frontend-php
Package 'apache2' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  apache2-bin apache2-data
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  zabbix-frontend-php
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 28.2 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 28117 files and directories currently installed.)
Removing zabbix-frontend-php (1:2.4.7-1+jessie) ...
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript apache2, action "restart" failed.
dpkg: error processing package zabbix-frontend-php (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 zabbix-frontend-php
E: Sub-process /usr/bin/dpkg returned an error code (1)

A: The question and answer here should help:
https://askubuntu.com/questions/438345/how-to-remove-install-a-package-that-is-not-fully-installed
As I read it either of these commands should do what you need:
apt-get --force-yes remove <pkgname>

dpkg -r <pkgname>


text:
Q: 3 random numbers between 1 and 20. Compare first number to second and third I have to make a program that generates 3 random numbers between 1 and 20 and the first number needs to be compared against the other two when a button is clicked. The output should display all 3 of the numbers and indicate the result of the comparison, for example: 1) The first number is less than both the second and third numbers; 2) The first number is between the other two numbers; 3) The first number is greater than the other two; 4) The first number is equal to one of the other two numbers; or 5) All three numbers are equal.
I'm generally new to programming so any help with this is appreciated.

A: Math.random() will return a number between 0 and 1 (with decimal).
For a specific number range you can do:
var x = Math.floor((Math.random() * y) + z);

Where y is the Max (max - min + 1) and z is the Min. For your example you would do:
var x = Math.floor((Math.random() * 20) + 1);

As for the comparison, because there are so many scenarios you should use if-else statements so it would look like:
var x = Math.floor((Math.random() * 20) + 1);
var y = Math.floor((Math.random() * 20) + 1);
var z = Math.floor((Math.random() * 20) + 1);
var output = null;
if(x > y && x > z){
  output = 'The first number is greater than the other two';
}else if(x < y && x < z){
  output = 'The first number is less than the other two';
}

And so on...

A:

        <button type="button" onClick="compare();">Click Me!</button>

A: <!DOCTYPE html>

Click the button to display a random number between 1 and 20.

<button onclick="x()">Roll</button>
<button onclick="y()">Roll</button>
<button onclick="z()">Roll</button>


text:
Q: Install repository and sync project error in android studio says all packages not available I ran syn gradle for my android studio project but the error shows up that
failed to resolve : com.android.support:appcompat-v7:23.1.0
when i click on install repository it says that all packages not available. Please help.

A: Friend, the very best solution for most problems in android studio is to do a Invalidate caches/Restart.
Go to File>Invalidate Cache/Restart you will be shown a window asking to confirm restart.Be aware that local history will be cleared.
I got this problem several times and messed up with the studio.I googled for a solution and found this solution.If it doesnt help try update android support repository and other sdk components.


text:
Q: JDBC Java Prepared Statement execution error Why won't the preparedstatement insert the data into the database table?
import java.sql.*;

public class MysqlConnect{
public static void main(String[] args) {
  System.out.println("MySQL Connect Example.");
  Connection conn = null;
  String url = "jdbc:mysql://localhost/";
  String dbName = "java";
  String driver = "com.mysql.jdbc.Driver";
  String userName = "root";
  String password = "";
  PreparedStatement pst;

  try {
      Class.forName(driver).newInstance();
      conn = DriverManager.getConnection(url+dbName,userName,password);
      conn.setAutoCommit(false);

      String sql = "INSERT INTO test (url) values(?)";
      PreparedStatement statement = conn.prepareStatement(sql);

      statement.setString(1, "teast.com");
      statement.executeUpdate();

      statement.close();

  }
  catch (Exception e) {
      e.printStackTrace();
  }
 }
}

A: Because you explicitly disabled autocommit:
conn.setAutoCommit(false);

By default, JDBC will auto-commit any transactions that are implicitly created.
With auto-commit disabled, you need to explicitly commit, e.g.
statement.executeUpdate();
conn.commit();


text:
Q: How to handle multiple parent types with JPA? I've inherited a system which has several tables of a form like this:
CREATE TABLE Notes (
    id INT PRIMARY KEY,
    note TEXT,
    parent_id INT,
    parent_type VARCHAR
);

Basically, the idea is that you could have several other types, say "Tickets" and "Widgets", and if you want to add a note for ticket 123, you'd do:
INSERT INTO Notes (note, parent_id, parent_type)
    VALUES ('blah blah', 123, 'ticket');

Is there any sensible way to have JPA create @OneToMany relationships from, say, a Ticket to a Note with this schema?
Or would I need to split my Notes table out into separate Ticket_Notes, Widgets_notes, etc tables?
Would it be possible to create separate TicketNotes, WidgetNotes, etc entities in Java using @DiscriminatorColumn, perhaps?

A: It seems that taking advantage of discriminators and inheritance gets me what I want.
For example:
@Entity
class Ticket {
    @Id
    private Integer id;

    // ...

    @OneToMany(mappedBy="ticket", fetch=FetchType.LAZY)
    private List<TicketNotes> notes;
}

@Entity
@Inheritence
@DiscriminatorColumn(name="PARENT_TYPE")
public abstract class Note {
    @Id
    private Integer id;

    // ...
}

@Entity
@DiscriminatorValue("ticket")
public class TicketNote extends Note {
    @ManyToOne
    @JoinColumn(name="PARENT_ID")
    private Ticket ticket;
}

Helpful reference: http://en.wikibooks.org/wiki/Java_Persistence/Inheritance


text:
Q: how to read one line to calculate the md5 I am using Linux bash version 4.1.2
I have a tab-delimited input_file having 5 fields and I want to calculate the MD5 for each line and put the md5sum at the end of each line.
The expected output_file should therefore has 6 fields for each line.
Here is my coding:
cat input_file | while read ONELINE
do
  THEMD5=`echo "$ONELINE" | md5sum | awk '{print $1}'`
  echo -e "${ONELINE}\t${THEMD5}"
done > output_file

The coding works well most of the time.
However, if ONELINE is ended with single/double tabs, the trailing tab(s) will disappear!
As a result, the output_file will sometimes contain lines of 4 or 5 fields, due to the missing tab(s).
I have tried to add IFS= or IFS='' or IFS=$'\n' or IFS-$'\012' in the while statement, but still cannot solve the problem.
Please help.
Alvin SIU

A: The following is quite certainly correct, if you want trailing newlines included in your md5sums (as your original code has):
while IFS= read -r line; do
  read sum _ < <(printf '%s\n' "$line" | md5sum -)
  printf '%s\t%s\n' "$line" "$sum"
done <input_file

Notes:

*

*Characters inside IFS are stripped by read; setting IFS= is sufficient to prevent this effect.

*Without the -r argument, read also interprets backslash literals, stripping them.

*Using echo -e is dangerous: It interprets escape sequences inside your line, rather than emitting them as literals.

*Using all-uppercase variable names is bad form. See the relevant spec (particularly the fourth paragraph), keeping in mind that shell variables and environment variables share a namespace.

*Using echo in general is bad form when dealing with uncontrolled data (particularly including data which can contain backslash literals). See the relevant POSIX spec, particularly the APPLICATION USAGE and RATIONALE sections.

*If you want to print the lines in a way that makes hidden characters visible, consider using '%q\t%s\n' instead of '%s\t%s\n' as a format string.


text:
Q: Wordpress Advanced Custom Fields repeater display title outsite of loop So I have a mediaelement.js audio player and I'm using the advanced custom fields plugin and I want to be able to display the title of the current track on the player, here's my code

<audio class="mejs-new" style="width: 100%; height: auto;" controls width="100%" height="auto">

  <?php if(get_field('audio_repeater')): ?>

        <?php while(has_sub_field('audio_repeater')): ?>

          <?php $title = get_sub_field('music_title'); ?>
          <source src="<?php the_sub_field('music_url'); ?>" title="<?php echo $title; ?>" type="audio/mp3">

<?php echo $title; ?>

        <?php endwhile; ?>

      <?php endif; ?>
</audio>

Edit..
I have tried echoing the title outside the audio tag but it only echoes the 2nd track title and won't change when changing tracks.

A: If I understand correctly, you're wanting to move the title outside the <audio /> tag, but you can only get the title from within the loop.
You're almost there actually - the easiest way to do this is to set the title to a variable while you're in the loop, which you're already doing ($title = get_sub_field('music_title');). So now, all you need to do is echo the variable when you need it.
Because you've already set the variable while you had access to the functions in the loop, you can now echo that variable afterwards without needing the loop.
For example:
    <?php endif; ?>
</audio>

<?php echo $title; ?>

EDIT:
I assumed you only had one title and I didn't question why you were using a repeater with one title :) To print out a list of the titles afterwards, you can use a similar approach, except this time you need to save the results of the loop and then loop through it again.
The easiest way to do this is to repeat the entire loop code but only print out the title, but that's a little inefficient. Ideally, we should only be getting the field once. Here's another way to do the whole thing:
<?php $audio_repeater = get_field("audio_repeater"); ?>

<audio class="mejs-new" style="width: 100%; height: auto;" controls width="100%" height="auto">

  <?php if((array) count($audio_repeater)): ?>

        <?php foreach($audio_repeater as $audio_source): ?>

          <source src="<?php echo $audio_source["music_url"]; ?>" title="<?php echo $audio_source["music_title"]; ?>" type="audio/mp3">

        <?php endforeach; ?>

      <?php endif; ?>
</audio>

<?php foreach($audio_repeater as $audio_source): ?>

<?php echo $audio_source["music_title"]; ?>

<?php endforeach; ?>

In this example, we're grabbing the entire ACF repeater once at the top, and assigning it to a variable. We're then checking it has items in it, and looping through those items.
This is an alternative way to use ACF repeaters, which might not quite be as easy as using the loop functions, but it is more extensible when you're moving things around a bit.


text:
Q: Failing at NetBeans Java Native Packaging for Linux Doing Linux Native Package builds I'm running into problems with both RPM and DEB.  In the case of RPMs, it's saying that rpmbuild cannot be found.  Then for DEBs it reports the dpkg cannot be found.
Both dpkg and rpmbuild are installed and are in /usr/bin.  Both are in my path and execute fine from CLI.  Failure is the same whether I start NetBeans from GUI or CLI.  I've even symlinked rpmbuild and dpkg into my NetBeans bin directory.  No luck.
How does one go about getting NetBeans to find dpkg and rpmbuild so that it can complete native builds from the GUI?  Currently working with SuSE LEAP 15.

A: For whatever reason, the "Package All Artifacts" option is currently generating .deb and .rpms, but I can't generate them individually.  I'm OK with this.  I think the most likely change to make that option work was symlinking the binaries from user bin into my netbeans bin.


text:
Q: Why is $f$ a homomorphism in this proof? Here a proof of Schur's lemma for representations is given. The proof begins by letting $f:V\to V'$ be a 'homomorphism of $G$-modules', but clicking on that link, I don't see how you can conclude that $f$ is a homomorphism. In fact, multiplication on $V$ and $W$ do not seem to be defined there.

A: You can conclude that $f$ is a homomorphism (of vectorspaces) as the definition of a homomorphism of $G$-modules includes the assumption that $f$ is a linear map a.k.a. a homomorphism (of vertorspaces).


text:
Q: crystal report 7 export to excel Max The crystal report i use has excel 5.0 which has a limit of 16384 rows, what can i do when the information being exported exceeds this number.
The problem is that once it reaches the limit other data gets cut off which is not cool
Any suggestion would be much appreciated.

A: You can place a warning in the report header so the interactive user is warned of the cutoff. Another possibility is to prompt the user for a section number and filter rows in blocks.

A: Try the following steps
1) Firstly find the total record either from a running total or from report data source data table end.
2) When export data exceed the limit then create another excel file after exporting data from crystal report and place remaining data in that file, you have to do this thing in your code.
3) Give a message to the user that exported data created two files.


text:
Q: UISearchBar displaying data UITableView I'm trying understand searchbar I have an api And when I send the api 'where' its giving me some data.
But when I tap the return key.I get nothing.
there is my code.
    - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
    AFSecurityPolicy *securityPolicy = [[AFSecurityPolicy alloc] init];
    [securityPolicy setAllowInvalidCertificates:YES];

    NSString *urlPath = [NSString stringWithFormat:@"http://test.com/api/index.php"];
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

    NSDictionary *parameters = @{@"process":@"search_record",@"where": self.searchBar.text};
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];

    [manager setSecurityPolicy:securityPolicy];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];

    [manager POST:urlPath parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSString *string = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
        NSError *error = nil;
        NSData *jsonData = [string dataUsingEncoding:NSUTF8StringEncoding];
        NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];

        self.customerCards = [NSMutableArray array];
        NSArray *customersArray = [dataDictionary objectForKey:@"customer_list"];
        NSLog(@"%@",customersArray);
        for (NSDictionary *customersDictionary in customersArray) {
            ApiClass *customer = [ApiClass customersWithTitle:[customersDictionary objectForKey:@"adi"]];
            customer.tel = [customersDictionary objectForKey:@"tel"];

            [self.customerCards addObject:customer];

        }
        [self.tableView reloadData];

        NSLog(@"GET: %@", string);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Error: %@", error);
    }];

}

what should I do.
Thanks


text:
Q: jQuery each width problem I have the following function set to run on a hover over an image:
function() {
  $('.slides .slide h3').each(function(i){
    var owidth = $(this).width()
    $(this).animate({"right":730 - owidth - 16}, 500);
  });
}

You can view the page here. Over the image and click the next icon on the lower right of the image.  For some reason, the function is calculating the first h3's width correctly, but then it thinks all other h3s have a width of 0.  Can anyone offer a solution?

A: function() {
  var owidth  = 0;
  $('.slides .slide h3').each(function(i){
    owidth = $(this).width();
    $(this).animate({"right":(730 - owidth - 16) + 'px'}, 500);
  });
}

A better way:
function() {
  $('.slides .slide h3').each(function(i){
    $(this).stop().animate({
      "right": (714 - $(this).width()) + 'px'
    }, 500);
  });
}


text:
Q: Flickr Oauth Android I want to authorize user from my app, I am following some example found on internet (http://www.programcreek.com/java-api-examples/index.php?api=org.scribe.model.Token):
public static void auth() throws IOException, FlickrException {
  Properties properties;
  InputStream in=null;
  try {
    in=AuthExample.class.getResourceAsStream("/setup.properties");
    properties=new Properties();
    properties.load(in);
  }
  finally {
    IOUtilities.close(in);
  }
  Flickr flickr=new Flickr(properties.getProperty("apiKey"),properties.getProperty("secret"),new REST());
  Flickr.debugStream=false;
  AuthInterface authInterface=flickr.getAuthInterface();
  Scanner scanner=new Scanner(System.in);
  Token token=authInterface.getRequestToken();
  System.out.println("token: " + token);
  String url=authInterface.getAuthorizationUrl(token,Permission.READ);
  System.out.println("Follow this URL to authorise yourself on Flickr");
  System.out.println(url);
  System.out.println("Paste in the token it gives you:");
  System.out.print(">>");
  String tokenKey=scanner.nextLine();
  Token requestToken=authInterface.getAccessToken(token,new Verifier(tokenKey));
  System.out.println("Authentication success");
  Auth auth=authInterface.checkToken(requestToken);
  System.out.println("Token: " + requestToken.getToken());
  System.out.println("nsid: " + auth.getUser().getId());
  System.out.println("Realname: " + auth.getUser().getRealName());
  System.out.println("Username: " + auth.getUser().getUsername());
  System.out.println("Permission: " + auth.getPermission().getType());
}

I am using webview, scribe and Flickr4Java for run URL which provide a code, authenticate and web view shows me a code, which I must pass to my app, but I can't understand how to retrieve this code from webview, and pass to tokenKey.
I am added onpageFinished and print URL which me give:
06-12 13:03:55.266     E/NEW﹕ uri is: https://m.flickr.com/services/oauth/authorize?oauth_token=72157654039925698-81abc00d035f5da0&perms=write
06-12 13:03:55.601    W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 4581
06-12 13:03:56.166      E/NEW﹕ uri is: https://m.flickr.com/#/services/oauth/authorize/_QM_oauth_token_IS_72157654039925698-81abc00d035f5da0_AND_perms_IS_write
06-12 13:03:56.476    W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 4581
06-12 13:03:56.476    E/NEW﹕ uri is: https://m.flickr.com/#/services/oauth/authorize/_QM_oauth_token_IS_72157654039925698-81abc00d035f5da0_AND_perms_IS_write
06-12 13:04:00.411   W/BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 4581
06-12 13:04:00.416   E/NEW﹕ uri is: https://m.flickr.com/#/#

A: Finaly, i found an answer (this provide a calback url: token = authInterface.getRequestToken("your calback url");),  the code for auth for someone is:
public class FlickrLogin1 extends AsyncTask<String, String, String> {

        public final String TAG = FlickrLogin1.class.getSimpleName();
        String url;
        int count = 0;

        @Override
        protected void onPreExecute() {
            Log.d(TAG, "START");
        }

        @Override
        protected String doInBackground(String... params) {
            String result = "";
            try {

                Flickr.debugRequest = false;
                Flickr.debugStream = false;

                flickr = new Flickr(flickrKey, flickrSecret, new REST());
                authInterface = flickr.getAuthInterface();

                token = authInterface.getRequestToken("your calback url");
                L("Token: " + token);

                result = authInterface.getAuthorizationUrl(token, Permission.WRITE);

                return result;
            } catch (IllegalStateException e) {
                e.printStackTrace();
                return result;
            } catch (VerifyError e) {
                e.printStackTrace();
                return result;
            }

        }

        @Override
        protected void onPostExecute(String result) {
            if (result != null && result.length() > 0) {
                L("Follow this URL to authorise yourself on Flickr");
                L(result);
                auth_dialog = new Dialog(getActivity());
                auth_dialog.setContentView(R.layout.auth_dialog);
                final WebView web = (WebView) auth_dialog.findViewById(R.id.webv);
                web.getSettings().setJavaScriptEnabled(true);

                web.loadUrl(result);

                web.setWebViewClient(
                        new WebViewClient() {

                            @Override
                            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                                super.onPageStarted(view, url, favicon);
                                L("url to start " + url);
                                if (url.contains("&oauth_verifier")) {
                                    auth_dialog.dismiss();
                                    Uri uri = Uri.parse(url);
                                    String oauth_verifier = uri.getQueryParameter("oauth_verifier");
                                    String oauth_token = uri.getQueryParameter("oauth_token");
                                    new FlickrLogin2().execute(oauth_token, oauth_verifier);
                                }
                            }

                            String authCode;

                            @Override
                            public void onPageFinished(WebView view, String url) {
                                super.onPageFinished(view, url);
                                L("url to get " + url);

                            }
                        });

                auth_dialog.show();
                auth_dialog.setTitle("Authorize");
                auth_dialog.setCancelable(true);

            }

        }
    }

    public class FlickrLogin2 extends AsyncTask<String, Void, String> {
        @Override
        protected void onPreExecute() {
        }

        @Override
        protected String doInBackground(String... oauth_verifier) {
            L("CODE " + oauth_verifier[0] + " " + oauth_verifier[1]);
            try {
                Verifier verifier = new Verifier(oauth_verifier[1]);
                Token accessToken = authInterface.getAccessToken(token, verifier);
                System.out.println("Authentication success");
                Auth auth = new Auth();
                authInterface = flickr.getAuthInterface();
                Token requestToken = authInterface.getRequestToken();
                L("auth tocen and secret: " + requestToken.getToken() + " , " + requestToken.getSecret());
                auth.setToken(requestToken.getToken());
                auth.setTokenSecret(requestToken.getSecret()); // thats the token I got from the registration, before I set the token of the requestToken
                auth.setPermission(Permission.WRITE);
                RequestContext requestContext = RequestContext.getRequestContext();
                requestContext.setAuth(auth);
                flickr.setAuth(auth);
                L("checking for token" + accessToken);
                auth = authInterface.checkToken(accessToken);

                // This token can be used until the user revokes it.
                L("Token: " + accessToken.getToken());
                L("Secret: " + accessToken.getSecret());
                L("nsid: " + auth.getUser().getId());
                L("Realname: " + auth.getUser().getRealName());
                L("Username: " + auth.getUser().getUsername());
                L("Permission: " + auth.getPermission().getType());
            } catch (FlickrException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(String result) {

        }

    }

A: Anyone who's struggling to get this to work with more recent version of Android with Kotlin, I have a gist that can be found here.


text:
Q: Finding $x^n$ patterns I noticed the other day while computing consecutive powers of $2$ that for $n \geq 1$, the numbers in the ones place of the values of $2^n$ repeat every 4 terms $(2, 4, 8, 6,\ldots)$. In the tens place, we get a repetition every 20 terms for $n \geq 4$ (the first term with a value in the tens place). In the hundreds place, a repetition every 100 for $n \geq 7$. The values in the thousands place repeat every 500 terms for $n \geq 10$.
Thus, for $2^n$, the pattern in the $10^k$ place will repeat every $4\cdot5^k$ terms for $n \geq 1+3k$
What is this called? Is there a way to generalize for every $x^n$?

A: When you have a finite set $S$, a map $f:\ S\to S$ and an initial value $a_0\in S$ then the sequence $(a_n)_{n\geq0}$  recursively defined by
$$a_{n+1}:=f(a_n)\qquad(n\geq0)\tag{1}$$
will eventually become periodic: After at most $|S|$ steps the recursion will produce a number which you have seen before, and from then on the procedure will repeat periodically.
Now given an $m>1$ the possible remainders of integers modulo  $m>0$ form such a finite set $S$, and  multiplication by $2$, i.e. $$\tilde f:\quad{\mathbb N}\to{\mathbb N}, \quad k\mapsto 2k\ ,$$ acts exactly like $(1)$ on these remainders. The remainder modulo $10^r$ of a natural number $k$ is plainly visible in the last $r$ digits of the decimal representation of $k$. It follows that beginning with an arbitrary $a_0$ the last $r$ digits of the numbers $a_n:=2^n a_0$ will eventually become periodic with a period length $\leq 10^r$.


text:
Q: Laravel MySQL whereIn Closure Not Working As Expected Can anyone help to explain why one of the following Laravel queries works and the other doesn't?
The first that works:
$array = ( 1, 2, 3 ,4 );
$query->whereIn( 'status_id', $array );

This works as expected. However, when I try and pass a function to build my array:
$query->whereIn( 'status_id', function() use ( $statuses ){
    $status_array = array();
    foreach( $statuses as $status ){
         $status_array[] = $status->status_id;
    }

    return $status_array;
});

I get the following error:

General error: 1096 No tables used (SQL: select * from jobs  where
  status_id in (select *))

I have checked to see that the array I am building in the closure is the same as the array that works, and it is. Am I missing something fundamental regarding whereIn() and it's closure functions? Can I even pass a closure to whereIn()?

A: As a related answer, instead of running a loop to generate your list - just have Laravel do it for you
 $status_array= DB::table('status')->lists('status_id');

then use it
 $query->whereIn( 'status_id', $status_array );

A: When you use a closure in whereIn(), Laravel will think that you will be doing a sub query. Hence you see another select inside your in in your error message.
You'll need to parse your array of values before passing to the whereIn()
foreach ($statuses as $status) {
     $status_array[] = $status->status_id;
}

$query->whereIn('status_id', $status_array);

Extra: See reference to Laravel source.
Illuminate\Database\Query\Builder:
public function whereIn($column, $values, $boolean = 'and', $not = false)
{
    ...

    if ($values instanceof Closure)
    {
        return $this->whereInSub($column, $values, $boolean, $not);
    }
}

which calls whereInSub():
protected function whereInSub($column, Closure $callback, $boolean, $not)
{
    $type = $not ? 'NotInSub' : 'InSub';

    // To create the exists sub-select, we will actually create a query and call the
    // provided callback with the query so the developer may set any of the query
    // conditions they want for the in clause, then we'll put it in this array.
    call_user_func($callback, $query = $this->newQuery());

    $this->wheres[] = compact('type', 'column', 'query', 'boolean');

    $this->mergeBindings($query);

    return $this;
}

A: I think your function returns an array like this one:
[ 0 => status_id_value_0,
  1 => status_id_value_1,
  ...
]

Try to return an array_values($status_array) to check it.
Anyway, try this one too:
$query->whereIn( 'status_id',
                 array_values(
                     array_map(
                         function($pos){return $pos->status_id;},
                         $statuses
                     )
                 )
               );

I hope it works fine for you.

A: You need to convert comma separated value to array before passing to whereIN.
and this is also good for any dynamic content
    foreach ($statuses as $status) {
         $status_array[] = $status->status_id;
    }
    $query->whereIn('status_id', $status_array);