text:
Q: couldn't resolve error: java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW- elasticsearch java client api I'm trying to implement an autocomplete feature using elaticsearch 6.2.4 and its java rest client API on my maven  web application which is running under glassfish 4.1
I am facing the below error:

java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW

I have read some about it and made changes accordingly essentially on project dependencies( inside pom.xml) because all responses that I met, turned around conflict on Jackson library version.
here is the code that I tried to run:
RestHighLevelClient client = new RestHighLevelClient(
        RestClient.builder(
                new HttpHost("localhost", 9200, "http")
                ));

         SearchRequest searchRequest = new SearchRequest( "trustiser_suggest" );
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        String[] includeFields = new String[] {"member_mname","member_pic","member_fname","member_lname","topic_label"};
        String[] excludeFields = null;
        searchSourceBuilder.fetchSource(includeFields, excludeFields);
 Map<String, List<? extends ToXContent>> contextMap = new HashMap<>();
    contextMap.put("account_state", Collections.singletonList(CategoryQueryContext.builder().setCategory("active").build()));
        SuggestionBuilder termSuggestionBuilder = SuggestBuilders.completionSuggestion("suggest_member" )
                .prefix( str )
                .contexts(contextMap);
        SuggestBuilder suggestBuilder = new SuggestBuilder();
        suggestBuilder.addSuggestion( "suggest-mem", termSuggestionBuilder );

         SuggestionBuilder termSuggestionBuilder1 = SuggestBuilders.completionSuggestion("suggest_topic" )
                .prefix( str )
                .skipDuplicates(true);
        suggestBuilder.addSuggestion( "suggest-top", termSuggestionBuilder1 );
        searchSourceBuilder.suggest( suggestBuilder);

        searchRequest.source( searchSourceBuilder );
        SearchResponse searchResponse = null;

            searchResponse = client.search( searchRequest );

        System.out.println("AutoCompleteMemberTopicccccccccccccccc: "+searchResponse.toString());

my curent pom.xml:
 <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
 <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.10</version>

</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>6.2.4</version>

</dependency>
<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-client -->
<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>elasticsearch-rest-client</artifactId>
    <version>6.2.4</version>
</dependency>

        <dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>elasticsearch-rest-high-level-client</artifactId>
    <version>6.2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1.1</version>
</dependency>

    </dependencies>

and the error:
java.lang.NoSuchFieldError: FAIL_ON_SYMBOL_HASH_OVERFLOW
    at org.elasticsearch.common.xcontent.json.JsonXContent.<clinit>(JsonXContent.java:57)
    at org.elasticsearch.common.xcontent.XContentFactory.contentBuilder(XContentFactory.java:121)
    at org.elasticsearch.search.suggest.completion.CompletionSuggestionBuilder.contexts(CompletionSuggestionBuilder.java:203)
    at com.trustiser.business.ElasticSearchDao1.AutoCompleteMemberTopic(ElasticSearchDao1.java:50)
    at com.trustiser.service.SearchEngineService.searchMemberCategory(SearchEngineService.java:33)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)

and finally the maven tree of the web project
--- maven-dependency-plugin:2.8:tree (default-cli) @ elasticmavenprojet ---
com.trustiser:elasticmavenprojet:war:1.0-SNAPSHOT
+- javax:javaee-web-api:jar:7.0:provided
+- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
+- org.elasticsearch:elasticsearch:jar:6.2.4:compile
|  +- org.elasticsearch:elasticsearch-core:jar:6.2.4:compile
|  +- org.apache.lucene:lucene-core:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-analyzers-common:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-backward-codecs:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-grouping:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-highlighter:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-join:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-memory:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-misc:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-queries:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-queryparser:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-sandbox:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-spatial:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-spatial-extras:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-spatial3d:jar:7.2.1:compile
|  +- org.apache.lucene:lucene-suggest:jar:7.2.1:compile
|  +- org.elasticsearch:securesm:jar:1.2:compile
|  +- org.elasticsearch:elasticsearch-cli:jar:6.2.4:compile
|  |  \- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile
|  +- com.carrotsearch:hppc:jar:0.7.1:compile
|  +- joda-time:joda-time:jar:2.9.9:compile
|  +- org.yaml:snakeyaml:jar:1.17:compile
|  +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.8.10:compile
|  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.10:compile
|  +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.8.10:compile
|  +- com.tdunning:t-digest:jar:3.0:compile
|  +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile
|  +- org.apache.logging.log4j:log4j-api:jar:2.9.1:compile
|  \- org.elasticsearch:jna:jar:4.5.1:compile
+- org.elasticsearch.client:elasticsearch-rest-client:jar:6.2.4:compile
|  +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile
|  +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile
|  +- org.apache.httpcomponents:httpasyncclient:jar:4.1.2:compile
|  +- org.apache.httpcomponents:httpcore-nio:jar:4.4.5:compile
|  +- commons-codec:commons-codec:jar:1.10:compile
|  \- commons-logging:commons-logging:jar:1.1.3:compile
+- org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:6.2.4:compile
|  +- org.elasticsearch.plugin:parent-join-client:jar:6.2.4:compile
|  |  +- org.locationtech.spatial4j:spatial4j:jar:0.6:compile
|  |  +- com.vividsolutions:jts:jar:1.13:compile
|  |  \- org.apache.logging.log4j:log4j-core:jar:2.9.1:compile
|  +- org.elasticsearch.plugin:aggs-matrix-stats-client:jar:6.2.4:compile
|  \- org.elasticsearch.plugin:rank-eval-client:jar:6.2.4:compile
\- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
   \- junit:junit:jar:4.10:compile
      \- org.hamcrest:hamcrest-core:jar:1.1:compile

Thank you :-)

A: You are right, this is an error message thrown by the Jackson library which elasticsearch uses for JSON serialization and deserialization And caused by having a conflicting version of Jackson library.
I can see you are explicitly including a Jackson library by defining below dependency in your pom.xml.
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.10</version>
</dependency>

And by looking at your mvn tree, I see elasticsearch is also bringing some Jackson libraries. Can you try below 2 options?
Option 1. Remove the explicit Jackson dependency which I just mentioned, and do a clean build. (Note this is less likely to work :), but there is no harm to try.
option 2. I looked at my project and I am using the elasticsearch 7.1 and using the below Jackson core library.
com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
If you can't figure out which is the compatible jackson core version for your es version, then you can just upgrade to elasticsearch 7.1 and use the Jackson version I provided and it should work.

A: after several days of work and research, I finally find the solution of my problem.
The problem is caused by a version conflict between dependencies of ES hight level client api and those existing on  glassfish modules ( Jackson-core is one of them).
Because replacing jars of glassfish module directory is a risky practice, the solution that I applied is to shade the ES dependency and rename there packages using maven shade plugin.
These are followed steps to implement the solution:

*

*Create the shaded dependency of ES:

*

*Create a java maven project;

*The Pom.xml of the project:

 <modelVersion>4.0.0</modelVersion>
    <groupId>com.trustiser</groupId>
    <artifactId>elasticshade</artifactId>
    <version>6.2.4</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>6.2.4</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>

                            <relocations>
                                <relocation>
                                    <pattern>org.elasticsearch</pattern>
                                    <shadedPattern>hidden.org.elasticsearch</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.apache.lucene</pattern>
                                    <shadedPattern>hidden.org.apache.lucene</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.fasterxml</pattern>
                                    <shadedPattern>hidden.com.fasterxml</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.apache.httpcomponents</pattern>
                                    <shadedPattern>hidden.org.apache.httpcomponents</shadedPattern>
                                </relocation>

                                <relocation>
                                    <pattern>org.hdrhistogram</pattern>
                                    <shadedPattern>hidden.org.hdrhistogram</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.slf4j</pattern>
                                    <shadedPattern>hidden.org.slf4j</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.yaml</pattern>
                                    <shadedPattern>hidden.org.yaml</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>net.sf.jopt-simple</pattern>
                                    <shadedPattern>hidden.net.sf.jopt-simple</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>joda-time</pattern>
                                    <shadedPattern>hidden.joda-time</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>commons-logging</pattern>
                                    <shadedPattern>hidden.commons-logging</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>commons-codec</pattern>
                                    <shadedPattern>hidden.commons-codec</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.tdunning</pattern>
                                    <shadedPattern>hidden.com.tdunning</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.github.spullara</pattern>
                                    <shadedPattern>hidden.com.github.spullara</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.carrotsearch</pattern>
                                    <shadedPattern>hidden.com.carrotsearch</shadedPattern>
                                </relocation>
                            </relocations>
                            <shadedArtifactAttached>false</shadedArtifactAttached>
                            <artifactSet>
                                <includes>
                                    <include>*:*</include>
                                </includes>
                            </artifactSet>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>

                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.PluginXmlResourceTransformer"/>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.trustiser.elasticshade.App</mainClass>
                                </transformer>

                            </transformers>

                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>

*

*Run clean, build and maven package goal;

*The jar will be created on "elastic shade project location" \target

*Add the shaded dependency on maven local repository:

*

*Access to m2 repository from the cmd, the default location is C:\Users\"user".m2\repository , and execute the following command to istall the created dependency:   mvn install:install-file -Dfile="location of the shaded elastic dependency".jar  -DgroupId="shaded dependency groupe id" -DartifactId="shaded dependency acrifact id" -Dversion="version of the shaded dependency" -Dpackaging=jar

*Add the shaded dependency of elasticsearch on the pom.xml of my  maven java web application instead of using elasticsearch hight level rest api directly

*To avoid log4j error I add a log4j2.properties file on the resources directory of my java web app :

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%m%n

rootLogger.level = info
rootLogger.appenderRef.console.ref = console


text:
Q: Java -  is not abstract and does not override abstract method next() in State I got this error message after complied the code

< anonymous State$1> is not abstract and does not override abstract
  method next in State.

States.java
enum States implements State {
Init { //error message here
        @Override
        public State next(Input word) {
            switch(word.read()) {
                case 'a': return A;
                default: return FinalStates.Failed;
            }
        }
    },
...

State.java
interface State {
    public State next();
}

A: The interface's declaration and the enum's definition have different signatures. The interface doesn't have the word parameter.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I initialize this custom class that inherits from UIButton? I can't figure out how I'm supposed to initialize this custom class, the code isn't mine and I'm fairly new to Obj-C, so I'm slow on the uptake.
PFTintedButton.h
#import <UIKit/UIKit.h>
@class CALayer;

typedef enum
{
    PFTintedButtonRenderTypeStandard,
    PFTintedButtonRenderTypeCandy,
    PFTintedButtonRenderTypeOpal,
} PFTintedButtonRenderType;

@interface PFTintedButton : UIButton
{
@private
    UIColor * tint;
    CGFloat cornerRadius;
    PFTintedButtonRenderType renderType;

    UIImage * stretchImage;
    CALayer * glowLayer;

    UILabel * subLabel;

    BOOL customShadow;
    BOOL customTitleColor;
}

@property( nonatomic, retain ) UIColor * tint;
@property( nonatomic, assign ) CGFloat cornerRadius;
@property( nonatomic, assign ) PFTintedButtonRenderType renderType;
@property( nonatomic, readonly ) UILabel * subLabel;

@end

PFTintedButton.m excerpt
#import "PFTintedButton.h"
#import "PFDrawTools.h"
#import "UIColor+PFExtensions.h"
#import <QuartzCore/QuartzCore.h>

#define glowRadius      30

@interface PFTintedButton()
-(void) createBackgroundImage;
-(void) createGlowLayer;
@end

@implementation PFTintedButton

-(void) dealloc
{
    SafeRelease( tint );
    SafeRelease( stretchImage );
    SafeRelease( subLabel );
    SafeRelease( glowLayer );

    [NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(createGlowLayer) object: nil];
    [NSObject cancelPreviousPerformRequestsWithTarget: self selector: @selector(renderGlowLayerOnMainThread) object: nil];

    [super dealloc];
}

-(void) initCommon
{
    cornerRadius = 6;
}

-(id) initWithFrame: (CGRect) frame
{
    if( self = [super initWithFrame: frame] )
    {
        [self initCommon];
    }

    return self;
}

-(id) initWithCoder: (NSCoder *) coder
{
    if( self = [super initWithCoder: coder] )
    {
        // this is such a hack but there's no other way to determine if the title label's settings
        // have been modified in IB.
        NSDictionary * dic = [coder decodeObjectForKey: @"UIButtonStatefulContent"];
        NSObject * st = [dic objectForKey: [NSNumber numberWithInt: UIControlStateNormal]];
        NSString * bc = [st description];

        customTitleColor = [bc rangeOfString: @"TitleColor = UIDeviceRGBColorSpace 0.196078 0.309804 0.521569 1"].location == NSNotFound;
        customShadow = [bc rangeOfString: @"ShadowColor = UIDeviceRGBColorSpace 0.5 0.5 0.5 1"].location == NSNotFound;

        [self initCommon];

        //[super setBackgroundColor: [[UIColor redColor] colorWithAlphaComponent: .5]];
    }

    return self;
}

I just included a small bit of the implementation, the full source can be found here. As a part of this repository by Paul-Alexander.
I initialize it like this:
PFTintedButton* buttony = [PFTintedButton buttonWithType:UIButtonTypeCustom];
[buttony setTint:[UIColor redColor]];
[buttony setBackgroundColor:[UIColor redColor]];
[buttony setRenderType:PFTintedButtonRenderTypeCandy];
[buttony setTitle:@"Title for Button" forState:UIControlStateNormal];

And it hiccups in PFDrawTools, it seems the tint variable is nil. So is it because I am initializing it incorrectly? Has anyone had success with this?

A: Try this instead:
PFTintedButton* buttony = [[PFTintedButton alloc] initWithFrame:CGRectMake(x, y, width, height)];

A: It seems to explicitly handle initWithFrame, I would try that.
PFTintedButton *buttony = [[[PFTintedButton alloc] initWithFrame:<some_frame>] autorelease];

A: Have you defined buttonWithType: initialize method in PFTintedButton class?


text:
Q: A confusion from Weinberg's QFT text (a vanishing term in Lippmann-Schwinger equation) I was reviewing the first few chapters of Weinberg Vol I and found a hole in my understanding in page 112, where he tried to show in the asymptotic past $t=−∞$, the in states coincide with a free state. In particular, he argued the integral
$$\tag{1} \int d\alpha\frac{e^{-iE_{\alpha}t}g(\alpha)T_{\beta\alpha}^+\Phi_\beta}  {E_\alpha-E_\beta+i\epsilon}$$
would vanish, where $d\alpha=d^3\mathbf{p}$ (also involves discrete indices like spin, but of no relevance here). In his argument, he used a contour integration in the complex $E_{\alpha}$ plane, in which the integral of central interest is the integration along real line
$$\tag{2} \int_{-\infty}^\infty dE_\alpha\frac{e^{-iE_{\alpha}t}g(\alpha)T_{\beta\alpha}^+\Phi_\beta}  {E_\alpha-E_\beta+i\epsilon}$$
I don't see how to obtain (2) from (1), since the lower bound of energy is the rest mass, in the best case I could get something like $\int_{m}^\infty dE_\alpha\cdots$, but how could one extend this onto the whole real line.

A: 1) OP is basically wondering how Weinberg on the middle of p. 112 can extend the integration region from$^1$
$${\cal J}^{\pm}_{\beta}~=~ \int_{m_{\alpha}}^{\infty} \!dE_{\alpha}\frac{e^{-iE_{\alpha}t}g(E_{\alpha})T_{\beta\alpha}^{\pm}}  {E_{\alpha}-E_{\beta}\pm i0^{+}}$$
to include the negative real axis
$${\cal J}^{\pm}_{\beta}~=~ \int_{-\infty}^{\infty} \!dE_{\alpha}\frac{e^{-iE_{\alpha}t}g(E_{\alpha})T_{\beta\alpha}^{\pm}}  {E_{\alpha}-E_{\beta}\pm i0^{+}},$$
where $g:E_{\alpha}\mapsto g(E_{\alpha})$ is a meromorphic function?
2) That Weinberg (implicitly) assumes meromorphicity of the $g:D\subseteq \mathbb{C}\to \mathbb{C}$ function can be deduced further down on p. 112, where he writes that

[...] we can close the contour of integration for the integration variable $E_{\alpha}$ [...],

which is a clear reference to the residue theorem, which in turn assumes meromorphicity. Also Weinberg writes on the same page$^1$

[...] The functions $g(E_{\alpha})$ and $T_{\beta\alpha}^{\pm}$ may, in general, be expected to have some singularities at values of $E_{\alpha}$
  with finite [...] imaginary parts [...]

So there is little doubt that Weinberg assumes meromorphicity of $g$.
3) On the other hand, on the bottom of p. 109, Weinberg writes$^1$

[...]Therefore, we must consider wave-packets, superpositions $\int\! dE_{\alpha}~g(E_{\alpha})\Psi_{\alpha}$ of states, with an amplitude  $g(E_{\alpha})$ that is non-zero and smoothly varying over some finite range $\Delta E$ of energies.[...]

Now according to the identity theorem for holomorphic functions, if a function $g:D\subseteq \mathbb{C}\to \mathbb{C}$ is zero on a subset $S\subseteq D$ that has an accumulation point $c$ in the domain $D$, then $g\equiv 0$ is identically zero. However, any interval $I\subseteq \mathbb{R}$ on the real line of non-zero length has accumulation points. So if Weinberg in above quote literally means that $g$ is mathematically zero outside some finite interval $I\subseteq \mathbb{R}$, then $g\equiv 0$ would be identically zero in the whole complex plane.
Of course Weinberg doesn't mean that. He just means that $g$ outside some finite range takes so small values, that to the precision $\epsilon$ that we are working, it doesn't matter whether we include the integration region $\mathbb{R}\backslash I$, or not.
In particular, mathematically speaking, Weinberg has only proven the condition
$$\tag{3.1.12} \int_{m_{\alpha}}^{\infty} \!dE_{\alpha}~
e^{-iE_{\alpha}t} g(E_{\alpha}) \Psi^{\pm}_{\alpha}~\longrightarrow~
\int_{m_{\alpha}}^{\infty} \!dE_{\alpha}~
e^{-iE_{\alpha}t} g(E_{\alpha}) \Phi_{\alpha}
~\text{for}~ t\to\mp\infty \qquad $$
within some precision $\epsilon$. However, the precision $\epsilon$ can be made arbitrarily fine by preparing more and more sharply defined wavepackets $g$.
4) If one would like to have a concrete example of a $g$ function, one may think of a Lorentzian function (aka. Breit–Wigner or Cauchy distribution),
$$g(E_{\alpha}) ~=~ \frac{1}{\pi}\frac{\delta}{(E_{\alpha}-E_0)^2+\delta^2}, \qquad \int_{-\infty}^{\infty}\! dE_{\alpha}~g(E_{\alpha})~=~1,$$
for appropriate choices of constants $E_0$ and $\delta$.
5) Finally, one should not loose sight of Weinberg's main goal in Section 3.1, namely to argue the $\pm i0^{+}$ prescription in the Lippmann-Schwinger equations
$$\tag{3.1.17}\Psi^{\pm}_{\alpha}
~=~\Phi_{\alpha}+\int\!d\beta\frac{T_{\beta\alpha}^{\pm}\Phi_{\beta}} {E_{\alpha}-E_{\beta}\pm i0^{+}}.$$
The Lippmann-Schwinger equations (3.1.17) are not an approximation, and they are independent of the choice of wavepacket $g$.
--
$^1$ To simplify the discussion, we have taken the liberty to replace Weinberg's more general $\alpha$-integration with just an $E_{\alpha}$-integration. Here
$$\tag{3.1.4} \int \!d\alpha \cdots \equiv \sum_{n_1\sigma_1n_2\sigma_2\cdots}\int d^3p_1 d^3p_2 \cdots$$
Changing integration variable from $E_{\alpha}$ to momenta does not solve OP's problem, essentially because we still have to pick the branch of the pertinent square root that has positive real part, so that it doesn't bring us any closer in understanding negative energies.


text:
Q: irreducible representation of a group Reduced group $C^\ast$-algebra of group $G$ is defined to be $G^*_{r}(G)=\overline{\lambda(L^1(G))}$ where $\lambda$ is left regular representation. My question is how to get a irreducible representation of $G$ from a irreducible representation of reduced group $C^*$-algebra $G^*_{r}(G)$? (In my question $G$ is a locally compact group)

A: You need an approximate identity for the convolution, i.e., a Dirac delta function at the identity of $G$. Then you can get a Dirac-$\delta$ at each $g$ by translating. Your representations $g$ amounts to $\pi(\delta_g)$. Of course, this can formally only done with nets.
To obtain that Dirac delta for general locally compact groups can be done via approximation of $G$ locally as a projective limit of Lie groups.


text:
Q: Основы безопасности от системного администратора Ввел в консоли Ubuntu команду:
$ sudo mc

Оно мне выдало такое:
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

И просит пароль. Что это? Мне просто нужно получить доступ к консоли от рута.

A: В русском варианте эта фраза звучит так:
Мы полагаем, что ваш системный администратор изложил вам основы
безопасности. Как правило, всё сводится к трём следующим правилам:

    №1) Уважайте частную жизнь других.
    №2) Думайте, прежде что-то вводить.
    №3) С большой властью приходит большая ответственность.

А пароль sudo надо знать, иначе доступ к консоли от рута невозможен.

A: Убедитесь, что текущий пользователь в группе sudo или wheel:
~$ id

Также пользователя можно внести в sudo группу напрямую:
~# visudo

На некоторых дистрибутивах нужно перезайти пользователю, чтоб права были «активированы».
Как минимум кто-то с рут правами должен добавить непривилегированного пользователя в группу sudo, и пользователь должен знать свой пароль.


text:
Q: android scrollview wont scroll I've got some linearlayouts and some views in my scrollview which covers the whole screen. The problem is that I can see that one of my widgets is under the screen and it won't scroll down. This is my xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="${relativePackage}.${activityClass}" >

    <ScrollView
        android:id="@+id/mainScrollView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true"
        android:scrollbars="vertical" >

        <LinearLayout
            android:id="@+id/mainLayout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >

            <RelativeLayout
                android:id="@+id/topLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <TextView
                    android:id="@+id/textDateTime"
                    android:layout_width="wrap_content"
                    android:text="@string/nullString"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="#FFCCFF99"
                    android:textSize="25sp" />

                <LinearLayout
                    android:id="@+id/buttonsLayout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_margin="5dp"
                    android:orientation="horizontal" >

                    <Button
                        android:id="@+id/buttonReset"
                        style="?android:attr/buttonStyleSmall"
                        android:layout_width="130sp"
                        android:layout_height="40dp"
                        android:background="@drawable/button"
                        android:text="@string/buttonResetText"
                        android:textColor="#000000"
                        android:textSize="20sp" />

                    <Button
                        android:id="@+id/buttonFreeze"
                        style="?android:attr/buttonStyleSmall"
                        android:layout_width="130sp"
                        android:layout_height="40sp"
                        android:layout_marginLeft="5dp"
                        android:background="@drawable/button"
                        android:text="@string/buttonFreezeText"
                        android:textColor="#000000"
                        android:textSize="20sp" />
                </LinearLayout>
            </RelativeLayout>

            <ProgressBar
                android:id="@+id/loadBar"
                style="?android:attr/progressBarStyleLarge"
                android:layout_width="118dp"
                android:layout_height="118dp"
                android:layout_gravity="center" />

            <GridView
                android:id="@+id/sensorsGrid"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:background="#FFCCFF99"
                android:gravity="center"
                android:numColumns="6"
                android:stretchMode="none" >
            </GridView>
        </LinearLayout>

    </ScrollView>

</RelativeLayout>

I also add a GraphView to mainLayout in code like this
graph = new LineGraphView(this, "GraphViewDemo");
graph.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 300));
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.mainLayout);
mainLayout.addView(graph);

Another problem is that if the GridView doesn't fit vertically to the mainlayout (cause it is larger) than the gridView becomes scrollable (which I don't want) and the GraphView which is below cannot be seen and I cant scroll down to it
UPDATE:
current xml
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="${relativePackage}.${activityClass}"
    android:id="@+id/mainScrollView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true"
    android:scrollbars="vertical" >

        <LinearLayout
            android:id="@+id/mainLayout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#FF023458"
            android:orientation="vertical" >

            <RelativeLayout
                android:id="@+id/topLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <TextView
                    android:id="@+id/textDateTime"
                    android:layout_width="wrap_content"
                    android:layout_height="40dp"
                    android:layout_margin="5dp"
                    android:text="@string/nullString"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textColor="#FFCCFF99"
                    android:textSize="25sp" />

                <LinearLayout
                    android:id="@+id/buttonsLayout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_margin="5dp"
                    android:orientation="horizontal" >

                    <Button
                        android:id="@+id/buttonReset"
                        style="?android:attr/buttonStyleSmall"
                        android:layout_width="130sp"
                        android:layout_height="40dp"
                        android:background="@drawable/button"
                        android:text="@string/buttonResetText"
                        android:textColor="#000000"
                        android:textSize="20sp" />

                    <Button
                        android:id="@+id/buttonFreeze"
                        style="?android:attr/buttonStyleSmall"
                        android:layout_width="130sp"
                        android:layout_height="40sp"
                        android:layout_marginLeft="5dp"
                        android:background="@drawable/button"
                        android:text="@string/buttonFreezeText"
                        android:textColor="#000000"
                        android:textSize="20sp" />
                </LinearLayout>
            </RelativeLayout>

            <ProgressBar
                android:id="@+id/loadBar"
                style="?android:attr/progressBarStyleLarge"
                android:layout_width="118dp"
                android:layout_height="118dp"
                android:layout_gravity="center" />

            <GridView
                android:id="@+id/sensorsGrid"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:background="#FFCCFF99"
                android:gravity="center"
                android:numColumns="6"
                android:stretchMode="none" >
            </GridView>
        </LinearLayout>
</ScrollView>

A: You should not add GridView inside ScrollView, because GridView itself is a scrollable view. A scrollable container inside another one will be taken over by the parent container (or vice versa) - causing not to scroll/appear properly on screen.
Tip: You should separate ScrollView and GridView. Or replace GridView with TableLayout.

A: change the scroll view tag to something like this, it will work for you.
<ScrollView
        android:id="@+id/mainScrollView"
        android:layout_width="fill_parent"
        android:layout_height="500dp"
        android:fillViewport="true"
        android:scrollbars="vertical" >


text:
Q: OData: How to convert a System.Uri to Edm.String? I'm building an OData Web API using ASPNetCore. The EdmModel is build like
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<MyType>("MyType");
edmModel = builder.GetEdmModel();

This is MyType
public class MyType
{
    [Key]
    public string Id { get; set; }

    [Required]
    public Uri Uri { get; set; }
}

This generates an EdmModel like this
<Schema Namespace="Test" xmlns="http://docs.oasis-open.org/odata/ns/edm">
  <EntityType Name="MyType">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Uri" Type="System.Uri" Nullable="false" />
  </EntityType>
</Schema>
<Schema Namespace="System" xmlns="http://docs.oasis-open.org/odata/ns/edm">
  <ComplexType Name="Uri">
    <Property Name="Segments" Type="Collection(Edm.String)" />
  </ComplexType>
</Schema>

When I query the OData controller I'm getting this response
{
  "@odata.context": "https://localhost:44389/v3/$metadata#MyType/$entity",
  "Id": "ID-1234",
  "Uri": {
    "Segments": [
      "/",
      "path/",
      "to/",
      "document"
    ]
  }
}

That's not at all what I want.
How can I get this to return me the complete URI as a string?
Is there an attribute I need to add to the model, or is there a way to configure the builder differently?


text:
Q: How to create an Image from a url Codenameone I need to make a new Image instance from a string that has the url of the image.
E.g. http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png
This type of urls come from a JSONParser and I want to use them to populate the icons of a multibutton list.
I use the following getItemAt method of this Model class put data on a multibutton list. Each multibutton has an icon and some lines. I have named Line1 as name and Line2 as rating. I want from the string url to make an Image so I can change the multibutton icon in place of defaultIcon in h.put("icon", defaultIcon) line.
static class Model implements ListModel {
    public Object getItemAt(int index) {
        Hashtable h      = new Hashtable();
        Hashtable entry  = (Hashtable) results.elementAt(index);
        String    name   = (String) entry.get("name");
        Double    rating = (Double) entry.get("rating");
        String    url    = (String) entry.get("icon");

        h.put("name", name);
        h.put("icon", defaultIcon); // change defaultIcon with an Image from url String

        if (rating == null) {
            h.put("rating", "Not rated");
        } else {
            h.put("rating", "Rating: " + rating.toString());
        }

        return h;
    }

A: Use ImageDownloadService.createImageToStorage which will asynchronously download the image, place it in the Hashtable for the list in the proper location. Refresh the list and cache the image in storage in case you ask for it again.
It can also scale your image to a fixed dimension as part of the service.

A: You can use this to obtain an image from an url
Image image = Toolkit.getDefaultToolkit().getDefaultToolkit().createImage(url);

this could also work
Image image = ImageIO.read(url);


text:
Q: How to get first value in PHP I have output Wordpress ACF field like this:
<?php the_field('price'); ?>

Result is this:
25000

That works very well, however I have problem when I put two values in Wordpress backend, result is like this:
250000 15000

What I'm trying to achieve is that I only output first value on the frontend. Idea is to achieve this:
250000

I try something like this:
  <?php $str1 = get_field('price'); $str2 = substr( $str1, 0, -4 ); echo $str2; ?>

I know that this is not solution, can I do it with Regex or can anybody help me with this? I'm new to PHP

A: Single line solution, break the string into an array of strings and then get the first element of the array, using null coalesce operator (php 7+) to avoid undefined index notice.
return explode(' ', get_field('price'))[0] ?? null;

A: This is your variable.
$price = the_field('price'); // which has value 250000 15000
Then using php explode function, You can get first value.
$priceSeperated = explode(' ', $price);
$priceSeperated = array_map('trim', $priceSeperated);
Then check the value by var_dump or print_r
var_dump($priceSeperated);
Your output will be like this.
array(3) {
  [0]=>
  string(3) "250000"
  [1]=>
  string(3) "15000"
}

It will turn into an array, using explode function, So getting your first value, You can get it like this $priceSeperated[0] for second value $priceSeperated[1], similarly if you have more values.
Note: the explode function will explode all the values after each space.
There is another PHP function strtok(), Example is give in other answers.
 but explode() is much faster compared to strtok(). (Almost 5 times faster in small strings as well).
If you have memory-usage critical solution, you should keep in mind, that strtok function holds input string parameter (or reference to it?) in memory after usage.

A: There are so many solutions to get ist value, you can get by using regex like:
$str1 = '250000 15000';
preg_match('/\w+/', $str1, $result); // Test
echo $result[0]; //250000

Second solution is strtok() which is more faster then to preg_match()
$str1 = '250000 15000';
echo strtok($str1, " ");  //250000

Explode() is an another option, which already posted in other answers.

A: All solutions presented so far rely on valid input into the ACF field.
What if the field is empty?
What is someone put in extra spaces, like ' 2500  1500 '?
What if you DO want the second, third, or fourth value?
While one-liners are nice, functions can be just as nice.
function get_price( $price, $which = 0 ) {
    // explode on spaces
    $price = explode( ' ', $price );
    // // get rid of all extra spaces, such as in ' 2500  1500 '
    $price = array_filter( $price );
    // checks if the requested key exists, and returns it
    return ( array_key_exists( $which, $price ) ) ? $price[ $which ] : 0;
}

// usage:
echo get_price( ' 2500  1500 ', 0 ); // returns 2500
echo get_price( '2500 1500 ', 1 ); // returns 1500
echo get_price( '2500', 1 ); // returns 0
echo get_price( '2500 1500 1000 500', 3 ); // returns 500

A: $value= explode(" ",$price);
$last = $value[0];

It will work even if you put 3 or more, it will always bring the first one keeping space as the separator.

A: this : DOC
$outPut = '25000 15000';
$firstNumber = explode(' ', $outPut)[0];


text:
Q: Error Creating the Web Proxy specified in system.net/defaultproxy Hi I am new to C# development. and I was given the job to create a C# WPF stand alone application, which creates an outlook template and open that in outlook application.
In order to open the outlook, I ma using outlook._mailitem and below is a snapshot of the code
try
{
    Outlook.Application oApp = new Outlook.Application();
    Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
    oMailItem.To = EmailUrl;
    oMailItem.BCC = "CarerGatewayReferrals@wellways.org";
    oMailItem.HTMLBody = HTMLBody;
    oMailItem.Subject = SubjectText;
    oMailItem.Display(true);
}

catch (Exception ex)
{
    MessageBox.Show(ex.Message + ", Please contact NCSP BI Team");
}

Now after building the application, I placed the executable file in our Company Server, so that everyone can access this application. Unfortunately due to the requirments I can't publish this application.
Whenever a user runs the application, and reach to this point,when the application needs to open Outlook, the program catches the exception and prompts the following message
"Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section"
I tried to debug the program, but found no issues at my development machine. And I think the error is occuring when the program is trying to open Outlook. I have no idea how to resolve this issue.
Please some one help.


text:
Q: How can i save and fetch MKPolyline by using core data in ios I am new for iOS, and working on google maps.
I would like to save my travelled route map (with polyline) into my Core Data based on Key Values.
Code using till for saving(from runkeeper app)
- (void)saveRun
{
Run *newRun = [NSEntityDescription insertNewObjectForEntityForName:@"Run"
                                            inManagedObjectContext:self.managedObjectContext];

newRun.distance = [NSNumber numberWithFloat:self.distance];
newRun.duration = [NSNumber numberWithInt:self.seconds];
newRun.timestamp = [NSDate date];

NSMutableArray *locationArray = [NSMutableArray array];
for (CLLocation *location in self.locations) {
    Location *locationObject = [NSEntityDescription insertNewObjectForEntityForName:@"Location"
                                                             inManagedObjectContext:self.managedObjectContext];

    locationObject.timestamp = location.timestamp;
    locationObject.latitude = [NSNumber numberWithDouble:location.coordinate.latitude];
    locationObject.longitude = [NSNumber numberWithDouble:location.coordinate.longitude];
    [locationArray addObject:locationObject];
}

newRun.locations = [NSOrderedSet orderedSetWithArray:locationArray];
self.run = newRun;

// Save the context.
NSError *error = nil;
if (![self.managedObjectContext save:&error]) {
    NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
    abort();
  }
}

Then after i would like to Fetch that Polyline details based on Key Values and display on MapView.
For fetching
- (MKCoordinateRegion)mapRegion
{
  MKCoordinateRegion region;
  Location *initialLoc = self.run.locations.firstObject;

float minLat = initialLoc.latitude.floatValue;
float minLng = initialLoc.longitude.floatValue;
float maxLat = initialLoc.latitude.floatValue;
float maxLng = initialLoc.longitude.floatValue;

for (Location *location in self.run.locations) {
    if (location.latitude.floatValue < minLat) {
        minLat = location.latitude.floatValue;
    }
    if (location.longitude.floatValue < minLng) {
        minLng = location.longitude.floatValue;
    }
    if (location.latitude.floatValue > maxLat) {
        maxLat = location.latitude.floatValue;
    }
    if (location.longitude.floatValue > maxLng) {
        maxLng = location.longitude.floatValue;
    }
}

region.center.latitude = (minLat + maxLat) / 2.0f;
region.center.longitude = (minLng + maxLng) / 2.0f;

region.span.latitudeDelta = (maxLat - minLat) * 1.1f; // 10% padding
region.span.longitudeDelta = (maxLng - minLng) * 1.1f; // 10% padding

return region;
}

- (MKPolyline *)polyLine {

CLLocationCoordinate2D coords[self.run.locations.count];

for (int i = 0; i < self.run.locations.count; i++) {
    Location *location = [self.run.locations objectAtIndex:i];
    coords[i] = CLLocationCoordinate2DMake(location.latitude.doubleValue,location.longitude.doubleValue);
}

return [MKPolyline polylineWithCoordinates:coords count:self.run.locations.count];
}
- (void)loadMap
{
if (self.run.locations.count > 0) {

    self.mapView.hidden = NO;

    // set the map bounds
    [self.mapView setRegion:[self mapRegion]];

    // make the line(s!) on the map
    NSArray *colorSegmentArray = [MathController colorSegmentsForLocations:self.run.locations.array];
   [self.mapView addOverlays:colorSegmentArray];
    //[self.mapView addOverlay:[self polyLine]];
    [self.mapView addAnnotations:[[BadgeController defaultController] annotationsForRun:self.run]];
} else {

    // no locations were found!
    self.mapView.hidden = YES;

    UIAlertView *alertView = [[UIAlertView alloc]
                              initWithTitle:@"Error"
                              message:@"Sorry, this run has no locations saved."
                              delegate:nil
                              cancelButtonTitle:@"OK"
                              otherButtonTitles:nil];
    [alertView show];
}
}

Main thing is save the path using Key values and fetch with that key value only.
Can any one help me please.


text:
Q: Recode multiple columns in dataframe R I am trying to convert a Y into a 1 for a number of columns that could change (e.g. it could go up to x20).
An example of the data is below as well as an expected output.
Data <- tibble(Date = seq.Date(as.Date('2019-01-01'),as.Date('2019-01-08'), by = "day"),
               x1 = c("Y","","","Y","Y","","Y","Y"),
               x2 = c("","Y","Y","Y","Y","","Y","Y"))

Data_output <- tibble(Date = seq.Date(as.Date('2019-01-01'),as.Date('2019-01-08'), by = "day"),
               x1 = c(1,0,0,1,1,0,1,1),
               x2 = c(0,1,1,1,1,0,1,1))

A: With dplyr:
Data %>%
  mutate_at(vars(contains("x")),~case_when(.=="Y" ~1,
                                           .=="" ~0))

or as suggested by @akrun simply:
Data %>%
  mutate_at(vars(contains("x")), ~as.integer(.=="Y"))

Result:
# A tibble: 8 x 3
  Date          x1    x2
  <date>     <dbl> <dbl>
1 2019-01-01     1     0
2 2019-01-02     0     1
3 2019-01-03     0     1
4 2019-01-04     1     1
5 2019-01-05     1     1
6 2019-01-06     0     0
7 2019-01-07     1     1
8 2019-01-08     1     1

A: In base R, we can do
Data[-1] <- +( Data[-1] == "Y")


text:
Q: Invalid SAML AuthN Request By trying to set up an SSO connection (sp initiated) between my SP and an IDP using ADFS, I am not able to get an answer from the IDP. The problem is that this IDP is a black box and i do not have the hand on.
So doing some debugging I checked that my query was valid and well formated using this tool and got this message

Invalid SAML AuthN Request. Not match the saml-schema-protocol-2.0.xsd

But their is no more details and even when I check saml protocol schema, I don't find where the problem is with this request :
<samlp:AuthnRequest
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    ID="_2e674db5054e407c30af"
    Version="2.0"
    IssueInstant="2019-05-10T09:39:52Z"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
    AssertionConsumerServiceURL="https://my-sp.com/callback">
    <saml:Issuer
        xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">sp_name
    </saml:Issuer>
    <samlp:NameIDPolicy
        xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
        Format="urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified"
        AllowCreate="true">
    </samlp:NameIDPolicy>
    <samlp:RequestedAuthnContext
        xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
        Comparison="exact">
        <saml:AuthnContextClassRef
            xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
        </saml:AuthnContextClassRef>
    </samlp:RequestedAuthnContext>
</samlp:AuthnRequest>

Did I missed a required field or is one value not well formated ?

A: First of all, you should use Validate XML with the XSD schema, tool. When I did this, I got:
Line: 14 | Column: 0  --> Element '{urn:oasis:names:tc:SAML:2.0:protocol}NameIDPolicy': Character content is not allowed, because the content type is empty.
So, I've removed the tag </samlp:NameIDPolicy> and just closed your NameIDPolicy as bellow:
<samlp:AuthnRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
ID="_2e674db5054e407c30af"
Version="2.0"
IssueInstant="2019-05-10T09:39:52Z"
ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
AssertionConsumerServiceURL="https://my-sp.com/callback">
<saml:Issuer
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">sp_name
</saml:Issuer>
<samlp:NameIDPolicy
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    Format="urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified"
    AllowCreate="true" />
<samlp:RequestedAuthnContext
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    Comparison="exact">
    <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
    </saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext></samlp:AuthnRequest>

Hope it helps


text:
Q: What settings affect user name in Git? I wanted to change the user name in my git configurations, but when I think I change the user name or email (in .gitconfig file) it restores back to the previous one. I have also tried doing it through git config --global user.name <user-name> but it "restores" back as well.
Where else should I look?  What are the (other) ways to tune my user name in Git?

A: git config user.name <user-name>
takes precedence i believe, you can find the information in your repository $REPO_DIR/.git/config


text:
Q: Writing long string to stdout in nodejs results in partial writes When writing a string to stdout on node js, if the string is really long, it is only partially written. I understand this is because of buffering in the stream.write method. In order to solve this problem I write the string a few chars at a time, but I've found this not to be 100% reliable. Sometimes I'll get partial writes with no error printed to screen.
At first I tried calling process.stdout.once('drain', cb) when the write method returned false, but that didn't seem to work all the time. However, it did lower the rate of unsuccessful writes.
At some point, after over an hour fighting this, I discovered that if I remove the process.exit(0) call at the end of my script, there would be no failures, or at least I saw none doing a few tests, whereas I would see errors in less than 5 tries if I left the process.exit call.
Here is what I do:
const b = JSON.stringify(response.data);
const chunk = 200;
const len = b.length;
let pos;

for (pos = 0; pos <= len; pos += chunk) {
  process.stdout.write(b.substring(pos, pos + chunk));
}

console.log('B'); // This is just a test print out.

// process.exit(0);

In the instances where the write would fail, the last 'B' is not printed, which leads me to think that the process just ends without even reaching that line, or without the stream having a chance to write it. I believe it is the second because if I change the exit code to something else, and then run echo $? I see that exit code. So process.exit is evaluated.
I have a working solution, which is leaving the process.exit commented out, but I want to know what the correct way of doing this is. I feel my solution is not the most optimal one.
Also, because I want to explicitly end the process, I've added the next couple lines after the test print out line:
process.stdout.on('finish', () => {process.exit(0)});
process.stdout.end();

Notes:

*

*My code runs inside a promise handler for an axios request.

*The test string I'm trying to write is 224364 chars long.


text:
Q: Get the file name of the current log file Enterprise Library 5.0 In MS Enterprise Library 5.0, Logging application block, at runtime, Can I get the name of the log  file (Flat File Listener) to which the log is going to?

A: You can get that information by using the configuration objects:
IConfigurationSource configSource = ConfigurationSourceFactory.Create();
var logSettings = configSource.GetSection(LoggingSettings.SectionName) as LoggingSettings;

var flatFileTraceListener = logSettings.TraceListeners
    .First(t => t is FlatFileTraceListenerData) as FlatFileTraceListenerData;

string fileName = flatFileTraceListener.FileName;

This assumes that you are interested in the first trace listener that is a FlatFileTraceListener.  If you wanted to get the trace listener by type and name then you could do that too:
IConfigurationSource configSource = ConfigurationSourceFactory.Create();
var logSettings = configSource.GetSection(LoggingSettings.SectionName) as LoggingSettings;

var flatFileTraceListener = logSettings.TraceListeners
    .FirstOrDefault(t => t is FlatFileTraceListenerData && t.Name == "Flat File Trace Listener")
    as FlatFileTraceListenerData;

string fileName = flatFileTraceListener.FileName;

A: Change the Config is no problem.
After Change the filename property  aaa.log -> bbb.log the Logger not Write in the new Filename.
The changed config must saved/activated (?) or the Logger must new Initialized..!??
    IConfigurationSource configSource = ConfigurationSourceFactory.Create();
    var logSettings = configSource.GetSection(LoggingSettings.SectionName) as LoggingSettings;

    var rollFileTraceListener = logSettings.TraceListeners
        .FirstOrDefault(t => t is RollingFlatFileTraceListenerData && t.Name == "RollingFlatFileTraceListener")
        as RollingFlatFileTraceListenerData;

    string fileName = rollFileTraceListener.FileName;
    rollFileTraceListener.FileName = fileName.Replace("aaa", "bbb");

    LogWriterFactory f = new LogWriterFactory(configSource);
    f.Create();
    Logger.Reset();
    LogEntry logEntry = new LogEntry();
    logEntry.Message = $"{DateTime.Now} Count:{333}";
    logEntry.Categories.Clear();
    logEntry.Categories.Add("General");

    Logger.Write(logEntry);


text:
Q: Generating code when using Netbeans Swing GUI builder Is there a way to get rid of the designer after creating a Swing GUI using the Netbeans GUI builder, without having to copy the source code into a new class?

A: Open the .java file of your class in another editor and remove comments like
//GEN-BEGIN:variables
//GEN-END:variables
These are not displayed by NetBeans editor. Then you can remove the .form file with the same name of your class.


text:
Q: Dynamic FROM in U-SQL statement I am trying to generate a dynamic FROM clause in U-SQL so that we can extract data from different files based on a previous query outcome. That's something like this:
@filesToExtract = SELECT whatevergeneratesthepaths from @foo; <-- this query generates a rowset with all the file we want to extract like: [/path/file1.csv, /path/file2.csv]
SELECT * FROM @filesToExtract; <-- here we want to extract the data from file1 and file2

I'm afraid that this kind of dynamics queries are not supported yet, but can someone help pointing me out the way to achieve this? It seems that the only feasible approach is to generate another U-SQL script and execute it afterwards.
Thanks in advance.

A: It is not fully clear from your question if you want the file names to be dynamically retrieved and passed to an EXTRACT statement, or the name of tables/rowsets and passed to a SELECT's FROM clause. Or both.
In general, you cannot dynamically generate source names from your U-SQL expression. You may want to file a feature request here http://aka.ms/adlfeedback for dynamically or statically parameterizable sources.
Having said that, depending on your exact requirements, there may be some ways to achieve your goals without the work-around you describe.
For example, you could write your code as a parameterized table-valued function and then pass the different rowsets with different scripts, or - if you statically can decide which rowset to choose - you can use the IF statement.
Here is a pseudo-code example:
DECLARE EXTERNAL @someconditionparameter Boolean = true;

IF (@someconditionparameter) THEN
   @data = EXTRACT a int, b string FROM @fileset1 USING Extractors.Csv();
ELSE
   @data = EXTRACT a int, b string FROM @file2 USING ...;
END;

@results = MyTableValuedFunction (@data);
...

If your files are schematized differently, you may be able to use flexible column sets (currently in preview, see release notes) in the TVF to handle the variability of the rowset schema.


text:
Q: Linux core dumps are too large! Recently I've been noticing an increase in the size of the core dumps generated by my application. Initially, they were just around 5MB in size and contained around 5 stack frames, and now I have core dumps of > 2GBs and the information contained within them are no different from the smaller dumps.
Is there any way I can control the size of core dumps generated? Shouldn't they be at least smaller than the application binary itself?
Binaries are compiled in this way:

*

*Compiled in release mode with debug
symbols (ie, -g compiler option in
GCC).

*Debug symbols are copied onto a
separate file and stripped from the
binary.

*A GNU debug symbols link is    added
to the binary.

At the beginning of the application, there's a call to setrlimit which sets the core limit to infinity -- Is this the problem?

A: Yes - don't allocate so much memory :-)
The core dump contains the full image of your application's address space, including code, stack and heap (malloc'd objects etc.)
If your core dumps are >2GB, that implies that at some point you allocated that much memory.
You can use setrlimit to set a lower limit on core dump size, at the risk of ending up with a core dump that you can't decode (because it's incomplete).

A: Yes, setrlimit is why you're getting large core files.  You can set the limit on the core size in most shells, e.g. in bash you can do ulimit -c 5000000.  Your setrlimit call will override that, however.
/etc/security/limits.conf can be used to set upper bounds on the core size as well.


text:
Q: 'Missing operator' in batch for statement I am getting 3 Missing operator. lines as output from the following batch script
SET w3wp2ID=0
SET w3wp1ID=0
SET w3wpID=0
SET ValuesAreSet=FALSE

for /f "tokens=2,3,4 delims=," %%A in ('typeperf -sc 1 -y "\Process(w3wp*)\ID Process" ^| find /V "\\" ^| find /V "please wait..."') do (
    if "%ValuesAreSet%"=="FALSE" (
        SET /A w3wp2ID=%%~A+0
        SET /A w3wp1ID=%%~B+0
        SET /A w3wpID=%%~C+0
    )
    SET ValuesAreSet=TRUE
)

At first I thought the output was coming from the 3 Set statements in the forloop, but upon investigation I no longer think this is the issue. Leading me to believe it has something to do with the for statement itself, but I cannot figure out what exactly is wrong.
I need to suppress these warnings since the output of this script will be logged.
Any help is appreciated, thanks, T.
EDIT: I should add that the 3 variables are getting the correct values set.

A: If you only want the values before the decimal point just use the %~nI expansion method which would treat the numbers after the decimal point as an extension thus removing them. (technically rounding it down).
SET "ValuesAreSet=FALSE"

For /F "Tokens=2-4 Delims=," %%A In (
    'typeperf -sc 1 -y "\Process(w3wp*)\ID Process" ^| find /V "\\" ^| find /V "please wait..."'
) Do If "%ValuesAreSet%"=="FALSE" (SET "w3wp2ID=%%~nA"
    SET "w3wp1ID=%%~nB"
    SET "w3wpID=%%~nC"
    SET "ValuesAreSet=TRUE"
)

A: I think if suppressing the error messages is ok for you then stay with it,
parsing the values to split at the dot is IMO overkill, but nevertheless:
SET w3wp2ID=0
SET w3wp1ID=0
SET w3wpID=0
SET ValuesAreSet=FALSE

for /f "tokens=2,3,4 delims=," %%A in ('typeperf -sc 1 -y "\Process(w3wp*)\ID Process" ^| find /V "\\" ^| find /V "please wait..."') do (
    if "%ValuesAreSet%"=="FALSE" (
        for /f "delims=." %%x in ("%%~A") do SET /A w3wp2ID+=%%x
        for /f "delims=." %%x in ("%%~B") do SET /A w3wp1ID+=%%x
        for /f "delims=." %%x in ("%%~C") do SET /A w3wpID+=%%x
    )
    SET ValuesAreSet=TRUE
)

A: Although for this specific case the method explained by Compo is probably the best solution for the problem at hand, I still want to contribute another approach: letting the set /A command do the variable expansion, because this does not rise errors if non-numeric values are stored; instead, everything up to the first non-numeric character is converted to a signed 32-bit integer, omitting leading white-spaces, regarding signs and coercing it to the 32-bit bounds. For example:
set "VAR=  -1.5 mV" & rem // (the first non-numeric char. is `.`, so the integer is `-1`)
set /A "VAR=VAR"    & rem // (`VAR` is read by `set /A`, because no `%%` are surrounded)
echo %VAR% (-1 expected, no error message arises)

set /A "VAR=%VAR%"  & rem /* (`VAR` becomes set to `-1` here, but an error message appears,
                      rem     because `set /A` actually receives the string `  -1.5 mV`) */
echo %VAR% (-1 expected, an error message arises)

Here this functionality is implemented into your code; the values are first stored unaltered with a standard set command, then converted to integers by a set /A command (note that VAR=VAR has been replaced by VAR+=0, just not to have to state each variable name twice per statement):
set "ValuesAreSet="
for /F "tokens=2,3,4 delims=," %%A in ('
    typeperf -sc 1 -y "\Process(w3wp*)\ID Process" ^
        ^| find /V "\\" ^| find /V "please wait..."
') do if not defined ValuesAreSet (
    set "w3wp2ID=%%~A" & set /A "w3wp2ID+=0"
    set "w3wp1ID=%%~B" & set /A "w3wp1ID+=0"
    set "w3wpID=%%~C" & set /A "w3wpID+=0"
    set "ValuesAreSet=#"
)

In addition, I changed the flag-style variable ValuesAreSet to indicate the FALSE state by being empty and the TRUE state by being non-empty, so if defined ValuesAreSet can be used.


text:
Q: Changing layout freezes my machine I use more than one language, and that's why I have to change layouts. But after doing it on my laptop, it freezes for a second. It's not a big issue and I can't live with it, but if it can be fixed, I'd like to.
I run the same Ubuntu 18.04 on both my PC and my laptop, and this issue only shows up with the second one (but that's not a surprise, because my PC is for sure way more powerful than my laptop).
I've also used 'Gnome Tweaks' to set layout changing to Alt+Shift, but using default Super+Space seems to make it freeze, too (even though it feels somewhat faster).

A: This is a bug in Gnome. For now it's impossible to say when if ever it's going to be fixed. However, you may be interested in either running Gnome on Wayland (this bug is not present there, but there are some other issues, depending on your workload you may be ok with it) or use another desktop environment, such as MATE, Cinnamon or KDE, which do not have this problem.


text:
Q: uwp: changing titleBar.ButtonForegroundColor with ThemeResource I want to make the ForegroundColor of the titlebar buttons dynamic if the User changes the AppTheme.
I'm created the app using the "Windows Template Studio" to get the settings for changing the AppTheme.
I declared following XAML:
<ResourceDictionary  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Color x:Key="CustomColor">#FF6D0839</Color>

<SolidColorBrush x:Key="ThemeBaseLowColorBrush" Color="{ThemeResource SystemBaseLowColor}" />
<SolidColorBrush x:Key="ThemeControlForegroundBaseHighBrush" Color="{ThemeResource SystemBaseHighColor}" />
<SolidColorBrush x:Key="ThemeControlBackgroundBaseHighBrush" Color="{ThemeResource SystemAccentColor}" />
<SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="{ThemeResource SystemBaseMediumLowColor}" />

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Default">
        <Color x:Key="SystemBaseMediumLowColor">Red</Color>
    </ResourceDictionary>
    <ResourceDictionary x:Key="Light">
        <Color x:Key="SystemBaseMediumLowColor">Green</Color>
    </ResourceDictionary>
    <ResourceDictionary x:Key="Dark">
        <Color x:Key="SystemBaseMediumLowColor">Blue</Color>
    </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

And in the code behind:
public static void SetRequestedTheme()
{
    if (Window.Current.Content is FrameworkElement frameworkElement)
    {
        frameworkElement.RequestedTheme = Theme;

        ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

        titleBar.ButtonForegroundColor = (Color)Application.Current.Resources["SystemBaseMediumLowColor"];
    }
}

Unfortunately the titlebar.ButtonForegroundColor remains the same. I'll always get the color of the light resource and not the color of the selected resource.
Any ideas?
P.S.: I also tried following with UWP.Toolkit
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
  extensions:ApplicationView.Title="View Extensions"
  extensions:TitleBar.ButtonForegroundColor="White"
  extensions:StatusBar.BackgroundColor="{ThemeResource SystemBaseMediumLowColor}"
  mc:Ignorable="d">

Doing so, will throw an XAML excecption. When I use StaticResource instead it works?
Many thanks for your help
P.S.: I ended up like this:
    public static void SetRequestedTheme()
    {
        if (Window.Current.Content is FrameworkElement frameworkElement)
        {
            frameworkElement.RequestedTheme = Theme;

            Color color;
            var appTheme = Application.Current.RequestedTheme;

            switch (Theme)
            {
                case ElementTheme.Default:
                    color = ((Color)Application.Current.Resources["SystemBaseHighColor"]);
                    break;
                case ElementTheme.Light:
                    if (appTheme == ApplicationTheme.Light) { color = ((Color)Application.Current.Resources["SystemBaseHighColor"]); }
                    else { color = ((Color)Application.Current.Resources["SystemAltHighColor"]); }
                    break;
                case ElementTheme.Dark:
                    if (appTheme == ApplicationTheme.Light) { color = ((Color)Application.Current.Resources["SystemAltHighColor"]); }
                    else { color = ((Color)Application.Current.Resources["SystemBaseHighColor"]); }
                    break;
                default:
                    break;
            }

            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
            titleBar.ButtonForegroundColor = color;
        }
    }

In the ApplicationTheme is stored the System setting of the user, which is activated by the "Default" ElementTheme
Depending on the ApplicatinTheme the result of ((Color)Application.Current.Resources["SystemBaseHighColor"]) is different, so I need to check an choose the right Resource

A: You can observe color and theme changes using the UISettings class in UWP. I have previously written a blog post about this. Simply said, you can observe the UISettings.ColorValuesChanged event to see when the colors or theme has changed and react to it. Also see this nice helper class on GitHub, which also handles the Window activation (because the event will not be triggered when the app is in the background).
As for the reason ThemeResource setting for the UWP Community Toolkit extension does not work - as the color is set statically on the TitleBar, it has to be done via code, while ThemeResource is a XAML only markup extension, which means it is not compatible with this.


text:
Q: EQS is not available?
*

*Unreal Engine 4.18.3,

*Windows 10,

*C++ or Blueprints,

*Top Down or Third Person Project.

I'm really sorry - I can't add an Environmental Query. It's not available in the AI menu when trying to "Add New" to add an advanced item, it's not in project settings, and you can't add one from the BT.
I can't follow the AI tutorial as there's no way to add an EQS query. I've looked in many posts and other forums but nothing seems to apply to 4.18.3
Also, I can't find any ini file setting with anything like "EnvironmentQuery" in it, to enable it in some ini file.
Is there some add-on I need to install?
How can I add an Environment Query to my project?

Solved
In Config/DefaultEngine.ini I had to manually add:
[EnvironmentQueryEd]
EnableEnvironmentQueryEd=True

A: Solved
In Config/DefaultEngine.ini I had to manually add:
[EnvironmentQueryEd] EnableEnvironmentQueryEd=True

A: Enabling the Environment Query System:

*

*Edit Menu -> Editor Preferences

*Experimental

*Scroll down to AI

*Enable Environment Query System


text:
Q: matplotlib.Path.contains_points : "radius" parameter defined inconsistently Problem:
The radius parameter in the function contains_point in matplotlib.path is defined inconsistently. This function checks if a specified point is inside or outside of a closed path. The radius parameter is used to make the path a little bit smaller/larger (dependent on the sign of radius). In this way, points can be taken into/out of account, which are close to the path. The problem is, that the sign of radius depends on the orientation of the path (clockwise or counterclockwise).
The inconsistency (in my opinion) is there, because the orientation of path is ignored when checking if a point is inside or outside the path. In a mathematical strict sense one says: everything which is left along the path is included.
In short:
If the path is orientated counterclockwise, a positive radius takes more points into account.
If the path is orientated clockwise, a positive radius takes less points into account.
Example:
In the following example there are 3 cases checked - each for a clockwise and a counterclockwise path:

*

*Is a point (close to path) contained with positive radius

*Is a point (close to path) contained with negative radius

*Is the origin contained (which is in the middle of both paths)

Code:
import matplotlib.path as path
import numpy as np

verts=np.array([[-11.5,  16. ],[-11.5, -16. ],[ 11.5, -16. ],[ 11.5,  16. ],[-11.5,  16. ]])

ccwPath=path.Path(verts, closed=True)
cwPath=path.Path(verts[::-1,:], closed=True)

testPoint=[12,0]

print('contains:         ','|\t', '[12,0], radius=3','|\t', '[12,0], radius=-3','|\t', '[0,0]|')

print('counterclockwise: ','|\t'
,'{0:>16s}'.format(str(ccwPath.contains_point(testPoint,radius=3) )),'|\t'
,'{0:>17s}'.format(str(ccwPath.contains_point(testPoint,radius=-3) )),'|\t'
,ccwPath.contains_point([0,0],radius=0) ,'|\t'
,'=> radius increases tolerance \t'
)

print('clockwise:        ','|\t'
,'{0:>16s}'.format(str(cwPath.contains_point(testPoint,radius=3) )),'|\t'
,'{0:>17s}'.format(str(cwPath.contains_point(testPoint,radius=-3) )),'|\t'
,cwPath.contains_point([0,0],radius=0) ,'|\t'
,'=> radius decreases tolerance \t'
)

Output:
contains:          |     [12,0], radius=3 |      [12,0], radius=-3 |     [0,0]|
counterclockwise:  |                 True |                  False |     True |  => radius increases tolerance
clockwise:         |                False |                   True |     True |  => radius decreases tolerance

Solution for convex paths:
The only idea I came up with, is to force the path into a counter-clockwise orientation and use radius according to this.
import matplotlib.path as path
import numpy as np

verts=np.array([[-11.5,  16. ],[-11.5, -16. ],[ 11.5, -16. ],[ 11.5,  16. ],[-11.5,  16. ]])

#comment following line out to make isCounterClockWise crash
#verts=np.array([[-11.5,  16. ],[-10,0],[-11.5, -16. ],[ 11.5, -16. ],[ 11.5,  16. ],[-11.5,  16. ]])

ccwPath=path.Path(verts, closed=True)
cwPath=path.Path(verts[::-1,:], closed=True)

testPoint=[12,0]

def isCounterClockWise(myPath):

        #directions from on vertex to the other
        dirs=myPath.vertices[1:]-myPath.vertices[0:-1]
        #rot: array of rotations at ech edge
        rot=np.cross(dirs[:-1],dirs[1:])
        if len(rot[rot>0])==len(rot):
            #counterclockwise
            return True
        elif len(rot[rot<0])==len(rot):
            #clockwise
            return False
        else:
            assert False, 'no yet implemented: This case applies if myPath is concave'

def forceCounterClockWise(myPath):
    if not isCounterClockWise(myPath):
        myPath.vertices=myPath.vertices[::-1]

forceCounterClockWise(cwPath)
print('contains:         ','|\t', '[12,0], radius=3','|\t', '[12,0], radius=-3','|\t', '[0,0]|')

print('counterclockwise: ','|\t'
,'{0:>16s}'.format(str(ccwPath.contains_point(testPoint,radius=3) )),'|\t'
,'{0:>17s}'.format(str(ccwPath.contains_point(testPoint,radius=-3) )),'|\t'
,ccwPath.contains_point([0,0],radius=0) ,'|\t'
,'=> radius increases tolerance \t'
)

print('forced ccw:      ','|\t'
,'{0:>16s}'.format(str(cwPath.contains_point(testPoint,radius=3) )),'|\t'
,'{0:>17s}'.format(str(cwPath.contains_point(testPoint,radius=-3) )),'|\t'
,cwPath.contains_point([0,0],radius=0) ,'|\t'
,'=> radius increases tolerance \t'
)

giving the following output:
contains:          |     [12,0], radius=3 |      [12,0], radius=-3 |     [0,0]|
counterclockwise:  |                 True |                  False |     True |  => radius increases tolerance
forced ccw:       |                  True |                  False |     True |  => radius increases tolerance

An example, where this solution fails (for a concave path) is given in the comment of the code.
My questions:

*

*Does anyone know, why this inconsistency is there?

*Is there a more elegant way to circumvent this issue? Examples might be: using an other library for contains_point, using the radius parameter in a smarter/proper way or finding the orientation of a path with a predefined function.

A: I think the only wrong assumption here is "everything which is left along the path is included.". Instead, contains_point literally means whether or not a closed path includes a point.
The radius is then defined to

*

*expand the path when the path goes counterclockwise and to

*shrink the path when the path goes clockwise

This is shown in the following example, where for a (counter)clockwise path the points included in the expanded/shunk area are plotted. (red = not contains_point, blue = contains_point)

import matplotlib.pyplot as plt
import matplotlib.path as path
import matplotlib.patches as patches
import numpy as np

verts=np.array([[-1,  1 ],[-1, -1 ],[ 1, -1 ],[ 1, 0 ],[ 1,  1],[-1,  1 ]])

ccwPath=path.Path(verts, closed=True)
cwPath=path.Path(verts[::-1,:], closed=True)

paths = [ccwPath, cwPath]
pathstitle = ["ccwPath", "cwPath"]
radii = [1,-1]

testPoint=(np.random.rand(400,2)-.5)*4

c = lambda p,x,r: p.contains_point(x,radius=r)

fig, axes = plt.subplots(nrows=len(paths),ncols=len(radii))

for j  in range(len(paths)):
    for i in range(len(radii)):
        ax = axes[i,j]
        r = radii[i]
        patch = patches.PathPatch(paths[j], fill=False, lw=2)
        ax.add_patch(patch)
        col = [c(paths[j], point[0], r) for point in zip(testPoint)]
        ax.scatter(testPoint[:,0], testPoint[:,1], c=col, s=8, vmin=0,vmax=1, cmap="bwr_r")
        ax.set_title("{}, r={}".format(pathstitle[j],radii[i]) )

plt.tight_layout()
plt.show()

A particularity, which does not seem to be documented at all is that radius actually expands or shrinks the path by radius/2.. This is seen above as with a radius of 1, points between -1.5 and 1.5 are included instead of points between -2 and 2.
Concerning the orientation of a path, there may not be one fix orientation. If you have 3 points, orientation can be unambiguously determined to be clockwise, counterclockwise (or colinear). Once you have more points, the concept of orientation is not well defined.
An option may be to check if the path is "mostly counterclockwise".
def is_ccw(p):
    v = p.vertices-p.vertices[0,:]
    a = np.arctan2(v[1:,1],v[1:,0])
    return (a[1:] >= a[:-1]).astype(int).mean() >= 0.5

This would then allow to adjust the radius in case of "mostly clockwise" paths,
r = r*is_ccw(p) - r*(1-is_ccw(p))

such that a positive radius always expands the path and a negative radius always shrinks it.
Complete example:
import matplotlib.pyplot as plt
import matplotlib.path as path
import matplotlib.patches as patches
import numpy as np

verts=np.array([[-1,  1 ],[-1, -1 ],[ 1, -1 ],[ 1, 0 ],[ 1,  1],[-1,  1 ]])

ccwPath=path.Path(verts, closed=True)
cwPath=path.Path(verts[::-1,:], closed=True)

paths = [ccwPath, cwPath]
pathstitle = ["ccwPath", "cwPath"]
radii = [1,-1]

testPoint=(np.random.rand(400,2)-.5)*4

c = lambda p,x,r: p.contains_point(x,radius=r)

def is_ccw(p):
    v = p.vertices-p.vertices[0,:]
    a = np.arctan2(v[1:,1],v[1:,0])
    return (a[1:] >= a[:-1]).astype(int).mean() >= 0.5

fig, axes = plt.subplots(nrows=len(radii),ncols=len(paths))

for j  in range(len(paths)):
    for i in range(len(radii)):
        ax = axes[i,j]
        r = radii[i]
        isccw = is_ccw(paths[j])
        r = r*isccw - r*(1-isccw)
        patch = patches.PathPatch(paths[j], fill=False, lw=2)
        ax.add_patch(patch)
        col = [c(paths[j], point[0], r) for point in zip(testPoint)]
        ax.scatter(testPoint[:,0], testPoint[:,1], c=col, s=8, vmin=0,vmax=1, cmap="bwr_r")
        ax.set_title("{}, r={} (isccw={})".format(pathstitle[j],radii[i], isccw) )

plt.tight_layout()
plt.show()


text:
Q: $\int_{\mathbb{R}}|p(v-r,x)-p(u-r,x)|dx \leq C\frac{v-u}{u-r}$ Consider $p(u,x)=(4\pi u)^{-1/2}e^{-\frac{x^2}{4u}},u>0,x\in \mathbb{R}.$
Prove that there exists $C>0$ such that for all $0<u\leq v,r\in[u,v],\int_{\mathbb{R}}|p(v-r,x)-p(u-r,x)|dx \leq C\frac{v-u}{u-r}$
Any ideas how to prove this inequality?
I tried computing the integral without sucess.


text:
Q: Not able to upload using CURl in nexus 2 While executing the below command:-
--- curl -v -u admin:admin123 --upload-file "/f/docs/java/FileUploadApplet.jar" http://localhost:8081/nexus/File/FileUploadApplet.jar ---
Not able to upload the artifact, getting the below error:-

< HTTP/1.1 405 HTTP method PUT is not supported by this URL
< Date: Mon, 30 Jul 2018 12:49:49 GMT
< Server: Nexus/2.14.9-01
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Content-Length: 0
* HTTP error before end of send, stop sending

A: Got the answer -
curl -v -u admin:admin123 --upload-file /f/java/File.jar http://localhost:8081/nexus/content/repositories/releases/file/File.jar


text:
Q: How to extract number that has a unit in mathematica? If the table data is set up with a value plus a unit,
for example, 1. "Kilos" or 34300. "GBP",
how to get the number using a functional approach or pattern matching?

A: A couple of suggestions here, mapping First or QuantityMagnitude.


text:
Q: Weak equality in angular select I'm trying to build an angular app with a parse.com backend.  In the app, a Student can be placed into one of many Classrooms.  I have a view that shows a row for each student, and in each row a <select> whose options are classrooms to which the student can be assigned.  I am able to initially assign and save the pointer from student->classroom.
The controller gets things going like this:
Student.withGrade($scope.grade).then(function(students) {
    // this eagerly fetches each student's assigned classroom
    $scope.students = students;
});

Classroom.withGrade($scope.grade).then(function(classrooms) {
    $scope.classrooms = classrooms;
});

And the classroom selector looks like this:
<select class="form-control" name="classroom" ng-model="student.classroom"
    ng-options="classroom.name for classroom in classrooms"></select>

The problem is, if I reload the page, even though some students have their classroom pointers initialized, the classroom select for those rows does not show that classroom (it appears uninitialized).
I think the reason is that even though the student's classroom object is equivalent to one of the classrooms in scope, they are retrieved by different fetches, so they are not equal as far as the <select> is concerned.
Is there a way to make the select test equivalence (say, like classroom.id) rather than equality?
I think one way to solve this is wait for both queries to finish, and then run through the students and replace their classroom pointer with a pointer to the equivalent fetched classroom, but that seems crazy.  (I still need it to select the whole classroom object into student.classroom because that's what parse needs in order to properly save the student).
EDIT - Just confirmed that the problem is select equality.  This fixes the problem, but there must be a way to get the select to make the equivalence test (.id == c.id)
Student.withGrade($scope.grade).then(function(students) {
    // this eagerly fetches each student's assigned classroom
    $scope.students = students;
    return Classroom.withGrade($scope.grade);
}).then(function(classrooms) {
    $scope.classrooms = classrooms;

     // yuck - resolve the students' classroom pointers so the selectors will work
    _.each($scope.students, function(student) {
        if (student.classroom) {
            student.classroom = _.find(classrooms, function(c) {
                return student.classroom.id == c.id;
            });
        }
    });
});


text:
Q: Url from getSignedUrl will expire in few weeks I've got storage trigger function which resize and replace uploaded image into storage and then update URL in my database
    }).then(() => {
        console.log('Original file deleted', filePath)
        const logo = storageRef.file(JPEGFilePath)
        return logo.getSignedUrl({ action: 'read', expires: date })

        // const logo = storageRef.child(JPEGFilePath)
        // return logo.getDownloadURL()

        // return storageUrl.getDownloadURL(JPEGFilePath)
    }).then((url) => {
        const newRef = db.collection("user").doc(uid)
        return newRef.set({
            profile: { profileImg: url[0] }
        }, {
                merge: true
            })
    })

here is how I set expiry date
const d = new Date()
const date = new Date(d.setFullYear(d.getFullYear() + 200)).toString()

However the image expire in few weeks (roughly about 2 weeks). Does anyone know how to fix that? I have even played with getDownloadURL as you can see from commented code but that doesn't seems to work in trigger

A: Per the following links:
https://stackoverflow.com/a/42959262/370321
https://cloud.google.com/nodejs/docs/reference/storage/2.5.x/File#getSignedPolicy
Not sure which version of @google/cloud-storage you're using, but assuming it's 2.5.x, it looks like any value you pass in the date field is passed into new Date(), so it looks like your code should work as I tried it in my dev tools. The only thing I can guess is it doesn't like that you want a file to live for 200 years.
Per the source code:
https://github.com/googleapis/nodejs-storage/blob/master/src/file.ts#L2358
Have you tried a shorter amount of time -- or formatting it in the dateform at mm-dd-yyyy ?

A: Ok so I have tried something but I have no idea if this will work or not so I'll come back in 2 weeks to mark my question as answered if it will work. For those with the same problem I'll try to recapitulate what I've done.
1/ Download the service account key from console. Here is the link
https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk
2/ Save the downloaded JSON file in your function directory
3/ Include the key in your function storage. But be careful how you set the path to the file. Here is my question about it
https://stackoverflow.com/a/56407592/11486115

UPDATE

I just found mistake in my function. My URL was provided by cloud function by mistake (commented code)
Here is complete function
const {
db
} = require('../../admin')

const projectId = "YOUR-PROJECT-ID"
const { Storage } = require('@google-cloud/storage');
const storage = new Storage({ projectId: projectId ,keyFilename: 'PATH-TO-SERVICE-ACCOUNT'})

const os = require('os');
const fs = require('fs');
const path = require('path');

const spawn = require('child-process-promise').spawn

const JPEG_EXTENSION = '.jpg'

exports.handler = ((object) => {
const bucket = object.bucket;
const contentType = object.contentType;
const filePath = object.name
const JPEGFilePath = path.normalize(path.format({ dir: path.dirname(filePath), name: 'profileImg', ext: JPEG_EXTENSION }))
const destBucket = storage.bucket(bucket)
const tempFilePath = path.join(os.tmpdir(), path.basename(filePath))
const tempLocalJPEGFile = path.join(os.tmpdir(), path.basename(JPEGFilePath))
const metadata = {
    contentType: contentType
}
const uid = filePath.split("/").slice(1, 2).join("")
const d = new Date()
const date = new Date(d.setFullYear(d.getFullYear() + 200)).toString()

if (!object.contentType.startsWith('image/')) {
    return destBucket.file(filePath).delete().then(() => {
        console.log('File is not an image ', filePath, ' DELETED')
        return null
    });
}

if (object.metadata.modified) {
    console.log('Image processed')
    return null
}

return destBucket.file(filePath).download({
    destination: tempFilePath
})
    .then(() => {
        console.log('The file has been downloaded to', tempFilePath)
        return spawn('convert', [tempFilePath, '-resize', '100x100', tempLocalJPEGFile])
    }).then(() => {
        console.log('JPEG image created at', tempLocalJPEGFile)
        metadata.modified = true
        return destBucket.upload(tempLocalJPEGFile,
            {
                destination: JPEGFilePath,
                metadata: { metadata: metadata }
            })
    }).then(() => {
        console.log('JPEG image uploaded to Storage at', JPEGFilePath)
        return destBucket.file(filePath).delete()
    }).then(() => {
        console.log('Original file deleted', filePath)
        //const logo = storageRef.file(JPEGFilePath)
        const logo = destBucket.file(JPEGFilePath)
        return logo.getSignedUrl({ action: 'read', expires: date })
    }).then((url) => {
        const newRef = db.collection("user").doc(uid)
        return newRef.set({
            profile: { profileImg: url[0] }
        }, {
                merge: true
            })
    }).then(() => {
        fs.unlinkSync(tempFilePath);
        fs.unlinkSync(tempLocalJPEGFile)
        console.log(uid, 'user database updated ')
        return null
    })
})

I'm pretty confident that this will work now.


text:
Q: joins with subqueries or recursion? I've tried a number of approaches on this one but just can't get to the correct result set.
I'm loath to revert to handling this in code & making multiple queries because I feel there is a reasonably simple solution there somewhere.
2 tables which contain process information.
process:
ID (key)
PARENT_ID
ROOT_ID

processdata
ID (key)
PROCESS_ID (key in process)
type
col1
col2

My data is something like this;
process
id, root_id, parent_id
100, 1, 10
101, 1, 10
102, 1, 10
10, 1,  1

processdata
id,process_id,type,col1, col2
201,100,X,NULL,NULL
202,100,X,NULL,NULL
203,100,TYPE1,My Data for Type1,NULL
301,100,X,NULL,NULL
302,100,X,NULL,NULL
303,100,TYPE1,My Data for Type1,NULL
401,100,X,NULL,NULL
402,100,X,NULL,NULL
403,100,TYPE1,My Data for Type1,NULL
503,10,X,NULL,NULL
503,10,TYPE2,NULL,My data for type2

desired result
root_id,parent_id,process_id,col1,col2
1,100,203,My data for type1,My data for type2
1,101,303,My data for type1,My data for type2
1,102,403,My data for type1,My data for type2

you can view this as a hierarchy of processes;
ROOT PROCESS
TOP_LEVEL PROCESS type=TYPE2 (has a label that applies to all it's children)
    (it's possible that between the type1 and type2 header above there is another process_id -> parent_id iteration needed - can ignore for now)
    PROCESS type=type1  (has data about this instance of the process)
    PROCESS type=type1  (has data about this instance of the process)
    PROCESS type=type1  (has data about this instance of the process)

TOP_LEVEL PROCESS type=TYPE2 (has a label that applies to all it's children)
    PROCESS type=type1  (has data about this instance of the process)
    PROCESS type=type1  (has data about this instance of the process)
    PROCESS type=type1  (has data about this instance of the process)

The closest I have got is;
with processes as (     -- this gets me all the process_id's for the root process - there will be lots of these with different types
                select  id
                        ,parent_id
                from process as p
                where root_process_id='1'
), processdatainfo as (             -- this should get the type 1 child processes
        select  pd.id
                ,pd.process_id
                ,col1
        from processdata as pd
        where pd.process_id in ( select id from processes )
        and pd.type = 'TYPE1'
), parentprocesses as (             -- this should get the type 2 parents that have the label for the children
        select  process_id
                ,col2
        from db2inst1.processlog
        where process_id in ( select id from processes )
        and type = 'TYPE2'
)
select *                            -- and the magic.....well doesn't happen....
from processes
    inner join processdatainfo
        on (processes.id = processdatainfo.process_id)
    left join parentprocesses
        on (parentprocesses.process_id = processes.parent_id)

In my results col2 is always NULL
I do only get the 3 rows I expected though this is one thing I guess.
I've been back and forward with nested select's using subqueries, but this approach seems closest.
I've looked at recursive queries but this problem didn't seem to fit because although I do need to process up the tree I need to get one row for the results rather than a row for each recursion.
Also recursion looked difficult - it would need to stop recursing when it reaches the type2 process rather than all the way to the root_id
I can't use stored procedures because I'm not able to update the server in this case - my application is a client to it.
Although the tables are huge - between 60M and 140M rows, filtering on the root process ID drops the list of process_id's down to 10-20 which is why I thought the above WITH would help.
What I think I need is;

*

*list of process_id's for my root process. That limits the result set
get my list of type1's and their parentid's

*from that, get the list of type2's where the parentid is the processid for the type2 record

Sounds so easy like that....


text:
Q: Android exposing service to other applications I need to expose a service in one android application. This service is to be used by other Android applications downloaded from play store in the device. How do I do it ?
Tried using AIDL, but it works only interprocess communication within the single application. Got error  when importing the service.
It also worked when including application that contained the service as a library. But I want to do without making it a library.
Faced errors in importing when using methods mentioned here.. which works when they are in same application.
android communication between two applications
I also do not want to use content resolver.


text:
Q: How to reference supporting database values throughout code? How should necessary data that is stored in the database be referenced throughout code? Is it better to reference a numeric, auto-incrementing ID, or a unique alphanumeric key/name, etc.? For example:

*

*Determining page display based upon a specific setting/value from, say, a Settings database table

*Retrieving a maximum value stored in the database for displaying a list of items on a page

Is it a good practice to define constants in code to reference these things, such as the following? Or is there an entirely better approach?
/* Code to define constant references */

// Numeric, auto-incrementing ID?
define('SETTING_A', 134);
// Or unique name?
define('SETTING_B', 'PageDisplaySetting');

/* Code to retrieve settings/values */

$settingA = $db->query('SELECT Value FROM Settings WHERE ID = ' . SETTING_A);
$settingB = $db->query('SELECT DisplayMaxItems FROM Table WHERE ID = ' . SETTING_B);
// etc.

/* Code to render display based upon these settings/values */
...

A: Regarding the ID vs. key question: your settings seem to be essentially key-value pairs. So representing them with a SettingKeyand SettingValue seems to be the most natural way to go. The keys should be defined somewhere, just like you proposed.
Also, you should probably hide the fact that they are stored in a database. I think you have two reasonable options for doing this:

*

*A settings object, e.g.
class Settings
{
    var $entries_per_page;
    var $date_format;
}

with a loadSettings() function that returns an instance of the Settings class. You can then load the settings at the beginning and pass that object around where needed, or store it globally. Then you access the values just via $mySettings->entries_per_page.
You can expand on this as needed, e.g. making the fields private and providing getters, have alternative loadSettings() functions, if you want to switch to text files instead of a DB, or go for a SettingLoader class/interface etc.

*Load as needed, with a getSetting($settingKey) function. This function can then execute the necessary query.
Option 1 has the advantage that you can load everything in one database call. Option 2 has the advantage that you can load only what you need, but you will have to make multiple queries. Unless you have a huge amount of settings that you only rarely access, I would recommend option 1.
In any case, retrieving the settings should be hidden in your loadSettings or getSetting function. To the rest of the application, there should just be a way to access values based on pre-defined keys.


text:
Q: How can I suppress the prompt for the execution of initialization cells? I would like to suppress the following super-annoying prompt that appears each time I exit the kernel and restart my computations:

Which menu option do I need to tweak? (I have tried quite a few.)

A: You can choose not to have initialization cells in your notebook, by right-clicking the cell bracket and uselecting "Initialization Cell"

Or, if you like having initialization cells but just want them to evaluate without asking, you can evaluate
SetOptions[$FrontEnd, InitializationCellWarning -> False]

Finally, if you want to turn off the evaluation of initialization cells altogether, evaluate
SetOptions[$FrontEnd, InitializationCellEvaluation -> False]

These settings are 'sticky' and should stay set after restarting.