text:
Q: How to change a UILabel using a slider I'm new to objective c and I want to change a label text to the value of a slider.
Should I add some text first and should I add the UILabel inside the Action?
What I have is:
#import "slRootViewController.h"
@implementation slRootViewController {
    NSMutableArray *_objects;
}

- (void)loadView {
    [super loadView];

    _objects = [[NSMutableArray alloc] init];

    self.title = @"Slider Test ";

    CGRect frame = CGRectMake(0.0, 0.0, 200.0, 10.0);
    UISlider *slider = [[UISlider alloc] initWithFrame:frame];
    [slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
    [slider setBackgroundColor:[UIColor clearColor]];
    slider.minimumValue = 0.0;
    slider.maximumValue = 50.0;
    slider.continuous = YES;
    slider.value = 25.0;

    UILabel *sliderText=[ [UILabel alloc] initWithFrame:CGRectMake(273,442,32,20)];

    [self.view addSubview:slider];
    [self.view addSubview:sliderText];
}

// voids
-(void)sliderAction:(id)sender
{
    UISlider *slider = (UISlider*)sender;
     self.sliderText.text=[NSString stringWithFormat:@"%f", slider.value];
    //-- Do further actions
}

@end

But I'm getting an error saying

error: Use of undeclared identifier "sliderText"

A: Define the Label object Globally in your file.
@implementation slRootViewController {
    NSMutableArray *_objects;
    UILabel *sliderText; //Define globally label object
}

and change name or any activity for this label using globally object, like a
Change name,
sliderText.text = @"Set Name";

Set Text Color,
sliderText.textColor = [UIColor redColor];

and so on......

A: The error is due to the variable's scope. You are declaring sliderText inside loadView and finally accessing it in another method called sliderAction. It should be an instance variable (defined in either your .h or .m file depending on your needs). Just like you did with _objects.
@implementation slRootViewController {
    NSMutableArray *_objects;
    UILabel *sliderText; // Move it to your .h file if needed
}

A: It should be like this
#import "slRootViewController.h"

@implementation slRootViewController {

    NSMutableArray *_objects;

}

@property (strong ,nonatomic) UILabel *sliderText;

- (void)loadView {
    [super loadView];

    _objects = [[NSMutableArray alloc] init];

    self.title = @"Slider Test ";

    CGRect frame = CGRectMake(60, 200.0, 200.0, 10.0);
    UISlider *slider = [[UISlider alloc] initWithFrame:frame];
    [slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
    [slider setBackgroundColor:[UIColor clearColor]];
    slider.minimumValue = 0.0;
    slider.maximumValue = 50.0;
    slider.continuous = YES;
    slider.value = 25.0;

    self.sliderText = [[UILabel alloc] initWithFrame:CGRectMake(60,CGRectGetMaxY(slider.frame)+40,120,20)];
    //You can change y axis what you want
    [self.view addSubview:slider];
    [self.view addSubview:self.sliderText];
}

// voids
-(void)sliderAction:(id)sender
{
    UISlider *slider = (UISlider*)sender;
    self.sliderText.text=[NSString stringWithFormat:@"%f", slider.value];
    //-- Do further actions
}

A: Let me clear with your error.
When you try to access any object in controller or class, which you haven't declared, or you declared in one method and you try to call its outside method (that's called as Out of Scope), then you will get an error like this.
Solutions:
1) Check your header file about the variable declaration.
2) Here you write self.sliderText. So make sure you have proper synthesize it.

A: You just need to change the UILabel declaration in implementation part..,just shown below in code
    #import "slRootViewController.h"
@implementation slRootViewController {
    NSMutableArray *_objects;
  UILabel *sliderText; //<<---
}

- (void)loadView {
    [super loadView];

    _objects = [[NSMutableArray alloc] init];

    self.title = @"Slider Test ";

    CGRect frame = CGRectMake(0.0, 0.0, 200.0, 10.0);
    UISlider *slider = [[UISlider alloc] initWithFrame:frame];
    [slider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
    [slider setBackgroundColor:[UIColor clearColor]];
    slider.minimumValue = 0.0;
    slider.maximumValue = 50.0;
    slider.continuous = YES;
    slider.value = 25.0;

    sliderText=[ [UILabel alloc] initWithFrame:CGRectMake(273,442,32,20)];

    [self.view addSubview:slider];
    [self.view addSubview:sliderText];
}

// voids
-(void)sliderAction:(id)sender
{
    UISlider *slider = (UISlider*)sender;
     sliderText.text=[NSString stringWithFormat:@"%f", slider.value];
}

@end


text:
Q: Error when trying to pull live values from firestore with flutter I am trying to pull values from a live firestore database but am getting few errors with the code. I have used streambuilder to pull the data as it will need to be updated whenever there is a change in the database.
class ProfileWidget extends StatelessWidget {

  final String userId;

  ProfileWidget(this.userId);

  @override
  Widget build(BuildContext context){
    return StreamBuilder<DocumentSnapshot>(
        stream:Firestore.instance.collection('users')
            .document(userId)
            .snapshots(),
        builder:(context, snapshot){
          if(snapshot.hasData){
            User user = User.fromSnapshot(snapshot.data);
              return Row(
                  children: <Widget>[
                  Text(snapshot.data.documents[0]['sold'].toString())}
              else
                {return CircularProgressIndicator();
          }
        });
  }
}

class User {
  final int name;
  final DocumentReference reference;

  User.fromMap(Map<String, dynamic> map, {this.reference})
      : name = map['name'];

  User.fromSnapshot(DocumentSnapshot snapshot)
      : this.fromMap(snapshot.data, reference: snapshot.reference);
}

Following are the two errors i get:

*

*'error: The getter 'documents' isn't defined for the class 'DocumentSnapshot'. (undefined_getter at [flutter_appprofilescreenfinal] lib\main.dart:37)

*info: The value of the local variable 'user' isn't used. (unused_local_variable at [flutter_appprofilescreenfinal] lib\main.dart:34)

A: For the first error, assuming your users each have documents property, you should access it like this
snapshot.data['documents'][0]['sold'].toString()

The second error is pretty simple. You defined user but never used it inside the StreamBuilder's builder function.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Solving nonlinear system of differential equations in matlab usin ODE45 i am trying to solve a system of nonlinear differential equation using ODE45 MATLAB , i did that many times successfully , but this time i get the following error and i really don't know what is wrong i am confused compeletly. here are the codes.
%%  this is the error:
Subscript indices must either be real positive integers or logicals.

Error in non_L_ss (line 6)
        (-Fk*(ds0+x(3)-x(1))+Fk*ds0-Fc(x(4)-x(2)))/ms +Fa/ms ] ;

Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:});   % ODE15I sets args{1} to yp0.

Error in ode45 (line 115)
odearguments(FcnHandlesUsed,solver_name,ode, tspan,y0,optio varargin);

Error in solve (line 50)
[t X]=ode45(@non_L_ss,t_span,IC);

%% the equations be defined in a function:
function dX=non_L_ss(t,x)
global Fk Fc kt Fa q ds0 ms mu
dX=[ x(2);
     (Fk*(ds0+x(3)-x(1))-Fk*ds0+Fc*(x(4)-x(2))-kt*x(1))/mu-Fa/m-kt*q/mu ;
     x(4);
     (-Fk*(ds0+x(3)-x(1))+Fk*ds0-Fc(x(4)-x(2)))/ms +Fa/ms ] ;
end

%%  and here the function be called to solve by ODE45:
clear
clc
global Fk Fc kt Fa q ds0 ms mu qdot v2
mu = 100 ;
ms = 1242 ;
k1s = 80000 ;
k2s = 32000 ;
kt = 405000 ;
c1s = 4000 ;
c2s = 1600 ;
v = 20 ;
Gq = 256e-6 ;
ds0 = 0.1538 ;
a = 1 ;
b = 0.001 ;
n0 = 0.1 ;
f0 = 0.011*v ;
w = 0.5 ;
Fa = 2000 ;
q = 0.05 ;
xs = 0.1 ;
xu = 0.1 ;
dxs = 0.1 ;
dxu = 0.2 ;

Fk = k1s+k2s*(ds0+xs-xu).^2 ;

if dxs >= dxu
Fc = c1s ;
elseif dxs < dxu
Fc = c2s ;
end

t_span=[0 1];
IC=[2 3 2 2];
[t X]=ode45(@non_L_ss,t_span,IC);

A: Subscript indices must either be real positive integers or logicals.

Error in non_L_ss (line 6)
    (-Fk*(ds0+x(3)-x(1))+Fk*ds0-Fc(x(4)-x(2)))/ms +Fa/ms ] ;

means that you use something as an indexed array with a non-integer index. Which probably means that the object is no array at all. I'd propose to replace
Fc(x(4)-x(2))

by
Fc*(x(4)-x(2))

to try to solve this issue.


text:
Q: pjsip iOS handling ip change during call I want to handle ip change form wifi to 4g and back during an ongoing call using pjsip on ios.
I have followed all the steps form pjsip website: https://trac.pjsip.org/repos/wiki/IPAddressChange and here I have found that the call is disconnected after the pjsua_acc_set_registration(the_acc_id, PJ_FALSE); is sent.
Also I don't figure it out how to send the re registration at point 4.

"And finally, once unregistration in 2b) above is complete,
  re-register (with TCP)."

Any advice, suggestion, link to any resource that will hell me solve the issue is well come.

A: The most simple and reliable way is described in your reference:

The most straightforward solution is of course to restart everything, which means in pjsua terms to call pjsua_destroy() and followed by pjsua_create(), pjsua_init(), and so on.

To detect 4G/WiFi changes, you should use Apple Reachability API, great wrappers are AFNetworkReachabilityManager and Reachability by Tony Million. I used this approach in my own project and it worked flawlessly.

A: Starting from Version 2.7 there is second approach there:

Approach 2: Selective update
Alternatively there may be a way to allow the stack to continue to
  run, updating the address information when necessary. This approach
  will require some specific features to be used, as well as some
  actions by the application when it detects that the IP address has
  changed.
The specific configuration and tasks will be explained below. Note we
  assume that the SIP and media sockets are bound to INADDR_ANY
  (0.0.0.0) and not to a specific interface IP address (this is the
  default behavior).
Update for 2.7 or above: application can apply this selective update
  approach with much simpler way, please check ticket #2041.

A: In Order to get Internet/IP changes, You can use Apple Reachability API or you can use Reachability by Tony. In Reachability change observer you can compare previous IP address family and current IP address family.
If both are from same family e.g last and new belongs to same ip family IPV4 or IPV6 than

*

*Get the current call info.

*Use pjsip method pjsua_call_reinvite() and use the flag PJSUA_CALL_UPDATE_CONTACT.

If both are from different family e.g last belongs to IPV4 and new belongs to IPV6 or vice versa than use below steps.

*

*Send Registration request

*Get the current call info.

*Use pjsip method pjsua_call_reinvite() and use the flag PJSUA_CALL_UPDATE_CONTACT.


text:
Q: ow to compute general processing time based on its complexity? I'm really confused about this, how to compute general processing time based on its complexity?
the question is:
Let the algorithms A of complexity 0(n^1.5) and B of complexity 0(nlogn) process a list of 100 records for TA(100) = 1 and TB(100) = 20 microseconds, respectively. Find their processing time, TA(n) and TB(n), for n records and decide which of them will process faster a list of n = 100,000,000 records.
Anyone keen to help??

A: Firstly we can deal with A, It is similar to a quadratic and we must find a constant value of C with the initial conditions we are given; 1 microsecond (1e^-6 seconds, and 100 records.
Therefore
 1µ = C * 100^1.5

 1µ = 1e^-3 * 100^1.5

 C = 1e^-3

We can then substitute in the values of 100,000,000 records and the value we found for c.
This results in a time of 1,000,000,000µs or 1000 seconds.
Try and do this process with the second algorithm in order to tell which one computes the records faster.


text:
Q: Raw input not reliably receiving all input I'm using raw input in my application to handle global hotkeys, but I'm running in to some funky behavior. Under normal circumstances, if I press the PrintScreen key on my keyboard, my application sees the following raw input events (scancodes):
2a (down) -> 37 (down) -> 37 (up) -> 2a (up)
However, if I run a fullscreen game, such as Team Fortress 2, and then press the PrintScreen, I see the following raw input events:
2a (down) -> 37 (up) -> 2a (up)
What happened to 37 (down)? It's like something is swallowing the input event.


text:
Q: Flutter Firebase: StreamBuilder Not Listening to Changes? I'm trying to create a UI where the user submits a "comment" on each "article". As you can see below, in my code, I get username of the user from Firestore and then checks if this user already has a comment for the respective article.
If the comment exists, it returns a stream of all the comments for that given article. If it does not exist, I return the CommentCollector that is a widget to collect the comment and post it to Firestore. This overall works, expect when I submit a comment via CommentCollector, the UserPostGetter widget does not does not rebuild.
How can I trigger this rebuild? I thought using StreamBuilder to listen to see if there is a comment would be enough, but clearly not so. What am I missing?
Really appreciate the help.
class UserPostGetter extends StatelessWidget {
  final String articleId;
  final String articleHeader;

  UserPostGetter({this.articleId, this.articleHeader});

  @override
  Widget build(BuildContext context) {
// TODO: implement build
    return new Scaffold(
      body: new Container(
        child: new FutureBuilder<FirebaseUser>(
          future: FirebaseAuth.instance.currentUser(),
          builder: (context, AsyncSnapshot<FirebaseUser> snapshot) {
            if (snapshot.connectionState == ConnectionState.done) {
              String userNumber = snapshot.data.uid;
              return new FutureBuilder(
                future: getUser(userNumber),
                builder: (context, AsyncSnapshot<User> snapshot) {
                  if (snapshot?.data == null)
                    return new Center(
                      child: new Text("Loading..."),
                    );
                  String username = snapshot.data.username.toString();
                  return StreamBuilder(
                    stream: doesNameAlreadyExist(articleId, username),
                    builder: (context, AsyncSnapshot<bool> result) {
                      if (!result.hasData)
                        return Container(); // future still needs to be finished (loading)
                      if (result
                          .data) // result.data is the returned bool from doesNameAlreadyExists
                        return PostGetter(
                          articleId: articleId,
                        );
                      else
                        return CommentCollector(
                          articleID: articleId,
                          userName: username,
                          articleTitle: articleHeader,
                        );
                    },
                  );
                },
              );
            } else {
              return new Text('Loading...');
            }
          },
        ),
      ),
    );
  }
}

Stream<bool> doesNameAlreadyExist(String article, String name) async* {
  final QuerySnapshot result = await Firestore.instance
      .collection('post')
      .where('article', isEqualTo: article)
      .where('author', isEqualTo: name)
      .getDocuments();
  final List<DocumentSnapshot> documents = result.documents;
  yield documents.length == 1;
}

Future<User> getUser(idNumber) {
  return Firestore.instance
      .collection('user')
      .document('$idNumber')
      .get()
      .then((snapshot) {
    try {
      return User.fromSnapshot(snapshot);
    } catch (e) {
      print(e);
      return null;
    }
  });
}

class User {
  String email;
  String user_id;
  String username;
  User.fromSnapshot(DocumentSnapshot snapshot)
      : email = snapshot['email'],
        user_id = snapshot['user_id'],
        username = snapshot['username'];
}


text:
Q: Issues with pydatatable frame output in google colab I'm doing data wrangling on a dataset using pydatatable in google colab notebooks, on executing code chunks its displaying two different output formats of a frame, where as the same dataframe with pandas displays a single output, i'm attaching hera a screenshot of it for reference.
Could you please let me know any options should be configured in dt displays to have a correct output format?. or something is wrong in google colab notebooks?.

A: It's been clarified to me by pydatatable team, and i would have to contact google colab team for this issue. and for now i'm not going to use this in Colab notebooks.

A: it should be fixed by google colab team.

A: Since the version 1.0.0 it is displaying a single output.


text:
Q: How to load JS file in Angular4 I am new to Angular. I have added JS files in angular-cli.json inside scripts tag. Files are loaded successfully but the problem is that on my LoginForm console showing:

zone.js:192 Uncaught ReferenceError: theWYSIWYG is not defined

it is loaded when I loggedIn successfully I route to my another component from login-form.component.ts this.router.navigate(['dashboard']); on dashboard component some of html code is

function defined inside the js file which is loaded when app was started. Why JS is not accessing dashboard components.?

A: if you want to use javascript in your component. you must be included before @Component
    declare var require: any;
    const myFunc = require('../assets/jsFile');
    @Component({ ....

and then inside your AppComponent you can call javascript function with myFunc .
ngOnInit() {
  myFunc.func1();
}

A: import * as _ from "<jsfile_name>"; you can import js file in your component type script file


text:
Q: How should you push a tower when you have Baron but are not ahead in gold? Many times as a jungle I call baron at the perfect time and we steal it.  I just want to know the best way to use that baron against a full team to push a tower if we are behind in gold.
Should we bait them to attack someone then all jump in?  Or should the ad carry focus the tower while our team distracts the enemy team?

A: Like so many things in League of Legends, it depends upon and changes based on your team composition and the enemy's team composition. If you have more poke than they do, just sit outside tower range and throw your poke abilities at them until they're so low that staying near the tower risks dying. This is generally the safest way to force an enemy team off of a tower and then you can kill it uncontested.
Another strat is to instantly clear their wave of minions just outside of tower range and then have your ranged carry get a few hits in every time your minion waves is tanking the tower. However, this requires an ad carry that is very good with positioning and understanding how to not get caught.
Generally you only want to go all in under a tower if you KNOW it will results in good kills for your team. Diving Taric but losing your farmed Vayne is a bad trade, for instance. Other times you would go all in is if someone on their team makes an obvious overextension mistake and because of this you can kill them for "free." Taking down a damage dealer on their team allows your team to engage in more favorable terms - 5v4, even under a tower, is still a pretty good fight to engage on. If you're fighting over a lane tower, teams will usually retreat to avoid the 4v5 fight and defend later.
And, of course, there is the CLG/Hotshot strat: split push. This should generally only be done in a coordinated team setting. Have a champ with teleport, strong pushing, and escape abilities push top(for instance) by himself, and the rest of the team can hover near a tower in bottom lane and force the enemy team to split themselves. When this happens, the person pushing top should teleport in and you can force a 5v4 engage to take the tower.
Importantly, try to never get hit by the tower unnecessarily. If there's not a minion wave there to take the initial agro from the tower, you should just stay out of range. There is almost no chance diving into a more well-equipped team with no minion support will work out in your favor, baron buff or no.


text:
Q: ubuntu python selenium -- close terminal I'm doing some testing on a Ubuntu terminal (14.04) using python (2.7) and selenium. I have created code that will open a browser, enter username and password information into the respective fields, and keep the browser open for one hour. The problem is, a python terminal is opened when code is run. When the browser is manually closed, the blank terminal remains. How can I get the terminal to disappear when the browser is manually closed?
Code:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import sys

driver = webdriver.Firefox()
driver.maximize_window()
driver.get("http://example.com")

inputElement = driver.find_element_by_id("username")
inputElement.send_keys('...')

inputElement = driver.find_element_by_name("password")
inputElement.send_keys('...')

inputElement.send_keys(Keys.ENTER)

while 1:
    time.sleep(3600)
    try:
       b = browser.find_by_tag("body")
    except:
      sys.exit()

I should mention that I'm executing this script using a .desktop file.

A: you can ping the browser once every second during the "sleep" time
i = 0
while i < 3600:
    browser.title
    time.sleep(1)
    i += 1
b = browser.find_by_tag("body")


text:
Q: How do I retain expanded dropdown menu in a new fresh page? It is a bit hard to explain what I am asking. So, I am explaining it using some snapshot step by step.
Initially when I load page, page looks like this:

If I click on Python Basics and Python Advanced links it will look like this:

If I choose a link like Python Variables [see above pic] this will show up:

as you can see, I am in Python Variables page and dropdown menus are collapsed, that is not what I want, I want it to look like this after clicking Python Variables link:

I mean even after clicking new link I want it to retain its previous expaned dropdown menu in new page. Is this possible to achieve? How do I do it?
This link shows exactly what I want my side bar to look like when I click a new link on side bar links?
This is the code of side bar:

        {% for sub_cat in sub_cats %}
                <button class="dropdown-btn"> {{ sub_cat.sub_cat_title }}

                </button>

                        {% for subsub_cat in sub_cat.subsubcategory_set.all %}
                            {% url 'tutorials:tutorials' subsub_cat.subsub_cat_parent.sub_cat_parent.cat_slug subsub_cat.subsub_cat_parent.sub_cat_slug subsub_cat.subsub_cat_slug as tutorial_link %}

                            {{ subsub_cat.subsub_cat_title }}
                        {% endfor %}

        {% endfor %}

and codes below are its associated Javascript code:
var dropdown = document.getElementsByClassName("dropdown-btn");
var i;

for (i = 0; i < dropdown.length; i++) {
    dropdown[i].addEventListener("click", function() {
        this.classList.toggle("active");
        var dropdownContent = this.nextElementSibling;

        if (dropdownContent.style.display === "block") {
            dropdownContent.style.display = "none";
        } else {
            dropdownContent.style.display = "block";
        }
    });
}

Please help me solve it, thank you.

A: I just come up with an approach and it worked fine.
This is what I did:
Solution:
active link has working class, if I click on any link on the side bar it will take working CSS class. As declared here {% if request.path == tutorial_link %}working{% endif %} &
.working{
    background-color: #ccc;
}

I used this CSS class as a medium to get to the parent and added working class to it to get to my goal as:
let sub_cat = document.getElementsByClassName('dropLink');

for (i = 0 ; i < sub_cat.length; i++){
  if (sub_cat[i].classList.contains('working')){
    x = sub_cat[i]

    elem = x.parentElement.previousElementSibling
    elem.classList.toggle('working');

    elem.click()
  }
}

This is all what it takes.
I don't know if this is a standard approach, but it worked fine and made me happy. If you have better solutions I would really like to hear it from you. Thanks.


text:
Q: Using delete() to remove object from array, and render the objects name in a TextField I have a component which facilitates entering a data object to an array of objects via submitting the data into a TextField. Upon entering an ingredient, an AddIcon and RemoveIcon will show up on either side of the TextField so you can add or remove ingredients as needed. Entering the data works, and upon entering the data each object is given an id which is associated with the it's id in the array. Adding everything works, however, upon removal of an item I find that the incorrect values are displayed in the TextFields. I'm sure the issue has something to do with how I'm rendering the value of the TextField, but I feel like I need a new pair of eyes on the problem. I've attempted to use both delete() and array.splice(). Here's the code
function MinusButton({ props }) {
  const {
    id,
    inputs,
    setInputs,
    spiritObject,
    setSpiritObject,
    ingredientsArray,
    setIngredientsArray
  } = props;

  const removeInput = (e, id) => {
    const tmpInput = [...inputs]
    delete(tmpInput[id])            // this removes the correct object from the array but obviously fails eventually since it doesn't reindex
    // tmpInput.splice(id, 1)       // this technically works as well, but rendering the values does not
    setInputs(tmpInput);
  }

  return (

      {
        inputs.length > 1 ?
          <IconButton
            id={id}
            color="primary"
            onClick={(e) => removeInput(e, id)}
          >
            <RemoveIcon fontSize="large"/>
          </IconButton>
        : false
      }

  );
}

function PlusButton({ props }) {
  const {
    id,
    inputs,
    setInputs,
    assignId,
    spiritObject,
    setSpiritObject,
    ingredientsArray,
    setIngredientsArray
  } = props;

  const addIngredientToArray = () => {
    inputs[id] = { id: id, ...spiritObject}
    setIngredientsArray([...ingredientsArray, inputs[id]])
    setInputs([...inputs, {}])
    setSpiritObject({})
  }

  return (

      {
        inputs.length === id+1 ?
          <IconButton
            color="primary"
            onClick={() => addIngredientToArray()}
          >
            <AddBoxIcon fontSize="large"/>
          </IconButton>
        : false
      }

  )
}

export default function Ingredients() {
  const classes = useStyles();
  const cocktail = useCocktail();
  const { register, handleSubmit } = useForm();
  const [spiritObject, setSpiritObject] = useState({});
  const [ingredientsArray, setIngredientsArray] = useState([]);
  const [inputs, setInputs] = useState([{}]);

  const onSubmit = () => {
    cocktail.addIngredients(ingredientsArray)
  }

  const onChangeInput = (e) => {
    setSpiritObject({...spiritObject, [e.target.name]: e.target.value})
  }

  return (
    <form
      noValidate
      className={classes.formContainer}
      id='ingredients'
      name='ingredients'
      onSubmit={handleSubmit(onSubmit)}
    >
      {
        inputs.map((input, id) => {
          const inputProps = {
            id,
            inputs,
            setInputs,
            spiritObject,
            setSpiritObject,
            ingredientsArray,
            setIngredientsArray
          }

          return (

              <Grid container alignContent="center" alignItems="center">
                <MinusButton props={inputProps} />
                <TextField
                  {...register('name')}
                  id={id}
                  label='Ingredient'
                  value={inputs[id].name}
                  variant='outlined'
                  margin='normal'
                  InputProps={{className: classes.input}}
                  onChange={(e) => onChangeInput(e)}
                />
                <FormControl variant="outlined" className={classes.formControl}>
                  <Select
                    {...register('type')}
                    defaultValue=""
                    id="spiritType"
                    onChange={(e) => onChangeInput(e)}
                  >
                    <ListSubheader>Ingredient Type</ListSubheader>
                    {
                      types.map((type, id) => {
                        return <MenuItem key={id} value={type}>{type}</MenuItem>
                      })
                    }
                  </Select>
                </FormControl>
                <PlusButton props={inputProps} />
              </Grid>

          )
        })
      }
    </form>
  );
}

I'm sure the solution is obvious, but I cannot see it. Thank you for reading.

A: delete is for fields in objects. To remove an entry from an array use filter().
const tmpInput = [...inputs].filter(element => element.id !== id);

A: Try to control all your input state into the parent component. handles functions should be side-by-side with your state. Something like this:
import React, { useState } from "react";
import DeleteForeverIcon from "@material-ui/icons/DeleteForever";
import AddBoxIcon from "@material-ui/icons/AddBox";
import { v4 as uuidv4 } from "uuid";

const RemoveButton = ({ onClick }) => (
  <DeleteForeverIcon
    fontSize="large"
    onClick={onClick}
    style={{ cursor: "pointer" }}
  />
);
const AddButton = ({ onClick }) => (
  <AddBoxIcon
    fontSize="large"
    onClick={onClick}
    style={{ cursor: "pointer" }}
  />
);

const InputField = ({ id, onClick }) => {
  return (

      <input id={id} />
      <RemoveButton onClick={onClick} />

  );
};

const App = () => {
  const [inputs, setInputs] = useState([]);

  const handleRemoveInput = (id) => {
    console.log(id);
    console.log(inputs.findIndex((input) => input.id === id));
    setInputs(inputs.filter((input) => input.id !== id));
  };
  const handleAddInput = () => {
    console.log("asd");
    setInputs([...inputs, { id: uuidv4() }]);
  };

  return (

      <AddButton onClick={handleAddInput} />
      {inputs.map(({ id }) => {
        return (
          <InputField id={id} key={id} onClick={() => handleRemoveInput(id)} />
        );
      })}

  );
};

export default App;


text:
Q: F#: System.Drawing.Graphics namespace not defined I've got a brand new and very minimal F# project; I'm on OSX, using Mono and Paket and Emacs. In this project, I'm trying to use the rich and wonderful world of System.Drawing.
I can do this just fine:
open System.Drawing

Great, no problems. Also this:
open System.Drawing.Drawing2D

Super duper. But this:
open System.Drawing.Graphics

Tells me the namespace is not defined.
I'm new to the F# neighborhood, so possibly I'm missing something obvious, but my understanding is that System.Drawing.Graphics is part of the System.Drawing assembly, and thus the DLL, that System.Drawing and Drawing2D are definitely already using perfectly happily.
Where do I even start with this?


text:
Q: WHILE loop in Teradata procedure I'm trying to write a procedure that concatenates all rows in a table in the case in which the row number is unknown.
I have this code but it is not working.
CREATE PROCEDURE Test (OUT r VARCHAR(3000))

BEGIN
DECLARE RowCnt INT;
DECLARE CurrRow INT ;
SET CurrRow = 1,
       r = 'SELECT ',
       RowCnt = (SELECT COUNT(*)
                   FROM tableWithSQLStmnts
                   )
WHILE CurrRow <= RowCnt DO
BEGIN
           SET r = r +
           CASE WHEN CurrRow = 1
                THEN 'MAX( CASE Seq WHEN ' + CAST( CurrRow AS VARCHAR ) + '
                                 THEN SqlStmnt
                                            ELSE SPACE(0) END ) + ' + CHAR(13)
           WHEN i = RowCnt
             THEN 'MAX( CASE Seq WHEN ' + CAST( CurrRow AS VARCHAR ) + '
                                 THEN ''  '' + SqlStmnt
                                 ELSE SPACE(0) END ) ' + CHAR(13)
             ELSE 'MAX( CASE Seq WHEN ' + CAST( CurrRow AS VARCHAR ) + '
                                 THEN ''  '' + SqlStmnt
                                 ELSE SPACE(0) END ) + ' + CHAR(13)
           END
           SET CurrRow = CurrRow + 1 ;
END ;
SET r = r + '
    FROM ( SELECT SqlStmnt,
                  ROW_NUMBER() OVER ( PARTITION BY TabName ORDER BY SQlStmnt )
             FROM tableWithSQLStmnts t ) D ( SqlStmnt, Seq )
           GROUP BY TabName;'

END WHILE;
END

;

I'm getting the following errors:

*

*Syntax error, expected something like ';' between an integer and ','.'.

*Unexpected text 'SET'.

New code, as suggested by dnoeth.
REPLACE PROCEDURE Test3 (IN TbName VARCHAR(256)) --, OUT r2 VARCHAR(3000))

BEGIN
DECLARE RowCnt INT;
DECLARE i INT;
DECLARE CurrRow INT;
DECLARE r VARCHAR(3000);
DECLARE r2 VARCHAR(3000);
SET CurrRow = 1;
SET r = 'SELECT ';
SET RowCnt = (SELECT COUNT(*)
              FROM tableWithSQLStmnts
              WHERE tabname = :TbName
             );

WHILE CurrRow <= RowCnt DO
   BEGIN
      SET r = r ||
   'MAX( CASE Seq WHEN ' || CAST( CurrRow AS VARCHAR(10) ) || '
           THEN '' , '' || SqlStmnt
           ELSE '''' END )
   '
      || CASE WHEN CurrRow = RowCnt
              THEN ''
              ELSE ' ||  '
         END;
      SET CurrRow = CurrRow + 1 ;
   END;
END WHILE;

SET r = r || '
    FROM ( SELECT SqlStmnt,
                  ROW_NUMBER() OVER ( PARTITION BY TbName ORDER BY SQlStmnt )
             FROM tableWithSQLStmnts t ) D ( SqlStmnt )
           GROUP BY TbName
           ;';

SET r2 = r;
CALL dbc.sysexecsql(:r);
END;

Now I get this error:
[3706] Syntax error: Column name list shorter than select list.

EDIT 2:
I have now rewritten it like this:
REPLACE PROCEDURE Test3 (IN TabName VARCHAR(256))
DYNAMIC RESULT SETS 1
BEGIN
DECLARE RowCnt INT;
DECLARE Seq INT;
DECLARE QRY VARCHAR(3000);
DECLARE CurrRow INT;
SET QRY= 'INSERT INTO vt21 SELECT   ';
SET CurrRow = 1;

CREATE VOLATILE TABLE vt21(QRY VARCHAR(3000)) ON COMMIT PRESERVE ROWS;
SET RowCnt = (SELECT COUNT(*)
              FROM TestTable
              WHERE tabname = :TabName
             );
FOR CurrentRefRow AS SourceCursor CURSOR FOR
            SELECT SqlStmnt
            FROM TestTable
            DO
WHILE CurrRow <= RowCnt
DO
   BEGIN
      SET QRY = QRY ||
      CASE  WHEN CurrRow=1
      THEN   'MAX( CASE Seq  WHEN ' || CAST( CurrRow AS VARCHAR(10) ) || '
           THEN '' , '' || SqlStmnt
           ELSE '''' END )     '

         WHEN CurrRow < RowCnt
         THEN ', MAX( CASE Seq WHEN ' || CAST( CurrRow AS VARCHAR(10) ) || '
           THEN '' , '' || SqlStmnt
           ELSE '''' END )    '
         WHEN CurrRow=RowCnt
      THEN   ', MAX( CASE Seq WHEN ' || CAST( CurrRow AS VARCHAR(10) ) || '
           THEN '' , '' || SqlStmnt
           ELSE '''' END ) '
              ELSE ' ||  '
         END;
                  SET CurrRow = CurrRow + 1 ;
         END;
         END WHILE;

SET QRY = QRY || '
    FROM ( SELECT SqlStmnt, Tabname,
                  ROW_NUMBER() OVER ( PARTITION BY TabName ORDER BY SQlStmnt )
             FROM TestTable t ) D ( Seq, Tabname, SqlStmnt )
           GROUP BY TabName
           ;';

EXECUTE IMMEDIATE QRY;
END FOR;

 BEGIN -- return the result set
      DECLARE resultset CURSOR WITH RETURN ONLY FOR S1;
      SET QRY = 'SELECT * FROM  vt21;';
      PREPARE S1 FROM QRY;
      OPEN resultset;
   END;

DROP TABLE vt21;
END;

But I'm getting the following error:
CALL Failed.  [3813] The positional assignment list has too many values.
I have tried modifying it but when I delete one value than it says that column name list is longer then the select list.

A: This is translated to valid syntax for Teradata/Standard SQL (and a bit simplified):
REPLACE PROCEDURE Test (OUT r2 VARCHAR(3000))

BEGIN
DECLARE RowCnt INT;
DECLARE i INT;

DECLARE CurrRow INT;
DECLARE r VARCHAR(3000);

SET CurrRow = 1;
SET r = 'SELECT ';
SET RowCnt = (SELECT Count(*)
              FROM tableWithSQLStmnts
             );

WHILE CurrRow <= RowCnt DO
   BEGIN
      SET r = r ||
   'MAX( CASE Seq WHEN ' || Cast( CurrRow AS VARCHAR(10) ) || '
           THEN ''  '' || SqlStmnt
           ELSE '''' END )
   '
      || CASE WHEN CurrRow = RowCnt
              THEN ''
              ELSE ' || '
         END;
      SET CurrRow = CurrRow + 1 ;
   END;
END WHILE;

SET r = r || '
    FROM ( SELECT department_name--SqlStmnt,
                  ROW_NUMBER() OVER ( PARTITION BY TabName ORDER BY SQlStmnt )
             FROM tableWithSQLStmnts t ) D ( SqlStmnt, Seq )
           GROUP BY TabName
           ;';

SET r2 = r;
END
;

What's the content of tableWithSQLStmnts?
Why do you want a single line? There are simpler ways to get a kind of LISTAGG.
Edit:
Based on your comments (here and on Teradata's Developer Exchange) it looks like you want to apply some kind of count to every column. But then you don't need the MAX/CASE/ROW_NUMBER, simply concat all rows for a table and then execute it. This counts NULLs in every column of a table:
REPLACE PROCEDURE Test3 (IN DBName VARCHAR(128),IN TabName VARCHAR(128))
DYNAMIC RESULT SETS 1
BEGIN

   DECLARE QRY VARCHAR(3000);

   CREATE VOLATILE TABLE vt21(col VARCHAR(128) CHARACTER SET Unicode, NullCnt BIGINT) ON COMMIT PRESERVE ROWS;

   SET QRY = 'INSERT INTO vt21 ';

   FOR c AS
      SELECT DatabaseName, TableName, ColumnName,
         Row_Number()
         Over (PARTITION BY tablename
                ORDER BY columnname) AS rn,
         Count(*)
         Over (PARTITION BY tablename) AS Cnt
      FROM dbc.ColumnsV
      WHERE DatabaseName = :DBName
        AND TableName = :TabName
   DO
      SET QRY = QRY
        || 'SELECT ''' || c.ColumnName
        || ''', COUNT(CASE WHEN ' || c.columnname
        || ' IS NULL THEN 1 END) FROM '
        || c.DatabaseName || '.' || c.TableName
        || CASE WHEN c.rn = c.Cnt -- last row
                THEN ';'
                ELSE ' UNION ALL '
           END;

   END FOR;

   EXECUTE IMMEDIATE QRY;

   BEGIN -- return the result set
      DECLARE resultset CURSOR WITH RETURN ONLY FOR S1;
      SET QRY = 'SELECT * FROM  vt21;';
      PREPARE S1 FROM QRY;
      OPEN resultset;
   END;

   DROP TABLE vt21;

END;

CALL Test3('dbc', 'dbcinfoV');


text:
Q: Delete object in list based on field value Vue.js I have an array of objects and I want to delete objects is one of the properties are true. For instance,
data(){
  return{
      entries : [
                 {
                name : "name here",
                age : 20,
                school:"UTK",
                isSelected : false
          },{
                name : "name here",
                age : 20,
                school:"UTK",
                isSelected : false
          },{
                name : "name here",
                age : 20,
                school:"UTK",
                isSelected : false
          }
       ]
  }
{

When the user clicks a button, I call a function in my methods block. I need the function to delete all objects that has the property "isSelected" set to true.
Any help is appreciated!!

A: in a function:
this.entries = this.entries.filter(e=> e.isSelected == true);

A: The method should contain the following code that filters the items with isSelected:true and remove them :
this.entries=this.entries.filter(entry=>!entry.isSelected)

A: You can also use filter() inside the entries object:
data(){
  return{
      entries : [
                 {
                name : "name here",
                age : 20,
                school:"UTK",
                isSelected : false
          },{
                name : "name here",
                age : 20,
                school:"UTK",
                isSelected : false
          },{
                name : "name here",
                age : 20,
                school:"UTK",
                isSelected : false
          }
       ].filter(e=>e.isSelected!=true)
  }

}


text:
Q: Adding and Displaying Array Issue var reset = function ()
    {
        var p = parseFloat($("#IA").val());
        var q = parseFloat($("#IB").val());
        var m = parseFloat($("#CGCD").val());
        var aR = [];

        aR += ["GCD(" + p + "," + q + ")=" + m];

        document.getElementById("PGCD").innerHTML = aR + "\n";

        document.getElementById("IA-error").innerHTML="";
        document.getElementById("IB-error").innerHTML="";

        $("#IA").focus();
    };

The code above is only for a 'reset' function, a part of additional code (not present), the purpose which is to find the Greatest Common Denominator, GCD.
My 'reset' function is connected to a button, #reset, the purpose of which is to do four things:

*

*add and store the string GCD(p,q)=m to the array 'aR'; p/q/m are variable stand-ins for the values of the input text areas #IA, #IB, and #CGCD (the GCD of #IA and #IB);

*display the array 'aR' in a text-area #PGCD each time the reset button is clicked; this is why I used an array;

*clear the two input text areas #IA and #IB;

*clear the one output text area;

As it stands, all four objectives are completed successfully, with one exception: for the second objective, only the most recent GCD calculation is outputted; none of the previous calculations output.
I cannot get the array to list the different saved calculations within it. I think (?) the new calculations are being added to the array, but I am not sure.
I've tried a 'for' statement, and an 'if' statement, neither of which worked. I don't know whether I coded it wrong, or if it wasn't the right solution for my issue.
I tried to search the forums (here) for a solution, but was unable to find one.
Thank you.

A: If I'm understanding what you are describing, I believe your problem is that you are attempting to use += to add elements to an array. You should use
aR.push("GCD(" + p + "," + q + ")=" + m);

The += operator is used for addition of a value to itself as well as string concatenation.
Edit: per comments below, the main issue was declaration of aR as a local variable. It needs to be either global or declared within the same scope.


text:
Q: An equilateral triangle altitude measurements. An equilateral triangle has three equal sides and if I take per example 11 as the side of the triangle then $11\times3=33$ for the perimeter.I want to find the height or the altitude of the geometric figure called a triangle.
So I came up with the result which is$\sqrt\frac{11\times11\times3}{4}$ or a result $\frac{11\sqrt3}{2}$
Why do we use only $\frac{11\sqrt3}{2}$ as the height?

A: or, in other words; the altitude is $a \cos \left( \dfrac{\pi}{3}\right)$, where $a$ is the edge length.

You have the $\angle BAC = \frac{\pi}{3}$. By trigonometry, you have: $ \dfrac{h}{a} = \cos{\left(\dfrac{\pi}{3}\right)}$


text:
Q: How to import node modules from root directory when using node ES Modules feature(.mjs)? For example, I have a node project using ES Modules feature which structures like this:
- user
-     a.mjs
-     b.mjs
- project
-     c.mjs
-     d.mjs
- main.mjs

In a.mjs file I want to import c.mjs file using root path in the way like this:
import c from '~/project/c.mjs';

but not using relative path like this:
import c from '../project/c.mjs';

I know I can use babel and babel-plugin-root-import plugin to achieve this.
But I dont want to use babel, so I am wondering if there is a native solution in node ES Modules can do this?


text:
Q: R Using previous iteration result in next iteration I have a data frame with two columns:
id  score
1     0.5
1     0.7
1     0.8
2     0.7
2     0.8
2     0.9

I want to generate a new column ("new") by iterating over the rows of "score", applying one of two functions ("function1" or "function2"), conditioned on whether "id" is different or the same as the last row id value. This part I can do, my problem is that I want function2 to refer to the value generated by function1. Something like:
function1 <- function(score) {new <- score*10 return(new)}
function2 <- function(score) {new <- score*new[-1] return(new)}

id  score  new
1     0.5  5
1     0.7  3.5
1     0.8  2.8
2     0.7  7
2     0.8  5.6
2     0.9  5.04

I know that apply() can't do this kind of backwards reference, but I can't for the life of me figure out how to do it with a loop. Any suggestions would be amazing as I am pulling my hair out at this point!

A: For the specific example in the question:
DT <- read.table(text="id  score
1     0.5
1     0.7
1     0.8
2     0.7
2     0.8
2     0.9  ", header=TRUE)

library(data.table)
setDT(DT)

DT[, new := 10*cumprod(score), by=id]
#   id score  new
#1:  1   0.5 5.00
#2:  1   0.7 3.50
#3:  1   0.8 2.80
#4:  2   0.7 7.00
#5:  2   0.8 5.60
#6:  2   0.9 5.04

In the more general case you'd need Reduce where I have used cumprod.

A: df <- data.frame(id=rep(c(1,2),each=3), score=c(.5,.7,.8,.7,.8,.9))

This could be done relatively simply with the mutate() function in the dplyr package:
require(dplyr)
mutate(group_by(df, id), new = 10*cumprod(score))

#Source: local data frame [6 x 3]
#Groups: id

#  id score  new
#1  1   0.5 5.00
#2  1   0.7 3.50
#3  1   0.8 2.80
#4  2   0.7 7.00
#5  2   0.8 5.60
#6  2   0.9 5.04


text:
Q: performance issue with record.set extjs 4.2.2 I observed that record.set takes around 500ms to execute. I am working with extjs 4 and I am trying to update values in grid. I tried suspendLayouts() and resumeLayouts() but couldnt really get it to work. Any suggestion on how can I reduce the processing time with record.set()

A: You need to suspend events on the store so it doesn't try and individually update the rows.
store.suspendEvents();
store.each(function(rec) {
    rec.set('foo', 'bar');
});
store.resumeEvents();
grid.getView().refresh();

A: I added grid.suspendLayout=true before calling the function where it performs record.set and record.endEdit() operation and added grid.suspendLayout=false after returning from that function.


text:
Q: How to find the volume of a rectangular prism with all chamfered edges? I know it would be the volume of the full prism minus the triangular prism shapes cut off of the edges but can't work out how to calculate the corners. The corners look like this: https://www.google.com.au/search?q=chamfered+edges+cube&client=ms-unknown&prmd=sivn&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiowveT_rPaAhXGXrwKHeo1Dl8Q_AUIEigC&biw=412&bih=652&dpr=2.63#imgrc=69Xby28QdeQr6M:

A: Let the box have sufficiently large edge lengths $a$, $b$, $c$; the original volume then is $abc$. Along the edges we cut off triangular prisms with cross section a right triangle of area ${r^2\over2}$. Not looking at the small $r^3$-cubes at the vertices this amounts to the following edge cutoff:
$$4\cdot{r^2\over2}\cdot\bigl((a-2r)+(b-2r)+(c-2r)\bigr)\ .\tag{1}$$
Now look at the cube $C=[0,r]^3$, and denote the polyhedral set cut off from $C$ by $B$. A point $(x,y,z)\in C$ belongs to $B$ iff at least one of the following is true:
$$x+y\leq r,\quad x+z\leq r,\quad y+z\leq r\ .$$
The points $(x,y,z)\in C$ satisfying $x+y\leq r$ make up half of $C$, hence
$${\rm vol}(B)={r^3\over2}+{\rm vol}(B')\ ,$$
whereby $B'$ is given by
$$B'=\bigl\{(x,y,z)\in C\,\bigm|\, x+y\geq r \ \wedge \  \ z\leq r-\min\{x,y\}\bigr\}\ .$$
Due to symmetry we only have to consider the case $y\leq x$ and obtain
$${\rm vol}(B')=2\int_{r/2}^r\int_{r-x}^x\int_0^{r-y} dz\>dy\>dx={r^3\over4}\ .$$
The total cutoff at the vertices therefore is
$$8\left({1\over2}+{1\over4}\right)\>r^3=6r^3\ .$$
Add this to $(1)$ and obtain a total cutoff given by $2(a+b+c)r^2-6r^3$, so that the remaining volume is
$$V=abc-2(a+b+c)r^2+6r^3\ .$$


text:
Q: NHibernate custom Dialect I am dealing with a legacy database, and I am writing a custom driver and dialect to access the data with NHibernate.
I need to suppress the aliases in the generated sql , so I think I should override the genericDialect, right?
is there any tutorial on how to do that?

A: Unfortunately this is such a rare thing that I don't think you are going to find any tutorials on this subject. Your just going to need to download the source and dig in:
Current version of the source: https://github.com/nhibernate/nhibernate-core
Previous versions: http://sourceforge.net/projects/nhibernate/files/NHibernate/
You may want to have a look at the following method:
NHibernate.Dialect.ExtractColumnOrAliasNames()

Find the usages of that method to see how other dialects are using it.
Also try searching for the word 'alias' and look particularly for usages of that word in the NHibernate.Dialect namespace. Even then, it's probably going to take quite a bit of investigation of the code to find your answer.
If you do find manage to suppress the aliases, be sure to post a follow up, create a blog entry, etc. to share your findings as I for one would be quite interested.


text:
Q: wp_footer hook puts content below footer My custom plugin to put a red sign-up bar just above the footer is putting it at the bottom of the footer using wp_footer.  If I use the the_content in a filter, then it puts it into the description of the Woo Commerce product pages.  Does anyone know of a way to move this action from the bottom to the top of the footer inside of the plugin? I have tried many combinations of things and am just getting no where.  Thank you for helping.

Signup Bar Plugin
<?php
/*
Plugin Name: ccg-signup
Description:  Adds an eye-catching signup bar to the bottom of the page
Author: Teresa Light
Author URI: https://teresalight.com
Plugin URI:
Version: 1.0
License:
*/

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/**
 * Register style sheet.
 */

   add_action( 'wp_enqueue_scripts', 'register_plugin_styles' );

  function register_plugin_styles() {
    wp_register_style( 'ccg-signup', plugins_url( 'ccg-signup/css/signup-bar.css' ) );
    wp_enqueue_style( 'ccg-signup' );
    }

/**
 * Add HTML markup for the bar
 */

    function signup_bar($content){
    ?>

            <signup>
                    <form class="flex-container" accept-charset="UTF-8" method="POST" action="https://eu943.infusionsoft.com/app/form/process/ae41b9e4b0750e3e3aa3ae78337d5fa6">
                        <input name="inf_form_xid" type="hidden" value="ae41b9e4b0750e3e3aa3ae78337d5fa6">
                        <input name="inf_form_name" type="hidden" value="CCG Newsletter Sign Up">
                        <input name="infusionsoft_version" type="hidden" value="1.38.0.37">

Get tips to start, fund and grow Your Great Business:

                            <input id="inf_field_FirstName"  name="inf_field_FirstName" type="text" placeholder="First Name*">

                            <input style="margin:10px 0;"id="inf_field_Email" name="inf_field_Email" type="text" placeholder="Email*">

                            <input class="input.flex-container ccg-button" type="submit" value="START NOW">

                    </form>
            </signup>
    <?php
    }
// Omit closing PHP tag to avoid "Headers already sent" issues.
// EXTRA CODE BELOW SHOWING PAST TRIALS, CURRENTLY COMMENTED OUT
/* The next two lines of code when used with the HTML based function will put the bar in the right place on Woo pages only */
/*remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 1);
add_action('woocommerce_after_main_content', 'signup_bar', 1);
 */

/* This line of code will put the signup bar correct on normal pages but in the description on the woo pages. It only works when the function code is totally inside of php */
/*add_filter( 'the_content', 'signup_bar',1 );*/

/*The code below works correctly on all pages but at the bottom of the footer, and not the top.*/
add_action( 'wp_footer', 'signup_bar', 1);

Signup Bar CSS
#main.clearfix.width-100{
    padding-right:0px!important;
    padding-left:0px!important;
}

/* Overall Container */
signup  {
  margin: auto;
  padding: auto 0px!important;
  font-size:80%;
  background: #d03925;
  text-align: center;
  display: flex;  /* NEW, Spec - Opera 12.1, Firefox 20+ */
  display: -webkit-flex; /* NEW - Chrome */
  display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
}
/* Begin Flex */
.flex-container {
  text-align: center;
  display: flex;  /* NEW, Spec - Opera 12.1, Firefox 20+ */
  display: -webkit-flex; /* NEW - Chrome */
  display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
   -webkit-align-items: center;
   align-items: center;
   -webkit-justify-content: center;
   justify-content: center;
}

/* MOBIL FIRST */
.flex-container{
   flex-direction: column;
   -webkit-box-flex-direction: column;
  -moz-box-flex-direction: column;
  -webkit-flex-direction: column;
  margin:0 0 5px 0;
  padding:15px;
}

/* DESKTOPS - go to a row for screens greater than 1000px */
@media screen and (min-width: 1024px) {
  .flex-container{
   flex-direction: row;
   -webkit-box-flex-direction: row;
  -moz-box-flex-direction: row;
  -webkit-flex-direction: row;
  margin:0 10px;
  padding:10px 0;
  }
}
/* End  Flex */

h3.signup-message, .signup-message{
  margin: auto;
  padding:0;
  color: #ffffff !important;
  font-family: 'lato', sans-serif;
  font-weight: 500;
  text-align:center;
  font-size:20px;
  line-height:30px;
}

#inf_field_FirstName, #inf_field_Email {
  border: 1px solid #d2d2d2;
  font-size: 15px;
  font-family: 'lato', sans-serif;
  color: #747474;
  padding: 15px 5px;
  width: 270px;
}

.ccg-button {
    border-width: 2px;
    border-style: solid;
    border-color:#ffffff;
    background: #d03925;
    color: #fff;
    font-family: 'lato', sans-serif;
    font-weight: 700;
    line-height: 20px;
    font-size:15px;
    cursor: pointer;
    padding: 13px 30px 13px 30px;
}
.ccg-button:hover, .ccg-button:focus, .ccg-button:active{
    border-width:2px;
    border-style: solid;
    border-color:#d03925;
    color:#d03925;
    background: #ffffff;
}
/************** END SIGNUP BAR ******************/

THEME FOOTER.PHP

            <?php
            global $social_icons;

            if ( strpos( Avada()->settings->get( 'footer_special_effects' ), 'footer_sticky' ) !== FALSE ) {
                echo '
';
            }

            // Get the correct page ID
            $c_pageID = Avada::c_pageID();

            // Only include the footer
            if ( ! is_page_template( 'blank.php' ) ) {

                $footer_parallax_class = '';
                if ( Avada()->settings->get( 'footer_special_effects' ) == 'footer_parallax_effect' ) {
                    $footer_parallax_class = ' fusion-footer-parallax';
                }

                echo sprintf( '
', $footer_parallax_class );

                    // Check if the footer widget area should be displayed
                    if ( ( Avada()->settings->get( 'footer_widgets' ) && get_post_meta( $c_pageID, 'pyre_display_footer', true ) != 'no' ) ||
                         ( ! Avada()->settings->get( 'footer_widgets' ) && get_post_meta( $c_pageID, 'pyre_display_footer', true ) == 'yes' )
                    ) {
                    ?>

                                <div class="fusion-columns fusion-columns-<?php echo Avada()->settings->get( 'footer_widgets_columns' ); ?> fusion-widget-area">

                                    <?php
                                    // Check the column width based on the amount of columns chosen in Theme Options
                                    $column_width = 12 / Avada()->settings->get( 'footer_widgets_columns' );
                                    if( Avada()->settings->get( 'footer_widgets_columns' ) == '5' ) {
                                        $column_width = 2;
                                    }

                                    // Render as many widget columns as have been chosen in Theme Options
                                    for ( $i = 1; $i < 7; $i++ ) {
                                        if ( Avada()->settings->get( 'footer_widgets_columns' ) >= $i ) {
                                            echo sprintf( '
', $column_width, $column_width, $column_width );

                                                if ( function_exists( 'dynamic_sidebar' ) &&
                                                     dynamic_sidebar( 'avada-footer-widget-' . $i )
                                                ) {
                                                    // All is good, dynamic_sidebar() already called the rendering
                                                }
                                            echo '
';
                                        }
                                    }
                                    ?>

                    <?php
                    } // end footer wigets check

                    // Check if the footer copyright area should be displayed
                    if ( ( Avada()->settings->get( 'footer_copyright' ) && get_post_meta( $c_pageID, 'pyre_display_copyright', true ) != 'no' ) ||
                          ( ! Avada()->settings->get( 'footer_copyright' ) && get_post_meta( $c_pageID, 'pyre_display_copyright', true ) == 'yes' )
                    ) {
                    ?>

                                    <?php
                                    /**
                                     * avada_footer_copyright_content hook
                                     *
                                     * @hooked avada_render_footer_copyright_notice - 10 (outputs the HTML for the Theme Options footer copyright text)
                                     * @hooked avada_render_footer_social_icons - 15 (outputs the HTML for the footer social icons)
                                     */
                                    do_action( 'avada_footer_copyright_content' );
                                    ?>

                <?php
                } // end footer copyright area check
            } // end is not blank page check
            ?>

        <?php
        // Check if boxed side header layout is used; if so close the #boxed-wrapper container
        if ( ( ( Avada()->settings->get( 'layout' ) == 'Boxed' && get_post_meta( $c_pageID, 'pyre_page_bg_layout', true ) == 'default' ) || get_post_meta( $c_pageID, 'pyre_page_bg_layout', true ) == 'boxed' ) &&
             Avada()->settings->get( 'header_position' ) != 'Top'

        ) {
        ?>

        <?php
        }

        ?>

        <?php
        wp_footer();

        // Echo the scripts added to the "before " field in Theme Options
        echo Avada()->settings->get( 'space_body' );
        ?>

THANK YOU

A: wp_footer() is to be called right before  and is NOT the function for getting the themes footer.  You are looking for get_footer()  However, many themes do not actually use get_footer(), so if you are looking for mass distribution, that will not be a very reliable method.  That said, some themes don't use wp_footer() either.


text:
Q: When I use storm, how can I ensure that a bolt with multiple inputs, process only when all the inputs arrive? The topology looks like this.

how can I ensure that a bolt with multiple inputs, process only when all the inputs arrive?

A: Bolt.execute() is called for each incoming tuple, regardless what the producer was (and you cannot change this). If you want to process multiple tuples from different producers at once, you need to write custom UDF code.

*

*You need an input buffer for each producer, that can buffer incoming tuples (maybe a LinkedList<Tuple> as bolt member)

*For each incoming tuple, you add the tuple to the corresponding buffer (you can access the producer information in the tuple's meta data, via. input.getSourceComponent()

*After adding the tuple to the buffer, you check, if each buffer contains at least one tuple: if yes, take one tuple from each buffer an process them (after processing, check the buffers again until at least once buffer is empty) -- of no, just return and do not process anything.

A: You might want to take a look here (refer to Batching). For bolts that process more complex operations such as aggregation on multiple input tuples, you will need to extend BaseRichBolt and do your own control of the anchoring mechanism.
For this you need to declare your own output collector like this:
private OutputCollector outputCollector;

And then initialise it through your override of the prepare method:
@Override
public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
    this.outputCollector = outputCollector;
}

Your execute method for BaseRichBolt only receives a tuple as argument, you need to be able to perform the logic to maintain the anchors and using them when emitting.
private final List<Tuple> anchors = new ArrayList<Tuple>();

@Override
public void execute(Tuple tuple) {
    if (!isTupleAggregationComplete(anchors, tuple)) {
        anchors.add(tuple);
        return;
    }

    // do your computations here!

    collector.emit(anchors, new Values(foo,bar,xpto));

    anchors.clear();
}

You should implement isTupleAggregationComplete with the necessary logic that checks if the bolt have everything necessary information to proceed with the processing.


text:
Q: Array Definition Modelling in MongoAlchemy I try to model my MongoAlchemy class in Flask. Here is my model:
{
    "_id" : ObjectId("adfafdasfafag24t24t"),
    "name" : "sth."
    "surname" : "sth."
    "address" : [
     {
      "city" : "Dublin"
      "country" : "Ireland"
   }
  ]
}

Here is my documents.py class:
   class Language_School(db.Document):
        name = db.StringField()
        surname = db.StringField()
        address = db.???

How can I define this like array model (address) in Flask?
Edit: I have already tried to my models like before asking question. But I took error like "AttributeError
AttributeError: 'list' object has no attribute 'items'".
class Address(db.Document):
    city = db.StringField()
    country = db.StringField()

class Language_School(db.Document):
    name = db.StringField()
    surname = db.StringField()
    address = db.DocumentField(Address)

A: You are asking about the ListField from what I understand.
Though, I am not sure you actually need a list to store the address, why not use the special document type - DocumentField, following the example here:
class Address(Document):
    street_address = StringField()
    city = StringField()
    state_province = StringField()
    country = StringField()

class User(Document):
    name_index = Index().ascending('name').unique()
    name = StringField()
    email = StringField()

    address = DocumentField(Address)

    def __str__(self):
        return '%s (%s)' % (self.name, self.email)

A: You could use a ListField and access the city as the 1st item on the list and country as the 2nd item on the list.
{
    "_id" : ObjectId("adfafdasfafag24t24t"),
    "name" : "sth."
    "surname" : "sth."
    "address" : ["Dublin", "Ireland"]
}

class Language_School(db.Document):
    name = db.StringField()
    surname = db.StringField()
    address = db.ListField(db.StringField())


text:
Q: What am I doing wrong in attempting to solve this system of differential equations? Problem:$$\quad x''+y''=t^{ 2 }\quad \quad x''-y''=4t\quad \quad x(0)=8\quad x'(0)=y(0)=y'(0)=0\\ \\$$ Attempt:$$\\ s^{ 2 }L\{ x\} -sx(0)-x'(0)+{ s }^{ 2 }L\{ y\} -sy(0)-y'(0)=2/{ s }^{ 3 }\\ { s }^{ 5 }L\{ x\} -8{ s }^{ 4 }+{ s }^{ 5 }L\{ y\} =2\quad \quad (1)\\ \\ { s }^{ 4 }L\{ x\} -8{ s }^{ 3 }-{ s }^{ 4 }L\{ y\} =4\quad \quad (2)\\ \\ (1)-(2)\cdot s:\quad 16s^{ 4 }+2s^{ 5 }L\{ y\} =2-4s\\ L\{ y\} =\frac { -8 }{ s } -\frac { 2 }{ { s }^{ 4 } } +\frac { 1 }{ { s }^{ 5 } } \\ y=-8-\frac { { t }^{ 3 } }{ 3 } +\frac { { t }^{ 4 } }{ 24 } \\ Sub\quad L\{ y\} \quad into\quad (2)\\ L\{ x\} =\frac { 2+1/2 }{ { s }^{ 4 } } \\ x=\frac { { t }^{ 3 } }{ 3 } +\frac { { t }^{ 4 } }{ 24 }$$
I know my attempt is wrong because x(0)=8 but if I compute x(0), I get 0. My prof's solution is also wrong for the same reason.

A: You made an error in $(1)-s\cdot (2)$.
$$
\begin{align}
(1)-s\cdot (2) &\Longrightarrow \qquad s^5Y(s)=1-2s\\
(1)+s\cdot (2) &\Longrightarrow \qquad 2s^5X(s)=16s^4+2+4s
\end{align}
$$
with ${\cal L}\{x\}=X$ and ${\cal L}\{y\}=Y$. So we find
$$
\begin{align}
X(s)&=\frac{8}{s}+\frac{2}{s^4}+\frac{1}{s^5}\\
Y(s) &=-\frac{2}{s^4}+\frac{1}{s^5}
\end{align}
$$
and for $t\ge0$
$$
\begin{align}
x(t)&=8+\frac{t^3}{3}+\frac{t^4}{24}\\
y(t) &=-\frac{t^3}{3}+\frac{t^4}{24}
\end{align}
$$


text:
Q: In Flutter, how can I create a string compatible with Firebase documentID? In Flutter,
in Firebase when a Document is added, the documentID is auto generated.
But if the App is Offline how can I create a string compatible with Firebase documentID?

A: I just found a solution
String getNewDocID() {
    return Firestore.instance.collection('').document().documentID;
}

DocumentReference document (
[String path]
)
Returns a DocumentReference with the provided path.
If no path is provided, an auto-generated ID is used.
The unique key generated is prefixed with a client-generated timestamp so that the resulting list will be chronologically-sorted.
https://pub.dev/documentation/cloud_firestore/latest/cloud_firestore/CollectionReference/document.html

A: Now
DocumentReference document ([String path])

"Is Deprecated in favor of .doc()"
So:
String getNewDocID() {
            return Firestore.instance.collection('').doc().documentID;
}

https://pub.dev/documentation/cloud_firestore/latest/cloud_firestore/CollectionReference/doc.html


text:
Q: RTL is forced in RTL devices The new version of React Native has issued support for RTL devices:
https://facebook.github.io/react-native/blog/2016/08/19/right-to-left-support-for-react-native-apps.html
However, it seems that in RTL android devices the RTL layout is forced and there's no way to change it so now all apps are broken for RTL devices.
How can I force my app to use LTR?

A: If you are using Expo or bare React Native, put these lines in your App.js/tsx file:
import { I18nManager} from 'react-native';

I18nManager.allowRTL(false);
I18nManager.forceRTL(false);
I18nManager.swapLeftAndRightInRTL(false);

const App = () => {

   ~ ~ ~

}

A: In manifest.xml file add android:supportsRtl="false" to your application tag

A: I managed to fix this by adding to MainApplication.java:
import com.facebook.react.modules.i18nmanager.I18nUtil;

public class MainApplication extends Application implements ReactApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        // FORCE LTR
        I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
        sharedI18nUtilInstance.allowRTL(getApplicationContext(), false);
        ....
    }
}

A: simply by adding these lines of code in your project entry point e.g App.tsx
import { I18nManager } from "react-native";

// disable RTL
try {
  I18nManager.allowRTL(false);
  I18nManager.forceRTL(false);
  // the next line is the most effective one
  I18nManager.swapLeftAndRightInRTL(false);
} catch (e) {
  console.log(e);
}

A: @atlanteh's answer is right.
I am just giving you a detailed answer for those who have the ios background and not much aware of the Android.
first, try once. if 1st one does not work then try 2. If still not work then try both. then it will show expected output.
Answer 1
MainApplication.java
public class MainApplication extends Application implements ReactApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        // FORCE LTR
        I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
        sharedI18nUtilInstance.allowRTL(getApplicationContext(), false);
        ....
    }
}

Answer 2
AndroidManifest.xml
i have add the  android:supportsRtl="false" in application tag
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.appname">
    ........
    <application
      android:supportsRtl="false"
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      android:name="com.facebook.react.devsupport.DevSettingsActivity" />
       ....
    </application>

</manifest>


text:
Q: Is there any way to get IsDate(Date) to come back as false? I'm reviewing some code in VB.net, and in a validation object they have written the following
If Not IsDate(Entity.SelectedDate) Then
            ErrorList.Add(New CValidationError("MainReport", "Please select a weekend date"))

SelectedDate is of type Date. It seems to me it would be impossible to ever hit this condition. Is this true?

A: Here's what I see in Reflector:
Public Shared Function IsDate(ByVal Expression As Object) As Boolean
    Dim time As DateTime
    If (Expression Is Nothing) Then
        Return False
    End If
    If TypeOf Expression Is DateTime Then
        Return True
    End If
    Dim str As String = TryCast(Expression,String)
    Return ((Not str Is Nothing) AndAlso Conversions.TryParseDate(str, (time)))
End Function

Now, the question is: if passed a Date (VB.NET's keyword for DateTime values), could this method ever return false?
No.
If (Expression Is Nothing)

This will never be true for a boxed value type.
If TypeOf Expression Is DateTime

This will always be true if the method is explicitly passed a Date.
Even if TypeOf A Is B returned false when B is a subclass of A (which it doesn't), you could still assume this would always return true since DateTime, as a value type, cannot be inherited.
So you're good.
My best guess is that this code originally called IsDate on a String or Object that was not strongly typed; at some point, someone must have updated the SelectedDate property to be typed as Date without bothering to update this validation code.

A: IsDate will always return true for any object which can be converted to a date:
http://msdn.microsoft.com/en-us/library/00wf8zk9%28VS.80%29.aspx
It will even return true if you do
dim myDate as Date
myDate = Nothing
IsDate(myDate)

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/3f70ef9e-79d0-4c89-ac33-ea16829e8298 says:

Please note that Date is a value type,
  not reference type, therefore
  assigning Nothing to a variable of
  type Date will set it to its default
  value (see what Lars says).

So IsDate(date) will always return true.
It is worth double checking however that IsDate refers to the standard VB function and isn't some custom function written elsewhere (it seems odd that the validation error text refers to weekend dates, so it might be a custom function). Right-click it and "go to definition" to make sure and see where Visual Studio goes to. If it is the one in the Microsoft.VisualBasic namespace then I would say it is always going to return true.

A: I don't believe it is possible to ever hit this condition.  The SelectedDate can only be set by either the calendar control or the OnSelectionChanged event handler.  Even then, the value can only be set to a date or a Null.  Maybe this should check to ensure that a value was selected that is Not Null.  Otherwise, just ditch the check altogether.

A: It gonna be never to that error. SelectedDate is of type Date. So you gonna check that this is a date.

A: It looks like they're checking for a weekend date, so why not check the DateTime.DayOfWeek for saturday or sunday?

A: It is indeed the IsDate from Microsoft.VisualBasic namespace; the weekend date error message is actually asking for the date that the week is ending on, usually a Friday. It seems clear now that this will always return true; thank you everyone for the resources and confirmation.


text:
Q: How to deal with a regex which has any of its start and/or end split up over two lines? Got a situation where the regex I built is working fine as long as the start and end sequences are onto one line and not fragmented. As an example if there is the need to extract the content from the following text between the ABCDE and VWXYZ sequences it should return 1234567890@#$@#$@##:
-@$@$@#@$@AB
CDE123456789
0@#$@#$@##VW
XYZ00000

In the two instances ABCDE is different. I am hoping there is a way to cater for this in Java.
Thanks

A: You can use String pat = "(?s)A\\R*B\\R*C\\R*D\\R*E(.*?)V\\R*W\\R*X\\R*Y\\R*Z" where \\R* matches zero or more linebreaks, and (?s) makes the dot in .*? match zero or more characters (including a newline) as few as possible (due to *? lazy quantifier).
See this IDEONE demo:
String pat = "(?s)A\\R*B\\R*C\\R*D\\R*E(.*?)V\\R*W\\R*X\\R*Y\\R*Z";
String s = "-@$@$@#@$@AB\nCDE123456789\n0@#$@#$@##VW\nXYZ00000";
Matcher m = Pattern.compile(pat).matcher(s);
while(m.find())
{
    System.out.println(m.group(1));
}

If it works poorly, you may try another, unrolled regex but its performance will depend on how many V symbols there are in your content:
String pat = "A\\R*B\\R*C\\R*D\\R*E([^V]*(?:V(?!\\R*W\\R*X\\R*Y\\R*Z)[^V]*)*)V\\R*W\\R*X\\R*Y\\R*Z";

In case you may have spaces there, in between letters, use \s* instead of \R*:
String pat = "(?s)A\\s*B\\s*C\\s*D\\s*E(.*?)V\\s*W\\s*X\\s*Y\\s*Z"
// or
String pat = "A\\s*B\\s*C\\s*D\\s*E([^V]*(?:V(?!\\s*W\\s*X\\s*Y\\s*Z)[^V]*)*)V\\s*W\\s*X\\s*Y\\s*Z";


text:
Q: RIpple effect on RecyclerView not working on light tap I have tried to implement the ripple effect on my RecyclerView. Here's my layout for it :
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card"
        android:layout_marginTop="7dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="5dp"
        android:clickable="true"
        card_view:cardElevation="5dp"
        android:focusable="true"
        android:foreground="?android:attr/selectableItemBackground">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="16dp">

                <TextView
                    //some properties />

                <TextView
                    //some properties />

                <TextView
                    //some properties />
            </LinearLayout>

    </android.support.v7.widget.CardView>

In order to implement the onclick listener I basically followed this tutorial here: http://sapandiwakar.in/recycler-view-item-click-handler/
The problem is that the ripple effect,generated thanks to the lines :
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"

is not working on light (it's to say quick) presses. When I just quickly tap the screen, the click listener is triggered. It means that the touch event have been detected, however there is no ripple effect showing. If I want to see the ripple effect, I have to maintain for a bit longer the pressure on the screen before releasing.
Is there a way to correct this behaviour and show a ripple effect even for quick presses?

A: I faced a similar problem. I had an ItemClickListener on the RecyclerView, and in that listener I was pushing a new fragment. By trial and error I noticed that removing or emptying the item click listener would get the highlight to show every time, even on light taps.
The fix was to change my onItemClick method:
@Override
public void onItemClick(final RecyclerView parent, final View view, final int position, final long id)
{
    ViewCompat.postOnAnimationDelayed(parent, new Runnable()
    {
        @Override
        public void run()
        {
            // Your click code goes here
        }
    }, 50);
}

This postpones your click action until 50ms after the next animation step and gives the animation enough time to load and run before your click action is performed.

A: This happens because you have used addOnItemTouchListener for item click listener. Just create an interface in RecyclerAdapter
In adapter create an interface
public interface OnItemClickListener {
    void onItemClick(Item item);
}

private final List<ContentItem> items;
private final OnItemClickListener listener;

public Adapter(List<ContentItem> items, OnItemClickListener listener)
{
   this.items = items;
   this.listener = listener;
}

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
   holder.bind(items.get(position), listener);
}

//In your Activity
recycler.setAdapter(new Adapter(items, new
Adapter.OnItemClickListener() {
@Override public void onItemClick(ContentItem item) {
    Toast.makeText(getContext(), "Item Clicked", Toast.LENGTH_LONG).show();
}
}));

instead of below code and it will work like a charm.
recyclerView.addOnItemTouchListener(
    new RecyclerItemClickListener(context, new RecyclerItemClickListener.OnItemClickListener() {
      @Override public void onItemClick(View view, int position) {
        // TODO Handle item click
      }
   })
);

A: Asked long ago but thought it might help someone, I faced the similar issue and used postDelayed method .
   ( new Handler()).postDelayed(new Runnable() {
        @Override
        public void run() {
           //your code
        }
    }, 100);


text:
Q: Downscaling 1km data to 250m with points I am doing some species distribution modeling with MODIS 250m data, and would like to downscale 30 arc-second (1km) bioclim data to 250m so that I can use them in my models.
My idea is this:
Rather than resampling the 1km data to 250m (e.g. bilinear interp), what if I were to:

*

*Convert the 250m grid to points

*Extract each of the bioclim values at each of the points

*Convert the points back into 250m grids.

The idea being that this is a more conservative approach than interpolation, since I wouldn't be making up new data values. Does this seem appropriate/viable, or would I be better off just resampling?
Follow up question: If I were to do this, would the resultant 250m bioclim grids still be considered continuous data? Or are they closer to discrete? The SDMs can handle either, but I need to specify for each variable.


text:
Q: Question about Gaussian Bound. The question is the following:
If $ Y \sim N(0,\sigma^2)$, then $ E\{\left|Y \right|I(\left|Y \right|>c)\} \le \sigma e^{-c^2/2\sigma^2}$.
I try to use Cauchy-Schwatz inequality and Gaussian tail bound but seems like not right approach. Any suggestion?

A: Using the pdf of $Y$ and the fact that $|Y|1_{|Y|>c}$ is symmetric about $0$, we have
$$ \mathbb{E}[|Y|1_{|Y|>c}]=\frac{2}{\sqrt{2\pi}\sigma}\int_c^{\infty}ye^{-\frac{y^2}{2\sigma^2}}\;dy$$
Setting $u=\frac{1}{2}(\frac{y}{\sigma})^2$, this becomes
$$ \sqrt{\frac{2}{\pi}}\sigma\int_{\frac{c^2}{2\sigma^2}}^{\infty}e^{-u}\;du=\sqrt{\frac{2}{\pi}}\sigma e^{-\frac{c^2}{2\sigma^2}}$$
and this is less than $\sigma e^{-\frac{c^2}{2\sigma^2}}$ since $\frac{2}{\pi}<1$.

A: $\mathrm{I}=\mathbf{E}\left(|Y|\mathbf{1}_{\{|Y|>c\}}\right)=2\int\limits_c^\infty dy\ y \dfrac{e^{-\frac{y^2}{2\sigma^2}}}{\sqrt{2\pi} \sigma};$ make the change of variable $u = \dfrac{y^2}{2\sigma^2}$ so $du = \dfrac{y}{\sigma^2}$ and so, $\mathrm{I}=\sqrt{\dfrac{2}{\pi}}\sigma\int\limits_{\frac{c}{\sigma^2}}^\infty du\ e^{-u}=\sqrt{\dfrac{2}{\pi}}\sigma e^{-\frac{c}{2\sigma^2}}.$


text:
Q: what is the best way to code sign(digitally sign) exe on client system more securely (with certificate safety)? I have a windows service and part of business logic it generates a desktop file setup. Now, I want to code sign that desktop file setup Programmatically so that Windows will not warn the end user about an application from an "unknown publisher".
I also know its very straight forward process as I can do it by Microsoft signtool by taking certificate from local system and also can use Azure signtool by taking certificate from azure Key Vault for sign setup.
now, I have following doubts:

*

*Now my problem is certificate security as windows service installed on client system and signing process will go on client system so, Its possible to misuse certificate by anyone.

*currently using AzureSigntool which takes certificate from azure Key Vault directly but we doing it programmatically so we need to pass some sensitive info. like client Id, key vault Url, and secret Key with windows service code to access certificate during signing process. another point is that we doing signing by AzureSigntool on client  system. does anyone can make forgery of my certificate from Azuresigntool during signing process?

*If do not hesitate to suggest any other best possible approach also.


text:
Q: Difference between this two js in react I start to learn React JS and anyone can explain me the difference between those two files? Both of them do the same thing.
First JS
import React, { useEffect, useState } from 'react'
import Product from './Product';
import './Today.css';
import { Link } from 'react-router-dom';
import { render } from '@testing-library/react';

export default class Today extends React.Component {

    state = {
        loading : true,
        fixture : null
    };

    async componentDidMount() {

        const OPTIONS = {
            method : 'GET',
                headers : {
                    'X-RapidAPI-Host' : 'api-football-v1.p.rapidapi.com',
                    'X-RapidAPI-Key' : '###'
                }
        };
        const url = 'https://api-football-v1.p.rapidapi.com/v2/fixtures/date/2020-07-18';
        const response = await fetch(url,OPTIONS);
        const fixtures = await response.json();
        this.setState({ fixture: fixtures.api.fixtures, loading: false});
        const teamData = fixtures.api && fixtures.api.fixtures > 0 ? fixtures.api.fixtures : [];
        console.log(this.state);
    }

    render() {
        return (

               {this.state.loading || !this.state.fixture ? (

               ) : (

                       {this.state.fixture.slice(0,10).map(fixtureToday => (

{fixtureToday.homeTeam.team_name}

                       ))}

               )}

        )
    }
}

Second one
import React, { useState, useEffect } from 'react';
import './AnotherDay.css';
import { Link } from 'react-router-dom';

function AnotherDay() {

    useEffect(() => {
        fetchItems();
    },[]);

    const OPTIONS = {
        method : 'GET',
        headers : {
            'X-RapidAPI-Host' : 'api-football-v1.p.rapidapi.com',
            'X-RapidAPI-Key' : '###'
        }
    };

    const [fixtures, setItems] = useState([]);

    const fetchItems = async () => {
        const data = await fetch(
            'https://api-football-v1.p.rapidapi.com/v2/fixtures/date/2020-07-18' , OPTIONS
            );
        const fixtures = await data.json();
        const teamData = fixtures.api && fixtures.api.fixtures.length > 0 ? fixtures.api.fixtures : [];

        console.log(teamData);
        setItems(teamData);
    }

  return (

      {fixtures.slice(0,10).map(fixture => (

{fixture.homeTeam.team_name}

      ))}

  );
}

export default AnotherDay;

And in the App.js I have
import React from 'react'
import './Today.css';
import { Link } from 'react-router-dom';
import Today from './Today ';
import AnotherDay from './EvenimenteMaine';

function TodayEvents() {
    return (

           <Today />

            <AnotherDay />

    )
}

export default TodayEvents

I have the same result in the both divs. My question is, what is the difference? The first one is a class and the second one is a function?
Which one is the correct way?
Thanks, maybe is a noob question but I'm new to learning React.

A: The first example is a class component the second one is a functional component. React development is moving away from classes toward the functional components. useEffect is supposed to replace several life cycle functions from class components.
Two things to look into functional components and class components. The second set of things to look up is life cycle functions and functional component hooks.
Here is a link that will explain at a high level the differences.
https://dev.to/danielleye/react-class-component-vs-function-component-with-hooks-13dg


text:
Q: How can I combine the jQuery datepicker plugin and hover event? I am not aware of an easy way to perform a function when hovering over a day with the jQuery UI datepicker so I am trying to do a work around by assigning a class and then calling a hover function:
$('.someDate').hover(function() { alert(this) } );

This does not work how I would like it though because it returns [object HTML TableCellElement]. How could I assign an attribute to each date cell td tag so that I can retrieve the date value through that method.
Or am i completely missing a really obvious way of doing this?

A: You can make use of the beforeShowDay event, which takes in the date object.
$('#date').datepicker({
    beforeShowDay: function(date) {
        var dateString = 'date-'+date.getDate()+'-'+date.getMonth()+'-'+date.getFullYear();
        return [true, dateString, ''];
    }
});

This will add a class of date-DD-M-YYYY to each of the <td>.
The function takes a date as a parameter and must return an array with:

*

*[0] equal to true/false indicating whether or not this date is selectable,

*[1] equal to a CSS class name(s) or "" for the default presentation

*[2] an optional popup tooltip for this date.

It is called for each day in the datepicker before it is displayed.
Read more at jQueryUI.com

A: Well I assume the tableCellElement has the date in it correct?  I haven't tested it, but..
alert($(this).text());


text:
Q: how to pass csrf token in jquery datatable/makeEditable function I need to pass my token anti-CSRF token in makeEditable .
.makeEditable({
    sUpdateURL: "com/change/company.do",
    headers: {
        'X-CSRF-Token': $('meta[name="_token"]').attr('content')
    },
    "aoColumns": [
                null,
                null,
                {
                   cssclass: "required",
                   onblur: 'submit'
                },
                null,
                null
    ]
});

tried this but that doesnt work..Please help me to find a solution..thanks in Advance


text:
Q: update the column specifed in the text box from the server I want to update a column of a table where the column name will be entered in the textbox while executing. The following code is not performing any action. TextBox14 contains the column name and TextBox12 consists the value to be updated.
        Dim squery As String = "SELECT name,days from definedLeave"
                        Dim cmd6 As SqlCommand = New SqlCommand(squery, con)
                        Dim dr6 As SqlDataReader = cmd6.ExecuteReader()
                        Dim i As Integer = 0
                        While dr6.Read()
                            Try
                                s = dr6(i).ToString
                                TextBox14.Text = s
                                a = dr6(i + 1).ToString
                                TextBox12.Text = a
                               Dim sql = "update empLeave set " & TextBox14.Text.Trim & "=@na where epid='" + txtCode.Text + "'"

                                Using com7 = New SqlCommand(sql, con)
                                    com7.Parameters.AddWithValue("@na", TextBox12.Text)
                                    com7.ExecuteNonQuery()
                                End Using
                            Catch ex As Exception
        MsgBox("HELLO")
    End Try
                        End While
                        com7.Dispose()
                        dr6.Close()

A: Try like this
Dim sql as string= "update empLeave set " & TextBox14.Text.Trim & "=@na where
epid='" + txtCode.Text + "'"

  Using com7 = New SqlCommand(sql, con)
      com7.Parameters.AddWithValue("@na", TextBox12.Text)
      com7.ExecuteNonQuery()
  End Using

A: Unfortunately, parameters can only be used for values, not identifiers.  They're just like variables in VB - you can't use the contents of one variable to stand for another variable in VB either.
The silly thing is that you're trying to use a parameter where you can't and then where you can, for the epid value, you use string concatenation.  Your code should look something like this:
Dim sql = "UPDATE empleave SET [" & TextBox14.Text & "] = @na WHERE epid = @epid"

Using com7 = New SqlCommand(sql, con)
    com7.Parameters.AddWithValue("@na", TextBox12.Text)
    com7.Parameters.AddWithValue("@epid", txtCode.Text)

    com7.ExecuteNonQuery()
End Using

That still leaves you open to SQL injection though, so you should make absolutely sure that you validate the column name first.  In fact, what you should do is query the database to get the column names first and then put them in a ComboBox.  That way you are guaranteed that the user will select a valid value.


text:
Q: HTML button onclick action with Django function HTML form on Django.
I want to perform or create web page in which the button performs the action, and in backend I am handling the Django function.
The code of HTML file is:
<form name="bookappointment" class="form" method="POST">
   {% csrf_token %}

                  <input type="hidden", name="selecteddoctornumber" value="{{i.doctornumber}}">

              <button class="btn approve" name="approvebtn">Approved</button>

                  <button class="btn notapprove" name="notapprovebtn">Not Approved</button>

                  Cancel

   </form>

and the other side the Django function is:
if request.method == 'POST':

    if request.POST.get('approvebtn'):
        for i in doctor:
            if pendingDoctorNumber == i.contactNumber:
                i.status = 'Approved'

        return redirect('request')

    if request.POST.get('notapprovebtn'):
        for i in doctor:
            if pendingDoctorNumber == i.contactNumber:
                i.status = 'Not Approved'

        return redirect('request')

but its not working any action just get me back to same page

A: <form action="{% url 'bookappointment' %}" method="POST">

you have to define bookappointment in your urls.py which redirect to views.py where your function lies with name bookappointment.


text:
Q: Function key reset by Azure? I have just finished fixing a function (an HTTP trigger) that stopped working due to the deployment of Azure Functions Runtime 2.0.12050-alpha. The error shown in the portal was The binding type(s) 'someType' are not registered.
After implementing a few changes (e.g. adding a reference to Azure Storage extension, ILogger instead of TraceWriter), the function started to work locally again, but my application was still failing.
After some poking around, I noticed that the function key has changed. The value was different than the one stored in the settings of the web app that was calling the function. I set the new value there and everything started to work fine.
Is it possible that the function key was reset without my knowledge?
(It's a small side project and I'm the only developer.)
Is it because of the new Functions Runtime deployment or are the keys reset periodically?

A: See Changes to Key Management in Functions V2.
Azure Functions currently supports two key storage mechanisms: file system and blob storage.
File system was always used to store secrets for both 1.x and 2.x runtime. For 2.x, begin with runtime 2.0.12050-alpha, function secrets are stored in blob storage (AzureWebJobsStorage in Application settings) by default, users can switch to files by setting the AzureWebJobsSecretStorageType app setting to files.
To make the transition work smoothly, Function team implemented a temporary key migration code path that would automatically copy the secrets from the file system to blob storage. BUT this internal method is not enabled from runtime 2.0.12115 as it was somewhat error prone.
This means:
If you pinged your function runtime (set FUNCTIONS_EXTENSION_VERSION to minor version <= 2.0.11961-alpha) before 2.0.12050-alpha was deployed and release the ping (change FUNCTIONS_EXTENSION_VERSION to major version ~2) after 2.0.12115 was deployed (right now it's 2.0.12134), your function keys are expected to be changed.
Else runtime is upgraded automatically and Function app created before 2.0.1250 should benefit from the secret migration code and has the consistent keys.
I always leave runtime to major version (beta before 2.x is GA and ~2 after) and I can confirm my keys are not influenced. As for SendGrid API key, it's controlled by SendGrid service other than Azure hence can't be influenced. BTW my SendGrid API key generated months ago still works right now.

A: In my case the keys were reset due to changing the storage account associated with my function app.
Specifically, while I was fixing the function code for environment X, I noticed that the AzureWebJobsStorage environment variable was pointing at the storage account associated with environment Y and changed it.
Per @jerry-liu's comments, since 2.x function secrets are stored in blob storage, changing the associated blob storage account effectively "reset" your function keys.


text:
Q: Redundant conformance of 'CLLocationCoordinate2D' to protocol 'decodable'/'encodable' I'm writing on an interally used framework making use of CoreLocation. Don't ask me why but I have the requirement to make CLLocation codable. So I came up with a struct
struct CLLocationEncodingStruct: Codable {
    let coordinate: CLLocationCoordinate2D
    let altitude: CLLocationDistance
    let horizontalAccuracy: CLLocationAccuracy
    let verticalAccuracy: CLLocationAccuracy
    let speed: CLLocationSpeed
    let course: CLLocationDirection
    let timestamp: Date

    public init(with location: CLLocation) {
        coordinate = location.coordinate
        altitude = location.altitude
        horizontalAccuracy = location.horizontalAccuracy
        verticalAccuracy = location.verticalAccuracy
        speed = location.speed
        course = location.course
        timestamp = location.timestamp
    }

    var location: CLLocation {
        return CLLocation(coordinate: coordinate, altitude: altitude, horizontalAccuracy: horizontalAccuracy, verticalAccuracy: verticalAccuracy, course: course, speed: speed, timestamp: timestamp)
    }
}

Then I'm conforming to Codable in an extension to CLLocation. Putting data into that struct or pulling the data out of it. To make this work, I also had to make CLLocationCoordinate2D conform to Codable. I did this by writing the following very sophisticated extension
extenstion CLLocationCoordinate2D: Codable {}

Now I wanted to do things right for a change, so I wanted to get started writing unit tests. The problem is that my extension to CLLocationCoordinate2D needs to be part of both targets: the unit test and the framework itself. Unfortunately this does not compile. It fails with
Redundant conformance of 'CLLocationCoordinate2D' to protocol 'Encodable'

Redundant conformance of 'CLLocationCoordinate2D' to protocol 'Decodable'
Pointing out that CLLocationCoordinate2D already conforms to the protocol at the same code line. Building the target that depends on said frameworks works perfectly though. Do you have any ideas to fix that?
Best,
geru

A: Your extension should not need to be part of the tests target.
You import your main application target into the unit test with the @testable attribute
import XCTest

@testable import MyProject

class MyProjectViewControllerTests: XCTestCase {}

This allows you to use the classes, extensions etc from your project without adding them to the test target.


text:
Q: How do I configure Nexus Sonatype to proxy maven-jgitflow-plugin I have configured a proxy in sonatype for the atlassian repo as follows:
Remote Storage Location: https://maven.atlassian.com/repository/public/

when i try to use the plugin it does not pickup my configuration from pom for the plugin and I see this error:
[WARNING] The POM for com.atlassian.maven.plugins:maven-jgitflow-plugin:jar:1.0-m5.1 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for com.atlassian.maven.plugins:maven-jgitflow-plugin:1.0-m5.1: Plugin com.atlassian.maven.plugins:maven-jgitflow-plugin:1.0-m5.1 or one of its dependencies could not be resolved: Failure to find com.atlassian.maven.plugins:maven-jgitflow-plugin:jar:1.0-m5.1 in https://<my local maven server>/content/groups/internal was cached in the local repository, resolution will not be reattempted until the update interval of <servername> has elapsed or updates are forced

A: It turns out that the groupId/artifactId are incorrect. the working entry for me is
                <plugin>
                    <groupId>external.atlassian.jgitflow</groupId>
                    <artifactId>jgitflow-maven-plugin</artifactId>
                    <version>1.0-m5.1</version>
                </plugin>


text:
Q: Does there exist an isotropic left invariant Riemannian metric on $GL_n^+$? Let $GL_n^+$ be the group of $n \times n$ real invertible matrices with positive determinant
Does there exist a left invariant isotropic Riemannian metric on $GL_n^+$?
(By "isotropic" I mean that the sectional curvature $k(p,\sigma)$ for $\sigma \subseteq T_pM$ does not deped on $\sigma$. By left invariance it does not depend on $p$ as well).

I present a proof below, but I suspect that there are simpler ones:
Suppose such a metric $g$ exists. Then the left invariance implies $(GL_n^+,g)$ is complete, hence it's universal covering space is complete, simply connected, and with constant curvature, so it must be diffeomorphic to $\mathbb{R}^{n^2}$ or   $\, \mathbb{S}^{n^2}$.
Since compact spaces can cover only compact spaces, this rules out $\mathbb{S}^{n^2}$, so the universal cover of $GL_n^+$ must be $\mathbb{R}^{n^2}$.
However, Milnor states here that the universal cover of a Lie group $G$ is not homeomorphic to Euclidean space iff $G$ contains a compact non-abelian subgroup*. Since $GL_n^+$ contains $SO(n)$ we have a contradiction, at least for $n \ge 3$.

*I actually don't know how to prove this. Any hints or references  would be welcome. Milnor states this in theorem 3.4.

A: Here is a topological argument ruling out covering by $\mathbb R^{n^2}$. However, it might be an overkill for this statement.
Assume $n>2$. If $\mathbb R^{n^2}$ were the universal cover of $GL^+_n$, we have $GL^+_n=K(\pi, 1)$, where $\pi=\pi_1(GL_n^+)$. At the same time, $\pi_1(GL_n^+)=\pi_1(SO(n))=\mathbb Z_2$, so $K(\pi, 1)=\mathbb R P^{\infty}$, which is clearly not homotopy equivalent to a finite dimensional space.

A: $GL_n^{+}$ deformation retracts onto $SO(n)$. The universal cover of this (for $n \ge 3$) is a double cover, since $\pi_1(SO(n)) = \mathbb{Z}_2$. It's known as the Spin group $Spin(n)$, and in particular, because it's a double cover it's compact. Hence it's certainly not homotopy equivalent to a Euclidean space (e.g. because its top $\mathbb{Z}_2$ homology is nontrivial), which means the universal cover of $GL_n^{+}$ can't be either.
Various other arguments are possible. For example, we also know that (again, for $n \ge 3$) $\pi_3(Spin(n)) \cong H_3(Spin(n)) \cong \mathbb{Z}$, so the same is true of the universal cover of $GL_n^{+}$.