text:
Q: Making my character fight I'm trying to create a beat em up game and right now i got my character walking and jumping. I have 3 attack animation so far and works just about. This is what i'm trying to achieve, if the player presses the attack button then the character will attack and if the player keeps pressing the attack button it will continue with its attack/punching sequence or if a different attack key is pressed it will switch attack/kicking animation (Note: I do no want if the player holds down the key, has to be a key press).
Also how can i make it go to the next attack animation once the current attack animation has completely finished instead of jumping to the next frame midway of it's current attack animation. So while the character is attacking and the attack key is pressed the character will finish its current attack animation and as soon as it ends it moves on to the next attack animation frame otherwise it will stop. I'm not sure how i can do this, should i create arrays or extend classes. I want to create the game like this a copy i found but its in AS2
https://www.dropbox.com/s/zhf68zmi0ktmeqq/DD%20%282%29.zip
This is what i have done so far
package
{
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    import flash.utils.*;
    import com.greensock.TweenLite;
    import com.greensock.easing.*;
    import com.greensock.plugins.*;

    public class Player extends MovieClip
    {
        TweenPlugin.activate([BlurFilterPlugin]);
        //Player run speed setting;
        var RunSpeed:Number = 8;
        //Player key presses
        var RightKeyPress:Boolean = false;
        var LeftKeyPress:Boolean = false;
        var UpKeyPress:Boolean = false;
        //Jump variables
        var Gravity:Number = 1.5;
        var JumpPower:Number = 0;
        var CanJump:Boolean = false;
        var Jumped:Boolean = false;
        //Dash variable
        var Pressed:Boolean = false;
        var LastKeyPressed:Number = -1;
        var DashAmount:Number = 250;
        var DoubleTapDelay:Number = 260;//-- delay in milliseconds
        var Dashing:Boolean = false;
        var RightDash:Boolean = false;
        var LeftDash:Boolean = false;

        public function Player()
        {
            stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyDown);
            stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyPressed);
            addEventListener(Event.ENTER_FRAME,Update);
        }

        function KeyDown(event:KeyboardEvent)
        {
            stage.removeEventListener(KeyboardEvent.KEY_DOWN, SecondDash);
            //If key is down cannot dash
            RightDash = false;
            LeftDash = false;

            //When Key is Down
            if (event.keyCode == 39)
            {
                RightKeyPress = true;
            }

            if (event.keyCode == 37)
            {
                LeftKeyPress = true;
            }

            if (event.keyCode == 38)
            {
                UpKeyPress = true;
            }
        }

        function KeyPressed(event:KeyboardEvent):void
        {
            stage.removeEventListener(KeyboardEvent.KEY_DOWN, KeyPressed);
            stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp);

            //If on floor
            if (CanJump)
            {
                //If right key is down
                if (event.keyCode == 39)
                {
                    if (event.keyCode == 39 && Pressed)
                    {
                        //If right key press matches with recent right key press, dash right
                        Dashing = true;
                        RightDash = true;
                    }
                    Pressed = true;
                    setTimeout(function(){Pressed = false}, DoubleTapDelay);
                }

                if (event.keyCode == 37)
                {
                    if (event.keyCode == 37 && Pressed)
                    {
                        //If left key press matches with recent left key press, dash left
                        Dashing = true;
                        LeftDash = true;
                    }
                    Pressed = true;
                    setTimeout(function(){Pressed = false}, DoubleTapDelay);
                }

            }
        }

        function Update(event:Event)
        {

            //Adding gravity to the game world
            JumpPower +=  Gravity;
            //if player is more than 300 on the y-axis
            if (this.y > 300)
            {
                //Player stays on the ground and can jump
                JumpPower = 0;
                CanJump = true;
            }

                //If already jumped and on floor
                if (Jumped == true && CanJump)
                {
                    //Cannot jump again
                    CanJump = false;

                    //If on floor and right key is pressed run right
                    if ((RightKeyPress))
                    {
                        gotoAndStop('Run');
                        scaleX = 1;
                    }
                    else if ((LeftKeyPress))
                    {
                        //Otherwise if on floor and left key is pressed run left
                        gotoAndStop('Run');
                        scaleX = -1;
                    }

                    //If no key is pressed stay idle
                    if ((!RightKeyPress && !LeftKeyPress))
                    {
                        gotoAndStop('Idle');
                    }
                }

                //If on floor and can jump
                if (CanJump)
                {
                    //If right key is pressed run right
                    if ((RightKeyPress))
                    {
                        x +=  RunSpeed;
                        gotoAndStop('Run');
                        scaleX = 1;
                    }
                    else if ((LeftKeyPress))
                    {
                        //otherwise if left key is pressed run left
                        x -=  RunSpeed;
                        gotoAndStop('Run');
                        scaleX = -1;
                    }

                    if ((UpKeyPress))
                    {
                        //If up key is pressed then jump
                        JumpPower = -15;
                        CanJump = false;
                        gotoAndStop('Jump');
                        Jumped = true;
                    }

                    //If no key is pressed stay idle
                    if ((!RightKeyPress && !LeftKeyPress && CanJump))
                    {
                        gotoAndStop('Idle');
                    }
                }
                else if (CanJump == false)
                {
                    //Otherwise if in air and right key is pressed move right
                    if ((RightKeyPress))
                    {
                        x +=  RunSpeed;
                        scaleX = 1;
                    }
                    else if ((LeftKeyPress))
                    {
                        //Otherwise if left key is pressed then move left
                        x -=  RunSpeed;
                        scaleX = -1;
                    }
                }

                //If Dashing is true
                if (Dashing == true)
                {
                    //Dash right
                    if (RightDash == true)
                    {
                        stage.addEventListener(KeyboardEvent.KEY_DOWN, SecondDash);
                        stage.removeEventListener(KeyboardEvent.KEY_DOWN, KeyPressed);
                        TweenLite.to(this,0,{blurFilter:{blurX:1000}});
                        TweenLite.to(this,0.2,{blurFilter:{blurX:0},x:x + DashAmount,ease:Expo.easeOut});
                        Dashing = false;
                    }
                    else if (LeftDash == true)
                    {
                        //Otherwise dash left
                        stage.addEventListener(KeyboardEvent.KEY_DOWN, SecondDash);
                        stage.removeEventListener(KeyboardEvent.KEY_DOWN, KeyPressed);
                        TweenLite.to(this,0,{blurFilter:{blurX:1000}});
                        TweenLite.to(this,0.2,{blurFilter:{blurX:0},x:x - DashAmount,ease:Expo.easeOut});
                        Dashing = false;
                    }
                }
                else if (Dashing == false)
                {
                    stage.removeEventListener(KeyboardEvent.KEY_DOWN, SecondDash);
                }

            this.y +=  JumpPower;
        }

        function SecondDash(event:KeyboardEvent)
        {
            stage.removeEventListener(KeyboardEvent.KEY_DOWN, SecondDash);

            if (event.keyCode == 38)
            {
                TweenLite.to(this,0,{blurFilter:{blurX:0}});
                TweenLite.to(this,0,{blurFilter:{blurY:1000}});
                TweenLite.to(this,0.5,{blurFilter:{blurY:0},y:y - DashAmount,ease:Expo.easeOut});
            }
        }

        function KeyUp(event:KeyboardEvent)
        {
            stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyPressed);
            RightDash = false;
            LeftDash = false;

            if (event.keyCode == 39)
            {
                RightKeyPress = false;
            }

            if (event.keyCode == 37)
            {
                LeftKeyPress = false;
            }

            if (event.keyCode == 38)
            {
                UpKeyPress = false;
                Jumped = false;
            }
        }
    }
}

A: It looks like you have not even attempted to try and do the attack animations...at least from what I see in your code. It would be helpful to learn if you at least tried on your own, and then posted, but with that said, I'll give you some starting points. Also, I'm not sure if you're using a document class and other classes to make this game, or if you are just using the timeline.....the following will be for using classes. If you aren't using classes...stop now, and go learn what AS3 really is. You never want to code on the timeline in AS3 if possible.
Let's say we have 3 attacks, consisting of the keys "1", "2", and "3". Put these variables up top with your other variables...right after your var LeftDash:Boolean = False is fine. (Also, just change all of your var to private var....if that doesn't work just use public var....just for completeness)
private var attack1Boolean:Boolean = false;
private var attack2Boolean:Boolean = false;
private var attack3Boolean:Boolean = false;

Next do pretty much the same thing you do with the keydown and keyup for the arrow keys. Put the following somewhere inside your KeyDown method.
if (event.keyCode == 49)
{
    attack1Boolean = true;
}
if (event.keyCode == 50)
{
    attack2Boolean = true;
}
if (event.keyCode == 51)
{
    attack3Boolean = true;
}

and then in your KeyUp method, add the following
if (event.keyCode == 49)
{
    attack1Boolean = false;
}
if (event.keyCode == 50)
{
    attack2Boolean = false;
}
if (event.keyCode == 51)
{
    attack3Boolean = false;
}

Now you are ready to start implementing the attacks. You say you have created 3 animations for the attacks already. This means each attack should have it's own timeline (you could have all 3 on one timeline, but separated by frames as well, but I wouldn't recommend this). In order to do what you want (finish each animation before the next attack ensues) you will have to utilize gotoAndStop or gotoAndPlay.
It is most useful to create a new .as file for each of your animations. If you have all 3 animations combined into one timeline...that's fine just create 1 new .as file instead of 3. Now link them all normally like you would (if you don't know how to do this...once again...go do a real AS3 tutorial...you're getting ahead of yourself).
You will have to create an instance of these new class files, so at the top under your vars, put the following (if you name your new classes Animation1, Animation2...etc.)
private var animation1:Animation1;
private var animation2:Animation2;
private var animation3:Animation3;

Then in function Player put
animation1 = new Animation1();
animation2 = new Animation2();
animation3 = new Animation3();

Now your animations should be ready to use. Go to your Update method and add the following
//note, the animation1.currentFrame == 1 doesn't have to be 1...it's just the initial starting frame of the animation
if (attack1Boolean &&
    animation1.currentFrame == 1 &&
    animation2.currentFrame == 1 &&
    animation3.currentFrame == 1)
{
    animation1.x = //character.x if you have a class...this.x for yours
    animation1.y = //character.y if you have a class...this.y for yours
    addChild(animation1);
    attack1Boolean = false;
    if (animation1.currentFrame = //the last frame of animation1...a number)
    {
        animation1.gotoAndStop(1);
        removeChild(animation1);
    }
}

if (attack2Boolean &&
    animation1.currentFrame == 1 &&
    animation2.currentFrame == 1 &&
    animation3.currentFrame == 1)
{
    animation2.x = //character.x if you have a class...this.x for yours
    animation2.y = //character.y if you have a class...this.y for yours
    addChild(animation2);
    attack2Boolean = false;
    if (animation2.currentFrame = //the last frame of animation2...a number)
    {
        animation2.gotoAndStop(1);
        removeChild(animation2);
    }
}

if (attack3Boolean &&
    animation1.currentFrame == 1 &&
    animation2.currentFrame == 1 &&
    animation3.currentFrame == 1)
{
    animation3.x = //character.x if you have a class...this.x for yours
    animation3.y = //character.y if you have a class...this.y for yours
    addChild(animation3);
    attack3Boolean = false;
    animation3.gotoAndStop(1);
    if (animation3.currentFrame = //the last frame of animation3...a number)
    {
        animation3.gotoAndStop(1);
        removeChild(animation3);
    }
}

That should start the character animation and make it so we can only use one attack once the others are finished. Also, since the condition that the animation must be on it's own frame 1 to begin pretty much also fixed the problem with holding down the key and repeatedly starting the animation (although, you can just continuously hold down the key and it will start the attack over once the animation is complete, but I don't think that's a big problem...if it is let me know).
Try all of this, tell me how many bugs there are because I did this from memory, up vote if it helps, =).


text:
Q: AWS MediaConvert - Stitch Portrait and Landscape videos I'm working on a side project using AWS MediaConvert to stitch together multiple video files.
MediaConvert now supports rotating video inputs, so if I have a video that was shot in portrait - usually from a cell phone - I can rotate it 90 degrees for correct display.
The problem is that if my first video input is portrait, and I configure it to rotate, either 90 degrees or "automatic", all subsequent video inputs are rotated as well regardless of any rotation setting I apply.
Has anyone encountered this issue to know of a solution?

A: This was a bug in Media Convert. It has been fixed as of summer 2019.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to add confirmation dialog for POST request with Flask? First time with Flask. I am trying to add a confirmation dialog for a form but only on certain conditions. So I am not able to do this on the client side. I was able to add it for the GET request but I wasn't able to do it for POST requests because I need to pass around the form data. Here is what I have done.
This is the form submit of the main form. On Cancel, it just refreshes the data on the current page by doing get request for config. But on Apply, it issues a POST request to /confirm route
main.html
<form class="module-form pure-form pure-form-aligned" autocomplete="off" id="uguu">
<fieldset>

            {{ form.export_server.label }}
            {{ form_input(form.export_server, maxlength=255) }}

            {{ form.export_port.label }}
            {{ form_input(form.export_port) }}

            <button class="pure-button pure-button-primary" type="submit"
                    formaction="confirm" formmethod="post">Apply</button>
            <button class="pure-button pure-button-primary cancel" type="submit"
                    formaction="config" formmethod="get">Cancel</button>

</fieldset>
</form>

This is the code segment in the flask server
@config_page.route("/config", methods=["GET", "POST"])
def config():
    if request.method == "POST":
         return post_config() #Uses request.form
    return get_config()

@config_page.route("/confirm", methods=["POST"])
def confirm():
    with ClassA() as class_a:
        class_a.load()
        #Need to show the confirmation only on this condition
        if class_a.is_val_x and request.form['is_val_x'] == 'on':
            #Is this the right way to go about it?
            return render_template('confirm.html', form=request.form )

    return redirect(url_for('.config',form=request.form),code=307)

An finally the code segment in confirm.html. The get request works fine but I am not sure how to post the form data from the flask /confirm route to /config. I am not even sure if this is the right way to do it. Any help would be really welcome? Any solution possible in jQuery or javaScript is also welcome.

 Are you sure kind of dialog?

<form>
   <button class="pure-button pure-button-primary deny" type="submit"
                formaction="config" formmethod="get">Cancel</button>

   <button class="pure-button button-warning confirm" type="submit"
                formaction="config" formmethod="post">Confirm</button>
</form>

A: As you have said the get request works fine. So you must be seeing the template confirm.html. Edit the form tag.
<form method="POST" action="./config">
<button class="pure-button pure-button-primary deny" type="submit"
            formaction="config" formmethod="get">Cancel</button>

<button class="pure-button button-warning confirm" type="submit"
            formaction="config" formmethod="post">Confirm</button>
</form>

Now once you click confirm on code segment , you can by printing request data debug the form fields.
@config_page.route("/config", methods=["GET", "POST"])
def config():
if request.method == "POST":
 print(request)
 return post_config() #Uses request.form
return get_config()

If you want to submit form using ajax/jquery, you can do this.

A: Well in the flask way of doing you should have separate forms.py file where you would build all your forms and use jinja2 templating.
How I would do something like that is by creating these things:
1. app/forms.py
from flask_wtf import FlaskForm
from wtforms import StringField, BooleanField, SubmitField
from wtforms.validators import DataRequired

class ConfigForm:
    conf1 = StringField('Config 1', validators=[DataRequired()])
    conf2 = StringField('Config 2', validators=[DataRequired()])
    confirm = BooleanField('Cnfirm')
    submit = SubmitField('Submit')

2. app/templates/config.py

Config

        {{ form.conf1.label }}

        {{ form.conf1(size=(42) }}
        {% for error in form.conf1.errors %}
        [{{ error }}]
        {% endfor %}

        {{ form.conf2.label }}

        {{ form.conf2(size=(42) }}
        {% for error in form.conf2.errors %}
        [{{ error }}]
        {% endfor %}

{{ form.submit() }}

3. app/routes.py
from flask import Flask render_template, redirect, url_for, request
from forms import ConfigForm

app = Flask(__name__)

@app.route('/config/<confirm>', methods=['GET', 'POST'])
def config(confirm):
    form = ConfigForm()
    if form.validate_on_submit():
        if form.validate_on_submit():
            db.get.value1.for.form = form.conf1.data
            db.get.value2.for.form = form.conf2.data
            if confirm:
                db.get.value3.form = form.confim.data

            db.session.commit()

            flash('You\'r changes have been saved!')
            return redirect(url_for('config'))
        elif request.method == 'GET':
            form.conf1.data = db.get.value1.for.form
            form.conf2.data = db.get.value2.for.form

    return render_template('config.html', form=form)

@app.route('/')
def index():
    confirm = True
    return redirect(url_for('config', confirm))

What I'm doing here is that I'm creating config page where data is loaded from database and in case the user wishes to update the data in the post method I will update the data to the database.
In my exaple if user enter to the /index page it redirects to cinfig page and passes the confim = True that will be updated together with post method without any user action needed.
I hope this example might atleast put you on the road to the solution you need. :)


text:
Q: How to protect software from being deleted by antivirus? I work for a publishing company and we are making interactive software that accompanies our books. The problem is that many clients complain that the antivirus keeps deleting parts of the software, especially the .exe files.
Which is the best way to avoid this? By digitally signing the software? (I don't know if that's the correct term, or maybe it's called licensing). Are there companies who provide such a thing?

A: By running that same anti-virus software in your testing environment. Make it part of your test procedure: "Software not deleted by antivirus."
(In my experience: some packers, which compress your executable, will make your executable get flagged.)

A: There's no magic cure unfortunately.  False positives by anti-virus software have been a problem for commercial publishers for a long time.  It is very common, especially for smaller publishers.
The first thing you want to do is sign all executables in your project as well as the installer.  That will go a long way towards helping you.  But its still no guarantee the programs won't be flagged.  To sign software you'll need a software signing certificate.  It takes a little bit of effort (and money), but its worth it.
You'll also want to make sure your program plays nicely with Windows, and doesn't do things like writing to places on the drive it shouldn't (such as the Windows directory).  Make sure you understand where files should be installed and written to under Windows.
If your program is still getting flagged, you can use a tool like VirusTotal which checks your file against all the major published anti-virus programs. This way you can see which ones are reporting false positives.  Usually its just one or a few that are flagging the program.  From there if need be you can submit your program to those anti-virus publishers.  Most of them have a place where you can do that on their website.  This is hit or miss, don't expect immediate responses from them.

A: Going by current tech - and your software will be most likely developed or at least built for Windows (10 .. 64 bit ) - get an official licensed developer key from Microsoft to sign your installer and program.
Avoid exe-packers like upk/upx like the plague, stick to well known formats like (7)zip or rar - or use a packaging software to build your installer.


text:
Q: Is it possible to combine SGD/ Minibatch GD and Batch Gradient Descent to find the global optimum quickly? Say the model is bouncing around the optimum with SGD. Is there a way to know that it's near the minimum, pause the model, and continue with an extremely small learning rate

A: That's one of the motivations of adaptive algorithms (e.g. Adam). In this algorithms the effective learning rate change during training and adapts the local geometry of the loss surface. You can take a look at this really nice post if you want to understand this more in depth.
I see that the title of your post exposes a different problem. When you take more samples to compute one gradient update, the variance of the estimate decreases, but at the same time the complexity of each update increases. Given that the stochastic estimates are unbiased, you can go much faster using minibatch or SGD.
Now to see if you are near a minimum in a very simplistic way, you could keep track of the magnitude of the gradient. When this value is close to zero for a certain number of iterations you may take more samples into account for each gradient update.
I cannot recall any paper that uses this approach but one similar way of using "better" updates when near the optimum is to use second order methods. This approach has been largely studied, since e.g. Newton's method has the fastest convergence rate when sufficiently close to the optimum, but each update is very expensive to compute.


text:
Q: Is it possible to deviate from a conversation flow and come back to the original flow in DF I am trying to develop a chat-bot in google Dialog Flow where user deviates from the original conversation flow (CF) but ends up coming back to original somewhere in the middle.
bot responses are in bold
For example:
original CF: hi -> how may i help you -> i would like to go travelling -> OK, i would suggest Europe. would you be interested? -> yes -> alright here's the price
deviated CF: hi -> how may i help you -> i would like to go travelling -> OK, i would suggest Europe. would you be interested? -> maybe -> Europe has lot of beautiful destinations u can travel to. would you be interested -> yes -> alright here's the price
The only way i found to implement this is to make a new intent and develop its followups which is making this very redundant. I had to develop two separate intents fully. Is there any way i can make an intent just for the deviated CF and join it to the original intent?

A: One simple solution is to make many follow-up intents, but that is never ending process.
Here is another approach I want to suggest:

*

*Make a list of important intents which you want to handle in case of
deviation

*When the intent is hit, save that to some DB (or cache), let's say
unfinished_intent

*In each request or every 2-3 requests check the value of
unfinished_intent, if it contains some intent name, prompt for it

*After your intent is fulfilled, delete the unfinished_intent
This is just an idea, how to implement is upto you.
I suggested this because it is generic and it will catch all the cases.
Hope it helps.

A: Keep in mind that the user can change the direction of the conversation at any time. So using a long chain of followup intents is a bad idea. Even using a short chain is a bad idea. Followup intents should be limited to fairly narrow circumstances, and in most cases they're not wise nor necessary.
Instead, keep track of the information that you have about the user and the information that you still need as part of a context. If you are engaged in a side conversation, or have made a recommendation, keep track of that as well, since the user may ask questions about it. Build many top-level Intents that represent what the user is saying, not where you are in the conversation or how you plan to reply.
See also Thinking for Voice: Design Conversations, not Code based on this answer on StackOverflow.


text:
Q: Service-to-service communication with feign in spring security 5 in fact the spring-oauth project turn into maintenance mode we trying migrate our application into pure spring security 5 which support resource server configuration as well.
Our actual resource server configuration looks like this:
@Configuration
@EnableResourceServer
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter {

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests(
            authorizeRequests -> {
                authorizeRequests.antMatchers("/api/unsecured/**").permitAll();
                authorizeRequests.anyRequest().authenticated();
            }
        );
    }

    @Bean
    @ConfigurationProperties(prefix = "security.oauth2.client")
    public ClientCredentialsResourceDetails clientCredentialsResourceDetails() {
        return new ClientCredentialsResourceDetails();
    }

    @Bean
    public TokenStore jwkTokenStore() {
        return new JwkTokenStore("http://localhost:8080/...", new JwtAccessTokenConverter());
    }

    @Bean
    public RequestInterceptor oauth2FeignRequestInterceptor(){
        return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), clientCredentialsResourceDetails());
    }

    @Bean
    public OAuth2RestTemplate clientCredentialsRestTemplate() {
        return new OAuth2RestTemplate(clientCredentialsResourceDetails());
    }
}

and these properties:
security:
  oauth2:
    client:
      client-id: service-id
      client-secret: secret
      access-token-uri: http://localhost:8081/oauth/token

This resource server is configured to work with jwt token. To verify token uses rsa public key from link passes to jwkstore. It is also able call another resource server with Feign.
And this is new configuration:
    @Configuration
    static class OAuth2ResourceServerConfig extends WebSecurityConfigurerAdapter {

        private final JwtDecoder jwtDecoder;

        ResourceServerConfiguration(JwtDecoder jwtDecoder) {
            this.jwtDecoder = jwtDecoder;
        }

        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http
                .authorizeRequests(authorizeRequests -> authorizeRequests
                    .antMatchers("/public/unsecured/**").permitAll()
                    .anyRequest().authenticated())
                .sessionManagement(session ->
                    session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                )
                .oauth2ResourceServer(oauth2ResourceServer -> oauth2ResourceServer
                    .jwt(jwtConfigurer -> {
                        jwtConfigurer.decoder(NimbusJwtDecoder.withJwkSetUri("http://localhost:8080/...").build());
                        jwtConfigurer.jwtAuthenticationConverter(tokenExtractor());
                    })
                );
        }

This configuration works fine to decode and verify tokens, but Feign doesn't work. Previous configuration with spring oauth2 supports Oauth2 feign interceptor which call authorization server to get its own access token. But I don't know how to configure this in spring security 5. This is flow which I need:

*

*frontend client call spring resource server A with token

*resource server A need data from resource server B

*resource server A call authorization server to get access token with client_credentials grant type

*resource server A call resource server B with its access token set to request header by feign

*resource server A return all data to frontend client

Can you tell me how to configure 3. and 4. step in spring security 5 without spring's oauth project? Thank you.


text:
Q: How can i upload a file with utf-8 name in php? we have a file that have persian name, like:
ایران.jpg

our problem is that php unable to copy or rename this file by orginal name,
meaning if file name does not have fully english character, result is like this:
ط§ط´ط±ع©طھ ظ…ظ"غŒ ظ¾ط®ط´ ظپط±ط¢ظˆط±ط¯ظ‡ ظ‡ط§غŒ ظ†ظپطھغŒ-04ط¢ط¨ط§ظ†.jpg

some articles recommendation for use of iconv function, like:
$fn = iconv("CP-1252", "UTF-8", $file['name']);

we use of that method, but the solution not work.

A: You need to specify the correct character set to iconv from which to convert the string. Something like this:
$fn = iconv("<persian-character-set>", "UTF-8", $file['name']);

You may want to add additional options to the output character set like TRANSLINT and/or IGNORE:
$fn = iconv("<persian-character-set>", "UTF-8//TRANSLIT//IGNORE", $file['name']);

See http://php.net/manual/en/function.iconv.php for details on these options.

A: You Should Choose Right Code Page. This Code Works In Windows For Arabic/Persian Names:
$newname = iconv("UTF-8", "CP1256//IGNORE","گچپژ");
echo rename("1.txt", $newname);

A: In fact, we have a conversion from UTF-8 to UTF-8, Not ridiculous?
Value of $_FILE['name'] is UTF-8 and we try to set that character-set to UTF-8!!!
Our problem is that we have entered into with utf-8, but saved by unknown encoding!
I think Php is a serious bug, if you think opposite, active persian language in your windows os and try to make a folder by persian character by PHP (like ایران), and use of all method that you think work!
If it was, you did a great job, but if ...


text:
Q: How to change the name of an android string in all the application I just finished to realize my first real Android application. The thing is I used an strings.xml file to store my strings, but I just discovered that the way I named them is really bad.
For instance, when I wanted to write "List of classrooms", I created a string named "class_list" instead of a better formatted name like "label_classroom_list_title (or any other more specific name).
The problem is that I would like to change these names like when I use the refactor function of Eclipse (the name of a variable is change for all references to this variable).
Is it possible using eclipse ? Or maybe another tool ?

A: If its just a few files try Ctrl+F type in the Find field, the old variable name and in the 'Replace with' the new variable name and hit Replace All. It works wonders :) you can also change the variable names in selected lines too.

A: Not really a programming question, but...
With Eclipse, right click on the variable name at any one place you see it. The variable should highlight. You'll get a pop-up menu. Choose the Refactor command. You'll get a second pop up menu. Choose the Rename command. Start typing the new variable name and you should be able to see all references updating as you type.

A: You can do that in Intellij using Refactor button from by right clicking the View you want to rename in the strings.xml file. Not sure if that works on Eclipse though.


text:
Q: Secure my connection string when sent from localhost over the network to my hosting site When we develop locally at time we need to connect to our live site from our localhost.
I've added encrypt=true to the connection string but I"m not sure if this encrypts the password and username sent to connect to the database.
So I downloaded TCPView to see if the connection is secure but could not tell?
How can I secure my password and username when sending over network and can I monitor it to make sure it is NOT being sent as plaintext?

A: Do you mean that the ASP.NET application running on your localhost connects to the SQL Server on your live site using SQL authentication? If that's the case, the SQL authentication username and password are not sent in cleartext. When you use encrypt=true the client (localhost, in this case) connects to the server over SSL so that everything sent to and from the server is encrypted. If you don't use it, the authentication information is still encrypted using a self-signed SSL certificate but your queries and resultsets are not encrypted. That's according to this ServerFault Q/A anyway:
https://serverfault.com/questions/230403/does-the-password-get-sent-in-the-clear-when-connecting-to-sql-server


text:
Q: Mainline Linux kernels make updates impossible? Using Ubuntu Kernel Update Utility (UKUU) I installed a mainline Linux kernel (4.16.18). I soon discovered that when starting the Update Manager it requires the new kernel to be uninstalled. The same probably happens with custom built kernels.
Is there any way to keep the kernel and do updates?


text:
Q: How to get index(of:) to return multiple indices? Here is a group array.
var group = ["H","H","E","D",
             "G","D","G","E",
             "D","B","A","B",
             "A","A","G","C",
             "C","H","D","G",
             "H","B","E","F",
             "F","C","E","A",
             "B","C","F","F"]

I want to do something like this to find indices of "A".
group.index(of: "A"!)

But this will return only first index, but not other indices for next three "A"s.
print(group.index(of: "A")!) //10

What do I do to get the program to return all four indices for "A"?

A: Or just enumerate/filter/map :
 group.enumerated().filter{$1=="A"}.map{$0.offset}

[EDIT] Changed $0.0 to $0.offset as per Alexander's recommendation (makes the code more legible/explicit)

A: You can use a simple cycle
Use this Code
var group = ["H","H","E","D",
             "G","D","G","E",
             "D","B","A","B",
             "A","A","G","C",
             "C","H","D","G",
             "H","B","E","F",
             "F","C","E","A",
             "B","C","F","F"]
var indexes : [Int] = []
for (index,string) in group.enumerated() {
    if(string == "A") {
        indexes.append(index)
    }
}

debugPrint(indexes)

A: For the sake of completeness this is another different approach which filters the indices
let group = ["H","H","E","D",
             "G","D","G","E",
             "D","B","A","B",
             "A","A","G","C",
             "C","H","D","G",
             "H","B","E","F",
             "F","C","E","A",
             "B","C","F","F"]

let indices = group.indices.filter{ group[$0] == "A"}

A: You might use a combination of enumerated and compactMap:
let indexArray = group.enumerated().compactMap {
   $0.element == "A" ? $0.offset : nil
}
print(indexArray) // [10, 12, 13, 27]

A: A reduce, generic, based solution:
let group = ["H","H","E","D",
             "G","D","G","E",
             "D","B","A","B",
             "A","A","G","C",
             "C","H","D","G",
             "H","B","E","F",
             "F","C","E","A",
             "B","C","F","F"]

extension Array where Element: Equatable {
    func indexes(of element: Element) -> [Index] {
        return enumerated().reduce([]) { $1.element == element ? $0 + [$1.offset] : $0 }
    }
}

group.indexes(of: "A") // 10, 12, 13, 27]

Another approach would be to built-up a letter-to-indices dictionary and query that:
let indices = Dictionary(group.enumerated().map { ($1, [$0]) }, uniquingKeysWith: +)
indices["A"] ?? [] // [10, 12, 13, 27]

, though for this solution you'd need to unwrap the result as the dictionary subscript returns an optional value.
BTW, your array could've been a let instead of a var, constants bring predictability over your code, I recommend using them as much as possible.

A: Vadian's answer above is already the most concise yet.
The rest of the answers just dance about chained HUFs because it's cool but just for true completeness, as the most basic implementation one would obviously do the following:
let group = ["H","H","E","D",
             "G","D","G","E",
             "D","B","A","B",
             "A","A","G","C",
             "C","H","D","G",
             "H","B","E","F",
             "F","C","E","A",
             "B","C","F","F"]

var array = [Int]()
for index in 0..<group.count {
    if group[index] == "A" {
        array.append(index)
    }
}

A: After reading about Extensions and functional programming past few days, I wanted to try writing an extension function for Array class. Here it is:
var group = ["H","H","E","D",
             "G","D","G","E",
             "D","B","A","B",
             "A","A","G","C",
             "C","H","D","G",
             "H","B","E","F",
             "F","C","E","A",
             "B","C","F","F"]

var group2 = [1,2,3,4,5,6,7,8]

// Create a nice Array extension method that will return indices of wanted group.

extension Array where Element: Equatable {

func showIndices(indexOf groupName: Element) -> [Int] {
    return self.enumerated().compactMap {
        $0.element == groupName ? $0.offset : nil
    }
}
}

group.showIndices(indexOf: "A")
group2.showIndices(indexOf: 1)

// [10, 12, 13, 27]
// [0]

A: You can extend collection and create your own indices method that takes a predicate.
extension Collection where Element: Equatable {
    func indices(where predicate: @escaping (Element) throws -> Bool) rethrows -> [Index] {
        try self.indices.filter({try predicate(self[$0])})
    }
    func indices(of element: Element) -> [Index] {
        self.indices.filter({self[$0] == element})
    }
}

For collections indexed by Int you can return an IndexSet:
extension Collection where Element: Equatable, Index == Int {
    func indexSet(where predicate: @escaping (Element) throws -> Bool) rethrows -> IndexSet {
        .init(try indices(where: predicate))
    }
    func indexSet(of element: Element) -> [Index] {
        .init(indices(of: element))
    }
}

Usage:
let array = [10, 20, 30, 5, 15, 25, 50]
let indices = array.indices { $0.isMultiple(of: 3) }

for index in indices {
    print("element:", array[index], "at:", index)
}

This will print

element: 30 at: 2
element: 15 at: 4

let group = ["H","H","E","D","G","D","G","E","D","B","A","B","A","A","G","C","C","H","D","G","H","B","E","F","F","C","E","A","B","C","F","F"]
let indices = group.indices(of: "A")
print(indices)

This will print

[10, 12, 13, 27]


text:
Q: How does this function fminunc(@(t)(costFunction(t, X, y, lambda)), startingTheta, options) work? I've used just about every resource i could find and still haven't found a concrete answer to the question I'm asking. Here's the code in question
    X = data(:, 1:2);
    y = data(:,3);
    X = [ones(m, 1) X];
    startingTheta = zeros(n + 1, 1);
    lambda = 0;
    % Set options for fminunc, maximum iterations allowed is 500
    options = optimset('MaxIter', 500);
    % fminunc()
    % Optimization function that finds the min point of cost function J
    fprintf('Run fminunc');
    [theta, cost] = fminunc(@(t)(costFunction(t, X, y, lambda)), startingTheta, options);
    fprintf('Done \n');
    fprintf('Theta: %f \n', theta);
    fprintf('Cost at theta found by fminunc: %f\n', cost);

How does this function work? Nowhere in the code is t defined. What value is being passed into the parameters t, X, y. I came across this answer
X = 1; y = 1; % Defining variables which aren't passed into the costFunction
% but which must exist for the next line to pass them as anything!
f = @(t)(costFunction(t, X, y)); % Explicitly define costFunction as a function of t alone
[theta, cost] = fminunc(f, 0, options);

but it really only confused me more. X and y are being defined only to be not passed into the costFunction. t isn't defined anywhere! What values exactly are being passed into these parameters? The code works, I just want to know how/why?


text:
Q: How to vertically align image and input type="text" filling the table cell? I have input type="text" and image button and I want input to fill tabe cell. I use the solution from Style input element to fill remaining width of its container, but I have problem with vertical alignment of both elements. I need to have the center of the elements on the same height.
HTML:

hhhh

	sssss

        <INPUT type='text' class='txt' ID='A12x1' NAME='A12x1'   />
        <input style='display: table-cell;' type='image' class='btn' src='http://myimages.bravenet.com/109/910/420/9/Arrow.png'/>

	kpu

CSS:
    .txt
{ BORDER: silver 1px solid;
  width:100%;
  vertical-align:middle;
  display: table-cell;
    }

.btn{ cursor: pointer;
       width: 18px;
    height: 26px;
    vertical-align: middle;
    }

http://jsfiddle.net/xqaN4/4/
I have tried various combintions of alignment, on the second place ,  or
 with background image with no success. The best solution was to include both elements in
s (display: table-cell), but this solution broke filling the width in chrome.
The second problem is to achieve the same height of the input and the button.
I need compatibility IE8+, Firefox, saf (Chrome).
Note: the image is an example found in the web.

A: Check this
Horizontal Align
http://jsfiddle.net/xqaN4/5/
.txt
{ BORDER: silver 1px solid;
  vertical-align:middle;
  display: table-cell;
    }

Vertical Align
http://jsfiddle.net/xqaN4/7/


text:
Q: Arranging the lines in required order A file contains lines as follows:
acb/xyz/row<t>
acb/xyz/row<t>
abc/xyz/row<1>
abc/xyz/row<1>
abc/xyz/row<0>
abc/xyz/row<0>
abc/xyz/row<3>
abc/xyz/row<3>
abc/xyz/row<2>
abc/xyz/row<2>
abc/xyz/row<4>
abc/xyz/row<4>
abc/xyz/row<b>
abc/xyz/row<b>

So I want the output to be
acb/xyz/row<t>
acb/xyz/row<t>
abc/xyz/row<b>
abc/xyz/row<b>
abc/xyz/row<0>
abc/xyz/row<0>
abc/xyz/row<1>
abc/xyz/row<1>
abc/xyz/row<2>
abc/xyz/row<2>
abc/xyz/row<3>
abc/xyz/row<3>
abc/xyz/row<4>
abc/xyz/row<4>

With t (for top) and b (for bottom) sorting before the numbers and in that order.

A: You can always use a decorate-sort-undecorate approach where you assign -2 to t, -1 to b with:
<your-file awk -F'[<>]' '
  {print $2 == "t" ? -2 : $2 == "b" ? -1 : $2, $0}' |
  sort -n |
  cut -d' ' -f2-

A: There may be other ways, but the best way I can think to do this involves using multiple commands, which you can do with a small script.
The script here first gets all lines with <t>, then gets all lines with <b>, then gets all lines with numerals inside <#> and sorts them numerically:
You can probably leave out the | sort in the first two commands if only what's inside the <...> matters:
#!/usr/bin/env bash

# get all rows with <t>
grep '<t>' input.txt | sort > output.txt

# get all rows with <b>, append to result
grep '<b>' input.txt | sort >> output.txt

# find lines with numbers inside <#>, pull the
# number out to start, sort numerically, then remove
# numbers pulled out to start; append to result
sed -n 's/.*<\([0-9]\+\)>.*/\1 &/p' input.txt | \
    sort -n | sed 's/^[0-9]\+ //' >> output.txt

I'm assuming the input file is input.txt and the output is output.txt; change as needed.
Make the script executable chmod a+x script.sh and run it ./script.sh.


text:
Q: Selenium: find input fieled element in Table I am using Java and firefox for automation.
i have the following table:

        User-ID:

         **<input name="username" size="25"/>**

       Password:

         **<input name="password" size="25" type="PASSWORD"/>**

I need to reach the "Input name" and "Input password" in order to input my credentials. I have tried the following commands :
driver.findElement(By.xpath("html/body/div[7]/div[2]/form[2]/fieldset/table[1]/tbody/tr[1]/td[2]/input")).sendKeys("XXXXX");
driver.findElement(By.xpath("*//table//tbody//tr//td[2]/input/@name")).sendKeys("XXXXXXX");

In both cases eclipse found nothing.
Can some one assist me with the correct xPath?
The error massage in Eclipse is the following:
Exception in thread "main" org.openqa.selenium.InvalidArgumentException: Expected [object Undefined] undefined to be a string

A: Looking at your HTML DOM this command will work for you:
You can use the "name" locator as:
driver.findElement(By.name("username")).sendKeys("your_username");
driver.findElement(By.name("password")).sendKeys("your_password");
OR
You can use the "xpath" locator as:
driver.findElement(By.xpath("//input[@name='username']")).sendKeys("your_username");
driver.findElement(By.xpath("//input[@name='password']")).sendKeys("your_password");
Let me know if it works for you.

A: Try this below code using xpath locator
driver.findElement(By.xpath("//input[@name='username']")).sendKeys("Username");
driver.findElement(By.xpath("//input[@name='password']")).sendKeys("XXXXXX");

Explanation of xpath:- Use name attribute of <input> tag.
Note:- Instead of using absolute xpath, use relative xpath.

OR

Try this below code using cssSelector
driver.findElement(By.cssSelector("input[name='username']")).sendKeys("Username");
driver.findElement(By.cssSelector("input[name='password']")).sendKeys("XXXXXX");

A: I found out why your answers are not working.
The error that i am getting is an actual Firefox issue.
Please refer to this link:
https://bugzilla.mozilla.org/show_bug.cgi?id=1357661
Many thanks to all that tried to help me.


text:
Q: Retrieve Case Insensitive SQL Select Query using DB2 Below sql select query retrieves the data from table.
SELECT DISTINCT  FRUIT_NAME,FRUIT_ID  FROM Fruits ORDER BY FRUIT_NAME ASC

I have used "ORDER BY FRUIT_NAME ASC" which fetches the results based on Assending order as shown below.
Results :
Apple
Bannana
Mango
apricots
blueberries
I want a case insensitive search results like below.
Apple
apricots
Bannana
blueberries
Mango
I dont want to use upper() or lower() as it might affect performance for larger table data.
Also COLLATE NOCASE doesn't work with db2. Below is the error i got when i used
COLLATE NOCASE in select sql query in db2.
1) [Code: -104, SQL State: 42601]  ILLEGAL SYMBOL "COLLATE".

Is there any way to retrieve case insensitive data from sql select query using db2?

A: You could order using the LOWER function:
SELECT DISTINCT FRUIT_NAME, FRUIT_ID
FROM Fruits
ORDER BY LOWER(FRUIT_NAME);

Of course, this means the ORDER BY step can't use an index.  If you need to order rapidly regardless of case, you could consider storing an all-lowercase version of the column, as one option.


text:
Q: Using wget to download select directories from ftp server I'm trying to understand how to use wget to download specific directories from a bunch of different ftp sites with economic data from the US government.
As a simple example, I know that I can download an entire directory using a command like:
wget  --timestamping  --recursive --no-parent ftp://ftp.bls.gov/pub/special.requests/cew/2013/county/

But I envision running more complex downloads, where I might want to limit a download to a handful of directories. So I've been looking at the --include option. But I don't really understand how it works. Specifically, why doesn't this work:
wget --timestamping --recursive -I /pub/special.requests/cew/2013/county/ ftp://ftp.bls.gov/pub/special.requests/cew/

The following does work, in the sense that it downloads files, but it downloads way more than I need (everything in the 2013 directory, vs just the county subdirectory):
wget --timestamping --recursive -I /pub/special.requests/cew/2013/ ftp://ftp.bls.gov/pub/special.requests/cew/

I can't tell if i'm not understanding something about wget or if my issue is with something more fundamental to ftp server structures.
Thanks for the help!

A: Based on this doc it seems that the filtering functions of wget are very limited.
When using the --recursive option, wget will download all linked documents after applying the various filters, such as --no-parent and -I, -X, -A, -R options.
In your example:
wget -r -I /pub/special.requests/cew/2013/county/ ftp://ftp.bls.gov/pub/special.requests/cew/

This won't download anything, because the -I option specifies to include only links matching /pub/special.requests/cew/2013/county/, but on the page /pub/special.requests/cew/ there are no such links, so the download stops there. This will work though:
wget -r -I /pub/special.requests/cew/2013/county/ ftp://ftp.bls.gov/pub/special.requests/cew/2013/

... because in this case the /pub/special.requests/cew/2013/ page does have a link to county/
Btw, you can find more details in this doc than on the man page:
http://www.gnu.org/software/wget/manual/html_node/

A: can't you simply do (and add the --timestamping/--no-parent etc. as needed)
 wget -r ftp://ftp.bls.gov/pub/special.requests/cew/2013/county

The -I seems to work at one directory level at a time, so if we step one step up from county/ we could do:
 wget -r -I /pub/special.requests/cew/2013/county/ ftp://ftp.bls.gov/pub/special.requests/cew/2013/

But apparently we can't step further up and do
 wget -r -I /pub/special.requests/cew/2013/county/ ftp://ftp.bls.gov/pub/special.requests/cew/


text:
Q: How to solve simple differential equation (biology) First of all, I am a biologist and I am not really knowledgeable in mathematics. Thus, I apologize if what I am asking is naive or not fully explained.
I am trying to solve analytically a differential equation for the growth of a pile ($S$). The differential equation should be as follows:
$\frac{dS}{dt} = (k×J) - S(t)×L ×(k×J)$
where:
$S =$ size of the structure
$J =$ constant
$L =$ changing with S
Flow = constant = $k$
The equation can thus be simplified to:
$\frac{dS}{dt} = N - S(t) × L × N$
where $N = (k × J)$
Is there an analytical solution to this equation? If so, how can I achieve it? I would like to learn a bit about the process but not being in the field makes finding resources a little harder.
Thanks a lot.

A: $$\frac{dS(t)}{dt} = N - S(t) \, L \, N$$
If $L$ does not depend on time, then
$$S(t)=\frac{S(0) L-1 }{L}e^{-L N t}+\frac1 L$$
Detailed steps
First, about notations : $a b$ stands for $a\times b$.
We shall write the equation as
$$\frac{dS(t)}{dt} + S(t) \, L \, N=N\tag 1$$ Consider first the corresponding homogeneous equation
$$\frac{dS(t)}{dt} + S(t) \, L \, N=0$$ what rewrite as
$$\frac {dS(t) }{S(t)}=-L\, N \,dt$$ Integrate both sides
$$\log(S(t))=-L\, N \,t+c_1\implies S(t)=\exp\left(-L\, N \,t+c_1 \right)=\exp\left(-L\, N \,t\right)\exp(c_1)$$
$$S(t)=c_2 \exp\left(-L\, N \,t\right)$$ If the rhs in $(1)$ had been $0$, the problem would have been over and $c_2=S(0)$. But this is not the case; so, to take it into account, we consider that $c_2$ is a function of $t$. For clarity, let me write $c_2=C(t)$ (this is called variation of parameters). So
$$S(t)=C(t)\exp\left(-L\, N \,t\right)\implies \tag 2$$ $$\frac{dS(t)}{dt}=\frac{dC(t)}{dt}\exp\left(-L\, N \,t\right)-C(t)\,L\,N\,\exp\left(-L\, N \,t\right)$$ Plug in $(1)$ and simplify to obtain
$$\frac{dC(t)}{dt}=N e^{L N t}\implies C(t)=\frac{e^{L N t}}{L}+c_3$$ Back to $(2)$, we then have
$$S(t)=\Big[\frac{e^{L N t}}{L}+c_3 \Big]\exp\left(-L\, N \,t\right)$$ Expand and simplify
$$S(t)=c_3 e^{-L N t}+\frac{1}{L}$$ Apply the condition at $t=0$
$$S(0)=c_3+\frac{1}{L} \implies c_3=S(0)-\frac{1}{L}\implies S(t)=(S(0)-\frac{1}{L})e^{-L N t}+\frac{1}{L}$$ which was the answer.


text:
Q: Android app crashes when passing through a bundle through intent I am kind of new to Android Development. In my activity, i am trying to pass through some strings using bundle and intent to the next activity. But for some reason the app crashes and throws an error:

FATAL EXCEPTION: main

The logcat when the button is pressed:
05-20 15:42:27.137 15393-15393/com.me.backtrack.backtrack D/AndroidRuntime: Shutting down VM
05-20 15:42:27.138 15393-15393/com.me.backtrack.backtrack E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.me.backtrack.backtrack, PID: 15393
    java.lang.IllegalStateException: Could not execute method for android:onClick
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:293)
        at android.view.View.performClick(View.java:5637)
        at android.view.View$PerformClick.run(View.java:22429)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
        at android.view.View.performClick(View.java:5637)
        at android.view.View$PerformClick.run(View.java:22429)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
        at com.me.backtrack.backtrack.CreateTrackActivity.onClickSave(CreateTrackActivity.java:62)
        at java.lang.reflect.Method.invoke(Native Method)
        at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
        at android.view.View.performClick(View.java:5637)
        at android.view.View$PerformClick.run(View.java:22429)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
05-20 15:42:27.142 1570-1843/system_process W/ActivityManager:   Force finishing activity com.me.backtrack.backtrack/.CreateTrackActivity
05-20 15:42:27.295 1292-1323/? D/AudioFlinger: mixer(0xb5b83c00) throttle end: throttle time(20)
05-20 15:42:27.390 1276-1999/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-20 15:42:27.409 1276-1999/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-20 15:42:27.411 1570-3402/system_process I/OpenGLRenderer: Initialized EGL, version 1.4
05-20 15:42:27.411 1570-3402/system_process D/OpenGLRenderer: Swap behavior 1
05-20 15:42:27.423 1276-1999/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
05-20 15:42:27.567 1570-3402/system_process E/EGL_emulation: tid 3402: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
05-20 15:42:27.572 1570-3402/system_process W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x9377b160, error=EGL_BAD_MATCH
05-20 15:42:27.666 1570-1586/system_process W/ActivityManager: Activity pause timeout for ActivityRecord{f964620 u0 com.me.backtrack.backtrack/.CreateTrackActivity t104 f}
05-20 15:42:27.984 2514-16105/com.google.android.gms I/iu.UploadsManager: End new media; added: 0, uploading: 0, time: 215 ms

Here is the starting activity:
package com.me.backtrack.backtrack;

import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import static android.R.attr.id;
import static android.R.attr.name;
import static android.R.id.edit;
import static com.me.backtrack.backtrack.R.id.addTag;

public class CreateTrackActivity extends AppCompatActivity {

    private EditText trackNameView;
    Fragment fr;
    boolean count = false;
    private EditText TagViewName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_create_track);

        trackNameView = (EditText) findViewById(R.id.trackName);
        final LinearLayout tagLayout = (LinearLayout)findViewById(R.id.tagView);

        final Button tagButton = (Button) findViewById(addTag);
        tagButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!count) {
                    Context c=CreateTrackActivity.this;
                    EditText tvv=new EditText(c);
                    tvv.setHint("Enter Tag");
                    tvv.setId(R.id.Tag_1);
                    tvv.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS);
                    tagButton.setVisibility(View.GONE);
                    tagLayout.addView(tvv);
                    count = true;
                }
            }
        });
        TagViewName = (EditText) findViewById(R.id.Tag_1);
    }

    public void onClickSave(View view) {
        String name = trackNameView.getText().toString();
        FileManager.CreateTrackDir(name);   //Creates track folders
        String tagName = TagViewName.getText().toString();
        Intent intent = new Intent(this, CameraActivity.class);

        //Bundle extras = intent.getExtras();
        Bundle bundle = new Bundle();
        bundle.putString("trackName", name); //pass through the folder name
        bundle.putString("tagName", tagName);
        intent.putExtra("bundle",bundle);
        startActivity(intent);
    }
}

Here is the onCreate part for the 2nd activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_camera);

    textureView = (TextureView) findViewById(R.id.camera_preview);
    assert textureView != null;
    textureView.setSurfaceTextureListener(textureListener);

    Bundle bundle = getIntent().getBundleExtra("bundle");
    nameOfTrack = bundle.getString("trackName");
    tagName = bundle.getString("tagName");
    //nameOfTrack = getIntent().getExtras().getString("trackName");
    //nameOfTrack = extras.getString("trackName");
    //tagName = extras.getString("tagName");
}

This activity like 450 lines of code so, i hope this is enough for knowing the problem. But if you want me to add the rest of the code please let me know. I tried using another StackOverflow answer but it seems like none of them are working for me for some reason. Am i doing something wrong with the intents? Thanks in advance.

A: The problem is that TagViewName is Null.
Here is the problem
final Button tagButton = (Button) findViewById(addTag);
    tagButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!count) {
                Context c=CreateTrackActivity.this;
                EditText tvv=new EditText(c);
                tvv.setHint("Enter Tag");
                tvv.setId(R.id.Tag_1);
                tvv.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS);
                tagButton.setVisibility(View.GONE);
                tagLayout.addView(tvv);
                count = true;
            }
        }

    });
    TagViewName = (EditText) findViewById(R.id.Tag_1);

As you see, you first find it by id. An id which does not exist at the beginning. Later you add a layout and set the id to it.
The workaround can be :
 public void onClickSave(View view) {
    String name = trackNameView.getText().toString();
    FileManager.CreateTrackDir(name);   //Creates track folders
    TagViewName = (EditText) findViewById(R.id.Tag_1);
    String tagName = TagViewName.getText().toString();
    Intent intent = new Intent(this, CameraActivity.class);


text:
Q: Windows 10 SplitView + Pivot not working properly I have used SplitView in my Windows 10 Universal Application and I added pivot to the SplitView.Content
Problem is when I start the application I cant click on Pivot headers to navigate.
This problem is occurring on Phone only Desktop or tablet not showing this issue.
If I Click on Hamburger Menu to open SplitView.Pane and then close the Pane I can touch the pivot headers and navigate pivot items.
Why my Pivot headers are not clickable at the start?
<SplitView>
<SplitView.Content>
    <Pivot>
        <PivotItem />
        <PivotItem />
        <PivotItem />
    </Pivot>
</SplitView.Content>
<SplitView.Pane>
    Hamburger Menu Button
    Other Buttons
</SplitView.Pane>

A: Hi i have the same issues when i was using spiltview + pivot in UWP
<SplitView>
     <SplitView.Pane>
      <!--  your view left bar view here -->
     </SplitView.Pane>
      <!-- remove your splitView.content tag then put your frame here -->
       <Frame x:Name="SplitViewFrame"/>
</splitView>

then set your select values like
SplitViewFrame.Navigate(typeof(your pivot page));

now it will be work

A: I am currently having the same issue. Clicking on the pivot header doesn't change the content of the pivot body. We need to resize the app so that the content of the selected pivot is shown. I have the sample and video showing the issue:
http://1drv.ms/1M7jYTQ
It happens on both, the phone and computer.


text:
Q: Options for real-time web notifications and updates using Comet/XMPP vs WebSocket technologies on a Microsoft stack? I am scoping out the architectural options for a project that will render live updates (like Facebook) of user activities - logins, photos, etc.  Two main UI components of this are an auto-updating scrolling area where new notifications will be listed (photos, etc.), and a toolbar that will update with things like updated message counts, etc.
The contenders for this are Jabber/Comet/XMPP-based and WebSocket technologies.
Comet camp:

*

*Pokein

*WebSync
WebSockets camp:

*

*Kaazing

*LightStreamer

*SuperWebSocket

*XSockets

*SignalR
Since this the existing infrastructure is a Microsoft stack, I would rather not introduce Java-based servers into the mix.  Saying this, it leaves (a very attractive) WebSync (Comet), and SuperWebSocket (WebSockets).  However the Pokein's DLL integration is fairly seamless into a .Net project as well.
Are there any more real production level WebSocket initiatives for .Net?  Is it too early to adopt WebSockets on a Microsoft stack, and should I go in favor of something like Kazing?
I am still waiting for a report on our current user base's browser types and versions (checking for HTML5 compatibility).  I am suspecting that this number will be low (older user base).  If that is the case, the Comet option would be the winner.
What are some other things to consider?
Looking at some of the .Net initiatives like Sockets.IO and others, I'm thinking this may be too much in its infancy yet, to apply to a large scale production system.
Can I get some comments from anyone that has used any of the technologies and products listed above?
Thanks.
UPDATE
I am still hunting for some good WebSocket servers that are reliable on a production level.  I added XSockets and SignalR to the Websockets camp after recently finding them.  Hoewver, there are still two main contenders at this time.  That could be just because of the fact that they have amazingly great marketing teams, good material available for developers - API's, and videos.  A lot of other implementations seem to still be in new-born phases, where examples are given of connectivity with only a few clients.  While this demonstrates the technology, these demos are not backed up with significant payload/load capacity data.  Kaazing and LightStreamer do meet the requirements below.
XSockets has some nice examples, but again, missing some real production metrics.
It doesn't seem that SignalR has yet been tested in a true production environment.  A scale-out solution is in development but doesn't appear stable yet.  Looking forward to seeing how this project does in the future.
Primary requirements are:

*

*Ability to implement fallback technology (if HTML5/WebSockets are
not available)

*High number of concurrent connections and number of messages per
second

*Scalable - ability to add additional servers/nodes for larger
traffic requirements

A: WebSync v4 uses WebSockets in addition to falling back to long-polling/callback-polling as needed. The WebSockets in WebSync are all over standard HTTP ports as well, so there won't be any issues with routers/filrewalls/etc.
On a "normal" system, you should see ~20k concurrent (per node) and ~100k messages/sec. Those are very rough numbers though, as it depends drastically on your system and the types of messages you're sending, etc. We've seen as high as 50k users (per node) and (in a different test) 300k messages/second.
(Disclaimer: I work for Frozen Mountain)

A: For reasons incl. those already stated above, I'd go with WebSockets.
If you go with WebSockets, you might also consider Autobahn WebSockets, a high-performance WS server that supports Windows where it runs on top of IOCP (I/O completion ports).
The latter is important if you want to scale to large connection numbers (hundred thousands).
Disclaimer: I am author of Autobahn WebSockets. The base tech is OSS. We are currently preparing a commercial offering, a real-time messaging hub provided as a virtual appliance (runs on VMware/sphere) .. completely integrated, hardened appliance. The latter also allows you to push notification via the hub using a plain old HTTP/POST .. it has a REST API that allows you to dispatch to clients connected via WS. If you are interested in private beta testing, contact me ..

A: It seems you pick the most stable Comet implementations available. All of them look stable, capable to host ten to hundred thousands of users per node and more.
So, what could be the next? For example, PokeIn is going to host all aspects of a web application over VisualJS.NET; Video-1, Video-2
This also shows the built-in capabilities of this library and the varieties you can do..
Besides, latest version supports Base64 serialization for the messages between a client and server hence no more naked JSON messages on network packages.
UPDATE: PokeIn 2.0 has built-in WebSockets support.

A: The performance gain you get with WebSockets over traditional comet solutions is in the multiple orders of magnitude range; I'd definitely go with the WebSockets camp. Here's a traditional comet vendor's comparison of the two technologies, measuring an over 150x factor in favor of WebSockets (700ms vs. 3 ms at 50,000 users).
A few notes on Kaazing's behalf:
Kaazing is fully supported on Microsoft as a server platform. Also, as you note, Kaazing supports a variety of client libraries and technologies, including the Microsoft stack: .NET and Silverlight, used happily by many of our customers.
In addition, Kaazing offers rich business protocols on top of WebSockets, allowing you to "speak" XMPP directly in your client code.
About browser support: Kaazing provides exceptionally good WebSocket emulation, supporting all the browsers out there, including old browsers, all the way back to IE6. You can read more about it in this blog post.
Regarding maturity: the Kaazing WebSocket Gateway has been shipping since 2009, and has a large number of high profile customers in many industries, including financial, logistics, gaming, and retail; very mature platform with top notch support.

A: SignalR wins.
Now that the product has matured it's been a breeze to implement.  Essentially it offers what those $everal thou$and dollar packages cost, but don't have the marketing bucks to showcase some really cool implementations.
From a technical perspective you can accomplish the same things with SignalR.  If your tech guys suggest otherwise, they probably don't know how to implement SignalR in a load-balanced environment (or even on its own).


text:
Q: How to implement a bidirectional relationship in Spring Data Neo4j? I am modelling a very simple use case, using Spring Data Neo4j: I want to have Persons, which are connected by friendship relations. Here is my code (getters and setters are omitted here):
@NodeEntity
public class Person {
    @GraphId
    private Long id;
    private String name;
    private String password;

    @RelatedTo(type = "FRIEND_OF", direction = Direction.BOTH)
    private Set<Person> friends = new HashSet<Person>();

    public Person() {};

    public Person(String name, String password) {
        this.name = name;
        this.password = password;
    }

    public void befriend(Person person) {
        this.friends.add(person);
    }

Ultimately, I make use of the following method in order to make use of my Persons:
@Transactional
private void populateTwoPersons() {
    Person person1 = new Person("Alice", "pw1");
    Person person2 = new Person("Bob", "pw2");

    List<Person> persons = Arrays.asList(person1, person2);
    personRepository.save(persons);

    person1.befriend(person2);

    personRepository.save(persons);
}

In my understanding a friendship relation should be bidirectional, that is why I set its direction to (direction = Direction.BOTH). Now when executing the populateTwoPersons() method it results in the creation of the two person nodes, but not in an edge between them.
Ideas that I have tried are altering the befriend()-function to
public void befriend(Person person) {
    this.friends.add(person);
    person.getFriends().add(this);
}

or setting the direction of the relationship to direction = Direction.OUTGOING. This however creates a directed edge, which is not what I want.
Why don't I get an edge in the first case altogether? Any ideas? :)
Thanks in advance,
Manu

A: All Neo4j edges must be directed and they cannot be bi-directional.  You can either create the friendship one-way and query it without direction. Or you can create two separate edges between the two friends. I think the latter is more flexible as one person may consider the other a friend but not vice versa.

A: If you don't care about the direction then you can specify direction=Relationship.UNDIRECTED which will guarantee that the path between two node entities is navigable from either side.
For example, consider the PARTNER_OF relationship between two companies, where
(A)-[:PARTNER_OF]→(B) implies (B)-[:PARTNER_OF]→(A)

The direction of the relationship does not matter; only the fact that a PARTNER_OF relationship exists between these two companies is of importance. Hence an UNDIRECTED relationship is the correct choice, ensuring that there is only one relationship of this type between two partners and navigating between them from either entity is possible.
Source: Good Relationships: The Spring Data Neo4j Guide Book.


text:
Q: python tree.xpath return empty list I'm having hard time figuring out why the tree.xpath method displayed in my code below would return an empty list.
In this example, I'm just trying to retrieve the stock tickers under the "People also Watch" banner in yahoo finance which seems pretty trivial but was unable to make it work so far.
I'm copying the xpath from the inspect element page. Have also tried changing the xpath manually such as removing 'tbody', but it didn't work neither.
Any help would be really appreciated. Thank you
import requests
from lxml import html

ticker = 'TSLA'
url = 'https://finance.yahoo.com/quote/'+str(ticker)+'?p='+str(ticker)
page = requests.get(url)
tree = html.fromstring(page.content)
tree.xpath('//*[@id="rec-by-symbol"]/table/tbody/tr[1]/td[1]/a')```

A: You're trying to parse page, that is being rendrered to HTML code by browser. If you open page's source code - you will see, that it has one big script tag with all data to be renderer.
You have two ways how to deal with this situation:
1. Render page and run XPathes in it.
It is about opening page in browser, getting rendered DOM from it and running XPath.
Best tool to use in this case - selenium with some kind of webdriver (util to control browser via python code)
Example code for your situation:
from selenium import webdriver
driver = webdriver.Chrome()

ticker = 'TSLA'
url = 'https://finance.yahoo.com/quote/'+str(ticker)+'?p='+str(ticker)
driver.get(url)

xpath = '//*[@id="rec-by-symbol"]/table/tbody/tr[1]/td[1]/a'
found_nodes = driver.find_elements_by_xpath(xpath)

for node in found_nodes:
    print(node.text)

driver.close()
driver.quit()

But you need to install selenium and download proper driver. For Chrome I used in example it will be chromedriver (you can get it here: https://chromedriver.chromium.org/):
pip install selenium

2. Parse script into Object (especially node root.App.main) and work with it
It is more complicated way, but without need of browser.
Workflow:
a. Download page via requests;
b. Get script with target data (via regular expressions);
c. load root.App.main as json Object (json.loads method);
d. Find necessary nodes in Object.

I won't provide any code for this case, because it requires to write almost whole parser for your task.

A: If you do not need any side packages as selenium and you want to use only requests and lxml, as i did by myself. I have used regex for such things:
for example, you could just look at page.context and find there some json structure that you need from the site like:
"NFLX":{"sourceInterval":15,"regularMarketOpen":{"raw":338.68,"fmt":"338.68"},"exchange":"NMS","regularMarketTime":{"raw":1579122001,"fmt":"4:00PM EST"},"fiftyTwoWeekRange":{"raw":"252.28 - 385.99","fmt":"252.28 - 385.99"},

and here you could find more info than just from lxml, but it could be much harder


text:
Q: Can't find resources runnable jar I can't load an resource file after extracting a project as a runnable jar.
It works in Eclipse but after exporting it throws a FileNotFoundException.
I have tried to put the res folder next to the .jar file but nothing helps. I've tried with JarSplice and got it running with all the libraries but it stops with the resource file. The object file is located in a source folder.
What can I do?
Code
    FileReader fr = null;
    try {
        fr = new FileReader(new File("res/" + fileName + ".obj"));
    } catch (FileNotFoundException e) {
        System.err.println("Couldn't load object file!");
        e.printStackTrace();
    }

EDIT: By opening the runnable .jar file in 7zip I can see that the whole /res folder has disappeared during the exporting and the files in the directory now lies directly in the root folder of the .jar file.

A: Based on your code, the res folder should be placed directly off the present working directory, which should be the directory where you are running the Java command from. For an example, see this question on how to determine the current working directory from inside Java.

A: Use Path instead of new File(string).
FileReader fr = null;
try {
    fr = new FileReader(Paths.get("res/" + fileName + ".obj").toFile());
} catch (FileNotFoundException e) {
    System.err.println("Couldn't load object file!");
    e.printStackTrace();
}


text:
Q: How to change button on click on Android? I want to make a on off single button which will change the background image of button on click. At initial the button should be red showing off and when clicked it should change colour to green and show on.

A: Create Boolean flag to check weather button is On or Off.
change button background color on button click event also change Boolean flag value
boolean isRed = false;
button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        if(isRed){
            isRed=false;
            button.setBackgroundColor(a.getResources().getColor(R.color.colorGreen));
        }else{
            isRed=true;
            button.setBackgroundColor(a.getResources().getColor(R.color.colorRed));
        }
    }
}

A: Create a xml named colors.xml in res/values folder:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="red">#ff0000</color>
    <color name="green">#00ff00</color>
</resources>

In drawable folder, create a xml file my_btn_toggle.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="false" android:drawable="@color/red"  />
    <item android:state_checked="true" android:drawable="@color/green"  />
</selector>

and in xml section define your toggle button:
<ToggleButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="New ToggleButton"
    android:id="@+id/toggleButton"
    android:background="@drawable/my_btn_toggle"/>


text:
Q: Returning Something As a Particular Type My IDE says there's an issue on the last line of code here (Cannot convert from Class<Ix> to Ix). How can it be resolved?
Here, Package is an interface where the method provides() returns a Collection<Type> of the types (interfaces) that the package provides.
m maps a type to a Package which provides the type.
I would like Manager's get() to return something of the requested type. In the example below, class P1 is a Package that provides a bunch of interfaces including Ix. I'd like to be able to ask the Manager to get the package that provides Ix and return it as an Ix.
public class Manager {

  public HashMap<Type, Package> m = new HashMap<Type, Package>();

  public void register(Package p) {
    for(Type t : p.provides())
      m.put(t, p);
  }

  @SuppressWarnings("unchecked")
  public <T> T get(T t) {
    return (T) m.get(t);
  }

  public static void main(String[] args) {
    Manager manager = new Manager();
    P1 p1 = new P1();
    manager.register(p1);
    Ix ix = manager.get(Ix.class);
    // What do I need to change so that the method call returns p1 as an Ix?
  }
}

I realize that the ideas in this code seem silly. But I still would like to understand the issue and how to resolve it. Thanks in advance!

A: 1) What do I need to change so that the method call returns p1 as an Ix?
Well, to be blunt you really can't. You could try casting, but I'm pretty sure that'd throw all kinds of errors.
As far as making sure get() returns a variable of type T, you need to pass some instance of the desired return type to the method. The issue comes from the fact that you're passing a Class object to get(T t), so it returns an object of type Class.
The parameter for get() just needs to be an instance of the desired return type.
Try: Ix ix = manager.get(new Ix());
That would fix the error your compiler is giving you; but I think you're approaching what you want to do in the wrong manner.
EDIT: I just realized you mentioned Ix was an interface - you'd need to pass a class which implements Ix to get() in that case, because you can't instantiate interfaces.

2) I'd like to be able to ask the Manager to get the package that provides Ix and return it as an Ix.
I think you're asking for the superinterface of Ix? As in what Ix implements? You wouldn't be able to store that in an Ix variable, at least not without errors. Ix can hold Ix objects and any subclasses of Ix, but not superclasses / superinterfaces.
If you just need to know what the superinterface of Ix is, I'd recommend using instanceof.


text:
Q: Construct identification between $L^2( \Omega;H)$ and $L^2(T \times \Omega)$ where $H=L^2(T, \mathcal B,\mu)$ I am reading page 31 of Nualart,
 "The Malliavin Calculus and Related Topics" .
Here, it says that there is an identification between the Hilberts spaces $L^2( \Omega;H) $ and $L^2( T \times\Omega) $ where $H=L^2(T, \mathcal B,\mu)$ and $\mu$ is atomless.
How can I contruct this "natural identification"? I know that $L^2(T \times \Omega) \cong L^2(T) \bigotimes L^2(\Omega)$, but I don't see how this helps.
Any hint is appreciated.

A: The map is just $f \in L^{2}(\Omega, H) \to g$ where $g(t,\omega)=f(\omega) (t)$. The fact that this is an isometry follows immdiately from Fubini's Theorem.


text:
Q: GraphQL::Client::ValidationError: Type mismatch on variable $id and argument eq (String! / ItemId) I want to get specific data from DatoCMS so I need to pass a parameter in my GraphQL query. The thing is I'm getting an error:
GraphQL::Client::ValidationError: Type mismatch on variable $id and argument eq (String! / ItemId)

I'm using ruby graphql-client gem to make this requests (probably it's not important) and It's my first time with Graphql.
below my query:
query($id: String!) {
  allTexts(filter: {id: {eq: $id}}) {
    title
    isSeparateActivity
    shortDescription
    longDescription
    text {
      article
    }
    author
    _updatedAt
    _createdAt
    length
  }
}

If I change query($id: String!) to query($id: ID!) I'm getting new error:
GraphQL::Client::ValidationError: ID isn't a defined input type (on $id)

A: It looks like your query is using String!, and it's telling you that it has to be ItemId. Without having an endpoint to test it against, it looks like if you use this query, it should work:
query($id: ItemId) {
  allTexts(filter: {id: {eq: $id}}) {
    title
    isSeparateActivity
    shortDescription
    longDescription
    text {
      article
    }
    author
    _updatedAt
    _createdAt
    length
  }
}


text:
Q: JW Player - how to send user to a certain url when they click on the video When the user clicks on the video once its ended id like it to pop up a window with a new url in it - how can i do this in jw player?

A: If you want the pop up in the player you'll need to create a flash plugin for it.
If you want a javascript alert, you can do something like this.
jwplayer().onComplete(videoEnded)

function videoEnded()
{
    alert("Your Message: and url");
}

http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12540/javascript-api-reference
Or for the Flash plugin
http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/17679/building-flash-plugins


text:
Q: How to identify the similar words using the word2vec input: I have a set of words(N) & input sentence
problem statement:
the sentence is dynamic, the user can give any sentence related to one business domain. we have to map the input sentence tokens to the set of words based on the closeness.
for example, we can use different words to ask the same meaning questions, and hard to maintain all the synonyms hence we have a mechanism to find similar words, we can map easily.
1) A meeting scheduled by john
2) A meeting organized by john

user can frame a sentence in different ways, like the above example.
scheduled & organized are very close.
N set has the word, scheduled. if a user gives a sentence like (2), I have to map the organized with scheduled.

A: Take a look at "Word Mover's Distance", a way to calculate differences between texts that's essentially based on "bags of word-vectors". It can be expensive to calculate, especially on longer texts, but generally identifies "similar" ranges-of-text better than a simple baseline like "average of all word-vectors".
Beyond that, some of the deeper-neural-network methods of vectorizing text – BERT, ELMo, etc – may do an even-more effective job of placing such "similar intent by different words" texts into close positions in a shared coordinate space.


text:
Q: Google Colab - writing out a .csv but overwriting file? I'm hoping this is a straightforwardly simple thing to do, but I can't find a solution for. I'm using Google Colab to process some data on a daily basis that I then read into another program. I use:
files.download('today_out.csv')

It outputs to my windows/user/downloads directory. I would like, if possible, to be able to overwrite this file - but the Windows file system end up creating a today_out.csv(1) and I'd rather just overwrite the existing today_out.csv. Is there a way to do this in Colab?

A: It is not possible to read local files on your computer from Colab. But you can create a local python script and run it before running Colab.
Before downloading the file, you can check if the file exists and delete it.
try:
    os.remove("file.csv")
except OSError:
    pass


text:
Q: Remove rectangle from Progress Indicator I tested Progress Indicator in Java 8u40. I get this visual result when I tried to make simple example. Do you know how I can remove the rectangle borders?

A: this works for me with no border or other problems (JDK 1.8.0_20ea):
    stage.setWidth(100);
    stage.setHeight(100);

    BorderPane root = new BorderPane();

    ProgressIndicator progress = new ProgressIndicator();
    progress.setMaxWidth(50);
    progress.setMaxHeight(50);

    root.setCenter(progress);

    stage.setScene(new Scene(root));

    stage.show();

Is this maybe a bug in 8u40?

A: Apply the CSS
-fx-box-border: transparent;

to the progress indicator.

A: I came from the future. The CSS you're all looking for is:
.progress-indicator:indeterminate > .spinner {
   -fx-border-width: 0 !important;
}

Now my soul can finally rest, knowing that this most vexing regret need not befall this generation


text:
Q: What are alternatives to OpenSplice and RTI DDS implementations? I have a good amount of experience with RTI DDS and have used it in many applications. I have recently begun to use OpenSplice to work with DDS to see if there if it is a good open source alternative to RTI. I have had these two butting heads for a while now, trying to get messages to pass back and forth between different implementations to no avail.
What (if any) other DDS implementations would everyone recommend? I have found others such as OpenDDS but what I really want is a good DDS implementation that is compatible with RTI, supports C/C++/C#/Java, and is open source.
I realize OpenSplice fits this description but I want ones other than that. Thanks!

A: I first began trying the OCERA(see link below) C implementation of the RTPS (I even translated to C++) but it's just an RTPS v1.0 protocol implementation, not fully DDS compliant. Ironically, it's the first version of the protocol any DDS implementation should use to be compliant (with the interoperable protocol).
I'm sure you know the DDS vendors page, right?
http://portals.omg.org/dds/where-can-i-get-dds/
I have not tried the OpenSplice, but it's been used in many military applications (as well as the RTI), and it's open source (registered free :D)
The guys of the OpenDDS have a long tradition with OMG products. Inside some not interoperable OpenDDS transport is ACE (and maybe TAO, their efficient CORBA implementation). It's good to know they finally have the option of the interoperable protocol, damned!, where it was in 2008?
I wish it were any in C#!!!! ... that drove me to develop (open source) a C# publish/subscribe framework/middleware with Google Protocol Buffers as wired format, catching some ideas from DDS, JMS, TIBCO rendevouz and JGroups. If you are interest, just let me know (I'll be releasing the v2 very soon).

A: There may be a very simple reason why OpenSplice DDS and RTI DDS did not communicate with each other, which is that you may not had configured OpenSplice to use DDSI as its wire-protocol.
OpenSplice DDS currently supports two protocols:

*

*DDSI, the DDS interoperability wire-protocol

*RT-NET, a proprietary protocol targeting hard real-time applications

Up to version 5.x OpenSplice DDS was configured to use RT-NET as the the default protocol. From v6.x we changed the default to use DDSI as the default.
Which version of OpenSplice DDS where you using?
That said, beware that OpenSplice DDS is Open Source and licensed under LGPL.
A+

A: At the most recent OMG meeting, OpenDDS demonstrated inter-operability with both RTI and OpenSplice (among other DDS implementations).


text:
Q: How does the OpenGL ES template work for the iPhone? So, I've been trying to figure out why the square is moving up and down the iPhone simulator when I Build and Run the template that Apple provides for OpenGL ES. I don't understand why for example they have ES1Render.m, and ES2Render.m instead of just one ESRender.m. Also, where is the equivalent of the glutDisplayFunc, and glutTimerFunc? Thanks in advance.

A: They are trying to the show the two versions of OpenGL ES. One uses shaders (v2) and the other (v1) uses older OpenGL technology. In the ES2 renderer I believe they are doing all the movement in the shader code. If you want something that looks like older OpenGL code try setting it to use the version 1 renderer. Then you can use stuff like the older demos on http://nehe.gamedev.net/. You just need to fill in the "render" function with your drawing code.
EAGLView has a timer which sets the frame rate, but there is a method which allows you to set it to be whatever you like.


text:
Q: .Net Core 2.0 Web API - Servers crashing because of issue with Destructors Ok, so I have an app with pretty heavy traffic (about 17 requests per second). The app is a REST API built with .Net Core 2.0 (just recently upgraded).
The app is hosted on Azure and we are having a problem that looked like a memory leak in that the servers would very slowly (over a week) eat up all the handlers and resources and eventually crash.
I have spoken a good bit to MS Support and they helped me narrow down the problem. Here is their last email:

"We are seeing a high amount of large objects (strings and arrays over
  85000 bytes) can lead to GC Heap fragmentation and thus higher memory
  usage in your application.    We were investigating how to manage the
  destructor and I can provide you the following documentation:

*

*Why does the Finalize/Destructor example not work in .NET Core?    Why does the Finalize/Destructor example not work in .NET Core?
  (not a Microsoft official documentation but it can be use as reference )

*ASP.NET Case Study: Bad perf, high memory usage and high
  CPU in GC – Death By ViewState:
https://blogs.msdn.microsoft.com/tess/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate/

*

*Finalizers (C# Programming Guide):
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/destructors
I will continue looking for more documentation related with the
  destructor in  .NET Core."

After this they basically said that Azure was not to blame and I needed to open up a "code" support ticket that costs about $500...
So I am coming here instead. :)
While I have been a .Net developer for over 15 years, this was my first time using .Net Core. I found this great article and used it as the backbone to my API (https://chsakell.com/2016/06/23/rest-apis-using-asp-net-core-and-entity-framework-core/).
When I compared it to other .Net Core examples it seemed to fall in line with those so I am reasonably confident that I am following "best practices", but I could be wrong.
My fear is that there is a fundamental problem with .Net Core (which those articles that MS referred to kinda suggest), but I am not sure how to find the answer. I don't want have to rewrite my code because of this, but aside from occasionally rebooting the servers I am not sure what my options are.
Thoughts?

A: Ok... for posterity... my eventual solution turned out to be a configuration setup issue... the destructor issue with Core wasn't a factor for me because we weren't sending strings large enough to trigger it.
You can see my approach and the eventual answer (using a singleton) in this question:
ASP.Net Core 2 configuration taking up a lot of memory. How do I get config information differently?


text:
Q: How to restart system-wide logging on a Linux server? I am running a Centos 7 Linux server. I tried to install rsyslog. Because of a misconfiguration, we had to uninstall it. Since then, I see that all logs are truncated and no new logs are being created.
How do I resolve this?

A: I believe rsyslog is installed by default in CentOS 7/RHEL 7. If you remove it then there is no syslog service and therefore no new logs that utilize syslog will be created.


text:
Q: Python Hanging on Length and Split functions I have a bit of code and it is hanging when I run it. I have narrowed it down to the following line. When I remove this line, my code does not hang.
However, there is nothing in this line which would make me think it could hang. There is no loops. Is there any known issues where string functions can hang given unknown input?
Here is the line causing the problem:
len(body.split("\n")[-1]) >= 67

Here is the full function. Notice I have commented things out trying to narrow this down:
    def __str__(self):
        body = ""
        for i in range(0, self.height):
            for j in range (0, self.width):
                body += str(clamp(self.canvas[j][i]).red)
                if len(body.split("\n")[-1]) >= 67 and j != self.width - 1:
                    body += "\n"
                else:
                    body += " "
                #body += str(clamp(self.canvas[j][i]).green)
                #if len(body.split("\n")[-1]) >= 67 and j != self.width - 1:
                #    body += "\n"
                #else:
                #    body += " "
                #body += str(clamp(self.canvas[j][i]).blue)
                #if len(body.split("\n")[-1]) >= 67 and j != self.width - 1:
                #    body += "\n"
                #elif j != self.width - 1:
                #    body += " "
            if i != self.height - 1:
                body += "\n"
        return body

A: After adding some print statements printing i and j in the for loop, I found that it was running, but slowing down at an almost exponential speed as i increased. Because of this continued exponential slow down, it seemed as if it will never finish.
I rewrote the str function and sped up the total time to write_file() to 12 seconds for a canvas of size 900 by 550.
Here is the new speedier function:
    def __str__(self):
        body = ""
        for i in range(0, self.height):
            cur = ""
            for j in range (0, self.width):
                clamped = clamp(self.canvas[j][i])
                print(str(i) + " " + str(j))
                cur += str(clamped.red)
                if len(cur) >= 67 and j != self.width - 1:
                    cur += "\n"
                    body += cur
                    cur = ""
                else:
                    cur += " "
                cur += str(clamped.green)
                if len(cur) >= 67 and j != self.width - 1:
                    cur += "\n"
                    body += cur
                    cur = ""
                else:
                    cur += " "
                cur += str(clamped.blue)
                if len(cur) >= 67 and j != self.width - 1:
                    cur += "\n"
                    body += cur
                    cur = ""
                elif j != self.width - 1:
                    cur += " "
            body += cur
            if i != self.height - 1:
                body += "\n"
        return body


text:
Q: always getting string was not recognized as valid datetime. how to convert for current format I want to accept date in dd-MM-yyyy format using textbox I have used ajax calendar also.
DateTime.ParseExact(txtDate.Text,"dd-MM-yyyy",null)

and
Convert.ToDateTime(txtDate.Text)

are both throwing exception:

string was not recognized as valid datetime.

I know when I will change my system dateformat which is currently MM-dd-yyyy to dd-MM-yyyy, it will start recognizing it but what is solution when I will publish it on server.
So is there any solution to parse it for current format ?

A: You need to pass an IFormatProvider parameter to the ParseExact method like :
CultureInfo provider = CultureInfo.GetCultureInfo("en-US")
DateTime.ParseExact(txtDate.Text,"dd-MM-yyyy",provider)

And don't forget to use the System.Globalization namespace

A: You need to use System.Threading.Thread.CurrentThread.CurrentCulture to get the user's current settings. Then use that to get the formatted date string.
DateTime now = DateTime.Now;
string formattedToCurrentUser = now.ToString(System.Threading.Thread.CurrentThread.CurrentCulture);