text:
Q: Query where sum of two fields is less than given value I am using Go language and MongoDB with mgo.v2 driver and I have struct like
type MarkModel struct {
    ID          bson.ObjectId                   `json: "_id,omitempty" bson: "_id,omitempty"`
    Name        string                          `json: "name" bson: "name"`
    Sum         int                             `json: "sum" bson: "sum"`
    Delta       int                             `json: "delta" bson: "delta"`
}

I need to find all where is Sum + Delta < 1000 for example. At the moment I load all and then in Go code I filter but I would like to filter on query level.
How to make that query ?
At the moment I return all with
marks := []MarkModel{}
c_marks := session.DB(database).C(marksCollection)
err := c_marks.Find(bson.M{}).All(&marks)
if err != nil {
    panic(err)
}

and here I filter in Go code in for loop but it is not optimal ( it is bad solution ).

A: To find all where is sum + delta < 1000,  you may use:
pipe := c.Pipe(
    []bson.M{
        bson.M{"$project": bson.M{"_id": 1, "name": 1, "sum": 1, "delta": 1,
            "total": bson.M{"$add": []string{"$sum", "$delta"}}}},
        bson.M{"$match": bson.M{"total": bson.M{"$lt": 1000}}},
    })

Here is the working code:
package main

import (
    "fmt"

    "gopkg.in/mgo.v2"
    "gopkg.in/mgo.v2/bson"
)

func main() {
    session, err := mgo.Dial("localhost")
    if err != nil {
        panic(err)
    }
    defer session.Close()
    session.SetMode(mgo.Monotonic, true) // Optional. Switch the session to a monotonic behavior.
    c := session.DB("test").C("MarkModel")
    c.DropCollection()
    err = c.Insert(&MarkModel{bson.NewObjectId(), "n1", 10, 1}, &MarkModel{bson.NewObjectId(), "n2", 20, 2},
        &MarkModel{bson.NewObjectId(), "n1", 100, 1}, &MarkModel{bson.NewObjectId(), "n2", 2000, 2})
    if err != nil {
        panic(err)
    }

    pipe := c.Pipe(
        []bson.M{
            bson.M{"$project": bson.M{"_id": 1, "name": 1, "sum": 1, "delta": 1,
                "total": bson.M{"$add": []string{"$sum", "$delta"}}}},
            bson.M{"$match": bson.M{"total": bson.M{"$lt": 1000}}},
        })
    r := []bson.M{}
    err = pipe.All(&r)
    if err != nil {
        panic(err)
    }
    for _, v := range r {
        fmt.Println(v["_id"], v["sum"], v["delta"], v["total"])
    }
    fmt.Println()

}

type MarkModel struct {
    ID    bson.ObjectId `json: "_id,omitempty" bson: "_id,omitempty"`
    Name  string        `json: "name" bson: "name"`
    Sum   int           `json: "sum" bson: "sum"`
    Delta int           `json: "delta" bson: "delta"`
}

output:
ObjectIdHex("57f62739c22b1060591c625f") 10 1 11
ObjectIdHex("57f62739c22b1060591c6260") 20 2 22
ObjectIdHex("57f62739c22b1060591c6261") 100 1 101

A: You should really use the Aggregation Framework for this. Then it's handled server side. do something like :
db.table.aggregate(
   [
     { $project: { ID: 1, name : 1, total: { $add: [ "$Sum", "$Delta" ] } } },
     { $match : { total  : { $gte: 1000 }}}
   ]
)


text:
Q: match index from pyspark dataframe in pandas I have following pyspark dataframe (testDF=ldamodel.describeTopics().select("termIndices").toPandas())
topic|    termIndices|         termWeights|
+-----+---------------+--------------------+
|    0|    [6, 118, 5]|[0.01205522104545...|
|    1|   [0, 55, 100]|[0.00125521761966...|

and i have following word list
['one',
 'peopl',
 'govern',
 'think',
 'econom',
 'rate',
 'tax',
 'polici',
 'year',
 'like',
........]

I am trying to match vocablist to termIndices to termWeights.
So far I have following:
for i in testDF.items():
    for j in i[1]:
        for m in j:
            t=vocablist[m],m
            print(t)

which results into:
('tax', 6)
('insur', 118)
('rate', 5)
('peopl', 1)
('health', 84)
('incom', 38)
('think', 3)
('one', 0)
('social', 162)
.......

But I wanted something like
('tax', 6, 0.012055221045453202)
('insur', 118, 0.001255217619666775)
('rate', 5, 0.0032220995010401187)

('peopl', 1,0.008342115226031033)
('health', 84,0.0008332053105123403)
('incom', 38, ......)

Any help will be appreciated.

A: I would recommend you spread those lists in the columns termIndices and termWeights downward. Once you've done that, then you can actually map indices to their term names while having the term weights aligned with each term index. The following is an illustration:
df = pd.DataFrame(data={'topic': [0, 1],
                        'termIndices': [[6, 118, 5],
                                        [0, 55, 100]],
                        'termWeights': [[0.012055221045453202, 0.012055221045453202, 0.012055221045453202],
                                        [0.00125521761966, 0.00125521761966, 0.00125521761966]]})

dff = df.apply(lambda s: s.apply(pd.Series).stack().reset_index(drop=True, level=1))

vocablist = ['one', 'peopl', 'govern', 'think', 'econom', 'rate', 'tax', 'polici', 'year', 'like'] * 50

dff['termNames'] = dff.termIndices.map(vocablist.__getitem__)

dff[['termNames', 'termIndices', 'termWeights']].values.tolist()

I hope this helps.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Standard Deviation: Can I remove some data? Suppose That I have measured property "X" in 16 points of a rigid body. This rigid body is consisted of two different materials. In one of them, property X is around 1, and in the other X is around 5. When I measured X, I found a transition zone of X between material 1 and 2. My matrix is something like this:
X=[1.1 1.08 1.05 0.98 1.02 1.29 1.78 2.34 3.78 4.21 4.78 4.98 5.02 5.09 5.1 5.06]
As you can see my findings are reasonable and I expect low value for standard deviation in materials 1 and 2.
Now, I want to calculate standard deviation of data in material 1 and standard deviation of data in material 2. What should I do with the data of transition region (I mean [1.29 1.78 2.34 3.78 4.21])? If I suppose they are for material 1, the standard deviation in material 1 goes very high; Similarly, if I attribute them to material 2, the standard deviation in material 2 increases. Is there any rule to just neglect the transition data? If yes, could you please provide a reference for that (like a book or article) so that I can include it in my report? Because I can not write down I just neglected them.
Thank you very much

A: You need to neglect them.  Standard deviation is a measure of the random variation of the dependant variable when you hold your independant variables constant.  In the mixture region (which I would assume to be the entire thing but this is your project and I don't know if the materials can diffuse), you are greatly varying the concentration independant variable.  Standard deviation, therefore, is not correct tool for that. What you can do, however, is do a fit against a theoretical model (which I don't have for you without knowing more) and measure the deviation from that model.  If I were to run an experiment with this type of thing I would have used separate control samples for either material treated simularly if possible.


text:
Q: two disjoint compact sets, holomorphic function there exists a decomposition $f=f_1+f_2$ Let $D_1$ and $D_2$ be two compact sets in $\Bbb C$, $D_1\cap D_2=\emptyset$, and $ f\colon \Bbb C\setminus(D_1\cup D_2)\to\Bbb C$ be a holomorphic function. Show that there exist two holomorphic functions  $ f_1\colon \Bbb C\setminus D_1\to\Bbb C$ and  $ f_2\colon \Bbb C\setminus D_2\to\Bbb C$ such that
$$f=f_1+f_2$$
for all $z\in  C\setminus(D_1\cup D_2)$.

I think about Cauchy integral formula. A similar question : Lemma 1 Math 246A, Notes 4: singularities of holomorphic functions

A: For $r$ small take some closed loop $C_r$ enclosing $D_1$ at a distance $< r$ and let
$$
g(z)=\frac1{2i\pi} \left[\;\,\int\limits_{|z|=1/r} \frac{f(s)}{s-z}ds -\int\limits_{C_r} \frac{f(s)}{s-z}ds\right]
$$
$g$ is analytic in the region between $C_r$ and $|z|=1/r$ and it doesn't depend on $r$, thus it is analytic on $\Bbb{C}-D_1$.
$$
f(z)=g(z)+(f(z)-g(z))
$$
Do you see why $f(z)-g(z)$ is analytic on $\Bbb{C}-D_2$ ?


text:
Q: How to set a maximum width of a layout/view in xamarin forms I have a signup page with a few labels and entries, it works fine in portrait, but when in landscape, especially in the UWP, the entries takes the width of the whole screen.
Is there a way to set the layout/view not to exceed a certain width?

A: You can use WidthRequest and HeightRequest or LayoutOptions(HorizontalOptions and VerticalOptions) for better positioning of views inside Layout

A: You can use the SizeChanged event of the Page to customize the layout when switching to/from portrait/landscape mode :
public partial class MyPage : ContentPage
{
    public MyPage()
    {
        InitializeComponent ();
        SizeChanged += OnSizeChanged;
    }

    void OnSizeChanged (object sender, EventArgs e)
    {
        // Customize your layout here (i.e. using HeightRequest/WidthRequest)...
    }
}

Hope it helps!

A: I figured it out, the `WidthRequest" will try to get the requested width, if not it will take the width available by the parent item. So basically, we do not need a maximum width property.

A: you do not need to set Maximum Width property. You would try something like that:
<Grid BackgroundColor="Black Padding="10,10,0,10" >
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
   <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
   </Grid.ColumnDefinitions>
   <Button Text="XXX"
            Command="{Binding SignUpCommand}"
            WidthRequest="100" HeightRequest="70"
            Grid.Row="0" Grid.Column="0"  Style="{StaticResource GrayButton} " / >

this would help to fit exactly your HeightRequest and WidthRequest.


text:
Q: CSS positioning images in the correct place I have the following HTML:

#cake1 {
  float: left;
}

#cake2 {
  width: 200px;
  height: 200px;
}

Cake

I am trying to get cake2 to appear under cake1 using CSS, instead of displaying on the right of the image.

A: I just removed float:left;

Cake

A: If you want to keep the word "Cake" to the right of the first image, and have the second image below them, try clearing the float on the first image and then also floating the second:

#cake1 {
  float: left;
}

#cake2 {
  width: 200px;
  height: 200px;
  clear:left;
  float:left;
}

Cake


text:
Q: Remove additional whitespace between row items with height (React JS/Material-UI) I am trying to create a dynamic grid system. I have an dictionary and when any of these values are set to true, the component renders:
const sideBarCategories = [
    { id: "Test", comp: Test, default: false },
    { id: "Y", comp: Y, default: true },
    { id: "X", comp: X, default: false},
    { id: "Z", comp: Z, default: false},
  ];

So in this case, only the Y widget will be rendered. The render function is wrapped in a grid with direction row as follows:
<Grid
          container
          direction="row"
          alignContent="center"
          alignItems="center"
          wrap="wrap"
          spacing={4}
        >
          {cardsInGrid.map((card) => {
            const Component = sideBarCategories.find(
              (cat) => cat.id === card.id
            ).comp;
            return <Component key={card.id} />;
          })}
        </Grid>

An example of the widget can be seen here:
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import Card from "@material-ui/core/Card";
import CardActions from "@material-ui/core/CardActions";
import CardContent from "@material-ui/core/CardContent";
import Button from "@material-ui/core/Button";
import Typography from "@material-ui/core/Typography";
import Grid from "@material-ui/core/Grid";

const useStyles = makeStyles({
  root: {
    minWidth: 275,
  },
  bullet: {
    display: "inline-block",
    margin: "0 2px",
    transform: "scale(0.8)",
  },
  title: {
    fontSize: 14,
  },
  pos: {
    marginBottom: 12,
  },
  cardDesign: {
    flexGrow: 1,
    marginRight: "20px",
    marginLeft: "20px",
    width: "100%",
  },
});

function Y() {
  const classes = useStyles();
  const bull = •;

  return (
    <Grid item xs={12} sm={12} md={6} lg={6} xl={6}>

        <Card className={classes.cardDesign}>
          <CardContent>
            <Typography
              className={classes.title}
              color="textSecondary"
              gutterBottom
            >
              Emoji Stats
            </Typography>
            <Typography variant="h5" component="h2">
              be{bull}nev{bull}o{bull}lent
            </Typography>
            <Typography className={classes.pos} color="textSecondary">
              adjective
            </Typography>
            <Typography variant="body2" component="p">
              well meaning and kindly.

              {'"a benevolent smile"'}
            </Typography>
          </CardContent>
          <CardActions>
            <Button size="small">Learn More</Button>
          </CardActions>
        </Card>

    </Grid>
  );
}

export default Y;

So in the row that I have, I make it so that there's a max of 2 items per row before it goes down and creates a new row (as seen by <Grid item xs={12} sm={12} md={6} lg={6} xl={6}> in the component file above.
The problem I am having is that if any of the components' height is larger than the other item in the same row, the website will account for that by having huge white spaces on either side of the smaller component. (See image below with orange representing whitespace)

I want it so that the components are directly below each other without that extra whitespace (see image below).

Sorry for the long post but any help with this matter would be appreciated.

A: I think the way you will have to do this is make two separate Grids with the cards mapped to even and odd indexes. Make sure the grids only allow 1 card per row.
<Grid
      container
      direction="row"
      alignContent="center"
      alignItems="center"
      wrap="wrap"
      spacing={4}
    >
      {cardsInGrid.filter((i, idx) => idx % 2).map((card) => {
        const Component = sideBarCategories.find(
          (cat) => cat.id === card.id
        ).comp;
        return <Component key={card.id} />;
      })}
    </Grid>

<Grid
      container
      direction="row"
      alignContent="center"
      alignItems="center"
      wrap="wrap"
      spacing={4}
    >
      {cardsInGrid.filter((i, idx) => !(idx % 2)).map((card) => {
        const Component = sideBarCategories.find(
          (cat) => cat.id === card.id
        ).comp;
        return <Component key={card.id} />;
      })}
    </Grid>

I would then wrap the entire thing in a flex container, with direction set to "row":
.dictionary-container {
   display: flex;
   flex-direction: row;
}

Hope this helps.


text:
Q: Case-sensitive GROUP BY in an Access query I am fairly new to Access but have been tasked at work with developing a query that pulls data from our existing work order tables via an ODBC connection. The problem I am having is that some shipments have multiple loads which need to be grouped based on their ID. The ID however is case-sensitive (ex. 00000A and 00000a are different). How would I go about grouping these entries with the IDs holding as case sensitive? I have tried using many SQL command found online however they always result in an error, is this because the database is not hosted on a server?
I have tried -
SELECT wofile.id collate SQL_Latin1_General_CP1_CS_AS, First(wofile.wo_number)
AS FirstOfwo_number, First(wofile.cust_name) AS FirstOfcust_name,
First(woload.ship_act_date) AS FirstOfship_act_date, Last(woload.cons_act_date)
AS LastOfcons_act_date FROM wofile INNER JOIN woload ON wofile.id = woload.wo_id
WHERE (((StrComp([wofile].[id],[woload].[wo_id],0))=0))
GROUP BY wofile.id collate SQL_Latin1_General_CP1_CS_AS

and
SELECT wofile.id, First(wofile.wo_number)
AS FirstOfwo_number, First(wofile.cust_name) AS FirstOfcust_name,
First(woload.ship_act_date) AS FirstOfship_act_date, Last(woload.cons_act_date)
AS LastOfcons_act_date FROM wofile INNER JOIN woload ON wofile.id = woload.wo_id
WHERE (((StrComp([wofile].[id],[woload].[wo_id],0))=0))
GROUP BY wofile.id Cast(wofile.id As varbinary(100))

and
SELECT wofile.id, First(wofile.wo_number)
AS FirstOfwo_number, First(wofile.cust_name) AS FirstOfcust_name,
First(woload.ship_act_date) AS FirstOfship_act_date, Last(woload.cons_act_date)
AS LastOfcons_act_date FROM wofile INNER JOIN woload ON wofile.id = woload.wo_id
WHERE (((StrComp([wofile].[id],[woload].[wo_id],0))=0))
GROUP BY BINARY wofile.id

A: As explained in the Microsoft support article here:

The Microsoft Jet database engine is inherently case-insensitive. When joining tables, it matches lowercase "abc" to uppercase "ABC," which in most cases is desirable.

(The same is true for the newer "Access Database Engine", a.k.a. "ACE", which is used by Access 2010.)
The article goes on to describe several strategies for performing case-sensitive JOINs. Of those, the one that is most likely to work for you (where you need both your JOINs and your GROUP BY clauses to be case-sensitive) is the one they call "Hexadecimal Expansion" where you create another column in each table that will store a hexadecimal representation of the ID value. The function they suggest is...
Public Function StrToHex(X As Variant) As Variant
Dim I As Long, Temp As String
    If IsNull(X) Then Exit Function
    Temp = Space$(Len(X) * 2)
    For I = 1 To Len(X)
        Mid$(Temp, I * 2 - 1, 2) = Right$("0" & Hex$(Asc(Mid$(X, I, 1))), 2)
    Next I
    StrToHex = Temp
End Function

...which will work provided that your ID strings do not contain Unicode characters. That function will convert a string into the hex representation of each character, e.g.,
StrToHex("GORD") --> "474F5244"
StrToHex("gord") --> "676F7264"

Once you've populated your new "surrogate ID" fields with the corresponding hex values you can use those fields in your JOINs and GROUP BY clauses.
For more information see the above-mentioned support article:
How To Perform a Case-Sensitive JOIN Through Microsoft Jet


text:
Q: Is there notation to express multiplying a set by a matrix? I have a set of vectors $\{a_1, a_2, \cdots, a_N\}$ where I multiply each vector with the same matrix $M$, resulting in a new set with the computed $N$ vectors, e.g., $\{a_1, a_2, \cdots, a_N\}$ "some operator" $M = \{b_1, b_2, \cdots, b_N\}$. Is there a symbol or other notation to denote this (in place of "some operator")? Or would I have to use pseudocode, e.g., "For each," to describe this calculation?

A: One option is to form a matrix $A=[a_1 ~a_2~ \dots~ a_n]$ from your set of vectors. Then the columns of the matrix product $MA = [Ma_1 ~ Ma_2 ~\dots~M a_n]$ will precisely recover the matrix $M$ times each vector individually.

A: I am not aware of anything like what you ask for, the closest I can think of would be one of: (using $M$ to denote the matrix)

*

*$\{Ma_1, Ma_2, \cdots, Ma_N\}$

*$\{b_i\}_{i=1}^N,\ \ b_i = Ma_i$

*If you take $A$, a matrix whose $i$th column is $a_i$, you can also think of the columns of $MA$ to be the $b_i$.


text:
Q: I can't stand much more of this Can we use 'adverb' before pronoun?
As we know adverbs are normally used to modify 'other adverbs' , 'verbs', and 'adjectives'. e.g (I'm feeling a lot better today.)
I consider 'a lot and 'much' as adverbs and 'more' as pronoun in the following. Is my analysis OK?
I earn a lot more than my sister does.
I have a lot more in common with my friends than my family.
I can't stand much more of this.

A: More is a indefinite pronoun in one of your examples, but much and a lot are not adverbs here.
In:

I can't stand much more of this.

..."Much" is not an adverb. It is a determinative, and it in turn modifies the determinative more. This means that much more is a noun phrase and it quantifies the pronoun this which is the object of the preposition in the comparative phrase more of.
In this sentence, more is an indefinite pronoun serving as the object of the verb earn:

I earn a lot more than my sister does.

Here, "a lot" is also not an adverb but a determinative phrase (DP) that modifies the indefinite pronoun more in the comparative phrase more than.


text:
Q: Pytest failed when testing API with correct URL and data When I am creating a Clinic via Swagger or Postman it works fine and field with the same data when test it !
model
class Clinic(models.Model):
   name = models.CharField(max_length=50)
   price = models.FloatField()
   doctor = models.ForeignKey(User, on_delete=models.CASCADE, related_name='doctor_clinic')
   date = models.ManyToManyField(ClinicDate, related_name='clinic_date')

serializer
class ClinicDateSerializers(serializers.ModelSerializer):
   class Meta:
          model = ClinicDate
          fields = ['day','start_time', 'end_time']

class ClinicSerializers(serializers.ModelSerializer):
   doctor = serializers.StringRelatedField(required=False)
   date = ClinicDateSerializers(many=True, required=True)
   class Meta:
          model = Clinic
          fields = ['name', 'price', 'doctor', 'date']

   def create(self, validated_data):
          dates_data = None
          if 'date' in validated_data:
              dates_data = validated_data.pop('date')
          user =  self.context['request'].user
          clinic = Clinic.objects.create(doctor=user, **validated_data)
          if dates_data != None:
             for date_data in dates_data:
                 dt = ClinicDate.objects.create(**date_data)
                 clinic.date.add(dt)
                 clinic.save()
          return clinic

URL
path('add/', views.ClinicCreateView.as_view(), name='clinic-create'),

pytest
@pytest.mark.django_db
class TestClinic:

   @pytest.fixture
   def setup(self):
          User.objects.create_doctor(email="doctor1@doctoronline.com", password="12345")
          data = {
                 'email':'doctor1@doctoronline.com',
                 'password':'12345',
          }
          response = client.post(reverse('token_obtain_pair_doctor'), data=data)
          self.access_token = response.json()['access']
          client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.access_token)

   def test_valid_create_clinic(self, setup):
          data = {
                 "name": "Clinic 1",
                 "price": 1000,
                 "date": [
                        {
                        "day": "SATURDAY",
                        "start_time": "2021-08-24T21:21:17.960Z",
                        "end_time": "2021-08-24T21:21:17.960Z"
                        }
                    ]
                 }
          response = client.post(reverse('clinic-create'), data=data)
          assert response.status_code == status.HTTP_201_CREATED

Swagger Snapshot

Hint there is no problem with setup or data

A: Just for the record: The problem was that I'm dealing with nested serializer and by default multipart format does not support nested data so, I just want to set `formate = 'json'
response = client.post(reverse('clinic-create'), data=data, format='json')


text:
Q: Holomorphic function on bounded domain. Let $\Omega$ be a bounded domain of $\mathbb{C}^n$ and $f$ be a holomorphic function defined on $\Omega$.
Is it possible that $L^2$-norm of $f$ is bounded but $f$ itself is unbounded?

A: Yes there it is often the case. The space you look at is called the Bergman space often denoted by $A^2(\Omega)$ or $L^2_a(\Omega)$.
To give a counter-example let us consider a simple case say $\Omega=\mathbb{D}=\{z\in\mathbb{C}: \,|z|<1\}$ - the unit disc.

*

*Note that the Hardy space $H^2=\{f\in L^2(\mathbb{T}):\, f$ is analytic in $\mathbb{D}\}$ (here $\mathbb{T}=\partial\mathbb{D}$ is the unit circle), normed by the $L^2$-norm (see remark below) is included in the Bergman space because
$$\|f\|_{H^2}^2=\sup_{0 \lt r \lt 1}\int_0^{2\pi}|f(re^{it})|^2\frac{dt}{2\pi}\geq \int_0^1\int_0^{2\pi}|f(re^{it})|^2\frac{dt}{2\pi} dr \qquad\qquad\qquad\qquad\qquad$$
$$\qquad\qquad\qquad\geq \int_0^1\int_0^{2\pi}|f(re^{it})|^2\frac{dt}{2\pi} rdr =\|f\|_{A^2}^2$$

*By Parseval's formula an analytic function $f(z)=\sum a_nz^n$ is in $H^2$ precisely when the sequence $(a_n)$ is in $\ell^2$ and then
$$\|f\|_{H^2}^2=\sum |a_n|^2$$

*Combining 1. and 2. shows that $z\mapsto\log(1-z)=\sum_{n\geq1} \frac{z^n}{n}$ belongs to $A^2$, but is unbounded at $z=1$.
Remark: For each $f \in H^2$ there is a boundary function $\tilde{f}\in L^2(\mathbb{T})$ such that $\lim_{r\to1}f(re^{it})=\tilde{f}(e^{it})$, and the $H^2$-norm of $f$ coinside with the $L^2$-norm of $\tilde{f}$.
Remark 2: The observation 1. above can be improved to show $H^p\subset A^{2p}$, which is one of the few Hardy-Littlewood theorems (see 5.11 in P. Duren: Theory of $H^p$-spaces, 2nd ed 2000).

A: I believe the answer to this is no. Let $p\in \Omega$ and let $D(p,b)$ be a disk contained in $\Omega$ centered at $p$. Switching to polar coordinates, we have
$\|f\|_2 ^2 \geq \int_{D(p,b)} |f(x+iy)|^2 dxdy = \int_0 ^b \int_0 ^{2\pi} |f(re^{i\theta}+p)|^2 r d\theta dr $
$.\geq \int_0 ^b |\int_0 ^{2\pi} f(re^{i\theta}+p)^2 d\theta|r  dr$
Notice that
$\int_0 ^{2\pi} f(re^{i\theta}+p)^2 d\theta = \frac{1}{i}\int_0 ^{2\pi} \frac{f(re^{i\theta}+p)^2}{re^{i\theta} + p - p} ire^{i\theta} d\theta = \frac{1}{i} \int_{D(p,r)} \frac{f(z)^2}{z-p} dz = 2\pi f(p)^2$
by the Cauchy integral theorem. Therefore
$\int_{D(p,b)} |f(x+iy)|^2 dxdy \geq \pi b^2 |f(p)^2|.$
So, $|f(p)|$ is bounded by $\frac{1}{\sqrt\pi b}\|f\|_2$.

A: A simple example would be the following: Let $\Omega$ be the right half of the unit disk and consider the function
$$f(z):={\rm Log}(z) =\log r + i\phi\ ,\qquad z=r e^{i\phi}, \ 0<r<1, \ |\phi|<{\pi\over2}\ .$$

A: Yes, there are such functions (even if $n = 1$).
The space of square integrable holomorphic functions is usually called the Bergman space, often denoted $A^2$. For a concrete example of an unbounded function in $A^2$, let $\mathbb{D}$ be the unit disc, and choose
$$ f(z) = \log(1-z) $$
(where $\log$ denotes the principal branch of the complex logarithm). Then, clearly $f$ is unbounded near $z = 1$, and holomorphic on $\mathbb{D}$. It is not too hard to show that $f \in A^2$. (The only problem is close to $z = 1$, and there $|f| \approx \ln|1-z|$. I'll leave the details as an exercise.)
In the argument given by user15464 (local $L^2$ estimates), the bound on $|f(z)|$ depends on $b$ -- which is the distance from $z$ to $\partial\Omega$. This estimate blows up as $z \to \partial\Omega$. However, these estimates show that point evaluations, i.e. the functionals
$$f \mapsto f(z) $$
are continuous for each $z \in \Omega$. This observation is usually the starting point in the study of Bergman spaces. For example, the Bergman space is a Hilbert space (under the natural inner product), and by Riesz' representation formula, for each $z \in \Omega$, there is a $B_z \in A^2$ such that
$$f(z) = \int_\Omega f(w)\overline{B_z(w)}\,dw$$
The function
$$B(z,w) = \overline{B_z(w)}$$
is called the Bergman kernel of $\Omega$. It is a nice exercise to compute this for the unit disc. The result turns out to be
$$B(z,w) = \frac{1}{(1-z\bar w)^2}$$


text:
Q: Folland ordinals exercise Consider following exercise from Folland's book:
I succesfully proved (a),(b),(c) and now I want to prove (d).

Attempt (outline):
Put $E:= \bigcap_1^\infty E_n$. We may assume $E \subseteq \Omega$ by removing the element $\omega_1$ (this modified is uncountable iff the original set is uncountable). We use (c) to prove that $E$ is uncountable.
So, let $x \in \Omega$. Define a sequence $(x_n)_n$ by a diagonal argument:
Define $x_0:= x+1$
$x_1 \in E_1, x_2 \in E_2, x_3 \in E_1, x_4 \in E_2, x_5 \in E_3, x_6 \in E_1, x_7 \in E_2, x_8 \in E_3, x_9 \in E_4, x_{10}\in E_1$ and continue. We can also arrange that $x_1 < x_2 < x_3 <\dots$, again using (c).
Following the hint, $(x_n)_n$ converges. I proved that $\lim_n x_n = \sup_n x_n = \bigcup_n x_n$. By construction thus $y:=\lim_n x_n \geq x_0 =x+1> x $. Also, all subsequences of $(x_n)$ converge to $x$ so  since $(x_n)_n$ contains subsequences consisting entirely from terms of each $E_n$, we see that $y=\lim_n x_n \in \overline{E_n} = E_n$ for all $n$ and hence $y \in E$, as desired.
Does the above proof outline look correct?

A: Yes, it's correct. Another way is to show that the intersection of two uncountable closed sets is uncountable by using the same basic argument but simply alternating between the two sets. It immediately follows that the intersection of finitely many uncountable closed sets is uncountable, so you can let $F_n=\bigcap_{k=1}^nE_n$, choose $x_1>x$ in $F_1$, and for $n>1$ choose $x_n>x_{n-1}$ in $F_n$. This way you automatically get a sequence with subsequences — tails, in fact — in each $E_n$.

A: Yes, your proof is fine. Perhaps a neater way of defining the sequence is by requiring that:

*

*$(x_n)$ is increasing, and

*if $k$ is the largest such that $2^k\mid n$, then $x_n\in E_{k+1}$.

This way it is slightly clearer than "and continue", and more formal as to how to continue. Then it's also very easy to point at a subsequence in $E_{k+1}$ by simply taking $x_{2^k(2m+1)}$ for $m\in\Bbb N$.


text:
Q: Find all functions with given property Find all functions $f$ that are holomorphic on $B = \{z: -\pi/2 < \operatorname{Im}(z) < \pi/2 \}$ with $f(B) \subset B$ and such that $f(0) = 0$ and $f'(0) = i$.
Thoughts so far: My first thought was to try to apply the Schwarz Lemma somehow. So I found a sequence of conformal maps from the given region to the open unit disk, and indeed $0$ gets sent to $0$. But even if I find that the composition of maps is just a rotation, how do I figure out what this implies about $f$? Any hint would be much appreciated!

A: If $\phi: B \to \Bbb D$ is a biholomorphic map from $B$ to the unit disk, then $$g := \phi \circ f \circ \phi^{-1}$$ is a biholomorphic map from the unit disk to itself. But we know (via the Schwarz Lemma) how to parameterize all such maps, and given any such map $g$, we can recover the corresponding map $f$ by conjugating $g$ with $\phi^{-1}$.


text:
Q: Alternative to glMultiDrawArrays when using uniform stride? Background: I am developing an application that essentially draws a huge 3D graph of nodes and edges. The nodes are drawn as instanced cubes while the edges are drawn with GL_LINE and expanded with a geometry shader into 3D volumetric "lines" made of triangle strips. Currently, I am performing this expansion every time I redraw the edges. However, as my graph is entirely static (nodes can not move and thus neither can the edges), I figure that I only need to expand the GL_LINE definitions into triangle strips once, capture the expanded vertices into a buffer (using Tranform Feedback), and then from that point on draw the edges using those captured vertices with glMutliDrawArrays using a primitive type of GL_TRIANGLE_STRIP.
Question: All of these volumetric lines I am drawing contain 10 vertices. However, glMultiDrawArrays requires an array of starting indices and count sizes that essentially describe the start point and count (in elements) of each primitive. As none of my primitives vary in size, I would be making an seemingly unnecessary list of starting indices & counts. Is there any functionality OpenGL provides that would allow me to simply specify a stride (in elements) at which primitive restart would occur?

A: There is no such function, but for your needs, you don't need one. Transform feedback cannot output triangle strips. It outputs only basic primitives: individual points, lines, or triangles. That's why glBeginTransformFeedback only takes GL_POINTS, GL_LINES, or GL_TRIANGLES.
All you have to do is render all of your edges at once, collect the results into a single buffer via feedback, and later render the entire thing with a single call to glDrawArrays.


text:
Q: Using OpenLayers and JSTS to create buffer geometry So far I have found similar questions like this one but none have quite expressed or fixed my exact issue.
I'm using Openlayers v4.6.5 and JSTS 1.4.0
The problem I'm having is with the buffer() method of the JSTS library. My conde snippets are as follows:
var feats = vectorSource.getFeatures();

// Takes in multiple features and combines them into one
var geom = joinGeoms(feats);

var parser = new jsts.io.OL3Parser();

var jstsGeom = parser.read(geom);
var meters = toMeters(500, 'ft'); // Result is 152.4 meters
var buffered = jstsGeom.buffer(meters);

// This is where the issue happens
var finalGeom = parser.write(buffered); <---

The geometry that is generated from the buffer() method and assigned to finalGeom is then used to select other features that intersect. I have captured this geometry and have shown it below along with measurements done with the my measure tool (which I have tested separately and know is accurate).

The buffer distance should be 500 feet or 152.4 meters but comes back as a different distance. I have to tried seeing if this is from a different projection or unit conversion but I cant find anything that would take my inputs and result in the numbers I am getting.
My projection is EPSG:3857, which I know isn't the best for these kinds of measurements but I have been unable to successfully convert where its accurate.
Any thoughts?

A: The solution to my problem ended up being fairly simple, but took long enough to solve that I feel it's worth answering.
Below is the amended, working code:
var feats = vectorSource.getFeatures();

// Takes in multiple features and combines them into one
var geom = joinGeoms(feats);
geom.transform('EPSG:3857', 'EPSG:2883'); // Transform into CRS specific to my area

var parser = new jsts.io.OL3Parser();

var jstsGeom = parser.read(geom);
var feet = toFeet(152.4, 'm'); // Result is 500 feet (EPSG:2883 uses feet)
var buffered = jstsGeom.buffer(feet);

// This is where the issue happens
var finalGeom = parser.write(buffered);
finalGeom.transform('EPSG:2883', 'EPSG:3857'); // Transform back to 3857

The part worth noting is that OpenLayers only supports EPSG:3587 and EPSG:4326 out of the box and needs assistance with other projections. The above code needed the following javascript libraries added in order to work:
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js"></script>
<script src="https://epsg.io/2883.js"></script>

Once all of those changes were made, the distances for the buffer were fully accurate.


text:
Q: Regex expression: can't set the length for firstname pattern eg. Mark-jacob john I wrote a regex for matching the following pattern
Sample strings
mark-jacob-john
mark jacob john
mark-jacob john
mark jakob john jen
mark jakob-john-jen

Regex
^[a-z]+((?:(\-|\s+)[a-z]+){0,})?$.

I want to set the length of the entire string to be between {7, 100}including the spaces and the hyphens. It doesn't matter how many first names I entered as long as the length is not less than 7and greater than 100.
How could I set the length and have the same pattern?

A: Use a lookahead at the start to check for the character length.
^(?=.{7,100}$)[a-zA-Z]+(?:[\s-][a-zA-Z]+)*$

DEMO


text:
Q: Django Generic Views and Customizability Referring to CreateView, UpdateView, & DeleteView, as I get further in to my testing, I am finding these - however convienient - to be to restrictive to customization.  I did a quick workthrough of using ModelForm last night (off of the Django docs), but wasn't successful.
Does anyone know of a good detailed guide for using ModelForm views and customizing forms with Django?
To elaborate why I am asking this, the many of guides I've found might refer to ModelView but are in fact using the aforementioned.  Also, because the many of guides I've found seem to be for much older versions of Django.


text:
Q: Countable additivity condition Let $\nu_n, n\ge1$ be a sequence of measure on a measurable space $(X,M)$. Suppose there exists a number $c>0$ such that $\nu_n \le c$ for all $n\ge 1$. Define a set function $\nu$ by
$$\nu(E)=\sum_{1}^{\infty} \frac{\nu_n(E)}{2^n}$$ for all $E\in M$.
My question:- I want to know if $\nu$ satisfy the countable additivity condition.

A: For any non-negative sequence $(a_n)_{n\geq 1}$ with $\sum\limits_{n=1}^\infty a_n<\infty$ we have that
$$
\nu(E):=\sum_{n=1}^\infty a_n \nu_n(E),\quad E\in M,
$$
defines a finite measure on $(X,M)$. In particular, $\nu$ satisfies the countable additivity condition.
Proof: Clearly $\nu(E)\geq 0$ for all $E\in M$ and $\nu(\varnothing)=0$. Moreover,
$$
\nu(E)\leq \nu(X)\leq c\sum_{n=1}^\infty a_n<\infty
$$
showing that $\nu$ is finite. Now, let $(E_k)_{k\geq 1}$ be a countable collection of disjoint sets from $M$. Then
$$
\nu\Big(\bigcup_{k=1}^\infty E_k\Big)=\sum_{n=1}^\infty a_n\nu_n\Big(\bigcup_{k=1}^\infty E_k\Big)=\sum_{n=1}^\infty a_n\Big(\sum_{k=1}^\infty \nu_n(E_k)\Big).
$$
Since this is a double sum of non-negative terms we may interchange the two sums
$$
\nu\Big(\bigcup_{k=1}^\infty E_k\Big)=\sum_{k=1}^\infty \sum_{n=1}^\infty a_n \nu_n(E_k)=\sum_{k=1}^\infty\nu(E_k)
$$
which shows that $\nu$ satisfies the countable additivity condition.


text:
Q: Permission problem with SFTP in FileZilla Recently, we installed Ubuntu Server on our servers this is very new for us. However, we tried to setup a apache2 server which did work. But the problem is that we can't configure apache and other configure files due the lack of permissions. I found a command for some days ago and gave myself access to "/var/www". But that's the only folder I got permissions to. I forgot what the command was and I can't use root because I don't know the password. I can't remember if I tried to setup any. I am the only user on the machine so I got admin permissions but need root. So what I need help with is to give myself access to the whole server. Mostly "/etc/apache2" but the whole server would be better. Anyways, how do I give myself permissions for this and how do I enable root? All sudo commands tells me this "
sudo: must be setuid root".

A: isn't sudo what you're looking for? In Ubuntu, when you want to get root privileges, you must run "sudo command"... or "sudo su" (there is also "sudo -s", and I think the difference is with environment variables, but I don't remember now) if you really want a root session. The password is your user password.
Try to check the owner of the directories... If I remember correctly, in ubuntu, apache creates a user and group of his own, and that only has access to it's own directories.
EDIT: I believe your only way to fix this is to boot with a Linux live disc and mount your Ubuntu file system there to fix the permissions and owner of the sudo binary (and maybe sudoers file). These commands should do it:
sudo chown root:root /mnt/yourfs/usr/bin/sudo
sudo chmod 4755 /mnt/yourfs/usr/bin/sudo
sudo chown root:root /mnt/yourfs/etc/sudoers
sudo chmod 440 /mnt/yourfs/etc/sudoers

The leading 4 in first chmod is to set the setuid special permission: http://docs.oracle.com/cd/E19683-01/816-4883/secfile-69/index.html


text:
Q: Writing optional data to Firebase With Firebase Swift 2 version, I was able to do:
something = ["someOptionalData": optionalData]
ref.updateChildValues(something,......})

After converting to Swift 3 & latest Firebase, I've got this error:
Cannot store object of type _SwiftValue at optionalData. Can only store objects of type NSNumber, NSString, NSDictionary, and NSArray.

After some googling, people are saying that firebase doesn't accept optional type.
So may I know what is the better way of handling it other than this:
if let unwrappedOptionalData = optionalData {
        something = [
            "someOptionalData": unwrappedOptionalData
        ]
} else {
        something = [
            "someOptionalData": true
        ]
}
ref.updateChildValues(something,......)

A: Try:-
something = ["someOptionalData": optionalData!]
ref.updateChildValues(something,......)

Given that your optionalData is of type:- NSNumber, NSString, NSDictionary or NSArray.


text:
Q: Simple framework MVC: how to associate the controller actions to urls? I have followed this nice video tutorial to create a mini MVC PHP framework.
As you can see, the guy creates an action called home() inside the Controller class to show the main page.
Now, I need to create another action called foobar() that shows another page, but how can i associated it to an url in a simple way?

A: This is usually done by routing. If the first part of the URL identifies the controller and the second the action, you extract those variables and route accordingly.
A very basic example:
$action = 'foobar';
$controllerName = 'whatever';

if(class_exists($controllerName)){

    $controller = new $controllerName;

    if(method_exists($controller, $action)){

        $controller->$action();

    }
}

Obviously, $action and $controllerName are obtained from the URL.
This code snippet tries to call the method 'foobar' inside a class named 'whatever'.


text:
Q: Adding PHP to a Page in WordPress 4.1.1 I have WordPress 4.1.1 installed. I want to be able to write PHP code for specific pages. I found an answer on here which seemed like the best option I have come across so far, this answer can be found here:
How to add a PHP page to WordPress?
But - this does not seem to work and I cannot figure out why.
I followed the steps accordingly and I was able to complete all steps with no problem but when I preview the page its blank.
My only guess is that this might have something to do with version 4.1.1 - is there any reason this method would not work with version 4.1.1?
Your help is greatly appreciated.

A: If you need to add PHP to a page you need to open your themes template files in a text editor of your choice.
If enabled, access the Theme Editor from the Administration > Appearance > Editor menu.
http://codex.wordpress.org/Appearance_Editor_SubPanel
If your pages are blank you might have an error with your PHP code.

A: Personally I use this plugin:
https://wordpress.org/plugins/php-code-for-posts/
However you can also use custom page templates: http://codex.wordpress.org/Page_Templates#Creating_a_Page_Template
It depends what your personal code needs are.


text:
Q: AWS hosted (s3, cloudfront) static react website does not route to sub page when the url entered from browser I have hosted a static react website on aws and use s3, cloudfront. It has several subpages.
<Link to='/about'>about us</Link>
<Link to='/projects'>projects</Link>
<Link to='/stats'>statistics</Link>
<Link to='/contact'>contact</Link>

When you entered to home page from browser and select one of these subpage's button it will successfully redirect to sub page.
but when you entered the url directly (www.example.com/about) in browser it wont redirect to the subpage and gives this error i.e. "This XML file does not appear to have any style information associated with it. The document tree is shown below."
I did check on developer tools and saw that when you click on the "about" button request header is like this
:path: /static/js/6.gc48fd92.chunk.js
referer: https://www.example.com/about

but when you entered the url in browser directly i.e. (www.example.com/about) , the request header is like this
:path: /about

and "referer" is not there.
Am i missing something here ? Is there a way to redirect to static js page when you entered the subpage's url in browser ?
Thanks in advance.

A: You need to set up Cloudfront so that when the user directly navigates to the page, CloudFront doesn't send back an error because it can't find a file for that page (this is the XML error you get), but instead passes that request onto / so React can take over.
https://gist.github.com/bradwestfall/b5b0e450015dbc9b4e56e5f398df48ff#spa
The gist of this is you tell CloudFront that on any 404 error, redirect to the root page and return a 200 to the user.

A: I have fixed it by doing this.
react router doesn't work in aws s3 bucket
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-tutorial.html
Hope this helps


text:
Q: Is there an android tag/attribute reference? I've had some experience with web development, and I found the W3C pages on different tags and attributes to be very useful.
Is there an equivalent online reference for Android tags and attributes? By Android tags I mean stuff like <EditText>, and by android attributes I mean stuff like android:id.


text:
Q: FluentMigration Backup Table I have a Table which needs removal of a few columns.
TableA
{
  ID int,
  Name NVarChar(MAX) NOT NULL,
  ToDelete1 int NOT NULL,
  ToDelete2 int NOT NULL,
}

I'm using FluentMigrator .NET (ActiveRecord Ruby On Rails like Migration). For the UP() migration it's a simple case of dropping the columns.
How do I create the down part of the migration?
My idea is to create a clone of the table during the UP() process and then copy the schema and data back to the Original during the Down() process.
What is the easiest way to achieve this?
EDIT: TableA.ID is referenced by other tables. So if we are deleting all rows from TableA and reinserting from TableA_Backup it has to be done while all foreign key constraints are turned off and with identity_insert turned on as far as I understand.
A code example would be great.

A: For anyone who is interested here is how I managed to get it to work.

*

*Renamed the Original table with a _Backup prefix.

*Copied items from that table to a new table schema with the Original name. With Identity Insert.

*Removed foreign keys referring to old table.

*Added foreign keys back to refer to new table.

Each of these steps are reversible and you can create the down migration.


text:
Q: lottery to pick a group while respecting pairs I am running an event that will be oversubscribed, so I'd like to use a lottery to randomly pick the participants that will be accepted.  (For example, 29 people want to attend, but I can accommodate only 17.)
The twist is that there are some couples among the people who want to attend, so I must either accept both of them or neither of them.
I would like to run this lottery so that any single person has an equally likely chance of being selected, regardless of whether that person is part of a couple or not.
Is it even possible to make the lottery fair in this manner?  If so, how should I run the lottery?  If not, what would be the fairest way to run the lottery?
I have thought of a few things that don't work.
Suppose you take all the combinations (choose 17 from 29 in my example), throw out the ones that do not violate any of the couples constraints, and pick one of the remaining combinations at random with uniform probability.  In general, the number of combinations with a member of a couple is not the same as the number of combinations with an individual.
Another simple scheme would be to write each individual's name on a slip of paper, write both names of each couple on a single slip of paper, throw all the pieces of paper in an urn, and draw slips of paper until the total number of names reaches the capacity of the event.  Let's say that if the slip you draw for the last spot has two names of a couple, you throw it out.  This also does not provide the same odds of an individual and one member of a couple being selected.
Perhaps there is a way of weighting the combinations in such a way to provide fair odds to an individual?  (Though when there are several couples this could get complicated...)

A: You can start by choosing the number of couples to invite.  Say you have five couples and nineteen singles.  Each person should have a chance $\frac {17}{29}\approx 0.5862$ of attending, which is between $\frac 25$ and $\frac 35$.  If you invite two couples with probability $x$ and three couples with probability $1-x$, the chance of each couple attending is $0.4x+0.6(1-x)$.  Equating that to $\frac {17}{29}$ gives $x=\frac 2{29}$.  Choose two couples randomly from the five with probability $\frac 2{29}$ and three randomly from the five with probability $\frac {27}{29}$.  Then choose the requisite number of singles from that pool.

A: Let individuals in couples be given tickets with probability $\beta$ of being selected, and let individuals not in couples be given tickets with probability $\alpha$ of being selected. An individual in a couple is selected if his or his partner's or both of their tickets are selected, so with probability $2\beta-\beta^2$. For the fairness requirement we set this equal to $\alpha$. Since the the couples' ticket probabilities and individuals' ticket probabilities must sum to 1, $\alpha$ and $\beta$ are determined in terms of the number of couples and individuals.


text:
Q: Why can't I create a pointer to a TTreeNode in a TTreeView Using C++ Builder in Rad Studio 10.4
Why can't I create a pointer to a TTreeNode?
I have a TTreeView called BookmarksTree, and I want to loop through all of its nodes. When I try and compile this:
TTreeNode *Node;
Node = BookmarksTree->Items[1];

I get a compiler error:

assigning to 'Vcl::Comctrls::TTreeNode *' from incompatible type 'Vcl::Comctrls::TTreeNodes'

According to Vcl.ComCtrls.TCustomTreeView.Items, I should be able to use
MyTreeNode = TreeView1->Items[[1]];
Has anyone any idea what's wrong here?

A: BookmarksTree->Items is a pointer to a single TTreeNodes object.  You are trying to perform pointer arithmetic to access a node as if the Items were an array of TTreeNode* pointers, which is simply not the case.
You need to use the TTreeNodes::Item[] sub-property instead, eg:
int count = BookmarksTree->Items->Count;
for(int i = 0; i < count; ++i)
{
    TTreeNode *Node = BookmarksTree->Items->Item[i];
    ...
}

Alternatively, you can use the TTreeNodes::operator[], but that requires you to dereference the TTreeNodes* pointer first, eg:
int count = BookmarksTree->Items->Count;
for(int i = 0; i < count; ++i)
{
    TTreeNode *Node = (*(BookmarksTree->Items))[i];
    ...
}

Alternatively, in the Clang-based compilers only, you can use C++ iterators, per C++ Iterator Support for Delphi Enumerable Types and Containers, eg:
auto iter = std::begin(BookmarksTree->Items);
auto end = std::end(BookmarksTree->Items);

while (iter != end)
{
    TTreeNode *Node = *iter++;
    ...
}

Or a range-for loop (which uses iterators internally):
for(TTreeNode *Node : BookmarksTree->Items)
{
    ...
}


text:
Q: Regular expression to find word with in word in php The below PHP regular expression will match the string which contain GB:2 and the word Samsung also there with in three word.
But my data sometimes contain GB-2 or GB,3 etc. So I want to change my regular expression as GB* so that it will take any character and alphabet after GB.
How I can put this GB* in my regular expression?
$regex = "~(?i)\bGB:2 (?:\w+\s+){1,3}Samsung\b~";

A: I think that this is what you're looking for - http://regex101.com/r/qJ9dV0
(?i)([0-9]GB|GB)[!@#$%^&*() _,.:-]\w+ (?:\w+\s+){1,3}application

EDIT You have to remove the boundaries and be a little more literal in your selection. I have made an improvement that will also get GB preceeded by numbers or just GB - http://regex101.com/r/jH7rH0 (You will need to add a dash to the special characters group as I just noticed that in your text. It has been correctly added in this answer.)


text:
Q: Angular CLI Observable Pipe Im trying to create a pipe that takes a date time stamp and returns how long it has been since that time.
I have the following pipe which returns the duration once, but I need this pipe to increment every second to give a timer effect:
import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';

@Pipe({ name: 'duration' })
export class DurationPipe implements PipeTransform{
  transform(value: any){
    var now = moment(new Date());
    var end = moment(value);
    var dif = moment.duration(now.diff(end));
    var toReturn = [];
    if(("00" + dif.hours()).slice(-2) != "00"){
      toReturn[toReturn.length] = ("00" + dif.hours()).slice(-2);
    }
    toReturn[toReturn.length] = ("00" + dif.minutes()).slice(-2);
    toReturn[toReturn.length] = ("00" + dif.seconds()).slice(-2);
    return toReturn.join(':');
  }
}

I've looked at the async pipe but I cant seem to get it working how I desire.
Any solutions?

A: The Pipe component pass value from the template and transform a new value out.  You shouldn't use Pipe to calculate a time duration and update to the view periodically because Pipe won't update itself unless value changed.  ( Pipes are all pure pipe by default! )
I think you should implement this into your component instead of implement this in Pipe.

A: Taking inspiration from the comment left from @Hinrich
I decided to pass in the current time to the pipe. Changing this value would trigger the pipe to change. This allows the logic of calculating the difference in two times to be reused throughout my app.
To get this to appear as a timer I set a timeout function that updates the current time argument in the component where the pipe is being used
import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';

@Pipe({ name: 'duration'})
export class DurationPipe implements PipeTransform{
  transform(value: any, now: any){
    var end = moment(value);
    var dif = moment.duration(now.diff(end));
    var toReturn = [];
    if(("00" + dif.hours()).slice(-2) != "00"){
      toReturn[toReturn.length] = ("00" + dif.hours()).slice(-2);
    }
    toReturn[toReturn.length] = ("00" + dif.minutes()).slice(-2);
    toReturn[toReturn.length] = ("00" + dif.seconds()).slice(-2);
    return toReturn.join(':');
  }
}

then in the component
@Component({
  moduleId: module.id,
  templateUrl: 'pending.template.html',
  styleUrls: ['../orders.scss']
})

export class PendingComponent implements OnInit {

  orders: any[];
  now = moment(new Date());

  constructor(private route: ActivatedRoute, private router: Router, private orderService: OrderService, public dialog: MdDialog ){}

  ngOnInit() {
    Observable.interval(1000).subscribe(x=>{
      this.now = moment(new Date());
    })
  }
}

with the html being
{{order.createdAt | duration:now}}


text:
Q: Iteration over multiple streams in Apache Flink My Question in regarding iteration over multiple streams in Apache Flink.
I am a Flink beginner, and I am currently trying to execute a recursive query (e.g., datalog) on Flink.
For example, a query calculates the transitive closure for every 5mins (tumbling window). If I have one input stream inputStream (consists of initial edge informations), another outputStream (the transitive closure) which is initialised by the inputStream. And I want to iteratively enrich the outputStream by joining the inputStream. For each iteration, the feedback should be the outputStream, and the iteration will last until no more edge can be appended on outputStream. The computation of my transitive closure should trigger periodically for every 5 mins. During the iteration, the inputStream should be "hold" and provide the data for my outputStream.
Is it possible to do this in Flink? Thanks for any help!

A: This sounds like a side-input issue, where you want to treat the "inputStream" as a batch dataset (with refresh) that's joined to the other "outputStream". Unfortunately Flink doesn't provide an easy way to implement that currently (see https://stackoverflow.com/a/48701829/231762)
If both of these streams are coming from data sources, then one approach is to create a wrapper source that controls the ordering of the records. It would have to emit something like a Tuple2 where one side or the other is null, and then in a downstream (custom) Function you'd essentially split these, and do the joining.
If that's possible, then this source can block the "output" tuples while it emits the "input" tuples, plus other logic it sounds like you need (5 minute refresh, etc). See my response to the other SO issue above for skeleton code that does this.


text:
Q: Create a new column with the minimum of other columns on same row I have the following DataFrame
Input:
A    B    C    D    E
2    3    4    5    6
1    1    2    3    2
2    3    4    5    6

I want to add a new column that has the minimum of A, B and C for that row
Output:
A    B    C    D    E    Goal
2    3    4    5    6    2
1    1    2    3    2    1
2    3    4    5    6    2

I have tried to use
df = df[['A','B','C]].min()

but I get errors about hashing lists and also I think this will be the min of the whole column I only want the min of the row for those specific columns.
How can I best accomplish this?

A: Use min along the columns with axis=1
Inline solution that produces copy that doesn't alter the original
df.assign(Goal=lambda d: d[['A', 'B', 'C']].min(1))

   A  B  C  D  E  Goal
0  2  3  4  5  6     2
1  1  1  2  3  2     1
2  2  3  4  5  6     2

Same answer put different
Add column to existing dataframe
new = df[['A', 'B', 'C']].min(axis=1)

df['Goal'] = new

df

   A  B  C  D  E  Goal
0  2  3  4  5  6     2
1  1  1  2  3  2     1
2  2  3  4  5  6     2

A: Add axis = 1 to your min
df['Goal'] = df[['A','B','C']].min(axis = 1)

A: you have to define an axis across which you are applying the min function, which would be 1 (columns).
df['ABC_row_min'] = df[['A', 'B', 'C']].min(axis = 1)


text:
Q: HighChart data table keeps adding number of tables at bottom on every call I am using HighChart library to show Pie Chart on my page, I am keeping showTable always true to show every time.
The problem is whenever data binds to charts using JQuery Ajax post dynamically, i see proper data in chart but also it keeps adding new data table everytime at the bottom. E.g. First time there will be only one table, after another call there will be two tables added and so on. Why Hightcharts not updating the same table again or is there a way to kill any existing table.?
 hc = Highcharts.chart(chartName, {
                chart: {
                    type: 'pie',
                    options3d: {
                        enabled: false,
                        alpha: 45
                    },
                    style: {
                        color: '#575962'
                    }
                },
                title: {
                    text: title,
                    style: {
                        color: '#575962',
                        fontweight: '400'
                    }
                },
                subtitle: {
                    text: 'Current Month(Top 10)'
                },
                plotOptions: {
                    pie: {
                        innerSize: 100,
                        depth: 45,
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: false
                        },
                        showInLegend: true
                    }
                },
                credits: {
                    enabled: false
                },
                exporting: {
                    showTable: true
                },
                series: [{
                    name: 'Price',
                    data: [],
                    dataLabels: {
                        formatter: function () {
                            //const point = this.point;
                            //return '' +
                            //    point.name + ': $' + point.y + '';
                        }
                    }
                }]
            });

Why Hightcharts not updating the same table again or is there a way to kill any existing table.?

A: I have achieved this by removing the series on each call and adding them again with new data. Hope this helps if anyone else looking and couldn't find any other answer.

//Removing Series
 while (hc.series.length > 0) {
            hc.series[0].remove(false);
        }

//Adding new Series
        hc.addSeries({
            name: 'Price',
            data: [],
            dataLabels: {
                formatter: function () {
                    const point = this.point;
                    return '' +
                        point.name + ': $' + point.y + '';
                }
            }
        });

//Binding Series data
            var res = result.Data.slice(0, 10);
            res.forEach(function (element, index) {
                hc.series[0].addPoint({
                    name: element.ResourceGroupName,
                    y: element.TotalMonthlyPrice,
                });
            });


text:
Q: Windows, PyCharm: DPI-1047: Cannot locate a 32-bit Oracle Client library I need help, I'm getting this error all the time.
'''
Traceback (most recent call last):
File "C:/Users/DELL/PycharmProjects/Anonimizacija/OracleConnect.py", line 3, in
con = cx_Oracle.connect("andjela", "andjela", "localhost/xe")
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 32-bit Oracle Client library: "C:\app\DELL\product\18.0.0\dbhomeXE\bin\oci.dll is not the correct architecture". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
'''
I don't know how to fix it.

A: You have a 32-bit python but a 64-bit Oracle database.
The best thing would be install a 64-bit Python.
Or you could upgrade to cx_Oracle to 8, download a 32-bit Oracle Instant Client and unzip it, and then pass the Instant Client directory to cx_Oracle 8's init_oracle_client():
import cx_Oracle
import sys

try:
    cx_Oracle.init_oracle_client(lib_dir=r"C:\oracle\instantclient_19_6")
except Exception as err:
    print("Whoops!")
    print(err);
    sys.exit(1);

See the cx_Oracle doc Using cx_Oracle.init_oracle_client() to set the Oracle Client directory.
With this function you do not need to add the Instant Client directory to PATH (which might impact Oracle XE database use).


text:
Q: Get a cell from the address In Excel VBA, I would like to do this:
Dim cellAddress As String, cell As Range
Set cellAddress = "=Sheet1!A7"
Set cell = GetCellFromAddress(cellAddress)

How could I implement "GetCellFromAddress" in the best way? I know I could parse the cellAddress, but that seems a little awkward...
I am using Excel 2007, if it matters.

A: Dim cellAddress As String, cell As Range
cellAddress = "=Sheet1!A7"

Set cell = Range(cellAddress)

MsgBox cell.Address(True, True, xlR1C1, True)

This will show a messagebox with text:
---------------------------
Microsoft Excel
---------------------------
[Book1]Sheet1!R7C1
---------------------------
OK
---------------------------

Have fun!

A: I think freerider's answer is good enough and I upvoted it.
If you want to see his solution implemented as GetCellFromAddress
Function GetCellFromAddress(cellAddress As String) As Range
    Set GetCellFromAddress = Range(cellAddress)
End Function

Sub test()
    Dim cellAddress As String, cell As Range
    cellAddress = "=Sheet1!A7"

    Set cell = GetCellFromAddress(cellAddress)
    MsgBox cell.Address(True, True, xlR1C1, True)
End Sub


text:
Q: Android ListView scrolls with no momentum A ListView in my Activity doesn't have scroll momentum - once I put my finger up, the scroll stops. I have another ScrollView in the hierarchy, but its visibility is set to gone.
<ListView
                    android:id="@+id/eventsListView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@+id/contentViewSearchBar"
                    android:divider="@android:color/transparent"
                    android:dividerHeight="10.0sp"
                    android:listSelector="@color/transparent" />

Any ideas?

A: did you override the onTouchEvent() in your Activity and/or Fragment? If so check this condition case MotionEvent.ACTION_UP. This where your "finger up" is detected.

A: The overscroll code is:
666                     if (overScrollBy(0, deltaY, 0, mScrollY, 0, range, 0, mOverscrollDistance, true)
667                             && !hasNestedScrollingParent()) {
668                         // Break our velocity if we hit a scroll barrier.
669                         mVelocityTracker.clear();

Your parent view has the ability to scroll. Which means the child doesn't scroll. Throw an error and you'll see that you're in startNestedScroll(int) code. This doesn't care about the visibility, just the existence of the parent.


text:
Q: Powerpoint theme is displaying two charts when I export When I save my Powerpoint theme as png, I'm getting two charts one inside the other.

I'm using Powerpoint 2013. How can I fix this?

A: I had to go normal view and delete other before saving.


text:
Q: How to send message from server to client using SignalR? How can I send something from server to clients using SignalR?
I created send method like bellow:
    public async void SendData(string data)
    {
       await Clients.All.SendAsync("ReceiveMessage", data);
    }

My javascript:
"use strict";

var connection = new signalR.HubConnectionBuilder().withUrl("/somemsg").build();

connection.on("ReceiveMessage", function (message) {
    var li = document.createElement("li");
    document.getElementById("responeHistory").appendChild(li);
    li.textContent = `${message}`;
});

In my case I receive error that Clients 'Object reference not set to an instance of an object.'

A: If you're registering SignalR in service collection, you can just inject
IHubConnectionContext, here's an example from ms docs:
https://learn.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-server-broadcast-with-signalr#getting-the-signalr-context-so-that-the-stockticker-class-can-broadcast-to-clients


text:
Q: How to add Q&A captcha into Redsilver3 style in phpbb I am maintaining a phpbb forum. The style used in the forum is Redsilver3, which supports phpbb version 3.0.4. I have updated the forum version to 3.0.11 so that I can use Q&A captcha to prevent spam. The Q&A captcha was successfully activated on the forum, but it is not displaying the captcha on Redsilver3. I tried updating the Redsilver3 file by adding code
"<!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
        <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
        <!-- ENDIF -->"

in the posting_body.html  in the Redsilver3 template folder and purged the cache. But still it is not displaying the captcha. I have also tried by replacing all the files with latest version of Redsilver3 but the captcha was not showing. Please help me.
Thanks in advance.

A: I copied the captcha_qa.html and captcha_default.html from the latest version of subsilver2 and added the code

to the ucp_register.html file and the captcha was working perfectly.
Earlier I copied captcha_qa.html and captcha_default.html from the latest version of Redsilver3 and have added the code to posting_body.html, so it was not working.
I got the idea after asking the same question on phpbb forum. Here is the link https://www.phpbb.com/community/viewtopic.php?f=74&t=2166883&p=13210671#p13210671


text:
Q: parameter passed via javascript - server tag not well formed TemplateField of a gridview column.
The OnClientClick keeps causing a "server tag not well formed error".  Any ideas?
 <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='../../images/20X20%20Dialog%20Box.png'
      OnClientClick='<%# string.Format("javascript: LoadPhysiologicalChart('{0}','{1}');", Eval("code"), txtMRN.ClientID)%>'  AlternateText="Chart Data" />

Thanks...

A: It's the single-quotes. ASP.NET gets a little picky with the types of quotes you have on data-bound controls.
One thing: get rid of the javascript: - that's not necessary in an onclick event.
Try this, with escaped double-quotes instead:
<asp:ImageButton ID="ImageButton1" runat="server"
    ImageUrl='../../images/20X20%20Dialog%20Box.png'
    OnClientClick='<%# string.Format("LoadPhysiologicalChart(\"{0}\",\"{1}\");", Eval("code"), txtMRN.ClientID)%>'
    AlternateText="Chart Data"
/>

A: Can you try the following ?
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='../../images/20X20%20Dialog%20Box.png'
      OnClientClick="LoadPhysiologicalChart('<%#Eval("code";) %>','<%#Eval("txtMRN.ClientID";) %>');" AlternateText="Chart Data" />


text:
Q: Implementing Naive Bayes Nearest Neighbor (NBNN) in MATLAB I posted this question on the CV SO a few days ago but it has gone basically unobserved by the forum. I'm trying to implement NBNN in MATLAB to do image classification on the CIFAR-10 image dataset. The algorithm is pretty simple, and I'm confident in it's correctness, however, I'm receiving terrible accuracy rates with 22-28%. I'm unsure why and I'm hoping someone who has experience with image classification or the algorithm could point me in the right direction. The algorithm learns off of SIFT image descriptors, which could be one of the reasons why it's under-performing. Matlab only has a SURF feature detector. From what I've read, SURF/SIFT are basically equivalent. I've been using features, (nDescriptros x 64) obtained from the function below to train my model.
points = detectSURFFeatures(rgb2gray(image));
[features,valid_points] = extractFeatures(image,points);

Another possible issue with the CIFAR dataset and this approach is the small size of the images. Each image is 32 x 32 images which, I beleive, makes feature detection very difficult. I've played around with the different octave settings in the detectSURFFeatures() but nothing has brought my accuracy above 28%.
The annotated code for the approach is below. It's difficult to understand but still might be helpful.
Hopefully someone can help me out.
for i = 3001:4000 %Train on the first 3000 instances and test on the remaining 1000.
    closeness = [];
    for j = 1:10 %loop over the 10 catergories
        class = train(trainLabel==j,:); % Pull out all descriptors that belong to class j
        descriptor = test(test_id==i,:); % Pull out all descriptors for image i
        [idx,dist] = knnsearch(class,descriptor,'K',1); % Find the distance between the descriptors and the closest labeled descriptor in class j.
        total = sum(dist); % sum up distances
        closeness = [closeness,sum(total)]; % append a vector of the image-to-class distances.
    end
    [val,cat] = min(closeness); % Find choose the class that resulted in the lowest, summed distance.
    predLabel = [predLabel;cat]; % Append to a vector of labels.
    i
end

A: If your images are 32x32 pixels, then trying to detect interest points is not a good idea.  As you have observed, you would get very few features, if any.  Upsampling the images is one option. Another option is to use a global descriptor like HOG (extractHOGFeatures).


text:
Q: Restkit. Show response body on storyboard I want to show on the storyboard the responde body that i get from the server, im doing the connection like this.
When i run the app, i get the following response:
response.body={"id":2,"token":"xyzzyzzyx"}
2013-11-05 11:36:52.405 networkTest3[1327:70b] It Worked: (
    "<LoginResponse: 0x8b508a0>"
)

Im trying to show the data from LoginResponse on masterview, following the CoffeeShop example but it seems many things are different because of the RestKit version (Im using the last one, 0.20 right now). I already know how to connect the data from the class to the Outlets on the interface but i cant find how i get the data from the response body.
Im trying to do it with this method on the class LoginResponse
- (void)loadToken{
    RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[LoginResponse class]];

    [mapping addAttributeMappingsFromDictionary:@{
                                                  @"id":   @"status",
                                                  @"token":   @"token",
                                                  }];
        RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping pathPattern:nil keyPath:@"" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

    NSURL *URL = [NSURL URLWithString:@"http://myurl.com"];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    RKObjectRequestOperation *objectRequestOperation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[ responseDescriptor ]];

    [objectRequestOperation start];
}

And i got this:
2013-11-05 12:09:56.867 networkTest3[1585:3307] E restkit.network:RKObjectRequestOperation.m:576 Object request failed: Underlying HTTP request operation failed with error: (null)

What im doing wrong and what would be my next step?
EDIT: I tried to add this on LoginManager.m
[responseMapping addAttributeMappingsFromDictionary:@{@"id" : @"id", @"token" : @"token"}];

But i got
libc++abi.dylib: terminating with uncaught exception of type NSException
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to add mapping for keyPath token, one already exists...'

A: You haven't set any headers on the results you're making so the server doesn't know how to appropriately respond to the request. With a null error it's impossible to tell more really. Your mapping looks fine and your log shows that the appropriate object is created.
Consider setting at least your Accepts header on the request or using an RKObjectManager to handle the request management for you.

If that isn't a real error and your mapping is working (it looks basically ok), then your issue is that you aren't calling setCompletionBlockWithSuccess:failure: so you never get a callback with the objects that were created during the mapping process.
Again, using RKObjectManager would make this easier to handle and harder to forget / miss...


text:
Q: Processing messages through named:channels with prefetch >= 1 Good evening everybody
I run with SpringXD-1.3.0.RELEASE (configuration: 3 admin and 3 container) and RabbitMQ 3.5.7 (3 nodes) into following scenario:
stream create --name fire  --definition "time --timeUnit=MILLISECONDS  > topic:fire" --deploy
stream create --name fireeater_1  --definition "topic:fire > null"
stream create --name fireeater_2  --definition "topic:fire > null"
stream create --name fireeater_3  --definition "topic:fire > null"
stream create --name fireeater_4  --definition "topic:fire > null"
job create test123 --definition "timestampfile --directory=/tmp"

stream deploy fireeater_1 --properties "module.null.consumer.durableSubscription=true,module.null.count=0,module.null.consumer.prefetch=500"
stream deploy fireeater_2 --properties "module.null.consumer.durableSubscription=true,module.null.count=0,module.null.consumer.prefetch=500"
stream deploy fireeater_3 --properties "module.null.consumer.durableSubscription=true,module.null.count=0,module.null.consumer.prefetch=500"
stream deploy fireeater_4 --properties "module.null.consumer.durableSubscription=true,module.null.count=0,module.null.consumer.prefetch=500"

job deploy test123

After few minutes this exception is thrown on one container.
2016-01-13T18:08:47+0100 1.3.0.RELEASE WARN xdbus.job:test123-6 listener.SimpleMessageListenerContainer - Consumer raised exception, processing can restart if the connection factory supports it
com.rabbitmq.client.ShutdownSignalException: connection error
    at com.rabbitmq.client.impl.AMQConnection.startShutdown(AMQConnection.java:721) ~[amqp-client-3.5.2.jar:na]
    at com.rabbitmq.client.impl.AMQConnection.shutdown(AMQConnection.java:711) ~[amqp-client-3.5.2.jar:na]
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:569) ~[amqp-client-3.5.2.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55]
Caused by: com.rabbitmq.client.impl.UnknownChannelException: Unknown channel number 6
    at com.rabbitmq.client.impl.ChannelManager.getChannel(ChannelManager.java:80) ~[amqp-client-3.5.2.jar:na]
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:552) ~[amqp-client-3.5.2.jar:na]
    ... 1 common frames omitted

At the end the container processes the messages from rabbitmq very slowly. Only an undeployment of the "fire"-stream or a container restart will help.
It seems so that a message channel, used by the job is closed by the stream.
-- Update --
Today I saw more output from the log and it seems so that the channel is closed by the message bus itself. Here the log for the exception
2016-02-23T15:05:18+0100 1.3.0.RELEASE ERROR AMQP Connection 10.0.3.210:5672 connection.CachingConnectionFactory - Channel shutdown: connection error
2016-02-23T15:05:18+0100 1.3.0.RELEASE WARN SimpleAsyncTaskExecutor-2 listener.ConditionalRejectingErrorHandler - Execution of Rabbit message listener failed.
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener threw exception
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(AbstractMessageListenerContainer.java:865) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:760) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:680) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:93) [spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:183) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1352) [spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:661) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1096) [spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1080) [spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$800(SimpleMessageListenerContainer.java:93) [spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1197) [spring-rabbit-1.5.2.RELEASE.jar!/:na]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55]

Caused by: org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint@69022500]; nested exception is org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:139) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.xd.dirt.integration.rabbit.RabbitMessageBus$SendingHandler.handleMessageInternal(RabbitMessageBus.java:891) ~[na:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:147) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:120) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:442) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:392) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115) ~[spring-messaging-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45) ~[spring-messaging-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105) ~[spring-messaging-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:105) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$400(AmqpInboundChannelAdapter.java:45) ~[spring-integration-amqp-4.2.2.RELEASE.jar!/:na]
at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$1.onMessage(AmqpInboundChannelAdapter.java:93) ~[spring-integration-amqp-4.2.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:757) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
... 10 common frames omitted

Caused by: org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:67) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.SimpleConnection.createChannel(SimpleConnection.java:51) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.createBareChannel(CachingConnectionFactory.java:833) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.access$400(CachingConnectionFactory.java:822) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.doCreateBareChannel(CachingConnectionFactory.java:474) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createBareChannel(CachingConnectionFactory.java:450) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getCachedChannelProxy(CachingConnectionFactory.java:419) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.getChannel(CachingConnectionFactory.java:412) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.access$1200(CachingConnectionFactory.java:86) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy.createChannel(CachingConnectionFactory.java:838) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createChannel(ConnectionFactoryUtils.java:90) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:139) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:71) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1278) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1271) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:619) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:717) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
at org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint.send(AmqpOutboundEndpoint.java:329) ~[spring-integration-amqp-4.2.2.RELEASE.jar!/:na]
at org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint.handleRequestMessage(AmqpOutboundEndpoint.java:321) ~[spring-integration-amqp-4.2.2.RELEASE.jar!/:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127) ~[spring-integration-core-4.2.2.RELEASE.jar:na]
... 25 common frames omitted
Caused by: java.io.IOException: null
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.ChannelN.open(ChannelN.java:125) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.ChannelManager.createChannel(ChannelManager.java:143) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.AMQConnection.createChannel(AMQConnection.java:503) ~[amqp-client-3.5.2.jar!/:na]
at org.springframework.amqp.rabbit.connection.SimpleConnection.createChannel(SimpleConnection.java:44) ~[spring-rabbit-1.5.2.RELEASE.jar!/:na]
... 44 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:361) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:226) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118) ~[amqp-client-3.5.2.jar!/:na]
... 48 common frames omitted
Caused by: com.rabbitmq.client.impl.UnknownChannelException: Unknown channel number 3289
at com.rabbitmq.client.impl.ChannelManager.getChannel(ChannelManager.java:82) ~[amqp-client-3.5.2.jar!/:na]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:556) ~[na:na]
... 1 common frames omitted

 2016-02-23T15:05:18+0100 1.3.0.RELEASE ERROR AMQP Connection 10.0.3.210:5672 connection.CachingConnectionFactory - Channel shutdown: connection error
 2016-02-23T15:05:18+0100 1.3.0.RELEASE WARN xdbus.test123-6 listener.SimpleMessageListenerContainer - Consumer raised exception, processing can restart if the connection factory supports it
 com.rabbitmq.client.ShutdownSignalException: connection error
at      com.rabbitmq.client.impl.AMQConnection.startShutdown(AMQConnection.java:739) ~[amqp-client-3.5.2.jar:na]
at com.rabbitmq.client.impl.AMQConnection.shutdown(AMQConnection.java:729) ~[amqp-client-3.5.2.jar:na]
at   com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:573) ~[amqp-client-3.5.2.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55]
 Caused by: com.rabbitmq.client.impl.UnknownChannelException: Unknown channel number 3289
at  com.rabbitmq.client.impl.ChannelManager.getChannel(ChannelManager.java:82) ~[amqp-client-3.5.2.jar:na]
at  com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:556) ~[amqp-client-3.5.2.jar:na]
... 1 common frames omitted

2016-02-23T15:05:18+0100 1.3.0.RELEASE WARN xdbus.fireeater_1-1 listener.SimpleMessageListenerContainer - Consumer raised exception, processing can restart if the connection factory supports it
com.rabbitmq.client.ShutdownSignalException: connection error
at com.rabbitmq.client.impl.AMQConnection.startShutdown(AMQConnection.java:739) ~[amqp-client-3.5.2.jar:na]
at com.rabbitmq.client.impl.AMQConnection.shutdown(AMQConnection.java:729) ~[amqp-client-3.5.2.jar:na]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:573) ~[amqp-client-3.5.2.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55]
 Caused by: com.rabbitmq.client.impl.UnknownChannelException: Unknown channel number 3289
at   com.rabbitmq.client.impl.ChannelManager.getChannel(ChannelManager.java:82) ~[amqp-client-3.5.2.jar:na]
at   com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:556) ~[amqp-client-3.5.2.jar:na]
... 1 common frames omitted

Does someone know why the exception is thrown and how is it possible to avoid this?

A: The problem seems to be a reply coming back on a channel that is already closed. When that occurs, the connection is torn down and all users will get that exception. As far as I can tell from the rabbit client code, that shouldn't happen.
Everything should recover though.
Spring AMQP has a channel cache to avoid closing channels and allows them to be reused; increasing the channel cache size (from the default 1), might solve the issue. You seem to be churning a lot of channels.
Spring XD currently doesn't expose the channel cache size as a property. To work around that, put the following file (named rabbit-bus.xml) under xd/config/META-INF/spring-xd/bus.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <bean id="rabbitConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
        <constructor-arg ref="rabbitFactory" />
        <property name="addresses" value="${spring.rabbitmq.addresses}" />
        <property name="username" value="${spring.rabbitmq.username}" />
        <property name="password" value="${spring.rabbitmq.password}" />
        <property name="virtualHost" value="${spring.rabbitmq.virtual_host}" />
        <property name="channelCacheSize" value="${spring.rabbitmq.channelCacheSize:100}" />
    </bean>

    <bean id="rabbitFactory" class="org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean">
        <property name="useSSL" value="${spring.rabbitmq.useSSL:false}" />
        <property name="sslPropertiesLocation" value="${spring.rabbitmq.sslProperties:}"/>
    </bean>

    <bean id="messageBus" class="org.springframework.xd.dirt.integration.rabbit.RabbitMessageBus">
        <constructor-arg ref="rabbitConnectionFactory" />
        <constructor-arg ref="codec"/>
        <property name="defaultAcknowledgeMode" value="#{T(org.springframework.amqp.core.AcknowledgeMode).${xd.messagebus.rabbit.default.ackMode}}" />
        <property name="defaultBackOffInitialInterval" value="${xd.messagebus.rabbit.default.backOffInitialInterval}" />
        <property name="defaultBackOffMaxInterval" value="${xd.messagebus.rabbit.default.backOffMaxInterval}" />
        <property name="defaultBackOffMultiplier" value="${xd.messagebus.rabbit.default.backOffMultiplier}" />
        <property name="defaultChannelTransacted" value="${xd.messagebus.rabbit.default.transacted}" />
        <property name="defaultConcurrency" value="${xd.messagebus.rabbit.default.concurrency}" />
        <property name="defaultDefaultDeliveryMode" value="#{T(org.springframework.amqp.core.MessageDeliveryMode).${xd.messagebus.rabbit.default.deliveryMode}}" />
        <property name="defaultDefaultRequeueRejected" value="${xd.messagebus.rabbit.default.requeue}" />
        <property name="defaultMaxAttempts" value="${xd.messagebus.rabbit.default.maxAttempts}" />
        <property name="defaultMaxConcurrency" value="${xd.messagebus.rabbit.default.maxConcurrency}" />
        <property name="defaultPrefetchCount" value="${xd.messagebus.rabbit.default.prefetch}" />
        <property name="defaultPrefix" value="${xd.messagebus.rabbit.default.prefix}" />
        <property name="defaultReplyHeaderPatterns" value="${xd.messagebus.rabbit.default.replyHeaderPatterns}" />
        <property name="defaultRequestHeaderPatterns" value="${xd.messagebus.rabbit.default.requestHeaderPatterns}" />
        <property name="defaultTxSize" value="${xd.messagebus.rabbit.default.txSize}" />
        <property name="defaultAutoBindDLQ" value="${xd.messagebus.rabbit.default.autoBindDLQ}" />
        <property name="defaultRepublishToDLQ" value="${xd.messagebus.rabbit.default.republishToDLQ}" />
        <property name="defaultBatchingEnabled" value="${xd.messagebus.rabbit.default.batchingEnabled}" />
        <property name="defaultBatchSize" value="${xd.messagebus.rabbit.default.batchSize}" />
        <property name="defaultBatchBufferLimit" value="${xd.messagebus.rabbit.default.batchBufferLimit}" />
        <property name="defaultBatchTimeout" value="${xd.messagebus.rabbit.default.batchTimeout}" />
        <property name="defaultCompress" value="${xd.messagebus.rabbit.default.compress}" />
        <property name="compressingPostProcessor">
            <bean class="org.springframework.amqp.support.postprocessor.GZipPostProcessor">
                <property name="level" value="${xd.messagebus.rabbit.compressionLevel:#{T(java.util.zip.Deflater).BEST_SPEED}}" />
            </bean>
        </property>
        <property name="decompressingPostProcessor">
            <bean class="org.springframework.amqp.support.postprocessor.DelegatingDecompressingPostProcessor">
                <!-- set a map of decompressors here if using other than the default -->
            </bean>
        </property>
        <property name="defaultDurableSubscription" value="${xd.messagebus.rabbit.default.durableSubscription}" />
        <property name="addresses" value="${spring.rabbitmq.addresses:}" />
        <property name="adminAddresses" value="${spring.rabbitmq.adminAddresses:}" />
        <property name="nodes" value="${spring.rabbitmq.nodes:}" />
        <property name="username" value="${spring.rabbitmq.username:}" />
        <property name="password" value="${spring.rabbitmq.password:}" />
        <property name="vhost" value="${spring.rabbitmq.virtual_host:}" />
        <property name="useSSL" value="${spring.rabbitmq.useSSL:false}" />
        <property name="sslPropertiesLocation" value="${spring.rabbitmq.sslProperties:}" />
    </bean>

</beans>

This replaces the standard bus configuration (it's a copy except for the connection factory configuration).
It will set the cache to 100 by default, but you can override it in servers.yml with
spring:
  rabbitmq:
    channelCacheSize: 200

EDIT
There is a better work-around, using the bus extension mechanism - simply put he replacement connection factory beans in the bus exension directory...
$ cat xd/config/META-INF/spring-xd/bus/ext/cf.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <bean id="rabbitConnectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
        <constructor-arg ref="rabbitFactory" />
        <property name="addresses" value="${spring.rabbitmq.addresses}" />
        <property name="username" value="${spring.rabbitmq.username}" />
        <property name="password" value="${spring.rabbitmq.password}" />
        <property name="virtualHost" value="${spring.rabbitmq.virtual_host}" />
        <property name="channelCacheSize" value="${spring.rabbitmq.channelCacheSize:100}" />
    </bean>

</beans>

Any file name ending .xml will be found in that directory.