text:
Q: How to add floating point numbers together with a small error? There is a file and there are 10000 numbers like the following numbers in the file.
7.474571938241547
5.9520387080950865
8.440712641801738
7.233918953859444
5.359040371183379
7.788831268552525
5.605003246355943
5.464119475471641
4.196570126808656

So I need to add them together with a float type, but there is a margin of error when I adding them together in the original order. So when I adding them in ascending order, the sum becomes smaller.
When I adding them in descending order, the sum also becomes smaller. what is the best way to minimize the error?

A:

*Use doubles

*Use Kahan summation

*Use a heap to sort also the intermediate results
remove the two smallest elements (by absolute value)
insert the sum back in the heap

*0+1+2

A:
How to add floating point numbers together with a small error?

Simple solution with best accuracy: Perform the calculation using arbitrary precision arithmetic. Convert the output to finite precision if desired.
Efficient solution using finite precision arithmetic: There is no one best algorithm for all use cases. A famous algorithm for floating point summation is Kahan summation algorithm, but research on the subject is active.


text:
Q: Topology of the space of hermitian positive definite matrices Let $\mathcal{H}_n \mathbb{C}$ be the set of hermitian $n \times n$ complex matrices. This set carries the structure of a vector space over $\mathbb{R}$ under  usual addition. It also inherits the standard euclidean topology from $\mathbb{C}^{n\times n}$. Let $\mathcal{P}$ denote the subset of $\mathcal{H}_n \mathbb{C}$ of positive definite matrices and give it the subspace topology.
My question is: is $\mathcal{P}$ locally compact?
What I understand: $\mathcal{P}$ is closed under linear combination with positive coefficients, in particular it is closed under addition, multiplication by a positive scalar and is convex. In dimension $1$ it is just $]0,+\infty[$, so the answer is yes. My feeling is that the answer should be yes in higher dimensions as well, since $\mathcal{P}$ is a kind of "cone" in a real vector space, but I can't provide a rigorous proof of this.

A: Edit: I think that the first answer below is more efficient and easier to write. Nevertheless, I have added a more concrete approach which might be closer to what you were after.
By some sort of transitivity: recall that every open or closed subset of a locally compact space is a locally compact space with the induced topology. We will use both, for open and for closed.
I consider every space here equipped with the topology induced by the Euclidean norm of $\mathbb{C}^{n\times n}$. Hence every space is Hausdorff. This is good to know, even though your question does not specifically ask about this aspect.
Like every finite-dimensional vector space over $\mathbb{R}$ or $\mathbb{C}$, $\mathbb{C}^{n\times n}$ is locally compact when equipped with the topology induced by any norm.
Clearly, $\mathcal{H}_n^+\mathbb{C}$, the set of positive semidefinite matrices, is closed in the locally compact $\mathbb{C}^{n\times n}$. So $\mathcal{H}_n^+\mathbb{C}$ is a locally compact space.
Now $\mathcal{P}=\{A\in \mathcal{H}_n^+\mathbb{C}\;;\det A>0\}$. By continuity of the determinant, it follows that $\mathcal P$ is open in the locally compact $\mathcal{H}_n^+\mathbb{C}$. Hence $\mathcal P$ is a locally compact space. QED.
Parametrized alternative: fix $A_0$ hermitian definite positive, and denote $\{t^0_1,\ldots,t_n^0\}$ its (positive) eigenvalues. Now let $\epsilon:=\min t_j^0/2>0$. Then denote $U_n$ the unitary group and $\mathcal{H}_n^{++}$ the cone of positive definte hermitian matrices. Now consider the map
$$
\phi:U_n\times \prod_{j=1}^n[t_j^0-\epsilon,t_j^0+\epsilon]\longrightarrow \mathcal{H}_n^{++}
$$
which sends $(U,t_1,\ldots,t_n)$ to $U\mbox{diagonal}\{t_1,\ldots,t_n\}U^*$. Since $U_n$ is compact, the domain is compact. And since $\phi$ is continuous, the range of $\phi$ is a compact subset of $\mathcal{H}_n^{++}$ containing $A_0$. So it only remains to check that this is a neighborhood of $A_0$ in $\mathcal{H}_n^{++}$. To that aim, note that it contains
$$
\phi(U_n\times \prod_{j=1}^n(t_j^0-\epsilon,t_j^0+\epsilon))\ni A_0
$$
i.e. the set of hermitian definite positive matrices with spectrum $\{t_1,\ldots,t_n\}$ such that, up to a permutation, $|t_j-t_j^0|<\epsilon$ for every $j=1,\ldots,n$. By continuity of polynomial roots over $\mathbb{C}$ applied to the characteristic polynomial, this is open in  $\mathcal{H}_n^{++}$. QED.

A: Edit: First, as $\mathbb{C}^{n\times n}$ is Hausdorff, so is $\mathcal{P}$.
Second, let $B(A,r)$ denotes the ball centred at a matrix $A$ with radius $r$ in $\mathbb{C}^{n\times n}$ and $\bar{B}(A,r)$ its closure. Since eigenvalues are continuous functions of matrix entries, for any $P\in\mathcal{P}$, there exists $r>0$ such that $B(P,r)\cap(\mathcal{H}_n \mathbb{C})\subset\mathcal{P}$. Therefore, for all $\varepsilon\in(0,r)$, the closure of $B(P,\varepsilon)\cap\mathcal{P}$ in $\mathcal{P}$ is simply $\bar{B}(P,\varepsilon)\cap\mathcal{P}=\bar{B}(P,\varepsilon)\cap(\mathcal{H}_n \mathbb{C})$, which is closed and bounded and hence compact in $\mathbb{C}^{n\times n}$. As compactness is an intrinsic property of a set, $\bar{B}(P,\varepsilon)\cap\mathcal{P}$ is also compact in $\mathcal{P}$. Furthermore, $\bar{B}(P,\varepsilon)\cap\mathcal{P}$ has a non-empty interior ($B(P,\varepsilon)\cap\mathcal{P}$). So, it is a compact neighbourhood in $\mathcal{P}$.
In other words, $\mathcal{P}$ is a Hausdorff space such that its every member is contained in a compact neighbourhood. Hence $\mathcal{P}$ is locally compact.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Blank MapServer WMS image at low zoom levels in OpenLayers I have an OpenLayers map using OSM as the baselayer with several layers coming from MapServer via WMS.  The OL map is in EPSG:3857 and my mapfile (and shapefiles) are in EPSG:4326.  In my mapfile I have 'epsg:3857' as one of the values for 'wms_srs'.
So my WMS layers produce the correct images at high zoom levels (zoomed in to the area they cover) around some islands in Hawaii.  But when I zoom out (lower than OL zoom level 6 or so) these WMS layers disappear.  What is more confusing is that if I make the map very small I can get it to show up down to level 3.  This indicates to me that is a projection issue and it is the requested extents that matter.  Here is an example request where it does work:
http://localhost:8080/cgi-bin/mapserv?map=/vagrant/djangoproject/djangoproject/site_media/media/outputs/HAKOU_v2/118/result_wave_deter.map&LAYERS=wave&FORMAT=image%2Fpng&TRANSPARENT=true&ISBASELAYER=false&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A3857&BBOX=-19159399.70874,918467.30427795,-16055444.864568,3714228.0504472&WIDTH=1269&HEIGHT=1143

and where it doesn't:
http://localhost:8080/cgi-bin/mapserv?map=/vagrant/djangoproject/djangoproject/site_media/media/outputs/HAKOU_v2/118/result_wave_deter.map&LAYERS=wave&FORMAT=image%2Fpng&TRANSPARENT=true&ISBASELAYER=false&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A3857&BBOX=-20848352.285494,-452507.23485414,-14640442.59715,5139014.2574847&WIDTH=1269&HEIGHT=1143

Here is an example mapfile:
MAP
  NAME 'wave'
  STATUS ON
  # Map image size
  SIZE 512 256
  MAXSIZE 4096
  UNITS METERS
  FONTSET '/vagrant/djangoproject/djangoproject/data/fonts/font.list'

  EXTENT -159.87 20.33 -156.3 22.7
  PROJECTION
    'init=epsg:4326'
  END

  # Background color for the map canvas -- change as desired
  #IMAGECOLOR 195 220 252
  IMAGECOLOR 255 255 255
  IMAGEQUALITY 95
  IMAGETYPE png24

  #CONFIG "MS_ERRORFILE" "/var/log/mapserver/ms_error.txt"
  #DEBUG 1

  #OUTPUTFORMAT
  #  NAME png
  #  DRIVER 'GD/PNG'
  #  MIMETYPE 'image/png'
  #  IMAGEMODE PC256
  #  EXTENSION 'png'
  #  TRANSPARENT ON
  #END

  OUTPUTFORMAT
    NAME 'png24'
    MIMETYPE 'image/png'
    DRIVER 'AGG/PNG'
    EXTENSION 'png'
    IMAGEMODE RGBA
    TRANSPARENT ON
  END # OUTPUTFORMAT

  # Legend
  LEGEND
      IMAGECOLOR 255 255 255
    STATUS ON
    KEYSIZE 18 12
    LABEL
      TYPE BITMAP
      SIZE MEDIUM
      COLOR 0 0 89
    END
  END

  # Web interface definition. Only the template parameter
  # is required to display a map. See MapServer documentation
  WEB
    # Set IMAGEPATH to the path where MapServer should
    # write its output.
    IMAGEPATH '/tmp/'

    # Set IMAGEURL to the url that points to IMAGEPATH
    # as defined in your web server configuration
    IMAGEURL '/tmp/'

    LOG '/tmp/zoowps/mapserver.log'

    # WMS server settings
    METADATA
      'wms_title'           'wave'
      'wms_onlineresource'  'http://cybereye.crc.nd.edu/portal/mapserver/?map=/vagrant/djangoproject/djangoproject/site_media/media/outputs/HAKOU_v2/118/result_wave_deter.map'
      'wms_srs'             'epsg:4326 epsg:3857'
      'wms_enable_request'  '*'
    END

    #Scale range at which web interface will operate
    # Template and header/footer settings
    # Only the template parameter is required to display a map. See MapServer documentation
#    TEMPLATE 'fooOnlyForWMSGetFeatureInfo'
  END

  LAYER
    NAME 'wave'
    TYPE POLYGON
    DUMP true
    TEMPLATE fooOnlyForWMSGetFeatureInfo
    EXTENT -159.87 20.33 -156.3 22.7
    DATA '/vagrant/djangoproject/djangoproject/site_media/media/outputs/HAKOU_v2/118/result_wave_deter.shp'
    METADATA
      'ows_title' 'wave'
    END
    STATUS ON
    TRANSPARENCY 100
    PROJECTION
    'init=epsg:4326'
    END

    LABELITEM 'HEIGHT_STR'
    #LABELMAXSCALEDENOM 1451339.3664

    CLASSITEM 'HEIGHT_STR'

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '0.001')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 0 242
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '1')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 48 242
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '2')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 96 242
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '3')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 145 242
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '4')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 193 242
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '5')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 242 242
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '6')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 242 193
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '7')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 242 145
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '8')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 242 96
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '9')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 242 48
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '10')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 0 242 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '11')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 48 242 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '12')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 96 242 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '13')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 145 242 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '14')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 193 242 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '15')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 242 242 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '16')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 242 193 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '17')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 242 145 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '18')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 242 96 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '19')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 242 48 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

        CLASS
            EXPRESSION ('[HEIGHT_STR]' eq '20')
            LABEL
                ANGLE FOLLOW
                MAXOVERLAPANGLE 20
                FONT 'arial'
                MAXSIZE 10
                MINSIZE 10
                SIZE 10
                BUFFER 2
                COLOR 255 255 255
                MINDISTANCE 75
                MINFEATURESIZE 20
                OFFSET 0 0
                OUTLINECOLOR 0 0 0
                PARTIALS FALSE
                POSITION CC
                #SHADOWSIZE 1 1
                TYPE TRUETYPE
            END # LABEL
            STYLE
                COLOR 242 0 0
                WIDTH 0.91
                OUTLINECOLOR 0 0 0
            END
        END

  END
END

Any ideas on how to go about fixing this?  In the end I would like it to show up at all zoom levels.  Thanks in advance.

A: In the end I decided to avoid the issue by making my OL layers multitiled (singleTile: false) with the appropriate maxExtent to prevent requests outside of the appropriate area.  This way, since my layers are around Hawaii and never actually cross the date line, I won't have issues with OL making bad requests with respect to the IDL.
The only downside is more requests per view, but theoretically each request should have a lower computational cost since it's a smaller area.  Thanks for your help in discovering the issue.


text:
Q: Is it possible to know programmatically the position of texture in ruby? I written some plugins for sketch-up. I want to know that is it possible to know the texture position that is vertical or horizontal programmatically in ruby ?
Ex: I'm using Sketch-up for wood working and whenever I apply material to the model I should take care of  grains. So that I want to know that the wood grains are in horizontal or vertical. Selecting face then clicking Texture->position we can make horizontal grains to vertical and vice-verse. After applying materials programmatically how should I know the grains are horizontal or vertical.
Is there any solution?

A: When you say horizontal and vertical that implies from general direction - do you have that via Ruby code some how? Do you determine via the bounds of the group/component?
You can use face.getUVHelper to extract the position of the texture on the face. (You can also do so via PolygonMesh - but that's only really useful if you are interested in all the other data you get from that.)
Once you have the UV position you can use that to compare against your desired direction. (This would also assume that all your textures have the grain in the same direction.) Based on that you can then reposition the texture using face.position_texture.
Edit: a very native version can be seen in my UV Toolkit plugin. It's a very old plugin and not the greatest example - it enforces restrictions that the face must be a quad and only rotates in 90 degrees. But it shows how to get UV data and change the orientation of the texture.
A better generic version would be to get four points of the plane of the face (not colinear) and get the UV data for each point. Then transform the UV data by the rotation needed to get the direction you want and set the new UV data.

A: Disclaimer
I am horrible with 3-Dimensions (so please don't ask for help with the appropriate vectors) and I have never used sketchup ever. Not even once until right now but...
Information
You must select the Face object.
model = Sketchup.active_model
entities = model.active_entities
face_entities = entities.find_all{|e| e.class == Sketchup::Face}
#=>[#<Sketchup::Face:0xea645d8>]
face_entities.each{|e| puts e.get_texture_projection(false)}
#=> output of each texture projection for the back side
#nil means that the projection is unchanged from it's initial position

So here is what you can do
#true returns front, false returns the back texture as a Vector object
get_texture_projection(true || false)

#submit a vector [0,1,0] || nil , true sets front || false sets the back
#nil will reset the projection back to it's initial position
set_texture_projection([0,1,0],true || false)
#texture is now rotated 90 degrees on the Y axis
set_texture_projection([1,0,0],true || false)
#texture is now rotated 90 degrees on the X axis

you can also access the material through material and back_material
face.material.name
#=> [Wood_ Floor]
face.material.texture.filename
#=>Wood_Floor.jpg

Hope this helps you out it took a bit of digging but based on using the built in console in Sketchup it works.
P.S. I love that this program has a built in Ruby API that's is awesome.


text:
Q: Can I catch and check the proxy request in tests I have the code:
def rest_endpoint
  RestClient::Resource.new(url, { proxy: @action.proxy_service }.compact_blank)
end

It is necessary to test that sometimes the request is executed through a proxy server.

test 'use GET request via proxy' do
  url = 'https://some.url'
  proxy = 'https://test.example.co.internal:1313'

  expected_proxy_request = stub_request(:any, proxy)

  RestClient::Resource.new(url, proxy: proxy).get

  assert_requested expected_proxy_request
end

It's failing. Is there a way to test accessing a proxy service using stub_request without paying attention to the instance of the RestClient::Resource class?


text:
Q: python shebang and path I tried to execute a python script which starts with shebang(#!/usr/bin/env python) and got an error message :

ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable?

when I type which python on prompt, this is the path : /Users/kimseunghee/anaconda3/bin/python
miss match of python path occured error message, in my guess...
if it's true, what should I do?
thanks.


text:
Q: set value of input field by php variable's value I have a simple php calculator which code is:

        <title>PHP calculator</title>

This is PHP Calculator

            <form method="post" action="phptest.php">
                Type Value 1:
<input type="text" name="value1">

                Type value 2:
<input type="text" name="value2">

                Operator:
<input type="text" name="sign">

                Result:
<input type"text" name="result">

                    <input type="submit" name="submit" value="Submit">

            </form>

<?php
    if(isset($_POST['submit'])){
        $value1=$_POST['value1'];
        $value2=$_POST['value2'];
        $sign=$_POST['sign'];

        if($value1=='') {
            echo "";
            exit();
        }

        if($value2=='') {
            echo "";
            exit();
        }

        if($sign=='+') {
            echo "Your answer is: " , $value1+$value2;
            exit();
        }

        if($sign=='-') {
            echo "Your answer is: " , $value1-$value2;
            exit();
        }

        if($sign=='*') {
            echo "Your answer is: " , $value1*$value2;
            exit();
        }

        if($sign=='/') {
            echo "Your answer is: " , $value1/$value2;
            exit();
        }
    }
?>

All I want to do is that answer should be displayed in the result input field instead of echoing them separately. Please help? I Know it's simple but I am  new in PHP.

A: inside the Form, You can use this code. Replace your variable name (i use $variable)
<input type="text" value="<?php echo (isset($variable))?$variable:'';?>">

A: One way to do it will be to move all the php code above the HTML, copy the result to a variable and then add the result in the <input> tag.
Try this -
<?php
//Adding the php to the top.
if(isset($_POST['submit']))
{
    $value1=$_POST['value1'];
    $value2=$_POST['value2'];
    $sign=$_POST['sign'];
    ...
        //Adding to $result variable
    if($sign=='-') {
      $result = $value1-$value2;
    }
    //Rest of your code...
}
?>

Result:
<input type"text" name="result" value = "<?php echo (isset($result))?$result:'';?>">

A: Try this
<input  class="qtytext-box" type="number"  value= <?php echo  $colll2; ?> >


text:
Q: Multiple htaccess rewrite rule here is my code for .htaccess file
Options -Indexes
RewriteEngine On
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^([a-z0-9]+)$ /profile.php?username=$1 [L]
RewriteRule ^([a-z0-9]+)$ /display.php?page=$1 [L]

For the first one it works correctly and is displaying like this:
www.site.com/user
The second one is not working, normally is displaying like this www.site.com/display.php?page=10. I want to display the page like this www.site.com/article
I tried different things and no result. Please tell me how to make to work with multiple rules. Also please give me an advice on how to use this functionalities in php because I think I done something not really good. My php code for using this rule is:

<a class="button" href="/<?php echo $user_data['username']; ?>"> Profile

It works, but maybe is a better way to make a link to take advantage of htaccess.

A: Options -Indexes
RewriteEngine On

RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^user/([a-z0-9]+)$ /profile.php?username=$1 [N]
RewriteRule ^page/([a-z0-9]+)$ /display.php?page=$1 [L]

use [N] (next) continue adding rules to the same condition
and [L] (last) to identify the last rule

A: The two rules that you have conflict, the patterns used are exactly the same, which means, other than the conditions which only get applied to the first rule, the two rules are completely indistinguishable.
Given this URL:
http://www.site.com/blah

Is "blah" a page or a user? Can't tell, because the regex pattern (^([a-z0-9]+)$) for both rules matches "blah". So, the first one will always get applied no matter what. You need to add something to distinguish between the 2, like including a "user" or "page" in the URL:
http://www.site.com/user/blah
http://www.site.com/page/bleh

And your rules would look like:
Options -Indexes
RewriteEngine On

RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^user/([a-z0-9]+)$ /profile.php?username=$1 [L]

RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^page/([a-z0-9]+)$ /display.php?page=$1 [L]

A: I made it working like this.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /domain/index.php/$1 [C]

#second condition and rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /domain/subdir/index.php/$1 [L]

A: After a LOT of trial and error :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?\/)*?([a-z\.\-]+)(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1$2$4 [NC]

# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [L]
</IfModule>

The tip I received was that [L] denotes the last rule and [N] means continue.


text:
Q: Perform date operations in a query My database table contains start_time (type date time) and duration (type integer, meaning hours).
I want to perform a query finding all records where start_time + duration is before Time.now.
Can I run the add operation and the comparison operation in one query? Or do I first need to read the record, convert it to rails and run the comparison there?
The pseudo-code is as follows:
@surveys = Survey.find_by_sql("select * from surveys where start_time  + duration < :now", :now => Time.now)

A: technically speaking, yes you could do it the way you are doing it, however you have to use datetime functions specific to your database engine (which you didn't specify)

A: if you are using ms-sql-server, convert time into a float, it has a basis of 1.0 = 1 day.
select *
from yourTable
where (CONVERT(FLOAT,start_time)+duration/24.0) < CONVERT(FLOAT,GETDATE())
should get what you want.


text:
Q: Error: 'fields' parameter is required for this method Google API: Google.Apis.Requests.RequestError
The 'fields' parameter is required for this method. [400]
Errors[
Message[The 'fields' parameter is required for this method.] Location[fields - parameter] Reason[required] Domain[global]
]

I'm trying to use the About resource in the Google Drive API (.v3) and receiving an error I can't seem to resolve, that isn't answered in documentation. I've spent a few days researching to no avail and don't quite understand what the error message is telling me. New to using the API. :)
P. S. oRequest.Fields does not exist. Tried that too.
string result = "success";
try {
    About oRequest = driveService.About.Get().Execute();
    result = result + oRequest.User;
} catch (Exception e) {
    result = "Google API: " + e.Message;
}
textBox1.Text = result;
return result;

Updated: The code below is an improvement, but produces "Object reference not set to an instance of an object" on the result line... :\
AboutResource.GetRequest oRequest = driveService.About.Get();
oRequest.Fields = "user:displayName, user:permissionId, user:emailAddress";
About oResponse = oRequest.Execute();
result = oResponse.User.DisplayName + " | " + oResponse.User.PermissionId + " | " + oResponse.User.EmailAddress;

A: You can also request a full User object Google.Apis.Drive.v3.Data.User, if you use "user" as field.
For example:
var request = service.About.Get();
request.Fields = "user";
var user = request.Execute().User;

Instead of getting a full response object Google.Apis.Drive.v3.Data.About

A: Working code:
string result = "success";
try {
    AboutResource.GetRequest oRequest = driveService.About.Get();
    oRequest.Fields = "*";
    About oResponse = oRequest.Execute();
    result = JsonConvert.SerializeObject(oResponse);
} catch (Exception e) {
    result = "Google API: " + e.InnerException;
}
textBox1.Text = result;
return result;


text:
Q: From subprocess.Popen to multiprocessing I got a function that invokes a process using subprocess.Popen in the following way:
    def func():
        ...
        process = subprocess.Popen(substr, shell=True, stdout=subprocess.PIPE)

        timeout = {"value": False}
        timer = Timer(timeout_sec, kill_proc, [process, timeout])
        timer.start()

        for line in process.stdout:
            lines.append(line)

        timer.cancel()
        if timeout["value"] == True:
            return 0
        ...

I call this function from other function using a loop (e.g from range(1,100) ) , how can I make multiple calls to the function with multiprocessing? that each time several processes will run in parallel
The processes doesn't depend on each other, the only constraint is that each process would be 'working' on only one index (e.g no two processes will work on index 1)
Thanks for your help

A: Just add the index to your Popen call and create a worker pool with as many CPU cores you have available.
import multiprocessing

def func(index):
    ....
    process = subprocess.Popen(substr + " --index {}".format(index), shell=True, stdout=subprocess.PIPE)
    ....

if __name__ == '__main__':
    p = multiprocessing.Pool(multiprocessing.cpu_count())
    p.map(func, range(1, 100))


text:
Q: multiple page print formatting using react to print overlaps contents in footer and header of second page Iam using React js  react-to-print If contents are more then footer overlapping in page content

A: I got the solution By using html table and the over lapping content with page footer is solved by the css code It is Mentioned in the code section.

...

...

...

          // CSS
          .header, .header-space,
          .footer, .footer-space {
            height: 100px;
          }
          .header {
            position: fixed;
            top: 0;
          }
          .footer {
            position: fixed;
            bottom: 0;
          }


text:
Q: w3wp crashing out One of our web servers is suffering from random w3wp.exe crashing and after a couple of weeks of debugging i simply cannot figure out why. The only thing that has helped so far is reducing the max worker processes from 15 to 5 however this isn't ideal as we are using a multi-cpu machine in the hopes of reducing the total number of servers needed. We serve a large volume of small requests so parallel processing is a requirement.
As far as I am aware all possible sources of parallel processing collision have been addressed using thread locking.

*

*Win 2008 64Bit SP2

*IIS7

*Dual 3.1Ghz Xeon

*4Gb Ram

First error:
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 70D9CECA (70D40000) with exit code 80131506.
Followed straight away by:
Faulting application w3wp.exe, version 7.0.6002.18005, time stamp 0x49e023cf, faulting module clr.dll, version 4.0.30319.1, time stamp 0x4ba1d9ef, exception code 0xc0000005, fault offset 0x0005ceca, process id 0x%9, application start time 0x%10.
Many Thanks
Edit
Problem eventually solved. It turned out SQL server was unmounting the database straight after every query, so every new query had to wait for it to re-mount. Anyway, telling SQL Server not to do that seems to have solved it, no idea how but it's working so I'm happy

A: Problem eventually solved. It turned out SQL server was unmounting the database straight after every query, so every new query had to wait for it to re-mount. Anyway, telling SQL Server not to do that seems to have solved it, no idea how but it's working so I'm happy

A: Exception code 0xc0000005 generally points to memory access violation. Look for any unsafe component you may be using.

A: You are in for a doozy of a ride. These exceptions are extremely tricky to track down and correct.
The first step is to get the IIS Debug Diagnostic Tool (v1.1). Once you have installed this, you'll need to set up some tracking projects and then attach the debugger to your running processes. Keep in mind, this tool collects a LOT of data (it can be in excess of 1GB of stuff), so combing through it may be a hassle, but it has a good potential of telling you what modules are causing the crash and what modules are interfering.
The reason w3wp.exe is crashing, though, is that an unhandle-able exception is occurring during phases of the transaction that your code/health-monitoring/etc are already completed.
In my own personal case, I found that decoupling the session from the process solved the problem. I never discovered the full reason, but the best guess we had was that the memory requirements for paging were too great for the w3wp.exe to handle all at the same time. Once we decoupled into an external session state server, the problem went away.

A: It may be time to re-think your web-garden. Scott Forsyth has an interesting 11 minute vLog on why webgardens are counterproductive: http://dotnetslackers.com/articles/iis/Why-You-Shouldnt-Use-Web-Gardens-in-IIS-Week-24.aspx
Links to articles he mentions in his VLog:
Tuning recommendations for IIS6 and IIS7 -- read the whole article: http://support.microsoft.com/kb/821268 Further information http://blogs.msdn.com/b/tmarq/archive/2007/07/21/asp-net-thread-usage-on-iis-7-0-and-6-0.aspx
His bottom line is if you have performance problems that are resolved by web gardens—use the web gardens as a great crutch until the underlying performance issue (usually resource contention) is resolved


text:
Q: Magento 2.0.7 - modify search terms I want to modify the search facility so that queries are more strict (narrowed).
For example:
Audi A8 2008 searches for: Audi AND A8 AND 2008 (not: Audi OR A8 OR 2008)
How can I achieve that?


text:
Q: Setting linewidth and dashtype in Gnuplot 5.0 I would like to plot a dashed line with a thickness of 2 in Gnuplot 5.0 in the epslatex terminal. In previous versions I could have accomplished this with something like the following:
plot 'datafile' u 1:2 w l lt 2 lw 2

In 5.0, lt doesn't change the dashtype by default. If I try something similar such as
plot 'datafile' u 1:2 w l dt 2 lw 2

then I will get a dashed line of thickness 1. If in the above expression I change the dashtype to dt 1 (a solid line), then the thickness will be 2 as I want. How can I achieve this?


text:
Q: Thymeleaf - How to add checked attribute to input conditionally As you know, input component has an attribute, checked to whether mark the checkbox as enabled by default or not.
<input type="checkbox" name="mycheckbox" checked="checked"/>

To disable the checkbox by default, the checked exception should be declared. Is it possible to set checked attribute by a flag in Thymeleaf?

A: After digging a little, I found out the solution. There is th:checked attribute for that purpose.
This works:
<input type="checkbox" name="mycheckbox" th:checked="${flag} ? 'checked'">

This fails:
<input type="checkbox" name="mycheckbox" th:checked="${flag} ? 'checked' : ''">

If checked="" is set to input component, it's marked checked. This method is valid for custom attributesth:attr also. Consider following example:

If flag is true, it's replaced with:

If flag is false, it's replaced with:

A: According to the official thymeleaf documentation
http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#fixed-value-boolean-attributes
th:checked is considered as a fixed-value Boolean attribute.
<input type="checkbox" name="active" th:checked="${user.active}" />

Where user.active should be a boolean.
So in your case it should be as Andrea mentioned,
<input type="checkbox" name="mycheckbox" th:checked="${flag}" />

A: You can conditionally add checked attribute to radio input in thymeleaf as below:
 <input type="radio" th:checked="${sales.sales_head.sales_type} == CREDIT" class="sales_type" value="CREDIT"  name="sales_type" >

Here if sales_type is CREDIT the radio will be checked. Otherwise it remains unchecked.

A: Thymeleaf th:checked attribute is fixed-value attribute and it does not toggle the boolean value on checking or unchecking the box.
To toggle the boolean value for backend use, use 'th:field attribute with the syntax: th:field="${object.attribute}"
A working code snippet that i used in my project is given here as exmple:
<form action="#" th:action="@{/editNotificationAlerts}" th:object="${userObject}" method="post">

      Notify At 80
      <input type="checkbox" name="sendEmailNotification" id="sendEmailNotification" th:field="${userObject.sendEmailNotification}">

     <input type="submit" value="Submit"/>

</form>

The toggled value shall be passed to controller on submit action.

A: Neither suggested solutions worked for me.
This one worked:
th:checked="${#strings.equals(param.myRequestParameterXYZ, 'foobar')}"

A: I faced problem for showing checkbox (tick mark on/off) in thymeleaf based on true or false value for the property. I solved it by following way.
Method in controller
@RequestMapping(value = "/test")
public String showCheckbox(Model model) {
 boolean myBooleanVariable = false;
 model.addAttribute("myBooleanVariable", myBooleanVariable);
 return "sample-checkbox";
}

In HTML page:
<input type="checkbox" name="myBooleanVariable" th:checked="${myBooleanVariable}"/>

A: If you have a form that is a model representation, say foo, and bar is a checkbox on your form and property of foo (e.g. foo.bar):
<form th:object="${foo}">
    <input type="checkbox" th:field="*{bar}" th:value="*{bar}"></input>
</form>

...will also work and presents a succinct approach.


text:
Q: Problem installing libigraph1 on Ubuntu 22.04 LTS In the purpose of using tgen, I need to run the following command.
sudo apt-get install cmake libglib2.0-0 libglib2.0-dev libigraph1 libigraph-dev

But I have the following problem

Reading package lists Done
Building dependency tree Done
Reading state information Done
E: Unable to locate package libigraph1

My system is running on Ubuntu 22.04.1 LTS
I searched for way to correct the problem or even workaround but found nothing.
Can someone help me ?

A: 22.04 has libigraph2, not libigraph1
https://packages.ubuntu.com/jammy/libigraph2


text:
Q: Using GCM with Meteor what is the best way to use GCM from google with meteor together?
There are much plugins with some sample code but I don't know what is the best to use. Also a full example of an plugin would be nice. I need to send push messages from the server to the clients. on android and ios. (Want to use it for a chat)
Thanks.

A: Use the raix:push meteor package.

A: Turns out meteor can add a cordova plugin as if it were a package.
meteor add cordova:<plugin id>@https://github.com/<user>/<repo>/tarball/<commit>

So you can use the plugin (https://github.com/uriva/PushPlugin)

A: You can use a Cordova plugin, this is a documentation about Meteor cordova integration which explains how to create meteor apps for Android and iOs, For the GCM push messages you can use meteor packages like raix:push.


text:
Q: Using recursion to draw nested Triangles I'd like to draw a series of nested triangles using recursion.
My faulty code below:
def recursiveTri(x, y, shrink):

    tt.penup()
    tt.setx(x)
    tt.sety(y)

    if x > -10:
        return

    for element in range(3):
        tt.pendown()
        tt.forward(x)
        tt.right(120)

    recursiveTri(x + shrink, y - shrink, shrink)

def main():
    recursiveTri(-300,300,30)

main()

The current code produces the following:

Here is what I mean by nested shapes, except that I would like to draw triangles instead of squares:

A: And now, just for fun, the "better living through stamping" solution:
import turtle

CURSOR_SIZE = 20

def recursiveTri(side, shrink):
    if side > 10:
        turtle.shapesize(side / CURSOR_SIZE)

        turtle.stamp()

        recursiveTri(side - shrink, shrink)

turtle.hideturtle()
turtle.shape('triangle')
turtle.fillcolor('white')

recursiveTri(300, 30)

turtle.dot()
turtle.exitonclick()

This is the default orientation, you can turn it anyway you want before calling recursiveTri().  Stamping is an alternative to drawing that works best with simple geometric patterms like this.

A: The problem is with
tt.forward(x)

Remember that your x is always negative, and the length of a side is not x, but rather -2 * x, if you want to be symmetrical about zero. Since your triangles are nested, you can also compute the initial y from x, given that it is 1/3 of the way up the main bisector. -sqrt(3) / 3 * x therefore puts the center of the circles circumscribed around and inscribed in your triangle at 0, 0.
In fact, it is probably easier to just fix the length of a side, and compute x and y from that:
import turtle as tt
from math import sqrt

def recursiveTri(side, shrink):
    if side < 10: return

    tt.penup()
    tt.goto(-side / 2, sqrt(3) / 6 * side)

    tt.pendown()

    for _ in range(3):
        tt.forward(side)
        tt.right(120)

    recursiveTri(side - shrink, shrink)

tt.penup()
tt.home()
tt.dot()
recursiveTri(300, 30)

In this case, shrink is the total amount removed from each side. If you want it to be the amount you step forward, change the recursive call to recursiveTri(side - 2 * shrink, shrink).
The result (without multiplying shrink by 2) is


text:
Q: $\vec{u}+\vec{v}-\vec{w},\;\vec{u}-\vec{v}+\vec{w},\;-\vec{u}+\vec{v}+\vec{w} $ are linearly independent if and only if $\vec{u},\vec{v},\vec{w}$ are I'm consufed: how can I prove that $$\vec{u} + \vec{v} - \vec{w} , \qquad  \vec{u} - \vec{v} + \vec{w},\qquad - \vec{u} + \vec{v} + \vec{w} $$ are linearly independent vectors if, and only if $\vec{u}$, $\vec{v}$ and $\vec{w}$ are linearly independent?
Ps: sorry for my poor English!

A: Hint:$$a(\vec{u} + \vec{v} - \vec{w})+ b (\vec{u} - \vec{v} + \vec{w})+c( - \vec{u} + \vec{v} + \vec{w})=0\\
\implies(a+b-c)\vec{u}+(a-b+c)\vec{v}+(-a+b+c)\vec{w}=0$$ then we have $$a+b-c=0 ,a-b+c=0 ,-a+b+c=0$$ From which we can easily conclude  $a=b=c=0$.

A: You can use the triple scalar product.  If the triple scalar product is zero, then the vectors are linearly dependent.
You should be able to verify that
$$(u + v - w) \cdot [(u - v + w) \times (-u + v + w)] = C u \cdot (v \times w)$$
for some nonzero constant $C$ (I believe it's $C = -4$). Thus, for the equation to be true, either both sets of vectors are linearly dependent, or neither set is.

A: Call the three vectors $a, b, c$ then you find $2u=a+b, 2v=a+c, 2w=b+c$
If there is a linear dependence in $a, b, c$ the equations translate into a (nontrivial) dependence in $u, v, w$ and vice versa - the two sets of vectors are related by an invertible linear transformation.


text:
Q: How to make Chrome render these characters correctly? I ran into this font weirdness today (in Chrome, on 18.04):

It should look like this (Screenshot from Firefox on the same system):

Here's what I've tried:

*

*Installing a bunch of font extensions in Chrome that accomplish
nothing

*Manually setting Chrome's fonts under Settings --> Appearance to match Firefox's use of system fonts


text:
Q: How to autostart app after install app in android? I am update my app from server, first download from my server then ask for install after I select install then not ask for open or done why?

Explanation of my issue...
I have one app remember not in playstore. It store in my own server.
I set update process for it.

*

*First check version.

*version not match then download from my server.

*After download it auto install.

*At installation time I get install button when I pressed Install button then it install background and current app closed.

*After installation it not give me Open or Done option for open app.

My problem is 5th point.

A:
Copy below code in Menifest.xml file

  <receiver
    android:name="com.example.extraApp.InstallReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.PACKAGE_INSTALL" />
        <action android:name="android.intent.action.PACKAGE_ADDED" />
        <data android:scheme="package"/>
    </intent-filter>
</receiver>

Creat new java class copy below code in it

public class InstallReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
    try {
        Intent new_intent = context.getPackageManager().getLaunchIntentForPackage("com.example.updaterjschtest");
        context.startActivity(new_intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

}


text:
Q: Querying for entities in an aggregate other than the root In the context of DDD, it's always said that a Repository must only query for aggregate roots. Aggregate roots then give access to other entities in the aggregate. However, how are queries to entities within the aggregate modeled?
Suppose the case of an Orders aggregate. Order is the root and have a list of detail Lines, which make reference to a Product (which is the root to another aggregate) and have other attributes like quantity
Now, suppose I need to list or order lines that make reference to an specific product, to generate a report that is used by diverse services, like calculate the average number of items requested by order for a product.
Searching for every Oder, then listing all Lines and selecting the one I'm interested in, sounds impractical. A getLinesByProduct() at the Orders repository sounds more convenient, but will expose Lines out of the Aggregate.
How can I model this query?
Maybe the problem is that I'm querying my Command model and I should have a (denormalized) Query model on which details lines are entities with all the needed information?

A:
Maybe the problem is that I'm querying my Command model and I should
  have a (denormalized) Query model on which details lines are entities
  with all the needed information?

This is exactly right. DDD isn't meant to address query concerns and often retorts with friction due to its various constraints and the constraints imposed by an ORM. Queries and especially reporting should be handled separately. You may use the read-model pattern to support queries that are part of the core application, or use a completely separate reporting system, which operates based on replicated data.


text:
Q: Google developer console - add multiple translations to app store listening I have an app title and description that i translated into multiple languages.
I dont want to update the translations manually because i have many of them.
Is there a way to uoload some kind of json file of all the translations?

A: Using Google Play Console, you can only write your own translations. If you want to automatise the process, you can purchase translations from Google, nothing more.


text:
Q: Data Factory - Copy Activity - Settings for Big XML I have a copy activity build in Azure Data Factory V2, where the datasource is a SFTP folder with several XML files and the Sink is a Azure Postgres Database.
I have successfully used the copy activity for small files (20 MB). But I have 3 major XML
files with 3 GB, 4.5 GB and 18 GB.

*

*For the size of these files which settings should I choose? How many DIU?

*Is the choice of the datasource relevant? This is, using Amazon S3 or Data Blob is better that FTP? (I ask this because is it taking too long for just coping the data).

A: A single copy activity can take advantage of scalable compute resources.
When using Azure integration runtime (IR), you can specify up to 256 data integration units (DIUs) for each copy activity, in a serverless manner.
When using self-hosted IR, you can take either of the following approaches:

*

*Manually scale up the machine.

*Scale out to multiple machines (up to 4 nodes), and a single copy activity will partition its file set across all nodes.
A single copy activity reads from and writes to the data store using multiple threads in parallel.
You can run multiple copy activities in parallel. You can run in parallel by using control flow constructs.
For more information, see the following articles about solution templates:
•   Copy files from multiple containers
•   Migrate data from Amazon S3 to ADLS Gen2
•   Bulk copy with a control table


text:
Q: Tweepy Error: Request exceeds account's current package request limits I'm using the Tweepy API to collect tweets containing specific keywords or hashtags through the standard Academic Research Developer Account. This allows me to collect 10,000,000 tweets per month. I'm trying to collect the tweets from one full calendar date at a time using the full archive search. I've gotten a rate limit error (despite the wait_on_rate_limit flag being set to true) and now this request limit error. I'm not totally sure why or what to change at this point?
consumer_key = '***'
consumer_secret = '***'
access_token = '***'
access_token_secret = '***'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth,wait_on_rate_limit=True)

def get_tweets_withHashTags(query, startdate, enddate, count = 300):
    tweets_hlist= []
    tweets_list= []
    qt=str(query)
    for page in tweepy.Cursor(api.search_full_archive, label='myLabel', query=qt, fromDate=startdate+'0000',toDate=enddate+'0000',maxResults=100).pages(100):
      count = len(page)
      print( "Count of tweets in each page for  " + str(qt) + " : " +  str(count))
      for value in page:
        hashList = value._json["entities"]["hashtags"]
        flag = 0
        for tag in hashList:
            if qt.lower() in tag["text"].lower():
                flag = 1

        if flag==1:
          tweets_hlist.append(value._json)
        tweets_list.append(value._json)

    print("tweets_hash_"+ query +": " + str(len(tweets_hlist)))
    print("tweets_"+ query +": " + str(len(tweets_list)))

    with open("/Users/Victor/Documents/tweetCollection/data/"+startdate +"/" + "query1_hash_" + str(startdate)+ "_" + str(enddate) + "_" +query+'.json', 'w') as outfile:
      json.dump(tweets_hlist, outfile, indent = 2)

    with open("/Users/Victor/Documents/tweetCollection/data/"+startdate +"/"+"query1_Contains_" + str(startdate)+ "_" + str(enddate) + "_" +query+'.json', 'w') as outfile:
      json.dump(tweets_list, outfile, indent = 2)
    return len(tweets_list)

query = ["keyword1","keyword2","keyword3", etc. ]
for value in query:
  get_tweets_withHashTags(value,"20200422","20200423")

A: At the time of writing this answer, Tweepy does not support version 2 of the Twitter API (although there is a Pull Request to add initial support). The api.search_full_archive is actually hitting the v1.1 Premium Full Archive search, which has a lower request and Tweet cap volume limit, so that is why you are seeing an error about exceeding your package.
For the Full Archive / All Tweets endpoint in v2 of the API, you need a Project in the Academic Track, and an App in that Project. You'll need to point your code at the /2/tweets/search/all endpoint. If you are using Python, there is sample code in the TwitterDev repo. This uses the requests library, rather than using a full API library like Tweepy.


text:
Q: How to fill a hydrogen tank using hydrogen bottles? I started building a hydrogen powered rocket, but realized a fatal flaw in my plan: the rocket relies on a hydrogen tank and is not connected to anything. Therefore, there is no way of filling the tank.
I have a bunch of hydrogen bottles though. Is it possible to fill the tank using the bottles? I placed them inside, but that had no effect.

A: I don't think you can fill a hydrogen tank with bottles, the intended use is that you fill the bottles with the tank.  As far as I know, hydrogen and oxygen can only be tranferred using conveyors.  You could consider using another ship to tow your ship to a connector on the base, that's probably the easiest solution.  You could also fill a tank and ferry it between to get your ship off the ground, but you'll need power on both grids to connect them with connectors or merge blocks.

A: If you have a Hydrogen powered rocket, that means you have a Hydrogen engine, right? While having a hydrogen tank on board is ideal, it isn't mandatory, as the engines have their own internal (but small) hydrogen tanks.
Anyway, to fill up a hydrogen tank or fuel a hydrogen engine, it's best to have a O2/H2 generator on board. This will consume Ice and create hydrogen, which is transferred via conveyor belts to the Hydrogen Engine and Tank and will power your rocket. So, on your rocket ship, build one of those O2/H2 generators and get some ice and pop it in. This can act as fuel for your rocket.
Like I said, you can pre-convert the Ice to hydrogen and store it in a tank, but that is optional. I believe your ship's hydrogen engine can depend entirely on the O2/H2 Generator's ice storage.
EDIT: I forgot to mention, hydrogen bottles can only be consumed by your space suit. They are filled by the O2/H2 generator, and the hydrogen tank can also fill the bottles. The hydrogen inside is not usable outside of powering your space suit's jetpack. So unfortunately the bottles won't help you here.
EDIT 2: I should point out that you didn't mention the type of thrusters your rocket uses. If it uses Atmospheric/Ion thrusters, they run on electricity, but if it uses Hydrogen thrusters, then that will run on hydrogen, created with the ice. Consider this, a hydrogen tank might be convenient on board.


text:
Q: SQL- group by to find out whether a value followed by certain other value only I have this below table
App No  EventCode   Event Date
---------------------------------------------------------
1        A          2010-01-01
1        B          2010-01-02
1        C          2010-01-03
1        A          2010-01-10
2        A          2010-01-04
2        C          2010-01-05
2        B          2010-01-06
3        A          2010-01-01
3        D          2010-01-11
4        A          2011-01-01
4        D          2011-01-02
4        C          2011-03-03

I need to find out whether the App No has atleast an event A followed by Event C without having Event B in between. Please advise if this can be done using group by App No. I already have a complex query that groups by app no for calculating various values. I need to integrate this one to that.
The result table should look like
[App No]    [A Immediately Followed By C]   [Max A date]
-------------------------------------------------------
1              0                            2010-01-10
2              1                            2010-01-04
3              0                            2010-01-01
4              1                            2011-01-01

A: I can't remember a way to solve this with aggregating, but you can use LEAD() (which you can use in SQL SERVER 2012+) or ROW_NUMBER() for SQL Server 2008+.
So here is sample data and temporary table.
...after reading through comments added on question, updated version:
CREATE TABLE #table_name (
    app_no int,
    event_code char(1),
    event_date date
);

insert into #table_name
    values
    (1,'A',GETDATE()-100),
    (1,'B',GETDATE()-10),
    (1,'C',GETDATE()-1),
    (2,'A',GETDATE()+10),
    (2,'A',GETDATE()+1),
    (2,'D',GETDATE()),
    (2,'C',GETDATE()+10),
    (3,'A',GETDATE()),
    (3,'C',GETDATE()+100)

select *
    ,ROW_NUMBER() over (partition by 1 order by app_no) as rowid
into #table_name2
from #table_name
where event_code in ('A','B','C')

select org.app_no
    ,org.event_code
    ,case
        when rez2.event_code is not null then 1
        else 0
    end as 'A followed by C'
    ,case
        when rez2.max_date is not null then rez2.max_date
        else org.event_date
    end as 'Max A date'
from #table_name2 org
left outer join (
    select t1.*,d.max_date
    from #table_name2 t1
    inner join #table_name2 t2 on t2.rowid=t1.rowid+1
    left outer join
    (
        select app_no,event_code,MAX(event_date) as max_date
        from #table_name
        group by app_no,event_code
    )d on d.app_no=t1.app_no and d.event_code=t1.event_code
    where t1.event_code='A' and t2.event_code='C'
)rez2 on rez2.app_no=org.app_no and rez2.event_code=org.event_code and rez2.event_date=org.event_date
where org.event_code='A'

drop table #table_name
drop table #table_name2

A: You should use lead() for this with aggregation and filtering:
select appno,
       (case when max(case when eventcode = 'A' and next_ec = 'C' then 1 else 0 end) > 0
             then 1 else 0
        end) as flag,
       max(case when eventcode = 'A' then date end) as max_a_date
from (select t.*,
             lead(eventcode) over (partition by appno order by date) as next_ec
      from t
      where eventcode <> 'B'
     ) t
group by appno;

EDIT:
In SQL Server 2008, you can do:
select appno,
       (case when max(case when eventcode = 'A' and next_ec = 'C' then 1 else 0 end) > 0
             then 1 else 0
        end) as flag,
       max(case when eventcode = 'A' then date end) as max_a_date
from (select t.*,
             t2.eventcode as next_ec
      from t outer apply
           (select top (1) t2.*
            from t t2
            where t2.appno = t.appno and t2.date > t.date
            order by t2.date desc
           ) tnext
      where eventcode <> 'B'
     ) t
group by appno;

A: ;WITH cte
AS
(
    SELECT tn.app_no
        ,tn.event_code
        ,tn.event_date
        ,LEAD(tn.event_code) OVER (PARTITION BY tn.app_no ORDER BY tn.event_date) NextEvent
    FROM <Your_Table> AS tn
)

SELECT app_no
    ,MAX(CASE WHEN cte.NextEvent='C'
              THEN 1
         ELSE 0
     END) AS [A Immediately Followed By C]
    ,MAX(event_date) event_date
FROM cte
WHERE event_code='A'
GROUP BY app_no


text:
Q: Using merge modules and InstallShield to install SQL Server 2008? How can I use merge modules and InstallShield to install SQL Server 2008 on the client system?

A: Installing SQL server via concurrent installs and/or merge modules hasn't been supported in a very long time.  The slammer worm back in 2003 combined with concurrent MSDE installations proved to be a very, very big problem.
You don't mention the InstallShield project type you are using but you probably want to look at Setup Prerequistes.


text:
Q: Mean of multivariate normal in measure theoretic sense For a random variable $X$ on a probability space $(\Omega,F,P)$ we have it's mean $E[X]$ given by $E[X] = \int_{\Omega} X dP$.
If the random variable has a density function given by the multivariate normal distribution with mean $\mu \in \mathbb{R}^n$ and covariance $Q$ (symbolically $N(\mu,Q)$) how do I transform $E[X] = \int_{\Omega} X dP$ into $\int_{\mathbb{R}^n} xN(\mu,Q)dx$ ?

A: The$\newcommand{\II}{1}\newcommand{\RR}{\mathbb{R}}\newcommand{\FF}{\mathcal{F}}$ way I've gone about answering your question involves a bit of a dive into the elementary mechanics of measure theory. Let me preface by giving some intuition. We have the standard way of integrating on $\RR^n$ — namely, with respect to Lebesgue measure $\lambda$. Given that we can integrate all sorts of functions this way, can we develop alternative notions of "integral" on $\RR^n$ using Lebesgue measure as a foundation? In particular, we would like our new integrals to correspond to familiar notions of probability. So what we're really after is a way of integrating with respect to different probability distributions based on Lebesgue measure.
Let's see if we can now flesh this out more technically. Note: Please let me know if there are any parts of this discussion you would like me to clarify, and I'll be happy to explain more.
Measure-theoretic context
Let $(\Omega, \FF, \lambda)$ be a measure space. We present a general technique for generating new probability measures.
Constructing the measure
Let $f : \Omega \to \RR$ be nonnegative (almost surely) such that
$$
\int_\Omega f \ d\lambda = 1.
$$
Define the set function $P : \FF \to \RR$ by
$$
P(E) = \int_\Omega \II_E \cdot f \ d\lambda = \int_E f \ d\lambda,
$$
where $\II_E$ is the indicator function of $E$. Now, since $f$ is nonnegative a.s. it follows that $P(E) \geq 0$ for any $E \in \FF$. Moreover, it is not hard to see that $P$ is, in fact, a probability measure:

*

*By definition of $f$, $P(\Omega) = 1$, and as a consequence, $P(\emptyset) = 0$.

*Let $(E_n) \in \FF$ be a disjoint sequence of measurable sets, and define $E = \bigcup_{n=1}^{\infty} E_n$. Then using the dominated convergence theorem, we have
\begin{align}
P(E) &= \int_{\Omega} \II_E \cdot f \ d\lambda \\
&= \int_{\Omega} \left(\sum_{n=1}^{\infty} \II_{E_n}\right) \cdot f \ d\lambda \\
&= \int_{\Omega} \left(\sum_{n=1}^{\infty} \II_{E_n} \cdot f\right) \ d\lambda \\
&= \sum_{n=1}^{\infty} \int_{\Omega} \II_{E_n} \cdot f \ d\lambda \\
&= \sum_{n=1}^{\infty} P(E_n).
\end{align}
Integration with respect to the measure
Now, we can apply the "standard machine" argument to show that $\int_{\Omega} g \ d P = \int_{\Omega} g \cdot f \ d\lambda$ for any measurable function $g : \Omega \to \RR$.

*

*If $E \in \FF$, then
\begin{align}
\int_{\Omega} \II_E \ dP &= P(E) \\
&= \int_{\Omega} \II_E \cdot f \ d\lambda
\end{align}

*Induction on the above fact implies that $\int_{\Omega} \psi \ d P = \int_{\Omega} \psi \cdot f \ d\lambda$ for any simple function $\psi$.

*The dominated convergence theorem on the above fact implies that $\int_{\Omega} g \ dP = \int_{\Omega} g \cdot f \ d\lambda$ for any nonnegative measurable function $g$.

*The decomposition $g = g^+ - g^-$ and the above fact imply that $\int_{\Omega} g \ dP = \int_{\Omega} g \cdot f \ d\lambda$ holds for any measurable $g$.

Back to the original question
In our case, we are in $\Omega = \RR^n$. We want to construct the probability measure $P$ corresponding to the multivariate normal distribution $N(\mu, Q)$. I tried to be sneaky in the previous section by hinting at how to proceed. If $\lambda$ is Lebesgue measure on $\RR^n$, and we define $f : \RR^n \to \RR$ by
$$
f(x) = \frac{1}{\sqrt{(2\pi)^n \det Q}} \exp\left(-\frac{1}{2} (x - \mu)^T Q^{-1} (x-\mu)\right),
$$
then we have

*

*$f \geq 0$ for all $x \in \RR^n$,

*that
$$
\int_{\RR^n} f \ d\lambda = 1,
$$
and thus there exists a probability measure $P$ on $\RR^n$ such that
$$
P(E) = \int_{\RR^n} \II_E \cdot f \ d\lambda = \int_E f(x) \ dx
$$
where the right hand side is justified by $f$ being continuous and thus reducing to the familiar Riemann integral.
But of course, $f$ was chosen in a special way to correspond to the multivariate normal random variable $X \sim N(\mu, Q)$. It follows, at last, that
\begin{align}
E[X] &= \int_{\RR^n} x \ dP \\
&= \int_{\RR^n} x \cdot f \ d\lambda \\
&= \int_{\RR^n} x \cdot f(x) \ dx.
\end{align}


text:
Q: "Error in drop(y %*% rep(1, nc))" error for cv.glmnet in glmnet R package I have a function to return the auc value for a cv.glmnet model and it often, although not the majority of the time, returns the following error when executing the cv.glmnet function:
Error in drop(y %% rep(1, nc)) :
  error in evaluating the argument 'x' in selecting a method for function 'drop': Error in y %% rep(1, nc) : non-conformable arguments
I've read a little bit about the error and the only suggestion I could find was to use data.matrix() instead of as.matrix(). My function is as follows (where "form" is a formula with my desired variables and "dt" is the data frame):
auc_cvnet <- function(form, dt, standard = F){
      vars = all.vars(form)
      depM = dt[[vars[1]]]
      indM = data.matrix(dt[vars[-1]])
      model = cv.glmnet(indM, depM, family = "binomial", nfolds=3, type.measure="auc", standardize = standard)

      pred = predict(model, indM, type = "response")
      tmp = prediction(pred, depM)
      auc.tmp = performance(tmp, "auc")
      return(as.numeric(auc.tmp@y.values))
    }

I'm implementing this function in another function that iterates through combinations of a few variables to see what combinations of variables work well (it's a pretty brute-force method). Anyway, I printed out the formula for the iteration when the error was thrown and called the function with just that formula and it worked fine. So unfortunately I can't pinpoint what calls throw an error, otherwise I'd try to give more information. The data frame has about 30 rows and there are no errors when I run my code on a larger data set with 110 rows. There also are no NAs in either data set.
Has anyone seen this before or have any thoughts? Thanks!

A: Believe it or not, I actually got this same error today. Since I don't know your dataset, I can't say for sure what it is, but for me, the data I was passing as my y variable (your depM) was a column of all True values. cv.glmnet would only return a valid model if my y variable contained True and False values.
I wish I could explain why cv.glmnet required both True and False, but I have a lack of understanding of the function itself (as it is, I am only adapting code given to me). I just thought I'd post this in case it would give you some help troubleshooting. Good luck!

A: I have the same problem when running cv.glmnet on a dataset with 2 positive cases and 850 negative ones. In one of the cross-validation iterations (where the training and testing sets are randomly sampled) both positive cases are sampled-out of the training set. Thus, glmnet calls lognet, which in turn calls drop(y %*% rep(1, nc)) but y is a vector and not a matrix with at least two columns.
The easiest way I can think of is to specify the foldid parameter to cv.glmnet and make sure that there are at least two classes present in the data in every iteration.


text:
Q: How To Bind the JSON Sub Array Data into Listview in xamarin.forms I want to bind the data coming from JSON to ListView in xamarin.forms. i have made the call and i have parsed the data from JSON. Now i am not able to understand the best way to bind the data in the xamarin.forms that is.
JSON:
[{"Product":"XXX","Origins":[{"Origin":"ORI1","Details":[{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"},{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"}]},{"Origin":"ORI2","Details":[{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"},{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"}]}]},{"Product":"PQR","Origins":[{"Origin":"ABC","Details":[{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"},{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"}]},{"Origin":"PPP","Details":[{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"},{"Seller":"Name","Seller_Rate":"256","Saller_QTY":"20","Buyer":"Name","Buyer_Rate":"256","Buyer_QTY":"20"}]}]}]

this JSON has Product,Origins,Details such as product has many Origins and origins has different seller,buyer and etc.
my source is- my object class:
public class Details
{
    public string Seller { get; set; }
    public string Seller_Rate { get; set; }
    public string Saller_QTY { get; set; }
    public string Buyer { get; set; }
    public string Buyer_Rate { get; set; }
    public string Buyer_QTY { get; set; }
}
public class Origins
{
    public string Origin { get; set; }
    public List<Details> Details { get; set; }
}
public class Products
{
    public List<Origins> Origins { get; set; }
    public string PRODUCT { get; set; }
}

I have Parsed it inside this method to test result:
public async Task<List<Products>> getProductsJson()
    {
        List<Products> root=null;
        Log.Debug("Login", "in get products");
        string responsejson = await client.GetStringAsync(Constants.url_getproducts);
        Log.Debug("Login", responsejson);
        try
        {
            root = JsonConvert.DeserializeObject<List<Products>>(responsejson);
            Log.Debug("Login",Convert.ToString(root.Count));
            for(int i=0;i<root.Count;i++)
            {
                Log.Debug("Login", "=============================");
                Log.Debug("Login", root[i].PRODUCT);
                for(int j=0;j<root[i].Origins.Count;j++)
                {
                    Log.Debug("Login","   "+root[i].Origins[j].Origin);
                    for(int k=0;k<root[i].Origins[j].Details.Count;k++)
                    {
                        Log.Debug("Login", "       Buy " + root[i].Origins[j].Details[k].Buyer+" BUY_QTY "+ root[i].Origins[j].Details[k].Buyer_QTY);

                    }
                }
                Log.Debug("Login", "=============================");
            }
            //Log.Debug("Login", root[0].PRODUCT);
            //Log.Debug("Login", root[0].Origins[0].Origin);
           // Log.Debug("Login", root[0].Origins[0].Details[0].Seller);
        }
        catch(Exception e)
        {
            Log.Debug("Login", e.Message);
            Log.Debug("Login", e.Source);
        }
        return root;
    }

As i have printed the log here, this log prints properly up to here every thing is working fine. i have called this method on the xamal page as:
async void GetProduct()
    {
        List<Products> result = await App.RestService.getProductsJson();
        list_data.ItemsSource = result;
    }

here i have set the result to listview.
On Design page:
<ContentPage.Content>
    <StackLayout VerticalOptions="FillAndExpand">
        <RelativeLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
        <StackLayout x:Name="logoStack">
            <Label x:Name="lbl_noInternet" HorizontalTextAlignment="Center" TextColor="Red" BackgroundColor="Black" />
        </StackLayout>
        <ListView x:Name="list_data"  HasUnevenRows="True">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <!--<TextCell Text="{Binding Topic}" TextColor="Purple" Detail="{Binding Description}" DetailColor="Black"/>-->
                    <!--<ImageCell Text="{Binding Topic}" TextColor="Purple" Detail="{Binding Description}" DetailColor="Black" ImageSource="{Binding ImageSource}" />-->
                    <ViewCell>
                        <ViewCell.View>
                            <StackLayout Spacing="5" Orientation="Horizontal" HorizontalOptions="StartAndExpand" >
                                <Label Text="{Binding PRODUCT}" FontSize="20" FontAttributes="Bold" />
                                    <Label   Text="{Binding Origin}" FontSize="20" HorizontalOptions="End" HorizontalTextAlignment="End" />
                                </StackLayout>
                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        </RelativeLayout>
    </StackLayout>
</ContentPage.Content>

Now. my code is working fine that means no any error but only PRODUCT is displayed, Origin value is not showing on label.
Now i have 3 questions.

*

*as origin is the sub array how to bind it to the label inside listview?

*which is the best way to achieve this. this same approach or to bind it programmatically?

3.if we need to bind it programmatically means dynamically from .cs file how to do that??


text:
Q: What is the origin of the use of "hate" with the preposition "on"?
Possible Duplicate:
Origin of "hating on"

Recently I've noticed an increasing use of the phrase to hate on [someone].
From what I can tell, the addition of on implies a jealousy or dislike for another person's talent or status. It doesn't appear that to hate and to hate on are directly interchangeable; one wouldn't say "I really hate on the taste of fish" for example.
The verb to hate was previously sufficient as far as I was aware, so where has the addition of the preposition on come from? My guess is America, but does anyone know where and when this originated?

A: This usage seems to have started, or at least become more prominent, in the last 5-10 years. My guess is that, for example, "I really hate on the Simpsons!" is something akin to saying "I shower my ill will / shit [up]on the Simpsons!".
"Street-cred" slang commonly includes non-standard usage for prepositions, alongside assigning different meanings to existing words, and coining neologisms. I very much doubt this particular usage will have a single, citable, original "first use".
EDIT: Although I've now voted to close, this 1978 reference seems to be earlier than anything answered to the original. The origins lie in (probably, disadvantaged/marginalised) American black communities, considerably earlier than the expression's adoption by "hip-hop" subculture.


text:
Q: Frobenius element of unramified extension Let $L/F$ be an unramified extension of $p$-adic fields. Then it is Galois and $Gal(L/F)$ is cyclic, generated by an element $\sigma$ called the Frobenius element. Now, in the book I'm reading, the author states "The latter is characterized by the congruence $\sigma(x)\equiv x^q\mod\mathfrak{P}$ for all $x\in\mathcal{O}_L$, where $\mathfrak{P}$ is the maximal ideal of $\mathcal{O}_L$ and $q$ is the size of the residue field $\mathbb{L}=\mathcal{O}_L/\mathfrak{P}$."
I know that since the extension is unramified that $Gal(L/F)\cong Gal(\mathbb{L}/\mathbb{F})$ where $\mathbb{F}$ is the residue field for $F$. My question is shouldn't we have $p$ instead of $q$ in the above paragraph defining the Frobenius element? Don't we have $x^q=x$ in general?


text:
Q: Jquery localscroll and hashtags I'm using localscroll jquery plugin, and I wanted a safe option when someone enter's url with hashtag at the end of url, so I wrote these lines of code:
        if (window.location.hash == "#home") {
      $('#menu-main a').removeClass('sel');
      $("#a1").addClass("sel");
      $('#about,#collections,#contact,#brides,#gallery').animate({ opacity: 0 }, 0);
    } else if (window.location.hash == "#about") {
      $('#menu-main a').removeClass('sel');
      $("#a2").addClass("sel");
      $('#home,#collections,#contact,#brides,#gallery').animate({ opacity: 0 }, 0);
    } else if (window.location.hash == "#collections") {
      $('#menu-main a').removeClass('sel');
      $("#a3").addClass("sel");
      $('#about, #home, #contact, #brides, #gallery').animate({ opacity: 0 }, 0);
    } else if (window.location.hash == "#brides") {
      $('#menu-main a').removeClass('sel');
      $("#a4").addClass("sel");
      $('#about, #collections, #contact, #home, #gallery').animate({ opacity: 0 }, 0);
    } else if (window.location.hash == "#gallery") {
      $('#menu-main a').removeClass('sel');
      $("#a5").addClass("sel");
      $('#about, #collections, #home, #contact, #brides').animate({ opacity: 0 }, 0);
    } else if (window.location.hash == "#contact") {
      $('#menu-main a').removeClass('sel');
      $("#a6").addClass("sel");
      $('#about, #collections, #home, #brides, #gallery').animate({ opacity: 0 }, 0);
    } else if (window.location.hash == "") {
      $('#menu-main a').removeClass('sel');
      $("#a1").addClass("sel");
      $('#about,#collections,#contact,#brides,#gallery').animate({ opacity: 0 }, 0);
    }

But, there definately must be better solution for this, some foreach function maybe, and since I'm not really a jquery guru, I'd like to ask for your advice ...
Thanks, Mart

A: I solved it, if anyone is interested in my solution:
var hash = window.location.hash;
var cats = {};

cats['#home'] = 'a1';
cats['#about'] = 'a2';
cats['#collections'] = 'a3';
cats['#brides'] = 'a4';
cats['#gallery'] = 'a5';
cats['#contact'] = 'a6';
cats[''] = 'a1';

$("#menu-main a").removeClass('sel');
$("#" + cats[hash]).addClass("sel");

if (!hash){
  $('#about,#collections,#contact,#brides,#gallery').animate({ opacity: 0 }, 0);
} else {
  $.each(cats, function(key, value) {
    if (key != hash){
        $(key).animate({ opacity: 0 }, 0);
    }
  });
}

A: function makeSelect(){
var hash = window.location.hash;
$("#menu-main a").removeClass('sel');
$("#"+hash).addClass("sel");
$('#about,#collections,#contact,#brides,#gallery').animate({ opacity: 0 }, 0);
}

you can use something like this, if you can change object names to hash values, or make an hash-map for them


text:
Q: Footer is not responsive I am trying to make my app responsive, but I have a problem because Footer is not responsive.
I read this link but this didn't worked for me.

            @include('includes.top')

            @include('includes.left')

            @yield('content')

            @include('includes.footer')

styles.css
html,
body { height: 100%; }
body {
  display: table;
  width: 100%;
}
#footer {
  display: table-row;
  height: 1px;
}
#content { height: 100%; }

A: The code in the link you posted (in the comments) does not implement it the way you do ..
Your html should be (according to that article)

            @include('includes.top')

            @include('includes.left')

            @yield('content')

        @include('includes.footer')

and your css
html,
body { height: 100%; }
body {
  display: table;
  width: 100%;
}
#footer {
  display: table-row;
  height: 1px;
}
#wrap{ display: table-row; height: 100%; }

And a demo of this code at http://jsfiddle.net/LFeYA/


text:
Q: Can I make git bisect display shortened commit SHAs? Running git bisect generates output like this after each bisection:
Bisecting: 22 revisions left to test after this (roughly 5 steps)
[123fedacc728b985d4f8d010e2a69dcbdcbf3e8e] use binascii module for hex/binary conversions

Can I make it use partial commit name prefixes, similar to those used in git log --abbrev-commit? Something like this:
Bisecting: 22 revisions left to test after this (roughly 5 steps)
[123feda] use binascii module for hex/binary conversions

A: No. The source for git bisect allots memory for a full hash and a terminator. It'd probably be easy to patch in a flag, however. You might try sending one to the git list if you think it's a worthy addition to git.


text:
Q: Use google plus api to insert activity in page I need that from my website admin screen to be able to post to my page stream. Using the Google Plus API I want to be able to add activities and share a URL on my page stream. However what is happening is that the post appears on my profile page rather than the page created under this profile. Below is a snippet of my code in Python. Instead of 'me' I tried using the page_id but it gives me an error wrong credentials. I would appreciate some help on this as I am stuck and have been trying different things these last 5 days and nothing works.
After OAuth2 success I do the following:
http = httplib2.Http()
http = credentials.authorize(http)

service_plus = build('plus', 'v1', http=http)
service_plus_domain = build('plusDomains', 'v1', http=http)

activity = {
    'object': {
        'url': 'https://developers.google.com/+/web/snippet/examples/photo',
    },
    'access': {
       'items': [{
           'type': 'public'
       }],
       'domainRestricted': True
    }
 }

google_request = service_plus_domain.activities().insert(
    userId='me',  #Trying page_id here gives invalid credentials
    body=activity
)

result = google_request.execute()
print result

A: Neither the Plus API nor the Plus Domains API will let you post to a Page. The Domains API will only let you post as a User Profile, and then only in some limited ways.
To post to a page, you need to either use the Plus Page API (which is limited to selected partners) or work with one of the partners who have access such as HootSuite.


text:
Q: Hide folder from Windows There are many Folder hiding solutions. Check out this blog-
https://www.guru99.com/file-folder-locker-windows.html
Ignoring a few encryptors, most of them work by hiding the folder from Windows. You just have to select a folder and it will hide it. I suspected that they are just hiding and not encrypting because they can hide GBs in a second.
And sure enough, when I booted into any other OS (Linux Mint here), I could clearly see the folder at the exact same location and I could fully access my data [which also goes on to show how insecure they are] .
The folder simply cannot be accessed using Windows, however hard you try (even in the Safe Mode). Does anyone know how they are doing that? Also can we do that using an inbuilt cmd command or a utility like Nirosoft?

A: The method for blocking access is probably by trafficking the permissions on the
folder.
You may probably achieve similar results by using a combination of the following
commands:

*

*attrib

*cacls

*icacls

*takeown


text:
Q: MySQL query to expand a bitfield into individual named columns? I have the following problem
i have two tables the first table contains a string like 01001101110 each digit represents a skill mentioned in table two.
So the first digit shows a zero that means that person does not have the skill with id 1. the second digit shows that person does have skill with id 2
table 1:
|-----------|-----------------------------|
|  name  |             skillset            |
|-----------|-----------------------------|
|   John  | 01001101110             |
|-----------|-----------------------------|

table 2:
|-----------|-----------------------------|
|    id       |              skill              |
|-----------|-----------------------------|
|       1    | polite                         |
|-----------|-----------------------------|
|      2     | easy going                 |
|-----------|-----------------------------|

now i need to create i query with outcome
|-----------|-------------------|------------------|
|  name  |      polite        |   easy going  |
|-----------|-------------------|------------------|
|  John   |          0            |            1        |
|-----------|-------------------|------------------|

A: I have seen many stories like this, "a former coder implemented this and now we're stuck with it." I imagine there's just one individual coder, who moves from company to company, implementing things in the most clever and least maintainable manner possible, and then quickly moving on to his next victim company.
I also find it ironic that someone would implement a bitfield in a varchar, because they end up using a full byte (8 bits) to store each 1 or 0. :facepalm:
Anyway, to solve your task you have to use a dynamic SQL query.
In fact, any pivot table query requires dynamic SQL, because you don't know the number of columns until you inspect the table that lists your skills, but you can't run a query without first knowing the number of columns. So you need to run at least two queries.
Here's the test data:
create table table1 (name varchar(20), skillset varchar(200));

insert into table1 values ('John', '01001101110110');

create table table2 (id int, skill varchar(20));

insert into table2 values
    (1, 'polite'),
    (2, 'easy going'),
    (3, 'trustworthy'),
    (4, 'loyal'),
    (5, 'helpful'),
    (6, 'friendly'),
    (7, 'courteous'),
    (8, 'kind'),
    (9, 'obedient'),
    (10, 'cheerful'),
    (11, 'thrifty'),
    (12, 'brave'),
    (13, 'clean'),
    (14, 'reverent');

Now is a clever query that produces the SQL for a dynamic query, by appending one field in the select-list for each entry in your skills table. The key is MySQL's GROUP_CONCAT() function.
select concat(
    'select name,',
    group_concat(concat(' mid(skillset,',id,',1) as `',skill,'`')),
    ' from table1;') as _sql
from table2;

The output of the above query is the following:
select name,
 mid(skillset,1,1) as `polite`,
 mid(skillset,2,1) as `easy going`,
 mid(skillset,3,1) as `trustworthy`,
 mid(skillset,4,1) as `loyal`,
 mid(skillset,5,1) as `helpful`,
 mid(skillset,6,1) as `friendly`,
 mid(skillset,7,1) as `courteous`,
 mid(skillset,8,1) as `kind`,
 mid(skillset,9,1) as `obedient`,
 mid(skillset,10,1) as `cheerful`,
 mid(skillset,11,1) as `thrifty`,
 mid(skillset,12,1) as `brave`,
 mid(skillset,13,1) as `clean`,
 mid(skillset,14,1) as `reverent`
from table1;

I made sure to delimit the column aliases with back-ticks, just in case one of the skill names contains special characters or whitespace or conflicts with an SQL reserved word.
Then this can be run as a second query, which has the following result:
+------+--------+------------+-------------+-------+---------+----------+-----------+------+----------+----------+---------+-------+-------+----------+
| name | polite | easy going | trustworthy | loyal | helpful | friendly | courteous | kind | obedient | cheerful | thrifty | brave | clean | reverent |
+------+--------+------------+-------------+-------+---------+----------+-----------+------+----------+----------+---------+-------+-------+----------+
| John | 0      | 1          | 0           | 0     | 1       | 1        | 0         | 1    | 1        | 1        | 0       | 1     | 1     | 0        |
+------+--------+------------+-------------+-------+---------+----------+-----------+------+----------+----------+---------+-------+-------+----------+

A: Make it a SET datatype; this gives you the best of both worlds -- storage of any combination of up to 64 pre-defined options in bits, yet read/write as strings.
The simple SELECT skillset FROM tbl WHERE name = 'John' would come back as the string
"easy going,helpful,friendly,kind"  (etc)

Reference


text:
Q: How to base64 string save as in (PDF , doc, xls , png.. ) in jquery , javascript , HTML5 I m getting base64 string from server and I want to save file in my all browser(IE,FF , chrome).
suppose I am getting PDF base64 string then how to save in brwsore?
Similarly , Image ,doc base64 string  then how to save ?

A: var myBaseString = charUri; // charURI is base64 encoded data of png image (data:image/png;base64,asP......)
var a = document.createElement('a');
a.href = myBaseString;
a.download = "chart.png";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);


text:
Q: Using ant-design-vue Notification I cannot get ant-design-vue Notification (or Message) to work in my project, which I created with vue-cli 3. I am using the examples from https://vue.ant.design/components/notification/ but the Notifications do not appear.
After doing some research on the ant-design-vue issues on GitHub, I believe this may be due to a defect in ant-design-vue itself. It does not appear to support Notification messages when a global render function is called, as is created by vue-cli 3, like this:

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

I think that this is a defect because of this issue:
https://github.com/vueComponent/ant-design-vue/issues/554
I believe that ant-design-vue Notification would work if I used this style to create my Vue object:

new Vue({
  el: '#app',
  components: { App },
  template: '<App/>'
})

However, when I change my main.js to use this second style of creating the Vue component, nothing renders in my SPA. So I'm stuck - I can't use ant-design-vue Notification because I don't think it works with render: h => h(App), nor can I switch the way I create the Vue app to the way I think works with Notification.
Help is appreciated - I'm new to Javascript, Vue, and Ant Design.

A: The answer to this question is here:
https://forum.vuejs.org/t/using-ant-design-vue-notification/66265/8


text:
Q: Unknown label type error while I'm trying to fit x_train and y_train to Perceptron and MLPClassifier using Sklearn This is a snippet of my code, I can't add more for some reason but,
per = Perceptron()

per.fit(x_train,y_train)

and this is the following error
ValueError: Unknown label type: (array([0.055, 0.09 , 0.095, 0.1  , 0.105, 0.11 , 0.115, 0.12 , 0.125,
   0.13 , 0.135, 0.14 , 0.145, 0.15 , 0.155, 0.16 , 0.165, 0.17 ,
   0.175, 0.18 , 0.185, 0.19 , 0.195, 0.2  , 0.205, 0.21 , 0.215,
   0.22 , 0.225, 0.23 , 0.235, 0.24 , 0.245, 0.25 , 0.255, 0.26 ,
   0.265, 0.27 , 0.275, 0.28 , 0.285, 0.29 , 0.295, 0.3  , 0.305,
   0.31 , 0.315, 0.32 , 0.325, 0.33 , 0.335, 0.34 , 0.345, 0.35 ,
   0.355, 0.36 , 0.365, 0.37 , 0.375, 0.38 , 0.385, 0.39 , 0.395,
   0.4  , 0.405, 0.41 , 0.415, 0.42 , 0.425, 0.43 , 0.435, 0.44 ,
   0.445, 0.45 , 0.455, 0.46 , 0.465, 0.47 , 0.475, 0.48 , 0.485,
   0.49 , 0.495, 0.5  , 0.505, 0.51 , 0.515, 0.52 , 0.525, 0.53 ,
   0.535, 0.54 , 0.545, 0.55 , 0.555, 0.56 , 0.565, 0.57 , 0.575,
   0.58 , 0.585, 0.59 , 0.595, 0.6  , 0.605, 0.61 , 0.62 , 0.625,
   0.63 , 0.65 ]),)

I really don't know how to fix this "Unknown label type: array", I've been researching for hours on how to fix this error. I'm pretty new to all of this, so apologies if there is a lot of error in the code.

A: I think there was something wrong with the file I was loading, I changed my csv file and now per.fit() works!