text:
Q: Is there a method of fixing DtypeWarning for mixed column types in a script? I'm using Python in a Power BI report on some relatively basic data. 15 columns imported into power BI from a txt flat file.
I wrote the following python code to create a dataframe from my data and pivot it:
 df = pd.DataFrame(dataset)
 df.pivot(index='Org Code', columns='Process Step', values='Status Change Date')

I get the following error, however:
DataSource.Error: ADO.NET: Python script error.
sys:1: DtypeWarning: Columns (2,7,13,14,15) have mixed types.Specify dtype option on import or set low_memory=False.
Traceback (most recent call last):

I have tried to set the datatypes in Power BI to what they should obviously be. Text columns to type text, date columns to date type, and so on. It doesn't fix the error. I also tried to pass in dtype:
df = pd.DataFrame(dataset, dtype={'Category':'str'})
df.pivot(index='Org Code', columns='Process Step', values='Status Change Date')

Using dtype in the dataframe, however, didn't even remove column 2 from the error, which shows it doesn't work.


text:
Q: Jquery. Как разделить массив на несколько частей через each Имеется такая структура из h2 и h3.

тест 1

тест 2

тест 3

тест 4

тест 5

Хотел сделать через each, не особо получилось так как хотелось бы.
Каким образом можно получить подобную структуру?

тест 1

тест 2

тест 3

тест 4

тест 5

Изначально делал так:
$('h2, h3').each(function(index, element){
  var name = $(this).text();
  $('ul').append('
'+ name +'
');
});

A:

// переменная для отслеживания индекса вложенного списка
let nestedIndex = null;
$('h2, h3').each(function(index, element){
  let name = $(this).text();
  // если эл-т h2 - добавляем его в ul и обнуляем индекс
  if ( element.nodeName === 'H2' ) {
    $('ul.main').append('
'+ name +'
');
    nestedIndex = null;
  }
  // если встречаем h3
  else if (element.nodeName === 'H3') {
    // проверяем, есть ли индекс вложенного списка
    if ( nestedIndex ) {
      // если есть - ему добавляем новую li
      $('ul.nested-'+nestedIndex).append('
'+ name +'
')
    } else {
      // если нет - добавляем старому li эл-т вместе с подменю
      $('ul.main').append('

'+name+'

');
      nestedIndex = index;
    }
  }
  // удаляем h2/h3 эл-т
  element.remove();
});

тест 1

тест 2

тест 3

тест 4

тест 5

тест 6

тест 7

тест 8

тест 9

тест 10

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why is $ \text{div}(\vec{r}/r^3) = 0 $? Let's begin with some context. I was reading Griffiths's introduction to electrodynamics.

This makes sense given all the content one can find online in order to understand visually the divergence.
for example: https://youtu.be/rB83DpBJQsE or https://en.khanacademy.org/math/multivariable-calculus/multivariable-derivatives/divergence-and-curl-articles/a/intuition-for-divergence-formula
So the problem arises when one tries to understand conceptually (or visually) the fact that $$ \nabla\cdot\frac{\hat{r}}{r^2} = 0, \qquad r\neq 0. $$
I've done the calculation where:
$$\nabla \cdot \frac{\hat{r}}{r^2}=\frac{1}{r^2}\frac{\partial}{\partial r}(r^2\frac{1}{r^2})=\frac{1}{r^2}\frac{\partial}{\partial r}(1)=0.$$
That's fine but I find it impossible to understand it visually. Take for example this picture.
$ \vec{r}/r^3 = 0 $ " />
Having in mind the intuitive explanation of the divergence, like the one showed in the links, is easy to see that the flow through a small region in the image above, not containing the origin, is not equal to zero. Furthermore, it is obvious that the divergence is not zero because it doesn't look anything like the next image whose divergence is zero.

(In the image above the vector field isn't changing in space.)
Finally, I know that using the divergence theorem one can show mathematically that:
$$\int \nabla\cdot\vec{r}/r^3 d\tau=\int \frac{\vec{r}}{r^3}\cdot d\vec{a} .$$
And if we consider the surface of a sphere of any radius, centered at the origin, one can show that $$\int \frac{\vec{r}}{r^3}\cdot d\vec{a}=4\pi.$$
Again, that's okay but doesn't help me to understand visually why $$ \nabla\cdot\frac{\vec{r}}{r^3} = 0~? $$

A: It the question it is said:

"[it] is easy to see that the flow through a small region in the image
above, not containing the origin, is not equal to zero"

but if you look at the diagram, what you see, for any region not containing the origin, is field lines coming in from one side of the chosen region and going out the other side. And if you count the number of lines coming in then it is equal to the number going out. That is the property of zero divergence. The very fact that one can draw continuous field lines, not starting or stopping anywhere but just going on, is itself also the property of zero divergence!
Once you have a charge in your region then there can be field lines starting or stopping on that charge, and then you have non-zero divergence.

A: You need to be careful when calculating the divergence in this case. In particular, notice that the function is undefined or infinite at the origin.
If you calculate the divergence in any area not containing the origin you should be able to convince yourself visually that there is an equal number of field lines entering a region as there are exiting.
If you calculate the divergence in an area which contains the origin, then if you switch the integral to a dot product over the surface via Stokes's theorem you will get a finite value. If you don't make this switch you will get zero, but only because you have actually ignored the origin.
A nice way of capturing this property is to say that the divergence is a delta function, which Griffiths does later on.

A: As @Uyttendaele comments(1)
\begin{equation}
\boxed{\:\:
\boldsymbol{\nabla}\boldsymbol{\cdot}\left(\dfrac{\mathbf{r}\boldsymbol{-}\mathbf{r}_{0}}{\:\,\Vert\mathbf{r}\boldsymbol{-}\mathbf{r}_{0}\Vert^{\bf 3}}\right)\boldsymbol{=}4\pi\delta\left(\mathbf{r}\boldsymbol{-}\mathbf{r}_{0}\right)\:\:\:\vphantom{\dfrac{\tfrac{a}{b}}{\tfrac{a}{b}}}}
\tag{A-01}\label{A-01}
\end{equation}
see my answer here Divergence of $\frac{ \hat {\bf r}}{r^2} \equiv \frac{{\bf r}}{r^3}$, what is the 'paradox'?
$=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=\!=$
(1)
$''\texttt{Introduction to Electrodynamics}''\texttt{ D.J.Griffiths, Edition 3 or 4, Sect.1.5.3, eq.(1.100)}$


text:
Q: How can I debug a juju client command? I'm having issues bootstrapping with juju, where are logs that I can review?

A: All commands accept both a -v and/or --debug flag that will produce a very verbose output. The former will output INFO level log information while the latter will produce DEBUG level output.
Here's an example bootstrap against an EC2 environment with both -v and --debug (juju bootstrap -v --debug)
2013-09-19 19:46:22 INFO juju.provider.ec2 ec2.go:209 preparing environment "ondina"
2013-09-19 19:46:22 INFO juju.provider.ec2 ec2.go:187 opening environment "ondina"
2013-09-19 19:46:22 INFO juju.environs.tools tools.go:29 reading tools with major version 1
2013-09-19 19:46:22 INFO juju.environs.tools tools.go:37 filtering tools by series: precise
2013-09-19 19:46:22 DEBUG juju.environs.tools storage.go:41 reading v1.* tools
2013-09-19 19:46:22 INFO juju.environs.tools tools.go:44 falling back to public bucket
2013-09-19 19:46:22 DEBUG juju.environs.tools storage.go:41 reading v1.* tools
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.10.0-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.10.0-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.10.0-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.10.0-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.10.0-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.10.0-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.0-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.0-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.0-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.0-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.0-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.0-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.2-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.3-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.3-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.3-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.3-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.3-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.3-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.3-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.11.4-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.12.0-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.0-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.1-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.2-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.13.3-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-precise-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-quantal-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-raring-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-saucy-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-saucy-armhf
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.14.0-saucy-i386
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.10-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.10-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.10-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.11-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.11-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.11-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.12-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.12-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.12-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.13-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.13-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.13-raring-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.14-precise-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.14-quantal-amd64
2013-09-19 19:46:23 DEBUG juju.environs.tools storage.go:61 found 1.9.14-raring-amd64
2013-09-19 19:46:23 INFO juju.environs.tools tools.go:93 picked newest version: 1.14.0
2013-09-19 19:46:30 INFO juju.environs.boostrap bootstrap.go:57 bootstrapping environment "ondina"
2013-09-19 19:46:30 INFO juju.environs.tools tools.go:29 reading tools with major version 1
2013-09-19 19:46:30 INFO juju.environs.tools tools.go:34 filtering tools by version: 1.14.0
2013-09-19 19:46:30 INFO juju.environs.tools tools.go:37 filtering tools by series: precise
2013-09-19 19:46:30 DEBUG juju.environs.tools storage.go:41 reading v1.* tools
2013-09-19 19:46:30 INFO juju.environs.tools tools.go:44 falling back to public bucket
2013-09-19 19:46:30 DEBUG juju.environs.tools storage.go:41 reading v1.* tools
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.10.0-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.10.0-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.10.0-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.10.0-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.10.0-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.10.0-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.0-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.0-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.0-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.0-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.0-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.0-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.2-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.3-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.3-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.3-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.3-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.3-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.3-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.3-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.11.4-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.12.0-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.0-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.1-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.2-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.13.3-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-precise-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-quantal-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-raring-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-saucy-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-saucy-armhf
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.14.0-saucy-i386
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.10-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.10-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.10-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.11-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.11-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.11-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.12-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.12-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.12-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.13-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.13-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.13-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.14-precise-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.14-quantal-amd64
2013-09-19 19:46:31 DEBUG juju.environs.tools storage.go:61 found 1.9.14-raring-amd64
2013-09-19 19:46:31 DEBUG juju.environs.simplestreams simplestreams.go:356 read metadata index at "http://cloud-images.ubuntu.com/releases/streams/v1/index.sjson"
2013-09-19 19:46:31 DEBUG juju.environs.simplestreams simplestreams.go:491 candidate matches for products ["com.ubuntu.cloud:server:12.04:amd64" "com.ubuntu.cloud:server:12.04:i386"] are [0xc200476a80]
2013-09-19 19:46:31 DEBUG juju.environs.simplestreams simplestreams.go:836 finding products at path "streams/v1/com.ubuntu.cloud:released:aws.sjson"
2013-09-19 19:46:32 DEBUG juju.provider.ec2 ec2.go:393 ec2 user data; 11572 bytes
2013-09-19 19:46:34 INFO juju.provider.ec2 ec2.go:426 started instance "i-29949e50"
2013-09-19 19:46:34 INFO juju supercommand.go:284 command finished


text:
Q: How to send bigger data over email I am using This solution.
At i.putExtra(Intent.EXTRA_TEXT   , "body of email"); it is working as expected. If "body of email" is changed to String with 711098 lengths than not: it is not coming up the email client chooser.
Any ideas, solutions?

A: An Intent used in an operation (e.g., startActivity()) is limited to ~1MB.

How to overcome it?

Send a shorter email.
Or, send the long text as an attachment, using EXTRA_STREAM.
Or, send the email using JavaMail.
Or, send the email by shipping up the 711098 bytes to a Web service that you operate that sends the email on your app's behalf.

A: Here is an implementation of what have suggested  CommonsWare:
The temp file is saved to your Downloads folder, so it is accessible for all apps. Do not forget to delete it!
At development time the USB cable is plugged to your device and you are watching the logcat. Now pull out the usb cable or you will get a Permission denied exception!
The data.txt it will be visible at Gmail client interface, but it will not send if you forget to pull out the cable and let the Android OS have access to his Downloads folder.
public void sendEmail(String emailBody, String emailAddrressTo) {

        boolean bodyToLong = (emailBody != null && emailBody.length() > 300000);

        final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { emailAddrressTo });
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "data");
        if (!bodyToLong) {
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailBody);
        } else {// data file to big:

            String tmpFileName = "data.txt";
            File dirDownloads = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
            File fileOut = new File(dirDownloads, tmpFileName);

            FileOutputStream fos;
            try {
                fileOut.createNewFile();
                fos = new FileOutputStream(fileOut);

                FileDescriptor fd = fos.getFD();
                BufferedWriter bw = new BufferedWriter(new FileWriter(fd));
                bw.write(emailBody);

                fd.sync();
                bw.close();

            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                String msg = e.getMessage();
                if (msg.contains("(Permission denied)")) {
                    Toast.makeText(activity, "PULL THE USB CABLE OUT FROM PHONE!!! Out You have forgot to add android.permission.WRITE_EXTERNAL_STORAGE  permission to AndroidManifest.xml", Toast.LENGTH_SHORT).show();
                }

            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This message has to long data. Please see the attachment!");

            Uri uri = Uri.fromFile(fileOut);
            emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, uri);
        }
        emailIntent.setType("message/rfc822");

        Intent intentToStart = Intent.createChooser(emailIntent, "Send mail...");

        activity.startActivity(intentToStart);
    }


text:
Q: Sort array by range of static values I have an array, for simplicity, lets say it is this:
var array = [2,55, 22, 6, 7];

and I want to sort it, I would do this:
array.sort(function (a, b) {
    return b > a ? -1: 1;
});

or if I want to sort it ascending I would do this:
array.sort(function (a, b) {
    return b < a ? -1: 1;
});

Now, let's say I have a value that I want to sort by.
So basically I want to sort my array by values greater than a number.
so if the number was 6, I would want my array to look something like this:

55, 22, 7, 6, 2

but if I want to sort between two numbers, let's say 6 and 23, I would want it to return something like this:

22, 7, 55, 6, 2

the last 3 items can appear in any order to be honest, but the range I have sorted must appear first.
Does anyone know how I can achieve this.
I have tried like this:
// Sort our mapped array
mapped.sort(function (a, b) {

    // Loop through our properties
    for (var i = 0; i < fields.length; i++) {

        // Get our value (skip the first)
        var field = fields[i],
            x = a[field.name],
            y = b[field.name];

        // If our values are the same, go to the next compare
        if (x === y)
            continue;

        // If we are using greater than
        if (field.operator === '>') {

            // Check that the value matches our expression
            return y < field.expression ? -1 : 1;
        }

        // If we are using less than
        if (field.operator === '<') {

            // Check that the value matches our expression
            return y > field.expression ? -1 : 1;
        }
    }
});

field.expression holds the range value. As you can see I am doing a loop around my fields and then trying to sort.

A: Your comparison function will need to check whether an item is in the range and then put that before an item outside of the range. If both are inside, or both are outside, they have to be compared as usual.
The following code does that:
var array = [2,55, 22, 6, 7];
var low = 6,
    high = 23;
array.sort(function(a, b) {
    return ((b >= low && b < high) - (a >= low && a < high)) || (a - b);
});

A: This function sorts your array and then pushes all numbers bigger than the given minimum value to the back of the array.
EDIT: Better performance by calling splice() only once.

var array = [2,55, 22, 6, 7];

function sortBetween(arr, min){
  var sorted = arr.sort(function(a, b) {
    return a - b;
  });
  var spliceIndex = sorted.length - 1;
  while(sorted[spliceIndex] > min) {
    spliceIndex--;
  }

  var tmp = sorted.splice(spliceIndex, sorted.length - 1 - spliceIndex);
  tmp.forEach(function(el, i) {
    sorted.unshift(el);
  });

  return sorted;
}
console.log(sortBetween(array, 6));

Result is, that your sorted array starts with your minimum number. There is no need to set the maximum, because you said:

the last 3 items can appear in any order to be honest, but the range I have sorted must appear first.

A: If an array element falls out of the range you care about, just replace it with an absurdly large value so it moves to the end of the list.
Because a and b have local scope, this won't affect the actual array, just the comparison.
array.sort(function (a, b) {
    if (a<6 || a>23) a = Number.MAX_SAFE_INTEGER;
    if (b<6 || b>23) b = Number.MAX_SAFE_INTEGER;
    return b > a ? -1: 1;
});


text:
Q: How does Rails autoload work? Is there a definitive guide or some good blog posts to understand how the autoload works in Rails 3? The "file not found" and "uninitialized constant" errors are so common and so, so frustrating.
What parts of the autoload mechanism are "from Ruby" and what are "from Rails"? How does it all work? Why can it not find files when they clearly exist in the correct location? And if it finds the files why does it complain of "uninitialized constant"?
Or is it just me being bad even after using Rails for a year?

A: It uses Kernel#autoload. From ri:
= Kernel#autoload

(from ~/.ri)
------------------------------------------------------------------------------
  autoload(module, filename)   -> nil

------------------------------------------------------------------------------

Registers filename to be loaded (using Kernel::require) the
first time that module (which may be a String or a symbol) is
accessed.

  autoload(:MyModule, "/usr/local/lib/modules/my_module.rb")

About the problems you are having with "file not found" errors, can you add the details of a specific example to your question? That will make it easier to help you.

A: IMO the best resource on autoloading and reloading in Rails is the Rails Guides chapter on the topic http://guides.rubyonrails.org/autoloading_and_reloading_constants.html
In order to understand how this Rails mechanism works, you need to make sure you understand how Ruby constant lookup works and what are the different ways of loading code in Ruby.
It is not an easy topic, as is explained in this detailed blog post from Konstantin Haase the creator of Sinatra. http://blog.rkh.im/code-reloading.


text:
Q: Background Access to microsoft Graph API i'm developing a single page application for a costumer. I need to create a script that allows me to access to my app without user interaction. for example i press a button and the script automatically log me in (i know username and password of the user). The user don't need to see the window where i put username and password.
Is it possible? at the moment my login script is:
const authResult = await msalClient.loginPopup(msalRequest);
localStorage.setItem('msalAccount', authResult.account.username);

// Get the user's profile from Graph
user = await getUser();
// Save the profile in session
localStorage.setItem('graphUser', JSON.stringify(user));
if(accountAttivo!=""){
setActiveUser();
}
updatePage(Views.home);

A: Looks like you are trying to follow the ROPC flow as you are using username and password credentials in your script, access token must be fetched from AAD before we call getUser(). To fetch any details using graph api we need to have access token please go through the article which helps you more in understanding.
Let's say we wrote a function called getAccessToken() to fetch the token. Once the token fetched and is saved in the sessions, following code can be used in getUser() to fetch the user profile.
const options = {
    authProvider,
};
const client = Client.init(options);
let res = await client.api('/me')
    .get();

Calling both the functions getAccessToken() and getUser() in the code flow of the button click event should bypass the user interaction with the application to enter credentials.

NOTE: Microsoft does not recommend to user ROPC flow. This most scenarios, more secure alternatives are available and recommended.
This flow requires a very high degree of trust in application, and
carries risks which are not present in other flows. You should only
use this flow when other more secure flows can't be used.


text:
Q: Can Bruce Abbott's inverting TTL to +/- 12V level shifter be improved to better frequency response and better matched impedance? I am working with Bruce Abbott's awesome level shifter here.
Level transformation 0/+5 V TTL logic to +/-9V how to maximize gain and frequency range (DC to 4 MHz)

simulate this circuit – Schematic created using CircuitLab
he clearly describes the circuit as follows:

Q1 is configured in Common Base mode with a bias voltage of 2.5 V.
When the TTL signal pulls down below ~1.8V the transistor turns on and
(almost) the same current flows through both R3 and R4, causing the
voltage at R4 to go down from 9 V to ~5 V. This then turns Q2 on via
R5, causing it to pull the voltage at R6 up from -9 V to +9 V.
It's a simple circuit, but getting good performance at 4 MHz is
tricky. Parasitic capacitances in Q2 cause charge to build up on the
Base, which normally prevents it from turning on and off quickly. This
problem is solved by adding C3, which bypasses R5 at high frequencies
to get charge in and out of the Base quicker. This also requires that
R4 (and therefore R3) have a low value.
R6 has a low value to improve the output fall time. R5 has a high
value to avoid turning Q2 on too hard, as this would cause more charge
to accumulate on the Base, slowing down the turn-off time.
Although this circuit is 'TTL compatible' it requires about 18 mA of
driver sink current, so you may need to pass your logic signal through
a high current buffer if you driver isn't strong enough.

and in the testing I did, especially head to head with the 75188 line driver IC, it has performed much better:

However, I need to improve it. It is really stretched to its limits on the 4 MHz frequency and it also is having problems with the output impedance matching to my scope's Z-input, which is what it is for. I can measure the nice still rectangular performance with the 10x probe alone, but when I hook up the Z-input it already starts breaking down. I had built this circuit 3 times on the bread board now and this time I have more difficulty than before, but it is anyway at its limits, and I want to increase the frequency to 16 MHz soon, as I change from 256 x 256 to 512 x 512 resolution.
The specification of that Z-axis input are

*

*impedance 33 kΩ

*maximum voltage 30 V (DC + AC peak), MAX AC 1kHz

*band width DC to 2 MHz.

OK, that means with 4 MHz I am already stretching it, and 16 would take it too far, but then I might have a different scope. Maybe I get myself a Tektronix 2246 that says it's usable up to 10 MHz.
So, what could be done to get it better? I guess given that R6 is low, the 33 kOhm on the Z-axis input should not really be a problem, but still on the 10x probe I see a major decay when connecting the Z-axis input.
Parasitic capacitance on the base of Q2. What if we were using a MOSFET? 2N7000 n-channel and BS250 p-channel MOSFET is what I have here. The inverting isn't critical, as I might anyway want to route the input signal through a buffer, so might just as well route it through an inverter. But I guess now the question is how to do the level shifting with -12V with that, can it be done?
UPDATE: I found another circuit right here, which helped me understand better the way to build the complementary side, but also how to change the BJTs to MOSFETs. But still it won't do 16 MHz: TTL to +/- 12V conversion - what's a better way?
The proposed solution I first simulate like this:

here is its performance at its bandwidth limit at 400 kHz.

So now I checked if I could build it with the MOSFETs I have available, BS250 for p-channel and BS170 or 2N7000 for n-channel. But the original contributor of the schematics only gave verbal description of the MOSFET transformation:

Since this answer was posted, I changed the design to use MOSFETs for speed. On the "left" pair the gate (formerly base) bias resistors are 0Ω, and there's a 10kΩ pull-up to +5 to protect against floating input (during controller reset). On the "right" pair, each gate has a 1kΩ resistor to source and a 10kΩ resistor resistor to the previous stage's drain. This makes each secondary MOSFET turn off quicker than turn on, which reduces transient current. The result is < 1µs rise/fall time to 90%

I wasn't clear about the resistors and couldn't get a decent result, so I removed all the resistors except two which I could ascertain needed to remain albeit at very low value. Here is the result:

and the response at 4 MHz is adequate:

blue is the drain of M1, red drain of M2 and then cyan the output between M3 and M4. This is very educational.
Now let's see this at 16 MHz, first double to 8:

that's already getting stressed, and now at 16 MHz:

it breaks down.
So, this won't work for me even in this ideal simulated case with no parasitic resistances and capacitances.
Here one more view of the 4 MHz circuit with the currents to see if it's feasible. Peaking at 1.5 A to supply that big swing, but I supposed a good bypass capacitor can provide that.

When I built it, I immediately blew M1 in smoke. So I figured I need a few more resistors.

and here is the simulation, the currents are more reasonably limited now:

but now R4 still got fried. And I am frankly worried that with this circuit if M1 or M2 get fried to bridge between + or - 12V and the 5V TTL power rail, I might blow more chips, if not the entire setup. So a complete separation would be better. And I wonder, could one use an opto-coupler for a level shifter or would that be too sluggish again?

A: [error corrected 17:20GMT Sept 20]
Suggestions on this speedup

*

*you are breadboarding a circuit intended to switch (at the input) 2v/100 = 20mA in 5 nanosecond. In 4" of wire (100nH), the VDD sag if poorly bypassed will be
V = L * dI/dT = 100nH * 20mA/5nanoSec = 2000/5 * milli = 0.4 volts. Thus Ground plane and VDD bypassing (1/4" wide VDD strip) are suggested

*that 40 nanosecond delay, from Input going Low, to output starting high, is puzzling. There should be no stored charge in that pre-transition quiescent state:
both transistors being OFF

*I agree with Chris Stratton about having a strong pulldown also. So take the existing circuit, mirror it with opposite polarity transistors, connect the new common_base's base to GROUND, have 68 ohms in the emitter, replace the output resistor with the new NPN pulldown collector. [had been PNP pulldown]

*use Baker Clamps in both common_emitter Inverting devices, to avoid saturation

A: Here's what did to improve it when I designed the original circuit (showing my LTspice schematic because I don't have the patience to redraw it in Circuitlab). I simply added a complementary Emitter-follower output stage to increase drive current and reduce capacitive loading on R1.

The graph is at 4 MHz. LTspice thinks it will work at 16 MHz, but with some asymmetry.


text:
Q: Do I need to reinstall PHP on Mac to get newly installed features? I admit that I am a bit spoiled by the Windows installer.  Anyway, I have mac os x leopard server and am trying to get gettext to work.  I had trouble with pear but put the include for pear in the /etc/php.ini file.  GetText seems different.  I don't know where to point to in php.ini or if that's how to get it to "see" it.  I installed GetText from source ./configure, make, etc. Do I have to reinstall PHP on Mac to get new stuff to work with --with?  thank you.
edit:  just wanted to ask a different way than the body above.  With PHP, if you want a new feature, do you have to reinstall the whole thing?  How does PHP know about the new library installs?

A: You can also use MacPorts to install whatever extensions you need and keep them up-to-date.
This also saves you from having Apple come along and replace your configuration.

A: I can't directly address your question, but I would consider using an installer such as provided by MAMP or by using the BitNami MAMP Stack.

A: Wile using MacPorts is probably the easiest solution, it's not an answer to your question. The php.ini can define and load php extensions. Things like gettext are linked into php's source during build time and php will have to be recompiled from source to make use of your new libraries.


text:
Q: MacBook Air for Java/J2EE/RoR kind of development work? How far MacBook Air is suitable for developers?
Can it handle running Eclipse, JDK, Flex Builder, Apache, Tomcat and couple of usual applications together and still perform well ?
Or is it purely for business people?

A: Suitable yes in the sense that it is above the "minimum system requirements". I've ran (older) versions of Eclipse and J2EE on much slower machines. I still recoil when I think of the time I tried to build distributed Eclipse plug-ins on an IBM T20.
Are you going to enjoy it and be very productive on it? I would bet not. You probably want more cores, more memory, etc. Developers are also prone to loss of concentration, so an added delay when switching windows, starting debugs, etc. will affect your performance.
In addition, I would highly recommend against trying to do full-time dev on a 13" screen. If you have to use your laptop screen, go with at least 15" with a decent resolution. IDEs require resolution these days because of the sidebars.
For about the same cost you can get a 15" MBP, better bang for the money. Core i5 in the new MBPs is also better structured for multithreading, IMHO, than the core 2 duos.

A: I have been using a 13" MB (before they became pros) with 4GB/2GHZ Core 2 Duo for some time now for work with Eclipse, XCode, Cassandra, Apache/Tomcat and Photoshop. Here is my take away:

*

*Screen size: At times I wish I had more but you learn to become a minimalist with all the windows available and use the hiding option on most of them. Major annoyances are typically having to go back and forth between dev environment and Console. Most of the time I code from home where I have an external monitor which solves all of this.

*Speed: The CPU is sufficient but the memory is not if you're doing major dev work with Java. Java is a memory-whore. I started with 2GB but had to upgrade to 4GB. Typically this was when I was working with Eclipse and had the whole stack running on my machine (app server, data store, dev environment). I've read that MBAs are upgradable to 4GB but it's soldered on in which case you should order the upgrade directly from Apple to be safe (whereas with MBPs you can do it yourself no problem).

*Convenience: My 13" MB is light. But, I don't know if it's age or spending too much time coding, I find myself wishing it was even lighter especially when I fly somewhere.
All in all, I'd be willing to switch to a MBA if cost weren't an issue. Another thing to keep in mind is that you'd have to be OK with working on high-resolution laptop on a smaller screen. It's worth going to the Apple Store to see it with your own eyes.

A: What about the new MacBook Air Model? The 13" inch version with 4GB RAM and 2,x GHz cpu should do it.
The SSD/FLash will be the performance booster in this model.

A: I used to do software development on an iBook with a 1.42GHz processor and 1GB of RAM, so I'm pretty sure the MacBook Air will be more than adequate. :)
To give a more technical analysis: The Air has a relatively slower processor than, say, a MacBook Pro, and less RAM (in its standard configuration), but it should still be more than adequate for development work.
Whether the MacBook Air is worth its price tag (especially compared to a MacBook or MacBook Pro) is a different story. :)

A: I'd say that if you're happy to consider using a laptop as your development machine then you'll probably be fine with a MacBook Air.
In my opinion, monitors, mouse, keyboard far outweigh any processing power.

A: I've got one. It's pretty fast, the SSD makes a lot of difference compared to the standard MBP laptops. I run IntelliJ on it. MBP is a bit faster with building the projects and I feel that IntelliJ sometimes is a bit sluggish, but it's OK.
I think it's a proper dev machine. We're typing text most of the time :-) We're not rendering video or 3D scenes. All devs I know that have one, are really happy with it. So yes, but it.


text:
Q: Using AWS EMR To Update S3 Data I am putting parquet files into an S3 bucket and using Athena to query it. I'd like to make row-level changes to my data, but i'm trying to avoid pulling down gigabytes of parquet data, modifying, and reuploading.
I've been messing with EMR all morning, getting acquainted with the tools available, but none are jumping out as a solution.
Will any of the EMR tools give me the ability to execute an UPDATE x SET foo = 'bar' type query on my existing s3 parquet data?


text:
Q: C# - How to pass a type as a parameter I think it's more difficult to ask than answering the question.
I wanna ask my question with an example:
You know that we can bind an object to a DataSource, and that object could be of any type. So suppose I've bound an object of type "MyClass" to DataSource of a DataSet.
Now I send this dataset as a parameter to another class in another DLL, and in this DLL file I want to create a List<> of type of "MyClass".
As I have not access to "MyClass" type i can use this code to get the type of DataSource:
_dataSet.DataSource.GetType()

but I can't use the code like the following to create a List of type of "MyClass":
List<_dataSet.DataSource.GetType()> _list;
What should I do in this situation?

A: There are basically two options:

*

*stick with List<object> or, better, we the closest known ancestor type of _dataSet.DataSource

*or use a nasty reflection hack to instantiate a List<T> dynamically.

I'd personally resort to option (1) in most cases because it is:

*

*easier to use,

*readable,

*sufficiently type safe,

*universal in terms of natural code reuse.

The second option was already elaborated in other answers.

A: var newtype = typeof (List<>).MakeGenericType(_dataSet.DataSource.GetType());
var _list = Activator.CreateInstance(newtype);

A: You can dynamically create a generic type using reflection:
var listType = typeof(List<>).MakeGenericType(
    new[] { _dataSet.DataSource.GetType() }
);
var ctor = listType.GetConstructor(new Type[] { });
var list = ctor.Invoke(null);

Note that list will be typed as object.

A: You'll need to use reflection to instantiate a generic list of the desired type. This method should do the trick:
public object InstantiateGenericList( Type nodeType )
{
    Type   list        = typeof(List<>) ;
    Type   genericList = list.MakeGenericType( nodeType ) ;
    object instance    = Activator.CreateInstance( genericList ) ;

    return instance ;
}

A: You could use reflection, as other answers have pointed out.
Do you have control over the other class in the other DLL?  Can you make that class or the particular method that you're calling on that class generic?
public class SomeOtherClassInSomeOtherDLL
{
    public void DoSomethingWithData<T>(T dataSource)
    {
        // ...

        List<T> list = new List<T>();
        list.Add(dataSource);

        // ...
    }
}

So you would call it like this:
        var anotherClass = new SomeOtherClassInSomeOtherDLL();

        // ...

        anotherClass.DoSomethingWithData(_dataSet.DataSource as MyClass);


text:
Q: How to highlight a particular marker on a multiple marker map I have situation here, kindly help me  in resolving this
On a  map with multiple markers i am using two variables for longitude and latitude and using them as center point of the map.
How can I

*

*use the marker for these lat/long used for  center to bounce or
animate

*change the icon of this centered marker to be different than others

*add additional info in the info box.

thanks in advance for the help
-----here is the code
<!DOCTYPE html>

  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <title>Google Maps Multiple Markers</title>

A: <!DOCTYPE html>

  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <title>Google Maps Multiple Markers</title>

List of markers available by google
More about markers


text:
Q: Use Widget Value in Server Script I may be overthinking this drastically, but what is the easiest way to access a widget's value in a server script?
In my particular case, I am trying to use a dropdown widget's value as the filter for a calculated model query.
function getMonthlyTotalsByResource_() {

  var allRecordsQuery = app.models.Allocations.newQuery();
  allRecordsQuery.filters.Approved._equals = true;
  allRecordsQuery.filters.Resource.Manager.ManagerName._equals = /* How do I make the widget's value available here? */

  var allRecords = allRecordsQuery.run();
...
...

A: In your calculated model datasource in the server script have the following:
return getMonthlyTotalsByResource_(query);

Still in your model datasource add a parameter ('String?') and call it ManagerName.
On your page with the dropdown bind the value of the widget to @datasource.properties.ManagerName
In your server script function change to the following:
function getMonthlyTotalsByResource_(query) {

  var allRecordsQuery = app.models.Allocations.newQuery();
  allRecordsQuery.filters.Approved._equals = true;
  allRecordsQuery.filters.Resource.Manager.ManagerName._equals =
  query.parameters.ManagerName;

  var allRecords = allRecordsQuery.run();

A: The easiest way to do this is to add a parameter to the datasource of your calculated model.  Then bind something to it from the client side (e.g. bind to datasource.mycalculatedds.parameters.myparam ).
Then pass the default 'query' object from your calculated datasource.  For example in your calculated DS, where you call your function, call
getMonthlyTotalsByResource_(query).  Then you can set something like
var thismanager = query.parameters.myparam

A: // get widget value
function getWidgetValue() {
    var val = app.PAGES.YOUR_PAGE.descendants.WIDGET_NAME.value;
    return val;
}

// execture query
function getMonthlyTotalsByResource_(widgetValue) {
    var allRecordsQuery = app.models.Allocations.newQuery();
    allRecordsQuery.filters.Approved._equals = true;
    allRecordsQuery.filters.Resource.Manager.ManagerName._equals = widgetValue;
    var allRecords = allRecordsQuery.run();
}
// run
getMonthlyTotalsByResource_(getWidgetValue);


text:
Q: Get all divs by data attribute until Creating a dynamic, multi-level jquery accordion menu of sorts, however using divs instead of the usual li tags.
Each div has a data attribute (data-level), and values are 1, 2, 3, 4, etc...
My "toggle" function needs to show/hide each div that has a greater data-level than it's own, until it reaches a div with a data-level that matches it's own...
so if I have:

Sample Title

Sample Subtitle

Sample Subsubtitle

Sample Subtitle

Sample Title

Sample Subtitle

Sample Subsubtitle

Then clicking on the first "Sample Title" would toggle both "Sample Subtitle" and the "Subsubtitle", but not touch the second "Sample Title" or its children... And of course, clicking on a "Subtitle" would toggle it's "Subsubtitle", but not affect any other elements.
Any advice?

A: Check out this Fiddle: http://jsfiddle.net/p4gps/1/
The key is in this code:
$('div').click(function() {
    var level = parseInt($(this).data('level'));
    if ($(this).hasClass('show')) {
        $(this).removeClass('show');
        $(this).nextAll('div').each(function() {
            if (parseInt($(this).data('level')) > level) $(this).hide().removeClass('show');
            else return false;
        });
    } else {
        $(this).addClass('show');
        $(this).nextAll('div').each(function() {
            if (parseInt($(this).data('level')) > level) $(this).show().addClass('show');
            else return false;
        });
    }
});

It does a $.each on all the div elements that come after the one you clicked on. Once it reaches a div that is at the same level or lower, it breaks out of the loop.


text:
Q: React Rails - Component not loading I've gone as far as I can
I am using the react gem for rails
gem 'react-rails', '~> 1.3.0'

and I hope to have a React loop
<%= react_component( "Posts", { posts: @posts} )%>

I have a post.js.jsx file in assets/javascripts/components with:
var Posts = React.createClass({
    render(){
        var createItem = ({article}) => <Post post={article} />;
        console.log(this.props.posts);
        return <div>{this.props.posts.map(createItem)}</div>;
    }
});

I require the article from each post to be in the view - however it won't return and the console.log does return an array of objects of the this.props.posts (it is also passing the @ instance variable to the data tag of the react_component tag in the source of the page.
Trying to understand why I can't gain access to "article" and why it is saying I have Posts undefined error in the console log.
Uncaught ReferenceError: Post is not defined


text:
Q: Merge polygons problems I have a group of polygons which I merged to create one large polygon using the editor toolbar. This worked fine but there are still 5 or 6 lines contained within the large polygon. I'm assuming these are contained within the polygon because when I select the polygon the lines are selected too - how can I get rid of these 'rogue' lines, if I merged the polygons how come I have lines now? Any help appreciated!

A: My guess is that your polygons don't have correct topology, I mean the sharing border is not exactly the same. There is very likely a tiny gap and when you merge your polygons, you see those tiny gaps as line (try zoom to very detail). If this was problem, solution is obvious - you should correct topology of your polygon before merge - you can use topology class with no gaps rule.

A: You can manually remove the lines by:
1) Enter an edit session
2) Selecting the feature
3) Select the "Edit Vertices" tool from the editor toolbar
4) Find the vertices of the rogue lines, select them, and delete them
5) End edit session and save edits
ESRI resource:
http://resources.arcgis.com/en/help/main/10.1/index.html#//01m80000003p000000


text:
Q: Celery throwing IOError when retrying a task I'm intermittently (about 20% of the time) getting an IOError exception from Celery when I attempt to retry a failed task.
Here is my task:
@task
def update_data(pk_id):
     try:
        pk = PK.objects.get(pk=pk_id)
        results = pk.get_update()
        return results
    except urllib2.HTTPError, exc:
        print "Let's retry in a few minutes."
        update_data.retry(exc=exc, countdown=600)

The exception:
[2011-10-07 11:35:53,594: ERROR/MainProcess] Task report.tasks.update_data[1babd4e3-45eb-4fa3-a497-68b67bb4a6df] raised exception: IOError()
Traceback (most recent call last):
  File "/home/prj/prj_env/lib/python2.6/site-packages/celery/execute/trace.py", line 36, in trace
    return cls(states.SUCCESS, retval=fun(*args, **kwargs))
  File "/home/prj/prj_env/lib/python2.6/site-packages/celery/app/task/__init__.py", line 232, in __call__
    return self.run(*args, **kwargs)
  File "/home/prj/prj_env/lib/python2.6/site-packages/celery/app/__init__.py", line 172, in run
    return fun(*args, **kwargs)
  File "/home/prj/prj/report/tasks.py", line 109, in update_data
    update_data.retry(exc=exc, countdown=600)
  File "/home/prj/prj_env/lib/python2.6/site-packages/celery/app/task/__init__.py", line 520, in retry
    self.name, options["task_id"], args, kwargs))
HTTPError

RabbitMQ Logs
=INFO REPORT==== 7-Oct-2011::15:35:43 ===
closing TCP connection <0.4294.17> from 10.254.122.225:59704

=WARNING REPORT==== 7-Oct-2011::15:35:43 ===
exception on TCP connection <0.4330.17> from 10.254.122.225:59715
connection_closed_abruptly

=INFO REPORT==== 7-Oct-2011::15:35:43 ===
closing TCP connection <0.4330.17> from 10.254.122.225:59715

=WARNING REPORT==== 7-Oct-2011::15:35:49 ===
exception on TCP connection <0.4313.17> from 10.254.122.225:59709
connection_closed_abruptly

=INFO REPORT==== 7-Oct-2011::15:35:49 ===
closing TCP connection <0.4313.17> from 10.254.122.225:59709

=WARNING REPORT==== 7-Oct-2011::15:35:49 ===
exception on TCP connection <0.4350.17> from 10.254.122.225:59720
connection_closed_abruptly

=INFO REPORT==== 7-Oct-2011::15:35:49 ===
closing TCP connection <0.4350.17> from 10.254.122.225:59720

=INFO REPORT==== 7-Oct-2011::15:36:22 ===
accepted TCP connection on [::]:5672 from 10.255.199.63:50526

=INFO REPORT==== 7-Oct-2011::15:36:22 ===
starting TCP connection <0.4501.17> from 10.255.199.63:50526

Any ideas why this might be happening?
Thanks!

A:
May be save each task in database and retry them if no result is
  received for some time? Or may be dispatcher have it's own persistent
  storage? What about then if worker thread crash receiving the task or
  while executing it?

Retry Lost or Failed Tasks (Celery, Django and RabbitMQ)

A: max_retries in celery is per default 3, so if the same task fails 3 times in a row (i.e. 20% of the time), retry will rethrow the exception.


text:
Q: StackOverflow's Ask Form mechanism? We all see,
When we are in process of writing a question on StackOverflow, before we post our question. If we close the browser or refresh it, we can still see that, all the content we typed in form is still available.
How is it programmed.
I want to do something similar in my application.
I can think of storing two session variables

*

*Title - Question

*Body - message

Update the session variables at minimum time Intervals and kill the variables on click of "Post your Question" Button
I am Not positive if this is how StackOverflow is handling this.
Can any one suggest best approach?
My platform is ASP.Net C# MVC 3.0

A: The best way to see how does it work is use the browser with some inspector for an example Firefox + Firebug.
You will see, that the page is posting content of the answer field from time to time and saves it on the server with ajax calls (therefore it also sometimes displays "draft saved" message while typing).
There are also other connections in the background: for an example websockets, which causes that the site really is updated on-life.


text:
Q: Usage of Maven tycho-p2-plugin with SWT How do I build an SWT application using the Eclipse P2 repository  and the Maven tycho-p2-plugin?

A: You can define the target environments for 'target-platform-configuration' plugin. Whatever you are building RCP or features for multiple environments, you can let your feature to include the fragments of swt for these hosts.
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>target-platform-configuration</artifactId>
            <version>${tycho-version}</version>
            <configuration>
                <resolver>p2</resolver>
                <environments>
                    <environment>
                        <os>linux</os>
                        <ws>gtk</ws>
                        <arch>x86</arch>
                    </environment>
                    <environment>
                        <os>win32</os>
                        <ws>win32</ws>
                        <arch>x86</arch>
                    </environment>
                    <environment>
                        <os>solaris</os>
                        <ws>gtk</ws>
                        <arch>sparc</arch>
                    </environment>
                </environments>
            </configuration>
        </plugin>

Snippet in feature.xml
   <plugin
         id="org.eclipse.swt"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

   <plugin
         id="org.eclipse.swt.gtk.linux.x86"
         os="linux"
         ws="gtk"
         arch="x86"
         download-size="0"
         install-size="0"
         version="0.0.0"
         fragment="true"
         unpack="false"/>

   <plugin
         id="org.eclipse.swt.win32.win32.x86"
         os="win32"
         ws="win32"
         arch="x86"
         download-size="0"
         install-size="0"
         version="0.0.0"
         fragment="true"
         unpack="false"/>

A: Tycho allows you to build & compile eclipse-based stuff, including plugins, features, and RCP applications. On the official project page there are a tons of good tutorial, but in my case I used the sample project ( http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp ).
However, if you do not need to build some plugins or a RCP application, I think you do not need tycho: you just can import SWT as a normal maven dependency and build your app that way...

A: I found the problem. Background: I'm building the editor plugin which Xtext generates for DSLs.
The plugin depends on org.eclipse.swt;version=3.7.0. The packaging is eclipse-plugin. I'm listing all the necessary environments in my parent POM.
The p2 repository is a local mirror on my hard disk which I fill by exporting a Target Definition (*.target file).
The problem is that exporting a Target Definition will create something that looks a lot like a p2 repo but there are subtle differences.
For example, you have to define a target environment (Linux/Windows/Mac, x86/x86_64, win32/cocoa/gtk) in the Target Definition file. If you don't specify anything, Eclipse will use the current platform. If you use "*", all SWT fragments will be omitted.
This means: The export contains all the SWT fragments (30 plugins in the plugins/ folder), they are mentioned in the contents.jar but the artifact.jar only lists the single SWT fragment which matches your current platform (i.e. the bundle plus the sources).
This is not enough for Tycho.
Solution: Create a proper p2 repo using this small script:
# Where you exported the Target Definition
dir="$HOME/3.7.1-from-target-platform"

# Where the result should be written. Must be != dir
dest="$HOME/3.7.1-from-target-platform-fixed"

# Make sure subsequent invocations don't try to merge old stuff
rm -rf "$dest"

# Prepend "file:" to create a URL from the path
dest="file:$dest"

echo "Merging $dir..."
./eclipse -nosplash \
    -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
    -metadataRepository "$dest" \
    -artifactRepository "$dest" \
    -repositoryName "3.7.1 Indigo Repository" \
    -source "$dir" \
    -compress -append -publishArtifacts

Run this inside of a working Eclipse installation.


text:
Q: Unable to send data to AWS elastic search instance using logstash I am trying to send data to AWS elastic search end point using logstash that is installed on my local machine.
The logstash conf file looks like this
input {
     file {
        path => "/path/log.txt"
      }
}
output {
   amazon_es {
        hosts => ["https://search-abclostashtrial-5jdfc43oqql7qsrhfgbvwewku.us-east-2.es.amazonaws.com"]
    action => "index"
    region => "us-east-2"
    index => "trial"
    ssl => true

    }
}

The Elastic search Access policy looks like this
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:*",
      "Resource": "arn:aws:es:us-east-2:0415721453395:domain/abclostashtrial/*"
    }
  ]
}

I am using logstash-output-amazon_es plugin to send the query like
sudo bin/logstash -f /path/logstash/abc.conf
And I get the following error log.
[ERROR] 2019-04-30 20:05:52.900 [Converge PipelineAction::Create<main>] agent - Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: PipelineAction::Create<main>, action_result: false", :backtrace=>nil}
[INFO ] 2019-04-30 20:05:53.165 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600}
[INFO ] 2019-04-30 20:05:58.037 [LogStash::Runner] runner - Logstash shut down.

What am I missing here ?

A: One option to start with is to create an AccessKey that has rights to write to Elasticsearch, and configure that in the output. Example:
amazon_es {
    hosts => ["vpc-xxxxxxxxx-es-yyyyyy4pywmwigwi47em.us-east-1.es.amazonaws.com"]
    region => "us-east-1"
    aws_access_key_id => 'AKIxxxxxxxxxxx'
    aws_secret_access_key => '11xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    index => "production-logindex-%{+YYYY.MM.dd}"
    }


text:
Q: "fuse: bad mount point No such file or directory" but the file exists My system is 32-bit so this answer doesn't help me.
I am trying to use sshfs to no avail:
$ sshfs -o IdentityFile=/home/aventinus/.ssh/id_rsa [name]@X.X.X.X:/data/[folder name]/[folder name]/ /home/aventinus/[folder name]/
SSHFS version 2.5
fuse: bad mount point `IdentityFile=/home/aventinus/.ssh/id_rsa': No such file or directory

But this makes no sense because:
$ cd /home/[user]/.ssh/
$ ls -l
total 12
-rw-rw-rw- 1 aventinus aventinus 1679 Sep 19 17:22 id_rsa
-rw-rw-rw- 1 aventinus aventinus  408 Sep 19 17:22 id_rsa.pub
-rw-rw-rw- 1 aventinus aventinus 1326 Sep 20 09:18 known_hosts

What am I doing wrong? The files are indeed there but I get "No such file or directory". Also, when I try to get them using bash, pressing tab doesn't autocomplete the name of the files. How is this possible?
edit 1: I know that the permissions on the files are over-permissive as @steeldriver mentioned in the comments. I did that in order to make sure that permissions is not the problem. I was running out of ideas.
edit 2: After @Jakuje's comments:
$ set -x
+ set -x
$ sshfs -o sshfs_debug [name]@X.X.X.X:/data/[folder name]/[folder name]/ /home/aventinus/[folder name]/
+ sshfs -o sshfs_debug [name]@X.X.X.X:/data/[folder name]/[folder name]/ /home/aventinus/[folder name]/
SSHFS version 2.5
read: Connection reset by peer

edit 3: After @Jakuje's answer:
$ sshfs [name]@X.X.X.X:/data/[folder name]/[folder name]/ /home/aventinus/[folder name]/ -o IdentityFile=/home/aventinus/.ssh/id_rsa
read: Connection reset by peer

Also:
$ sshfs [name]@X.X.X.X:/data/[folder name]/[folder name]/ /home/aventinus/[folder name]/ -o sshfs_debug -o IdentityFile=/home/aventinus/.ssh/id_rsa
SSHFS version 2.5
fuse: invalid argument `IdentityFile=/home/aventinus/.ssh/id_rsa'

So indeed, for some reason, sshfs cannot read the id_rsa file but as I have shown you, it is there. How is this possible?
edit 4: After @Jakuje's comments on his answer:
$ sshfs [name]@X.X.X.X:/data/[folder name]/[folder name]/ /home/aventinus/[folder name]/ -o LogLevel=DEBUG3 -o IdentityFile=/home/aventinus/.ssh/id_rsa
read: Connection reset by peer

Also:
$ sshfs [name]@X.X.X.X:/data/[folder name]/[folder name]/ /home/aventinus/[folder name]/ -d -o debug -o IdentityFile=/home/aventinus/.ssh/id_rsa
FUSE library version: 2.9.4
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
ssh: connect to host X.X.X.X port 22: Connection timed out
read: Connection reset by peer

I really don't understand this.

A: The order of the synopsis matters:
sshfs [user@]host:[dir] mountpoint [options]

Therefore you should use
$ sshfs [user@server] [/path/to/mountpoint] -o IdentityFile=/home/[user]/.ssh/id_rsa

as manual page for sshfs suggests.
Edit: You can't even ping the host, so the problem is in the network. Check if there is some firewall on the way or something else blocking the connection.

A: You are getting the connection reset error.
Please try adding your public key to the authorizedkey of remote.

A: I had a similar issue and (eventually) when I just ssh'd directly to the other machine I got a warning about IP address changes... and yes over the weekend the machine had changed IP address.  So I removed the offending line from .ssh/known_hosts and ssh'd over again no problem.  Then when I used my sshfs string that had been working until this weekend it worked fine.  Not a helpful error message at all in this case!


text:
Q: Jenkins Git-Push with master branch only This might be a very basic question in terms of jenkins and github integration. However, I am thinking good to ask.
What I am basically looking to do is if anything pushed to master branch of git only then my jenkins job must get triggered. Considering there are multiple feature branches and multiple commits happening on different branches but I am interested only in master branch push.
I did not find good documentation over, could anybody give me any pointer on this.
Help is appreciated, thanks!

A: OK, so you got two options:
Create a single branch pipeline
Just click on create new item, select pipeline and under "Pipeline" configure as "Pipeline script from SCM" and put your GitHub and in "branches to build" put "*/master".
Add brach conditions
Alternatively you could add when conditions to your stages if you use declarative syntax:
pipeline {

    agent any

    stages {

        stage("Build") {
            when { branch 'master' }
            steps {
                // do your build
            }
        }
    }
}

Or if you're using scripted:
node {
    stage('Build') {
        if (env.BRANCH_NAME == 'master') {
            // do your build
        }
    }
}

See "flow control".


text:
Q: Customize or change Json converter for numbers in Asp.net webapi I have a website, and most of the functionality is implemented using asp.net webapi. The problem is that some users have special keyboard layouts that have non-standard number characters, one is ۰۱۲۳۴۵۶۷۸۹ instead of 0123456789.
Now I need a way to customize asp.net webapi, or Json.Net to handle conversion of these strings to numbers.
I already know how to handle this, by implementing a JsonConverter and decorate the Property with [JsonConverter] attribute, but this is error prune, as one might forget to put this on new properties and this is an error which might easily slip through testing and creep to production code.
I need one global setting where I can handle this for all numerals types (even if I need to do that for each numeral separately).

A: You can register you formatter globally by this way:
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Converters.Add(new NumeralsFormatConverter());

Registered formatter will process fields that pass CanConvert method validation.


text:
Q: get function called on click javascript or jquery I am working on mouse tracking application. i will give a small piece of code to my user, He will paste that piece of code into his footer, and the recording will start for his website. whenever any user visits his website, i save the source of the visited page, and track all the mouse movements, scrolling, typing and clicking. if he clicks on a link, then i save the source of that page again and its mouse movement and so on. my user can view the recordings and use activity of each session using his control panel.
i have been stuck in the following case.
If user clicks on any div, span, p, img, checkbox, dropdown, radio etc and there is any jquery effect is associated with it. if there is any id or name then i can trigger the click event onto that id or name object during playback. But if i dont have any id or name then i cant trigger the click event.
i am saving the x,y position also. but there is the problem of accuracy during playback.
that why i want to track the function called for click event on the above mentioned elements and call that function directly during playback.
is there any way to track which "user defined function" is being called onClick in javascript or jquery without any debugger tool. Please note that i dont know the name of any function associated with each element. i can only track the click using the following code:
 $(window).mousedown( function(e) {
     mouseTracker.clickState = true;
     console.log( "id:" + e.target.id + " name:" + e.target.name );
     mouseTracker.clickObject = e.target.id + ":" + e.target.name;
 }).mouseup( function() {
            mouseTracker.clickObject = ':';
            mouseTracker.clickState = false;
 });

Can anyone please help.
Regards,

A: I think you are looking for this:
The code bellow traces every click performed on the DOM
$(document.documentElement).on('click', function(e){
   //e.target will output the clicked element
   //$._data( element, "events" ) will find any events attached to this element
   console.log($._data( e.target, "events" ));
});

NOTE: This answer uses jQuery, I'm assuming that it's loaded.


text: Q: force url to open in chrome:// Url with c# in Android I want to open a specific URL given with Application.OpenUrl() in a specific browser (chrome). Adding @"googlechrome://..." to the URL opens the browser but doesn't forward the URL. Any ideas to how force chrome to open the url?


text:
Q: youtube-dl not performing as expected on 12.10 When I type the video url, it bring out this message instead of download.
Please what do I do because I really need to start downloading videos.
joshua@joshua-HP-625:~$ youtube-dl http://www.youtube.com/watch?v=h3gPo7qFOFw&

feature=player_detailpage
[1] 6720
joshua@joshua-HP-625:~$ Hi! We changed distribution method and now youtube-dl needs to update itself one more time.
This will only happen once. Simply press enter to go on. Sorry for the trouble!
The new location of the binaries is https://github.com/rg3/youtube-dl/downloads, not the git repository.

A: You have two issues.

*

*You need to surround your link in " to escape that last ampersand &:
youtube-dl "http://www.youtube.com/watch?v=h3gPo7qFOFw&"

*You need to update youtube-dl one more time, run as sudo:
sudo youtube-dl --update

and press Enter when prompted.

A: First, the & sign at the end of the link is forcing youtube-dl to run in the background.
Second, the instructions give you the location of the new download: https://github.com/downloads/rg3/youtube-dl/youtube-dl
Finally, consider a site like http://www.keepvid.net in the meantime.


text:
Q: limits questions squeeze theorem Find the limit of:
$a_n=\frac{1}{\sqrt2}+\frac{2}{3}+\frac{3}{\sqrt{28}}+...+\frac{n}{\sqrt{n^3+1}}$
I'm having trouble in figuring out what the upper part of the squeeze theorem could be.

A: Hint: You can use $ \sum_2^n \frac{1}{n} < a_n < \sum_1^n \frac{1}{\sqrt{n}}$ for bounds.

A: It does not converge, it goes to infinity:
$$a_n=\sum_{k=1}^n\frac{k}{\sqrt{k^3+1}}\geq \sum_{k=1}^n\frac{k}{\sqrt{k^3+k^3}}\geq \sum_{k=1}^n\frac{1}{\sqrt{2k}}\geq \sum_{k=1}^n\frac{1}{\sqrt{2}k}$$
and https://en.wikipedia.org/wiki/Harmonic_series_(mathematics).


text:
Q: How to use selenium and poltergeist together in RSpec? I have a rich frontend in my application. Some of my tests not works well with poltergeist, because of animations and AJAX requests, but works fine with selenium.
How can i use them together in one project and in one test session?

A: If you're using the standard RSpec configuration with Capybara (require 'capybara/rspec') then you can override the normal driver that would be used for a given test with :driver metadata
it "should do something", driver: :selenium do
  # will use the selenium driver for this test
end

it "should do something else", driver: :poltergeist do
  # will use the poltergeist driver for this test
end

that could also be specified on the enclosing feature if you want the whole feature to use a specific driver
feature "blah balh", driver: :selenium do
  # all scenarios here would use the selenium driver unless overridden with their own :driver metadata

A: I found solution.
Created macros in spec/support/selenium_macros.rb:
module SeleniumMacros
  def use_selenium_webdriver
    before(:all) do
      Capybara.javascript_driver = :selenium
      Capybara.current_driver = :selenium
    end

    after(:all) do
      Capybara.current_driver = :poltergeist
      Capybara.javascript_driver = :poltergeist
    end
  end
end

spec/rails_helper.rb
RSpec.configure do |config|
  config.extend SeleniumMacros, type: :feature # add macros for acceptance tests

using example
spec/features/example_feature_spec.rb
feature 'Add files to question' do

  use_selenium_webdriver

this feature will be work with selenium, after it will be executed it activates poltergeist webdriver.
P.S. Sorry for my english.


text:
Q: Using Javascript to save files in Photoshop without a prompt? I am using a simple script to edit an existing image.
No matter what I do, a save prompt always comes up. I want this to be 100% automated.
save() gives me a saveAs prompt to save it as a copy.
close(SaveOptions.SAVECHANGES) just gives me a generic "Do you wish to save before closing?" box that I still need to select Yes on.
saveAs() gives me the same as save(), except I can toddle the "As copy" option off... but that still doesn't help.

A: Try this instead:
// where fPath is your file path
// jpgSaveOptions.quality controls the quality of the jpeg

// save out the image as jpeg
var jpgFile = new File(fPath);
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 12;

activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);

There is a known bug with compatibility issues of Photoshop, but I dodn't think this is it.
And just for the record Photoshop can be scripted in either Applescript, JavaScript or Visual Basic


text:
Q: is there a better way to set global variables in a script I've written a function in another file, basically doLostOfStuff
and to call, it, I have my main.py file pass variables to it.  Something like this
def doLotsOfStuff(v1,v2,v3):
    return v1+v2+v3

def initializeVariables():
    v1= 1
    v2 = 2
    v3 = 3
    return(v1,v2,v3)

myV1,myV2,myV3 = initializeVariables()
doLotsOfStuff(myV1,myV2,myV3 )

The thing is, in my actual code there are a lot of variables, with long names and the initializing line is about 90 columns wide.
Is there a better/cleaner way to call doLotsOfStuff`?  I just feel like this makes for code that isn't easy to read.

A: You can use argument unpacking:
args = initializeVariables()
doLotsOfStuff(*args)


text:
Q: Mind helping a newcomer who hit their first speed bump? I just started learning how to program in Java. Everything was going well so far.. That was until I came across this "bonus" question/problem our teacher gave us to solve as an additional "challenge".
Please click here to view the Question and the Sample input/output (it's an image file)
Note that I'm not allowed to use anything that wasn't taught or discussed in class. So, things like arrays, method overloading, parsing arrays to methods, parseInt, etc. gets ruled out.
Here's what I was able to come up with, so far:
import java.util.Scanner;
public class Test
{
    public static void main(String[] args)
    {
         int N; // number of lines of input
         double length1, length2, length3; // the 3 lengths
         double perimeter; // you get this by adding the 3 lengths
         double minperimeter=0; // dummy value

         Scanner input = new Scanner(System.in);
         System.out.println("Enter the number of triangles you have:");
         N = input.nextInt();

         System.out.println("Insert the lengths of the sides of these " +
                            "triangles (3 real numbers per line):");

         for (int counter=0; counter<N; counter++)
         {
             length1 = input.nextDouble();
             length2 = input.nextDouble();
             length3 = input.nextDouble();

             perimeter = (length1 + length2 + length3);
             minperimeter = Math.min(perimeter,Math.min(perimeter,perimeter));
         }

         System.out.printf("The minimum perimeter is %.1f%n", minperimeter);
    }
}

My 2 main problems are:
1) The program only stores and works with the 'last' input.
The ones before it get replaced with this one. [update: solved this problem]
2) How do I print the "triangle number" in the final output? [update: solved this problem, too]
So, can anyone please help me come up with a solution that requires only the very basic learnings of Java? If it helps, this is the book we're using. Currently at Chapter 4. But we did learn about Math Class (which is in Chapter 5).
Update: Thank you so much for your replies, everyone! I was able to come up with a solution that does exactly what was asked in my question.

A: Math.min(perimeter,perimeter) will always give you perimeter. You probably wanted to do Math.min(perimeter,minPerimeter)
Since it's a programming assignment is best if I don't give you the full solution to your second question, but your hint is, in the counter parameter of your for loop. Save that when you update minperimeter, so that you know in which iteration of the loop you found the minimum.
Also, initialise your minPerimeter to 10000 or higher. If you start at 0, Math.Min will never be lower than that.

A: Change your for loop as:
double minperimeter=-1;

for (int counter=0; counter<N; counter++)
     {
         length1 = input.nextDouble();
         length2 = input.nextDouble();
         length3 = input.nextDouble();

         perimeter = (length1 + length2 + length3);

         if(minperimeter == -1){
               minperimeter = perimeter;
         } else{
               Math.min(perimeter,minperimeter);
         }
     }

A: You have to store the smaller perimeter in your variable perimeter.
The hint from your task tells you, that any given perimeter is smaller than 1000. Thus initiate the perimeter to 1000.
In your for-loop then you have to store the smaller perimeter:
perimeter = Math.min(perimeter, length1 + length2 + length3)

if the sum of the edges is smaller than the current perimeter, the smaller value will be stored.
Please note that according to your given task, you have to input 3 doubles within one line.

A: Alternative Solution
Make an ArrayList and add all perimeter to that list and then find the minimum value from that list.
     List<Double> perimeter = new ArrayList<>();

     for (int counter=0; counter<N; counter++)
     {
         length1 = input.nextDouble();
         length2 = input.nextDouble();
         length3 = input.nextDouble();

         perimeter.add(length1 + length2 + length3);
     }

     System.out.printf("The minimum perimeter is %.1f%n", Collections.min(perimeter));


text:
Q: I can't change the postgres user password First a question:
I am a complete newbie. Is it correct that postgresql installs with some default passwords without asking to change it during installation? What are those passwords? I am just playing with an app and if I know the default passwords, everything will be okay.
As you could tell I don't have the default passwords. Somewhere I read that postgres user allows login with no password. Do I then leave the password field in the app config file empty?
I used the following command from the postgresql command line:
ALTER ROLE postgres WITH PASSWORD 'new_password';

I get the following error:
ALTER: command not found.

Could you tell me what is going on?
I have postgresql 11.6 & 12.1.

A: For a newly installed PostgreSQL cluster, it does not allow non-local connections, namely that you can connect it locally without a password. For example:
psql -U postgres -p5432 -h127.0.0.1 -d postgres

You can run psql --help to see all the help information for psql.
As above, after you log in, you can create a new user and specify a password[1] or change the password like you do.
Note that you can't log in to the database with this account on other hosts if you don't modify the client authentication configuration file[2].

Client authentication is controlled by a configuration file, which traditionally is named pg_hba.conf and is stored in the database cluster's data directory. (HBA stands for host-based authentication.) A default pg_hba.conf file is installed when the data directory is initialized by initdb. It is possible to place the authentication configuration file elsewhere, however; see the hba_file configuration parameter.

References

*

*https://www.postgresql.org/docs/current/sql-createuser.html

*https://www.postgresql.org/docs/current/auth-pg-hba-conf.html

A: Unless your installation process sets one, the superuser postgres has no password set. You connect from the local computer without a password, then you can set one.
First, start the command line client:
psql -U postgres

Then you can run your ALTER ROLE command.

A: There are two steps to changing PostgreSQL database user (postgres) password:

*

*Log in as Linux / Ubuntu PostgreSQL admin user onto Linux / Ubuntu:

su - postgres

*And then you can ALTER ROLE:

ALTER ROLE postgres WITH PASSWORD 'new_password';


text:
Q: R - From long to wide and back to the same long format I have Compustat data in the long format, which I transform to the wide format by spread (from the tidyr package).
Then I do some calculations and after that I want to bring the dataframe back to the long format again. Is there any sort of "memory" function, so that my new long dataframe is in the exact same way as the old one (same order).
The Problem is that there are a lot of NAs and the data of each stock begins when the stock is first listed and ends after it's delisting or at the end of the sample. My sample goes from 1960 to 2015 (quarterly). Of course not all stocks have data for all that dates, but when I go back from the wide to the long format each stock gets all of the dates from 1960.1 to 2015.4. This long format dataframe is part of a score I am building and I have to compare it to other long format dataframes (all of them have the same order by kypermno and date), because of that I need to convert the wide dataframe back into the exact original form just with the new values.
Edit: Here is an example of my problem:
long format 'original' (called 'test'):
    `kypermno fyyyyq ROE_Q
      <int>  <int> <dbl>
1      1001   1985  0.56
2      1001   1986  0.43
3      1001   1987  0.78
4      1001   1988    NA
5      1001   1989  0.34
6      1001   1990  0.76
7      1002   1980  0.12
8      1002   1981  0.67
9      1002   1982  0.12
10     1002   1983  0.56
11     1002   1984    NA
12     1002   1985  0.91
13     1002   1986  0.45
14     1002   1987  0.23
15     1002   1988  0.54
16     1002   1989  0.14
17     1002   1990  0.19
18     1002   1991  0.27`

With the following code I put it in the wide format:
dat_wide <- spread(test, kypermno, ROE_Q)

now in the wide format it looks like this:
 fyyyyq `1001` `1002`
*   <int>  <dbl>  <dbl>
1    1980     NA   0.12
2    1981     NA   0.67
3    1982     NA   0.12
4    1983     NA   0.56
5    1984     NA     NA
6    1985   0.56   0.91
7    1986   0.43   0.45
8    1987   0.78   0.23
9    1988     NA   0.54
10   1989   0.34   0.14
11   1990   0.76   0.19
12   1991     NA   0.27

And when I put it back in the long format it becomes this:
dat_long <- gather(dat_wide, key = 'fyyyyq', value = 'ROE_Q', -kypermno)

fyyyyq kypermno ROE_Q
    <int>    <chr> <dbl>
1    1980     1001    NA
2    1981     1001    NA
3    1982     1001    NA
4    1983     1001    NA
5    1984     1001    NA
6    1985     1001  0.56
7    1986     1001  0.43
8    1987     1001  0.78
9    1988     1001    NA
10   1989     1001  0.34
11   1990     1001  0.76
12   1991     1001    NA
13   1980     1002  0.12
14   1981     1002  0.67
15   1982     1002  0.12
16   1983     1002  0.56
17   1984     1002    NA
18   1985     1002  0.91
19   1986     1002  0.45
20   1987     1002  0.23
21   1988     1002  0.54
22   1989     1002  0.14
23   1990     1002  0.19
24   1991     1002  0.27

As you can see there are a lot more NAs now (since they are created going form long to wide) and NA omit isn't an option, because with that all NAs are omitted (not only the new created one).
So when I go back again from the wide format to the long format, I want to get the old (18 rows long) long format dataframe and not the one I got (with 24 rows and "new" NAs).
I hope my problem got comprehensible now.
PS: As you can see I didn't manage to get kypermno in the first column and fyyyyq in the second (after going back to long format), but I think it doesn't affect the issue above.

A: There is a fill= option that allows you to choose the value tobe used to "fill" the gaps. Sadly it replaces also the original NA so it is useless.
This is an inelegant solution using the original test data to eliminate the cases that were not originally present.
NB : I had to modify slightly your code to make it work.
test <- read.table(text =
'ID kypermno fyyyyq ROE_Q
1      1001   1985  0.56
2      1001   1986  0.43
3      1001   1987  0.78
4      1001   1988    NA
5      1001   1989  0.34
6      1001   1990  0.76
7      1002   1980  0.12
8      1002   1981  0.67
9      1002   1982  0.12
10     1002   1983  0.56
11     1002   1984    NA
12     1002   1985  0.91
13     1002   1986  0.45
14     1002   1987  0.23
15     1002   1988  0.54
16     1002   1989  0.14
17     1002   1990  0.19
18     1002   1991  0.27',
header = TRUE)
test <- test[,-1]

library(tidyr)
dat_wide <- spread(test, kypermno, ROE_Q)
dat_wide

dat_long <- gather(dat_wide, key = 'kypermno', value = ROE_Q, -fyyyyq)
dat_long

# Keep only the original data
dat_long[ paste(dat_long[,2], dat_long[,1]) %in% paste(test[,1], test[,2]),]

# Alternative (shorter and probably better)
merge(test[,1:2], dat_long, all.x=TRUE)

But maybe you should ask yourself whether it is really necessary to transform your data in wide format...


text:
Q: Sharepoint foundation 2010 search I was developing my project with SharePoint foundation 2010, so I getting an error when I wanner search data from SharePoint foundation search
Error is:

The start address
sts4://windows-qz9wkeb/contentdbid={71276566-c0ba-4918-b3c0-42ad57b33022}
cannot be crawled.
Context: Application 'Serve_search_queries_over_help_content', Catalog
'Search'
Details:  The SharePoint server was moved to a different location.
(0x8004fd12)

Please help me to solve this bug.
Edit
WHEn i access to search database and i select from table MsscrawlURL and get result on record error like image!
Please help me fix it!

A: There are couple of things, you have to check:

*

*did you change the address of the web application?

*is loopback check disabled on the server?, in many case disabling fix it.

*Sometime you need to stop and start sharepoint foundation search.

read this blog for more information: http://www.no-dumping.com/2011/09/20/sharepoint-configuring-foundation-search/
Check this post as well: https://social.technet.microsoft.com/Forums/en-US/ce47ce64-fb71-422d-89b4-0096ab06f9f4/sharepoint-foundation-event-id-14-start-address-cannot-be-crawled

A: I apologize for my slow response, I have followed the instructions but to the present my fault has not been resolved please, can help me a solution other than this problem
I have posted more attachments describing my error message in the project.
Currently all call to search server functions do not return results because search server can not scan data to create index!


text:
Q: Adxstudio installer keeps hanging I've imported adxstudio into my CRM online, when I try to run the installer hangs in the loading stage. What might be the problem?.
Thanks

A: I've had this two times, but underneath, the portal was still provisioned.
Two places to check
1. Is the adxstudio solution available in your crm?
2. Does your public site load?
If so, it's provisioned, despite the installer hanging.


text:
Q: Dart List doesnt get updated with forEach loop I am using this package to retrieve device's contacts. The lib retrieve 427 contacts and I want to loop the whole list so that I can create another list and send it to the back-end. The problem is looping does not work this the function return before looping is completed.
Here the function I use:
  Future<QueryResult> uploadContacts() async {
    final List<Contact> rawContacts =
        (await ContactsService.getContacts(withThumbnails: false)).toList();
    List<ContactInput> contactsListInput;

    print('contactsListInput length: ${rawContacts.length}');

    rawContacts.forEach((contact) {
      print('contact: $contact'); //PRINTED JUST ONCE

      //Contact can have more than 1 number. We need them all
      contact.phones.forEach((phone) {
        final contactInput =
            ContactInput(name: contact.displayName, phone: phone.value);

        contactsListInput.add(contactInput);
      });
    });

    print('contactsListInput length: ${contactsListInput.length}'); //NEVER PRINT ANYTHING

    final ContactsListInput input =
        ContactsListInput(contacts: contactsListInput);

    final MutationOptions _options = MutationOptions(
        document: SyncContactsMutation().document,
        variables: SyncContactsArguments(input: input).toJson());

    return client.mutate(_options);
  }

I have also tried using for loop and the same thing happened.
    for (int i = 0; i < rawContacts.length; i++) {
      final contact = rawContacts[i];

      final contactInput =
      ContactInput(name: contact.displayName, phone: contact.phones.first.value);

      contactsListInput.add(contactInput);
    }
    print('contactsListInput length: ${contactsListInput.length}'); //NEVER CALLED

And I also tried  Future.forEach
    await Future.forEach(rawContacts, (contact) async {
      print('contact: $contact');

      //Since contact can have more than one number we loop them too.
      await Future.forEach(contact.phones, (phone) async {
        final contactInput =
            ContactInput(name: contact.displayName, phone: phone.value);

        contactsListInput.add(contactInput);
      });
    });

How to fix this? Any help will be much appreciated.

A: I have fixed it as
  Future<QueryResult> uploadContacts() async {
    final Iterable<Contact> rawContacts =
        (await ContactsService.getContacts(withThumbnails: false));

    final Iterable<ContactInput> contacts = rawContacts.expand((contact) => contact.phones.map(
        (phone) =>
            ContactInput(name: contact.displayName, phone: phone.value)));

    final input = ContactsListInput(contacts: contacts);

    final MutationOptions _options = MutationOptions(
        document: SyncContactsMutation().document,
        variables: SyncContactsArguments(input: input).toJson());

    return client.mutate(_options);
  }

Credit goes to @pskink  and @loganrussell48

A: You should use it as a dynamic type object. Try something like this:
(event.snapshot.value as dynamic).forEach()

Try and see if it works.


text:
Q: Defining functions in a namespace declared in a seperate header file (C++) I have a problem that ive been looking at for a bit, and being new to C++ i don't even know if this is possible. I'm trying to replicate a body of code thats in a programming book but when i try to use it in Visual Studio i get an error that tells me that "the function cannot be defined in the current scope".
If i take it out of the "Records" namespace it works fine.
So, is this body of code legal or is there a quirk about this syntax i just don't know?
#include <iostream>
#include "Employee.h"
using namespace std;
namespace Records {
Employee::Employee()
: mFirstName("")
, mLastName("")
, mEmployeeNumber(-1)
, mSalary(kDefaultStartingSalary)
, mHired(false)

}

A: For one thing, you need a body on your constructor:
namespace Records {
Employee::Employee()
: mFirstName("")
, mLastName("")
, mEmployeeNumber(-1)
, mSalary(kDefaultStartingSalary)
, mHired(false)
{
}

}

And Employee must be declared in the Records namespace in Employee.h as well.