text:
Q: In Java code, need to figure out how to get back to the main menu after doing one of the options in the menu? I am working on Java code. I have a menu, the user selects an option, does something in the option then returns to the menu until the exit is selected. I'm not sure how to get it to go back to the menu.
Here is what I have:
/**
 *
 * @author Lisa Hergert
 */

import java.util.Scanner;
import java.util.Random;

public class MathTutor {

    //Create scanner for user input
    Scanner keyboard = new Scanner(System.in);

        //Declare variables
        int choice;
        Random generator = new Random();

        public MathTutor () {
            choice = 0;
        }

        public int getQuestionType() {
            while (choice < 1 || choice >3) {
                System.out.println("Math Tutor");
                System.out.println("\t1) Addition problem");
                System.out.println("\t2) Subtraction problem");
                System.out.println("\t3) Quit");
                System.out.println("Enter your choice (1 - 3): ");
                choice = keyboard.nextInt();
                if (choice < 1 || choice > 3) {
                    System.out.println("You must choose a number from 1-3");
                }
            }
            return choice;
            }

    public void askQuestions () {
        for (int i = 0; i < 4; i++) {
            int num1 = genRandomNum();
            int num2 = genRandomNum();
            int max = choice;
            if (max == 3) {
                max = (int)(Math.random() * 3 + 1);
            }
            switch (max) {
                case 1: addition(num1, num2);
                    break;
                case 2: subtraction(num1, num2);
                    break;
                default: System.out.println("Error");
                System.exit(1);
            }
        }
    }

public int genRandomNum() {
    return (int)generator.nextInt(1000);
}

public void addition(int num1, int num2) {
    if (num1 > num2) {
        System.out.printf("%5d\n", num1);
        System.out.printf("+ %3d\n", num2);
        System.out.println("-------");
    } else {
        System.out.printf("%5d\n", num2);
        System.out.printf("+ %3d\n", num1);
        System.out.println("-------");
    }
    int sum = num1 + num2;
    int answer = keyboard.nextInt();
    if (num1 + num2 == answer) {
        System.out.println("Good job, you got it right!");
    } else {
        System.out.println("Good try, the correct answer is: " + sum);
    }
}

public void subtraction (int num1, int num2) {
    if (num1 > num2) {
        System.out.printf("%5d\n", num1);
        System.out.printf("- %3d\n", num2);
        System.out.println("-------");
    int diff = num1 - num2;
    int answer = keyboard.nextInt();
        if (num1 - num2 == answer) {
            System.out.println("Good job, you got it right!");
        } else {
            System.out.println("Good try, the correct answer is: " + diff);
        }
    } else {
        System.out.printf("%5d\n", num2);
        System.out.printf("- %3d\n", num1);
        System.out.println("-------");
    int diff = num2 - num1;
    int answer = keyboard.nextInt();
        if (num2 - num1 == answer) {
            System.out.println("Good job, you got it right!");
        } else {
            System.out.println("Good try, the correct answer is: " + diff);
        }
    }
}

public static void main(String[] args) {

    MathTutor tutor = new MathTutor();

    int choice = tutor.getQuestionType();

    tutor.askQuestions();

    return;
  }
}

A: import java.util.Scanner;
import java.util.Random;

/**
 *
 * @author Lisa Hergert
 */
public class MathTutor {

        //Create scanner for user input
        Scanner keyboard = new Scanner(System.in);

            //Declare variables
            int choice;
            Random generator = new Random();

            public MathTutor () {
                choice = 0;
            }

            public int getQuestionType() {
                while (choice < 1 || choice >3) {
                    System.out.println("Math Tutor");
                    System.out.println("\t1) Addition problem");
                    System.out.println("\t2) Subtraction problem");
                    System.out.println("\t3) Quit");
                    System.out.println("Enter your choice (1 - 3): ");
                    choice = keyboard.nextInt();
                    if (choice < 1 || choice > 3) {
                        System.out.println("You must choose a number from 1-3");
                    }
                }
                return choice;
                }

        public void askQuestions () {
                int num1 = genRandomNum();
                int num2 = genRandomNum();
                int max = choice;
                if (max == 3) {
                    max = (int)(Math.random() * 3+3);
                }
                switch (max) {
                    case 1: addition(num1, num2);
                        break;
                    case 2: subtraction(num1, num2);
                        break;
                    default: System.out.println("Thank you for your time.");
                    System.exit(1);
                }
            }

    public int genRandomNum() {
        return (int)generator.nextInt(1000);
    }

    public void addition(int num1, int num2) {
        if (num1 > num2) {
            System.out.printf("%5d\n", num1);
            System.out.printf("+ %3d\n", num2);
            System.out.println("-------");
        } else {
            System.out.printf("%5d\n", num2);
            System.out.printf("+ %3d\n", num1);
            System.out.println("-------");
        }
        int sum = num1 + num2;
        int answer = keyboard.nextInt();
        if (num1 + num2 == answer) {
            System.out.println("Good job, you got it right!");
        } else {
            System.out.println("Good try, the correct answer is: " + sum);
        }

        MathTutor tutor = new MathTutor();

        int choice = tutor.getQuestionType();

        tutor.askQuestions();
    }

    public void subtraction (int num1, int num2) {
        if (num1 > num2) {
            System.out.printf("%5d\n", num1);
            System.out.printf("- %3d\n", num2);
            System.out.println("-------");
        int diff = num1 - num2;
        int answer = keyboard.nextInt();
            if (num1 - num2 == answer) {
                System.out.println("Good job, you got it right!");
            } else {
                System.out.println("Good try, the correct answer is: " + diff);
            }
        } else {
            System.out.printf("%5d\n", num2);
            System.out.printf("- %3d\n", num1);
            System.out.println("-------");
        int diff = num2 - num1;
        int answer = keyboard.nextInt();
            if (num2 - num1 == answer) {
                System.out.println("Good job, you got it right!");
            } else {
                System.out.println("Good try, the correct answer is: " + diff);
            }
        }

        MathTutor tutor = new MathTutor();

        int choice = tutor.getQuestionType();

        tutor.askQuestions();
    }

    public static void main(String[] args) {

        MathTutor tutor = new MathTutor();

        int choice = tutor.getQuestionType();

        tutor.askQuestions();

    }
}

A: Maybe I'm missing something but can't you just loop all the functionality?
public static void main(String[] args) {
  MathTutor tutor = new MathTutor();

  int choice = tutor.getQuestionType();
  while(choice != 3) {
    tutor.askQuestions();
    choice = tutor.getQuestionType();
  }
  return;
}


text:
Q: React Native Firestore remove object in array I cannot delete object inside my array of object in a document from Firestore.
Here my Document

I have tried that
const obj = product;
    const user_post = await this.checkOwnerPost();

    console.log(obj);

        if (user_post){
  await this.firestore
  .collection('testCollection')
  .doc(user_post.doc_id)
  .update({
    products: firebase.firestore.FieldValue.arrayRemove(obj)
    .then(() => {
    console.log("Document successfully updated!");
    return true;
  }).catch((error) => {
    console.log(error);
    return false;
  })
});

}
Console.log(obj) = {
  "description": "1",
  "key": 1,
  "name": "first",
  "picture": "https://firebasestorage.googleapis.com/v0/b/url",
  "price": 1,
}

Here the error msg:
[Unhandled promise rejection: TypeError: undefined is not a function (near '..._firebase.default.firestore.FieldValue.arrayRemove(obj).then...')]
at node_modules/lodash/lodash.js:10487:35 in debounced
at [native code]:null in flushedQueue
at [native code]:null in callFunctionReturnFlushedQueue

Someone can help me ? Or do you have any ideas how can i do for delete and update a object inside an array ?
EDIT: Is fix, it was bad formating of JS code

A: Fix
I was a bad formating of the JS Code.
The working code is:
if (user_post){
      await this.firestore
      .collection('testCollection')
      .doc(user_post.doc_id)
      .update({products: firebase.firestore.FieldValue.arrayRemove(obj)})
      .then(() => {
        console.log("Document successfully updated!");
        return true;
      }).catch((error) => {
        console.log(error);
        return false;
      });
    };

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can a physical parameter originally defined as a scalar be shown to be a tensor through its relationship to another parameter that is a tensor? I'm going to provide background on the parameters in the title's question.  Then I'm going to explain the origin of my question.  Hopefully, then, my title question (and additional questions) will be more clear and the focus can be on the mathematical proof. (Note I have only recently became aware about tensors and their use for physical problems).
Background: Fluid flow through porous media is commonly described using Darcy's Law,
$$\tag{1} v=\frac{k_d}{\mu} \frac{\Delta p}{\Delta x}$$
where $k_d$ is known as the medium's absolute coefficient of permeability, its a proportionality constant that reflects the porous medium's void space configuration.  Permeability is one of the parameters of focus for this question/post.  It was originally only considered to be a scalar quantity (Darcy's original experiments from which his equation was determined only considered isotropic media).
However, for anisotropic porous media, quoting wiki:

To model permeability in anisotropic media, a permeability tensor is
  needed. Pressure can be applied in three directions, and for each
  direction, permeability can be measured (via Darcy's law in 3D) in
  three directions, thus leading to a 3 by 3 tensor. The tensor is
  realized using a 3 by 3 matrix being both symmetric and positive
  definite.

The other parameter of focus is the so-called Klinkenberg factor, $b$.  It is a correction factor required when flowing gas at low mean pressure.  Like permeability, the Klinkenberg factor is a function of the porous medium's void space structure, namely, how large (or small) the radii ($r$) of the interconnected void spaces are within the medium.
The origin of my question: Paraphrasing a paper I am reading,

Using one-dimensional flow, Kinkenberg came to the following
  conclusions and verified them experimentally.

*

*As the constant $b$ (Klinkenberg factor) is inversely proportional to $\bar r$ (radius of capillaries), the value of $b$ may be expected
  to be small for highly permeable samples, and to be large for less
  permeable samples.

*The apparent permeability, $k_{app}$, extrapolated to infinite mean pressure ($1/p_m=0$) should give the absolute permeability.
  Klinkenberg's proposed equation for isotropic permeability is:
  $$\tag{2} k_{app}=k_d(1+b/p_m)$$ Given the consistency of
  Klinkenberg's conclusions, one may generalize Eqn (2) for three
  dimensional flow.  From conclusion 2, the apparent permeability tensor
  $k_{app}^{ij}$ for anisotropic rock extrapolated to infinite mean
  pressure should give the absolute permeability tensor.  Therefore, it
  should be a contravariant tensor of order two since absolute
  permeability tensor is a contravariant tensor of order two.  From
  conclusion 1, the Klinkenberg factor for anisotropic rocks also should
  be a tensor.  Since the Klinkenber factor is related to the absolute
  permeability, it is convenient to use the same kind of tensor as the
  absolute permeability.  Thus, one may by analogy write the following equation:
  $$\tag{3} k_{app}^{ij}=k_d^{ij} \left(\delta_\alpha^j+g_{\alpha \beta} \frac{b^{\beta j}}{p_m}\right)$$
  where $\delta_\alpha^j$ = Kronecker delta, and $g_{\alpha \beta}$ = metric tensor.

Restating the Title's question: Can a physical parameter originally defined as a scalar (the Klinkenberg factor $b$) be shown to be a tensor through its relationship to another parameter that is a tensor (the absolute permeability $k_d^{ij}$)?
Additional questions:

*

*In line with my proof-explanation tag, does the arguments given by the paper I am reading make sense as a proof to conclusively say that the Kinkenberg factor is a symmetric positive-definite tensor of rank 2 like the absolute permeability tensor?

*In line with my alternative-proof tag, regardless of the answer to the previous question, can an alternative proof be given to show that the Kinkenberg factor is (or is not) a symmetric positive-definite tensor of rank 2 like the absolute permeability tensor?


text:
Q: Using javax.validation in GWT throws runtime error ClassNotFoundException I'm using in GWT application the javax.validation.*
I added the dependencies to my pom:
<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>1.0.0.GA</version>
</dependency>

But on runtime i'm getting ClassNotFoundException :
2012-03-20 09:46:12,253 WARN [pool-2-thread-1] o.s.c.t.c.AnnotationAttributesReadingVisitor [AnnotationAttributesReadingVisitor.java:91] Failed to classload type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable.
java.lang.ClassNotFoundException: javax.validation.constraints.NotNull
       at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701) ~[catalina.jar:7.0.26]
       at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546) ~[catalina.jar:7.0.26]
       at
Any ideas?

A: There are actually several things you need for the validation framework to work.
You need the validation API.  It seems like you have that but you must remember that GWT needs the source of included files.
In order to get this to work you need to include both the API jar and API sources.
<dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <type>jar</type>
        <classifier>sources</classifier>
</dependency>
<dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
        <type>jar</type>
</dependency>

Without this you'll get class not found exceptions for the validation API.
You also need to make sure that you've added the validation inclusion to your GWT module XML.
<inherits name="org.hibernate.validator.HibernateValidator" />
<replace-with
    class="com.google.gwt.sample.validation.client.SampleValidatorFactory">
    <when-type-is class="javax.validation.ValidatorFactory" />
</replace-with>

Further, you also need to include a validation engine of some sort.  You probably want hibernate-validation if you're following the GWT bean validation guide.
To validate an annotated object, you should use the API provided.
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import javax.validation.ConstraintViolation;

/* ... snip ... */

//get validator factory using default bootstrap mechanism of the Validation library
ValidatorFactory factory = Validation.byDefaultProvider().configure().buildValidatorFactory();

//get a validator instance
Validator validator = factory.getValidator();

//create new object
Person person = new Person();
person.setFirstName("Andrew");

//validate person object
Set<ConstraintViolation<Person>> violations = validator.validate(person);

//should be one violation from lastName being null
assert violations.size() == 1;

Good luck.

A: you must add one jar, with the validation implementation, such us hibernate-validation.


text:
Q: C# check/uncheck checkbox in WebBrowser control? This is my code:
webBrowser1.Document.GetElementById("user").SetAttribute("value", txtUsername.Text);
webBrowser1.Document.GetElementById("pass").SetAttribute("value", txtPassword.Text);
webBrowser1.Document.GetElementById("rememberme").SetAttribute("checked", cbAutoLogin.Checked.ToString());

The username and password is ok I don't have any problem, but the check is not working. The problem is not on the cbAutoLogin.Checked.ToString(), even if I write true or false nothing change.
Here is the checkbox on html
<input type='checkbox' id='rememberme' checked='checked' name='rememberme' value='1' class='input_check' />

Anyone else have the same problem? Or I do something wrong?

A: Use this:
webBrowser1.Document.GetElementById("rememberme").InvokeMember("CLICK");

It will make it checked if unchecked and Unchecked if Checked.
OR change the value attribute same like username,password to 0 or 1.


text:
Q: Python base 64 decode I have a base 64 encoded string and when I call base64.b64decode on this string I received hex values of bytes:
>>> base64.b64decode('ut3u4RDwyk6z3pYp7hg60rH87qptHQEt+Ffxrc50ohU/lKrD0PcGYu/mC2PZusumsIn2B7krD+EG /TRXpuaHRRQS4uaMz9Lyd8vyV8p4PeyNzytdyXn7lsF5tcILiN4e7y8OX2MNf4x6y0q2QwzFB110 5cxjQHdghOWNBqPdVFkpv14+0pkZ3ugAd9hFRMEUyIWvjHbsFA5+JZZv/9lRLbo/r0f30MnKJrTa jdVi3W787G9/B6Rfg+kxWWviLlHsOk98S/HdcU+nMY6LzSzDrNx31slQjF0wuK/0tjpmML7aBGeN JqCYyfqKLu9s8c9n4vn/TtH2zyv3aRckgjrjyLy2+/6T/jR5oXDRjHu8wHUgFpDm9VkR9Y+0zcCy 4s0ZasNCeF5GNp+4YUFqcmNp7/C0m20QAAAAlF5P7jSKksi6ESBpxL5bbA==')
'\xba\xdd\xee\xe1\x10\xf0\xcaN\xb3\xde\x96)\xee\x18:\xd2\xb1\xfc\xee\xaam\x1d\x01-\xf8W\xf1\xad\xcet\xa2\x15?\x94\xaa\xc3\xd0\xf7\x06b\xef\xe6\x0bc\xd9\xba\xcb\xa6\xb0\x89\xf6\x07\xb9+\x0f\xe1\x06\xfd4W\xa6\xe6\x87E\x14\x12\xe2\xe6\x8c\xcf\xd2\xf2w\xcb\xf2W\xcax=\xec\x8d\xcf+]\xc9y\xfb\x96\xc1y\xb5\xc2\x0b\x88\xde\x1e\xef/\x0e_c\r\x7f\x8cz\xcbJ\xb6C\x0c\xc5\x07]t\xe5\xccc@w`\x84\xe5\x8d\x06\xa3\xddTY)\xbf^>\xd2\x99\x19\xde\xe8\x00w\xd8ED\xc1\x14\xc8\x85\xaf\x8cv\xec\x14\x0e~%\x96o\xff\xd9Q-\xba?\xafG\xf7\xd0\xc9\xca&\xb4\xda\x8d\xd5b\xddn\xfc\xeco\x7f\x07\xa4_\x83\xe91Yk\xe2.Q\xec:O|K\xf1\xddqO\xa71\x8e\x8b\xcd,\xc3\xac\xdcw\xd6\xc9P\x8c]0\xb8\xaf\xf4\xb6:f0\xbe\xda\x04g\x8d&\xa0\x98\xc9\xfa\x8a.\xefl\xf1\xcfg\xe2\xf9\xffN\xd1\xf6\xcf+\xf7i\x17$\x82:\xe3\xc8\xbc\xb6\xfb\xfe\x93\xfe4y\xa1p\xd1\x8c{\xbc\xc0u \x16\x90\xe6\xf5Y\x11\xf5\x8f\xb4\xcd\xc0\xb2\xe2\xcd\x19j\xc3Bx^F6\x9f\xb8aAjrci\xef\xf0\xb4\x9bm\x10\x00\x00\x00\x94^O\xee4\x8a\x92\xc8\xba\x11 i\xc4\xbe[l'

I am not sure what to make out of \xcaN or \x96)? Why are there N and ) characters? If I understand correctly hex only ranges from 0-9 and a-f.
Or is it wrong to interpret them as hex values?


text:
Q: How to license part of the file? I have modified some files of an open source project under GNU GENERAL PUBLIC LICENSE to add some specific features.
I would add the same license for the part of the code written by me.
How i should do this?
What is the preamble that have to be added to files modified?
Thanks

A: Usually because of the Gnu GPL definition, if the code is under GPL license and if any changes made to the code then the total code should be licensed under the GPL compatible  license. But usually everyone license the code under the same GPL license.
GPL frequently used questions


text:
Q: How to access data from computed property Vue.js I'm using Vue.js and when I try to access a variable from data inside a computed property, it returns undefined.
Here's the code:
    <script>
     export default {
       name: 'app',
       data: () => {
         return {
           lang: 'sp'
         }
       },
       computed: {
         langEn: () => this.lang === 'en',
         langSp: () => this.lang === 'sp'
       }
     }
    </script>

This is in a NPM project. And inside a .vue file. Maybe it behaves differently when used like this?
Thanks for the help

A: This is a very common "gotcha".
Do not use a fat arrow when defining your computed.
When you use a fat arrow to define your computed, methods, or data, you capture this lexically and it will point to the containing scope (which is often window or undefined) and not your Vue.
<script>
   export default {
     name: 'app',
     data() {
       return {
         lang: 'sp'
       }
     },
     computed: {
       langEn() { return this.lang === 'en' },
       langSp() { return this.lang === 'sp' }
     }
   }
</script>


text:
Q: Proving that a certain operator which takes continously differentiable functions has a continuous inverse I've been trying to do this exercise for a while now and I'm getting nowhere, I'd really appreciate some help:

Let $A: \mathcal{D}(A) \to C([0, 1])$ be the linear operator given by $(Ax)(t) = x'(t) + a(t) x(t)$ for all $x \in C([0, 1])$, where $a \in C([0, 1])$ is fixed and $\mathcal{D}(A) = \{x \in C^1([0, 1]) \ \vert \ x(0) = 0 \}$  . Prove that $A^{-1}$ exists in $C([0, 1])$ and is continuous.
Observation: the norm on $\mathcal{D}(A)$ is given by $\|x\| = \displaystyle\max_{x \in [0, 1]} |x(t)| + \displaystyle\max_{x \in [0, 1]} |x'(t)|$, whereas the norm in $C([0, 1])$ is the usual one, $\|f\| = \displaystyle\max_{x \in [0,1]} |f(x)|$.

I know that a linear operator $T: \mathcal{D}(T) \subset E \to F$ between two normed vector spaces has a continuous inverse iff there exists a constant $m > 0$ such that $\|T(x)\| \geq m \|x \|$ for all $x \in \mathcal{D}(T)$. I tried to find such an estimate for $\|T\|$ but to no avail, I can't seem to find any way to control $\|T(x)\|$ in terms of $\|x\|$ like that. I also tried to find the explicit inverse but it's way too complicated to show that is continuous. I also tried the usual $\varepsilon$-$\delta$ characterization but that didn't help either. I'm stuck. Would really like some help! Thanks beforehand.

A: You are making it too complicated. Let $g\in C[0,1]$. Consider the initial value problem
$$
x'+ax=g,\ \ \ x(0)=0.
$$
This is a first order linear differential equation. Integrating factor is $e^{a(t)}$, and we get
$$
x(t)=e^{-a(t)}\,\int_0^t e^{a(s)}\,g(s)\,ds.
$$
And that's $A^{-1}$:
$$
(A^{-1}g)(t)=e^{-a(t)}\,\int_0^t e^{a(s)}\,g(s)\,ds.
$$
Note that
$$
\|A^{-1}g\|\leq\|e^{-a}\|\,\|e^{a}\|\,\|g\|,
$$
so $A^{-1}$ is bounded and $\|A^{-1}\|\leq\|e^{-a}\|\,\|e^a\|$.


text:
Q: PHP: is_readable not working for relative path, works for absolute I'm moving a site from one server to another.  On the old server, my code calls is_readable("filename") and it works.  On the new server, it does not work.  The files are exactly the same and "filename" is in the same place relative to the calling page.
When I put in an absolute path instead, is_readable returns true as expected.  Any suggestions about what the problem could be?
safe_mode is off and open_basedir is not set in my php.ini.  I also modified the file permissions, it doesn't work even if I chmod 777 (but that shouldn't matter since it reads properly when using the absolute path).

A: The servers probably have different configurations causing the current working directory (CWD) not to be the one where the script is being read. Relative paths are always relative to the CWD, not the current executing script.
You can check the CWD by calling getcwd() or by using realpath() to resolve the relative path into an absolute one. If the value is incorrect, you will have to either configure the server properly, or set the CWD manually by doing the following:
chdir(dirname(__FILE__));

A: Try using realpath on you relative path to check if it points to the right file.
You could also use getcwd to check if you're in the correct directory.

A: Typically, if you pass a relative path to is_readable (or file_exists), it will return false unless the path happens to be relative to the current PHP direct  -- View PHP chdir info


text:
Q: POJO support for primefaces autocomplete using omnifaces I am trying to use primefaces autocomplete component in my project, in order to avoid writing specific converter to each list object I am trying to use omnifaces as suggested in here and here by 'BalusC', I tried to replicate exactly same way but could not able get this work. please review below code snippet and advice if I am missing anything here?
First part of the code [f:selectOneMenu] is working absolutely fine without anyissues
XHTML
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:composition template="WEB-INF/layout/layout.xhtml">
    <ui:define name="content">
        <h:form>
            <h:outputText id="selected_status"
                value="#{mybean.objLuStatus.strDescColVal}" />
            <!-- h:selectOneMenu Working fine -->
            <h:selectOneMenu id="iterator2" value="#{mybean.objLuStatus}"
                converter="omnifaces.SelectItemsConverter">
                <f:selectItem itemLabel="Choose item" noSelectionOption="true" />
                <f:selectItems value="#{mybean.lstStatus}" var="entity"
                    itemLabel="#{entity.strDescColVal}" itemValue="#{entity}" />
                <f:ajax render="selected_status" />
            </h:selectOneMenu>
            <!-- p:autoComplete is NOT Working -->
            <p:autoComplete id="iterator3" value="#{mybean.objLuStatus}"
                converter="omnifaces.ListConverter" dropdown="true" var="entity"
                itemLabel="#{entity.strDescColVal}"
                placeholder="----- Select One -----" itemValue="#{entity}"
                completeMethod="#{mybean.completeList}">
                <f:ajax render="selected_status" />
            </p:autoComplete>
            <h:commandButton value="Submit" action="#{mybean.post}" />
        </h:form>
    </ui:define>
</ui:composition>
</html>

Managed Bean
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ntr.foundation.model.LuStatus;

@ManagedBean(name = "mybean")
@ViewScoped
public class MyManagedBean extends BaseManagedBean implements Serializable {

    List<LuStatus> lstStatus;
    LuStatus objLuStatus;

    @PostConstruct
    public void init() {
        lstStatus = new ArrayList<LuStatus>();
        lstStatus.add(new LuStatus("1", "Draft", "DraftLong"));
        lstStatus.add(new LuStatus("2", "Approved", "ApprovedLong"));
    }

    public List<LuStatus> getLstStatus() {
        return lstStatus;
    }

    public void setLstStatus(List<LuStatus> lstStatus) {
        this.lstStatus = lstStatus;
    }

    public void post() {
        System.out.println("returned value " + objLuStatus);
    }

    public LuStatus getObjLuStatus() {
        return objLuStatus;
    }

    public void setObjLuStatus(LuStatus objLuStatus) {
        this.objLuStatus = objLuStatus;
    }

    public List<LuStatus> completeList(String strQuery) {
        return lstStatus;
    }

}

But I am getting below error...
Thanks in advance..
Caused by: java.lang.NullPointerException
    at org.omnifaces.converter.ListConverter.getAsObject(ListConverter.java:39) [omnifaces-1.7.jar:1.7]
    at org.primefaces.component.autocomplete.AutoCompleteRenderer.getConvertedValue(AutoCompleteRenderer.java:600) [primefaces-4.0.jar:4.0]
    at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1046) [jsf-api-2.2.4.jar:2.2]
    at javax.faces.component.UIInput.validate(UIInput.java:976) [jsf-api-2.2.4.jar:2.2]

A: Sorry I overlooked one line of ListConverter documentation.. I missed feeding the ListConverter with the original list like mentioned below.
<o:converter converterId="omnifaces.ListConverter" list="#{mybean.lstStatus}" />

I got this worked by adding above line of code.
Final xhtml is going to look like below..
    <p:autoComplete id="iterator3" value="#{mybean.objLuStatus}" forceSelection="true"
        dropdown="true" var="entity"
        itemLabel="#{entity.strDescColVal}"
        placeholder="----- Select One -----" itemValue="#{entity}"
        completeMethod="#{mybean.completeList}">
        <f:ajax render="selected_status" />
         <o:converter converterId="omnifaces.ListConverter" list="#{mybean.lstStatus}" />
    </p:autoComplete>

Thank you to omnifaces team for providing such a useful utility...

A: I had the same problem. I could not use omnifaces.ListConverter for autocomplete.BalCus could answer that.
But for auto-complete, try the below generic converter.
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.WeakHashMap;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

@FacesConverter(value = "entityConverter")
public class EntityConverter implements Converter {

    private static Map<Object, String> entities = new WeakHashMap<Object, String>();

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object entity) {
        synchronized (entities) {
            if (!entities.containsKey(entity)) {
                String uuid = UUID.randomUUID().toString();
                entities.put(entity, uuid);
                return uuid;
            } else {
                return entities.get(entity);
            }
        }
    }

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String uuid) {
        for (Entry<Object, String> entry : entities.entrySet()) {
            if (entry.getValue().equals(uuid)) {
                return entry.getKey();
            }
        }
        return null;
    }

}


text:
Q: Compute $\oint_{\gamma}f(z)dz$, where $f(z)=\frac {ze^{\pi z}}{z^4-16}+ze^{\frac \pi z}$ where $\gamma:9x^2+y^2=9$ Compute $\oint_{\gamma}f(z)dz$, where $f(z)=\frac {ze^{\pi z}}{z^4-16}+ze^{\frac \pi z}$ where $\gamma:9x^2+y^2=9$ Using the residue theorem.
I don't know how to start this, first I thought about parametrizing this curve as: $x=\frac 13\cos\theta$ and $y=\sin\theta$ but I don't know how this would help me.. any ideas?

A: The curve $\gamma$ (directed counterclockwise) is an ellipse having the poles $\pm2i$ of the first part in its interior, but not the poles $\pm2$. For the first part of the integrand it is therefore sufficient to compute the residues at $\pm2i$, using standard computational methods (no computing of line integrals).
The second part of the integrand has an essential singularity at $0$, but the Laurent expansion
$$z\,e^{\pi/z}=\sum_{k=0}^\infty {\pi^k\over k!}\,z^{1-k}$$
is convergent in the full punctured $z$-plane. The residue at $0$ can then be immediately read off.


text:
Q: Laravel app with nginx on docker-compose behind apache redirects to nginx domain instead of Apache domain I have a ubuntu server that runs a stack of docker-compose that includes nginx as the http-server exposing port 8081 and on the host the apache2 is redirecting site.com requests to site.local:8081.
The laravel app for example redirects to site.local:8081/home after login, instead I want it to redirect to site.com/home. And I don't know exactly that this is gonna be solved through the laravel or nginx;
And also I don't know if the whole structure (Apache to nginx in a docker container) of app is the best it could have been structured or not.
Laravel .env: (omitted lines for simplicity)
APP_URL=https://example.com # (example=site)
ASSET_URL=https://example.com # (example=site)

Laravel AppServiceProvider.php: (omitted lines for simplicity)
    public function boot()
    {
        if (env('SERVER', 'local') === 'online')
            URL::forceScheme('https');

        URL::forceRootUrl(env('APP_URL'));
        URL::formatHostUsing(function(){
            return env('APP_URL');
        });
       .
       .
       .
    }

Laravel LoginController.php: (has omitted lines)
protected function authenticated(Request $request, $user)
    {
        $result = UserLogin::dispatch($user);

        if ($result[0] instanceof RedirectResponse) return $result[0];

        dd(redirect()->intended($this->redirectPath()),$this->redirectPath());
        if ($user->hasRole('newbie') && $user->can('form.upss')) return redirect('/upsss');
        if ($user->hasRole('newbie') && $user->can('form.biz')) return redirect('/auditor');
        else return redirect()->intended($this->redirectPath());
    }

docker-compose.yml: (omitted lines for simplicity)
# Services
services:

    # Nginx Service
    nginx:
        # user: "1000:"
        build: ./.docker/nginx
        ports:
            - 8081:80
        networks:
            default:
                aliases:
                    - site.local
                    - db.site.local
        volumes:
            - ./src/backend:/var/www/backend:ro,delegated
            - ./.docker/nginx/conf.d:/etc/nginx/conf.d:ro
            - phpmyadmindata:/usr/src/phpmyadmin:delegated
            - ./.docker/nginx/certs:/etc/nginx/certs:delegated
        depends_on:
            - backend

    # Backend Service
    backend:
        user: "${UID}:${GID}"
        labels:
            ofelia.enabled: "true"
        build:
            context: ./src/backend
            target: backend
        working_dir: /var/www/backend
        volumes:
            - ./src/backend:/var/www/backend:delegated
            - ./.docker/backend/init.sh:/opt/files/init.sh:delegated,ro
            - ./.docker/nginx/certs:/usr/local/share/ca-certificates:delegated,ro

Nginx backend.conf:
server {
    listen      80;
    listen      [::]:80;
    server_name site.local;
    root        /var/www/backend/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~* \.php$ {
        fastcgi_pass    backend:9000;
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME     $fastcgi_script_name;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

Apache conf:
<VirtualHost *:80>

        ServerName site.com

        ServerAdmin webmaster@localhost

        ErrorLog ${APACHE_LOG_DIR}/site_error.log
        CustomLog ${APACHE_LOG_DIR}/site_access.log combined

        ProxyPass / http://site.local:8081/
        ProxyPassReverse / http://site.local:8081/
        <Proxy *>
                allow from all
        </Proxy>
RewriteEngine on
RewriteCond %{SERVER_NAME} =site.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>

        ServerName site.com

        ServerAdmin webmaster@localhost

        ErrorLog ${APACHE_LOG_DIR}/site_error.log
        CustomLog ${APACHE_LOG_DIR}/site_access.log combined

        ProxyPass / http://site.local:8081/
        ProxyPassReverse / http://site.local:8081/
        <Proxy *>
                allow from all
        </Proxy>
# Include /etc/letsencrypt/options-ssl-apache.conf
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/site.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/site.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>


text:
Q: Count Bold Cells in Google Sheets Script So, I'm not much of a coder to be honest, but I've managed to fumble my way through counting cell background colour, but struggling to get it to work for counting cells where the font is bold. I've detailed my function below, which counts only 6 cells with a bold font style, but there is 13 cells with a bold font style.
function countboldcells() {
  var book = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = book.getActiveSheet();
  var range_input = sheet.getRange("E2:S7");
  var range_output = sheet.getRange("G14");
  var cell_styles = range_input.getFontStyle();
  var count = 0;

 for(var r = 0; r < cell_styles.length; r++) {
    for(var c = 0; c < cell_styles[0].length; c++) {
      if(cell_styles.isBold = true) {
        count = count + 1;
      }
    }
     range_output.setValue(count);
  }

}

A: Your if statement needs to have 3 "=" inside the parentheses
if(cell_styles.isBold === true)

A: getFontWeights() is the method that will return bold or not. Then the easy way to count them would be to flatten the array, filter all of the "bold" elements and get the length of the filtered list
function countboldcells() {
  var book = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = book.getActiveSheet();
  var range_input = sheet.getRange("E2:S7");
  var range_output = sheet.getRange("G14");

  // Get the fontWeights of the range and flatten the array
  var cell_styles = range_input.getFontWeights().join().split(",");

  // Filter out any value that is not "bold"
  var filter_bold = cell_styles.filter(function (e) { return e == "bold" });

  // Set the count
  range_output.setValue(filter_bold.length);

}

A: Here is your code with corrections. Explanations are in the comments.
function countboldcells() {
  var book = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = book.getActiveSheet();
  var range_input = sheet.getRange("E2:S7");
  var range_output = sheet.getRange("G14");
  var cell_styles = range_input.getFontWeights(); // getFontStyle can only return 'italic' or 'normal'
  var count = 0;

  for(var r = 0; r < cell_styles.length; r++) {
    for(var c = 0; c < cell_styles[0].length; c++) { // isBold is a method for Google Documents only (not sheets)
      if(cell_styles[r][c] === "bold") { // you need at least two '=' signs // also include the index of cell_styles
        count = count + 1; // count += 1 would also work
      }
    }
  }
  range_output.setValue(count); // make sure you setValue only when booth loops are done.
}


text:
Q: Rewrite max using two and statements Say I want to rewrite A <= MAX (B, 100) using only AND statements and substractions. <= means smaller or equal. A and B are variables. Is it possible?
I can't seem to use OR's using the Microsoft Solver foundation in this contrived example, which is a simplification of a problem I have at work :
Decision x = new Decision(Domain.Real, "x");
            model.AddDecisions(x);
        Decision y = new Decision(Domain.Real, "y");
        model.AddDecisions(y);

        // Add a constraint
        // x <= MAX(y,200);
        model.AddConstraints("zero", x + Math.Sin(44) == 33.2);
        model.AddConstraints("one", y + x == 5);
        model.AddConstraints("three", x <= -y);
        model.AddConstraints("four", x <= 200);
        // Solve the problem
        context.Solve();

        // Display the results
        Console.WriteLine("x: {0}", x);
        Console.WriteLine("y: {0}", y);

A: Um, whats wrong with "NOT (A > MAX (B, 100))"?

Since MAX is not allowed, then try "NOT (x > a) And NOT (x > 100)".

A: Would this work:

*

*A) Assume that B <= 100, solve for A and B. If A > 100 or B > 100, then this answer is crap.

*B) Assume that B >= 100, solve for A and B. If B < 100, then the answer is crap.

*C) Assert that you A) and B) do not both give the answer.

*D) Write dozens of unit tests (or feed it an XML, etc). If an assert is ever raised, then pause and examine what is going on.

?

A: Is B non-negative?  Then MAX is the infinity-norm, since you're allowed multiplication you can approximate this:
A*A*A*A*A*A <= B*B*B*B*B*B + 100*100*100*100*100*100

If the six-norm isn't a good enough approximation for the infinity-norm, add more terms.
Also, the linked solution can be adapted, and MIP is not even necessary:
A <= B + M1
A <= 100 + M2
M1*M2 <= 0


text:
Q: Using DISTINCT, COUNT AND SUBSTRING in a statement I have a id column below

I want to count the 3 unique char in the column starting from 3 on the right. So I did this: SELECT SUBSTRING(id,3,3) FROM lhr and I get this result:

Now how do I count the total in the id column such as A00 = 7 and A90 = 1? I try Count As such as this : SELECT SUBSTRING(id,3,3), COUNT(*) AS 'total' FROM lhr
but it did not worked. I don't get the result i wanted. The result I get is total = 8. Help me please and thanks in advance.

A: select mydata, count(*) from
(SELECT SUBSTRING(id,3,3) as mydata FROM lhr) a
group by mydata

That should do it for you.
Better method:
select substring(id,3,3), count(*)
from 1hr
group by substring(id,3,3)


text:
Q: How to rectify the gap between line numbers and code in WebStorm How to rectify the gap between line numbers and code in web storm
There is a huge gap between the line numbers and the code in webstorm Ide. The theme that I am using is Material Theme-darker


text:
Q: imageView.setVisibility(View.GONE); not working for ImageView
*

*I am trying to implement imageView.setVisibility(View.GONE); if my URL is null then the visibility of the imageView should ne GONE or else it should be VISIBLE.

*In my XML I have defined it as android:visibility="gone" and if the URL is not null then I am displaying the image.

*The issue here is, it displays the image when it contains the url. But when the url is null it is giving the empty space.

*XML

<ImageView
            android:id = "@+id/imageView"
            android:layout_width="200dp"
            android:layout_height="300dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginBottom="10dp"
            android:layout_gravity="center"
            android:visibility="gone"
            android:src="@drawable/rectanglebutton"/>

*

*Java

url = list.get(position).getImageUrl();
            if(url == "null") {
                imageView.setVisibility(View.GONE);
                imageView.requestLayout();
            }
            else
            {
                imageView.setVisibility(View.VISIBLE);
                imageView.requestLayout();
                Glide
                        .with(DisplayQuestions.this)
                        .load(url)
                        .into(imageView);
            }

A: the problem seems to be in the java code.
try changing
if (url == "null")

to
if (url == null)

*

*null should not be in doubble quotes.

*and generally you should use "some_string".equals(object) to test strings.

A: Try to check url string if its empty
if(url.getText().toString().isEmpty()){
   imageView.setVisibility(View.GONE);
   imageView.requestLayout();
}

A: url = list.get(position).getImageUrl();
            if(url == null) {
                imageView.setVisibility(View.GONE);
                imageView.requestLayout();
            }
            else
            {
                imageView.setVisibility(View.VISIBLE);
                imageView.requestLayout();
                Glide
                        .with(DisplayQuestions.this)
                        .load(url)
                        .into(imageView);
            }

null should not be inside double quote


text:
Q: First picker row selection changes second picker row Ive picked up some code form another developer which im trying to put right.  One of the problems is:
I have 2 pickers that fill a text box with selected row from a picker.
If picker 1 (named: Type) is selected,  the row selected ..say row 3, defaults to that row on my next picker (named: FlueType) when the picker is presented.
How can I get the second picker not be affected by the first pickers row selection?
Ive looked at [picker reloadComponent:0]; I've looked on stack and google and cant seem to find anything that fits this problem.
Ive also tried [picker selectRow:0 inComponent:0 animated:NO] in the ViewDidLoad method hoping that it would set all my pickers to the first row value which is all im trying to do.
Apologies for the mountain of code, I've tried to separate it out into context
      /////////////////////picker action////////////////////////

      -(void)flueTypeBtnClicked//:(id)sender
       {

   [flueTypeBtn.titleLabel setTextColor:[UIColor blackColor]];

currentSelectedIndex = flueTypeBtn.tag;
[makeTxt resignFirstResponder];
[modelTxt resignFirstResponder];
[locationTxt resignFirstResponder];
[oprPressureMBarTxt resignFirstResponder];

[picker setHidden:NO];
[picker reloadComponent:0];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
self.ToolsView.frame = CGRectMake(0, 200, 320, 260);

extern GasCertificateAppViewController *viewController;
[viewController.view addSubview:self.ToolsView];

[UIView commitAnimations];
   }

 -(void)typeBtnClicked//:(id)sender
 {

 [typeBtn.titleLabel setTextColor:[UIColor blackColor]];

currentSelectedIndex = typeBtn.tag;
[makeTxt resignFirstResponder];
[modelTxt resignFirstResponder];
[locationTxt resignFirstResponder];
[oprPressureMBarTxt resignFirstResponder];

[picker setHidden:NO];
[picker reloadComponent:0];

//NSLog(@"In type btn Clicked:");
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
self.ToolsView.frame = CGRectMake(0, 200, 320, 260);
extern GasCertificateAppViewController *viewController;
[viewController.view addSubview:self.ToolsView];

    [UIView commitAnimations];

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////more code here///////////////////////

  - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
 {

if (textField.tag == 1 )
{
    [self typeBtnClicked];
    return NO;
}
else if(textField.tag == 3)
{
    [self flueTypeBtnClicked];
    return NO;
}

CGPoint offset = CGPointMake(0, textField.frame.origin.y - textField.frame.size.height);
[self.screenScrollView setContentOffset: offset animated: YES];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];

self.ToolsView.frame = CGRectMake(0, 200, 320, 260);
extern GasCertificateAppViewController *viewController;
[viewController.view addSubview:self.ToolsView];

[UIView commitAnimations];
    return YES;
   }

      //////////////

   -(void) fillData
  {
extern Survey *survey;
ApplianceTest *test = [survey.applianceTestArray objectAtIndex:testId];

if(test.type != nil)
    [self.typeTxt setText:test.type];
   // [self.typeBtn setTitle:test.type forState:UIControlStateNormal];
if(test.make != nil)
    [self.makeTxt setText:test.make];
if(test.model != nil)
    [self.modelTxt setText:test.model];
if(test.location != nil)
    [self.locationTxt setText:test.location];
if(test.flue_type != nil)
    [self.flueTypeTxt setText:test.flue_type];
    //[self.flueTypeBtn setTitle:test.flue_type forState:UIControlStateNormal];    if(test.operating_pressure_mbar_or_heat_input_kwh != nil)
    [self.oprPressureMBarTxt setText:test.operating_pressure_mbar_or_heat_input_kwh];

if([test.safety_device_correct isEqualToString:@"Yes"])
    [self.segtCtrl setSelectedSegmentIndex:0];
else
    if([test.safety_device_correct isEqualToString:@"No"])
        [self.segtCtrl setSelectedSegmentIndex:1];
        else
            [self.segtCtrl setSelectedSegmentIndex:2];

    }
   -(IBAction)bgTouched:(id)sender
     {

CGPoint offset = CGPointMake(0, 0);
[self.screenScrollView setContentOffset: offset animated: YES];[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];

self.ToolsView.frame = CGRectMake(0, 500, 320,260);
//[self.ToolsView removeFromSuperview];

//self.view.frame = CGRectMake(0, 0, 320,  372 );

[makeTxt resignFirstResponder];
[modelTxt resignFirstResponder];
[locationTxt resignFirstResponder];
[oprPressureMBarTxt resignFirstResponder];

[UIView commitAnimations];
 }
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////

   - (void)viewDidLoad {
   [super viewDidLoad];

//segment control selected Index = 2;

segtCtrl.selectedSegmentIndex = 2;

navigationTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, 0, 200, 25)];
navigationTitleLabel.textAlignment = UITextAlignmentCenter;
navigationTitleLabel.font= [UIFont fontWithName:@"Futura" size:18];
navigationTitleLabel.backgroundColor = [UIColor clearColor];
navigationTitleLabel.textColor = [UIColor whiteColor];
navigationTitleLabel.text = @"Appliance Test 1/3";

self.navigationItem.titleView = navigationTitleLabel;

self.screenScrollView.frame = CGRectMake(0, 0, 320, 370);
self.screenScrollView.contentSize = CGSizeMake(320, 600 + 200);
self.screenScrollView.clipsToBounds = YES;
self.screenScrollView.showsVerticalScrollIndicator = NO;
[self.view addSubview:self.screenScrollView];

testId = [testIdStr intValue];
currentSelectedIndex = 0;

typeArray = [[NSMutableArray alloc] init];
[typeArray addObject:@""]; ///change
[typeArray addObject:@"Boiler"];
[typeArray addObject:@"Cooker"];
[typeArray addObject:@"Fire"];
[typeArray addObject:@"Hob"]; ///change to hob

currentSelectedIndex = 0;
flueTypeArray = [[NSMutableArray alloc] init];
[flueTypeArray addObject:@""]; //change
[flueTypeArray addObject:@"OF"];
[flueTypeArray addObject:@"RS"];
[flueTypeArray addObject:@"FL"];

unitArray = [[NSMutableArray alloc] initWithObjects:@"MBar",@"KW/h",nil];
//self.navigationItem.title = @"Appliance Test 1/3";

//[typeTableView setHidden:YES];
//[flueTypeTableView setHidden:YES];

[segtCtrl setSelectedSegmentIndex:2];

extern Survey *survey;

    [self fillData];
[picker setHidden:YES];
self.ToolsView.frame = CGRectMake(0, 500, 320, 260);

  /////////////////

    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
    {
return 1;
    }

  - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:    (NSInteger)component
   {
if (currentSelectedIndex == 1)
{
    return [typeArray count];
}
else if(currentSelectedIndex == 3)
{
    return [flueTypeArray count];
}
else if(currentSelectedIndex == 7)
{
    return [unitArray count];
}
else
{
    return 1;
}
   }

  - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row   forComponent:(NSInteger)component
    {
if (currentSelectedIndex == 1)
{
    if ([typeArray count] == 0)
    {
        return [NSString stringWithFormat: @"None"];

    }
    else
    {
    return [typeArray objectAtIndex:row];
    }
}
else if(currentSelectedIndex == 3)
{
    if ([flueTypeArray count] == 0)
    {
        return [NSString stringWithFormat: @"None"];

    }
else {

        return [flueTypeArray objectAtIndex:row];
    }
}
else if(currentSelectedIndex == 7)
{
    if ([unitArray count] == 0)
    {
        return [NSString stringWithFormat: @"None"];

    }
    else
    {
        return [unitArray objectAtIndex:row];
    }
}
 return @"";

 }
 - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
 {
//      [gasSafeNoBtn setTitle:[NSString stringWithFormat:@"%d",[(NSNumber *) [gasSafeNoArray objectAtIndex:row]intValue]] forState:UIControlStateNormal];
extern Survey *survey;
if (currentSelectedIndex==1)
{
    //typeTxt.text = [typeArray objectAtIndex:row];
    [typeBtn.titleLabel setTextColor:[UIColor blackColor]];
    [typeBtn setTitle:[typeArray objectAtIndex:row] forState:UIControlStateNormal];
    typeTxt.text  =[typeArray objectAtIndex:row] ;
}
else if(currentSelectedIndex == 3)
{
    //flueTypeTxt.text = [flueTypeArray objectAtIndex:row];
    [flueTypeBtn.titleLabel setTextColor:[UIColor blackColor]];

    [flueTypeBtn setTitle:[flueTypeArray objectAtIndex:row] forState:UIControlStateNormal];
    flueTypeTxt.text= [flueTypeArray objectAtIndex:row];
}
else if(currentSelectedIndex == 7)
{
    unitString = [[NSString alloc] initWithString:[unitArray objectAtIndex:row]];
//  NSLog(@"Unit String : %@", unitString);
    [unitBtn setTitle:[unitArray objectAtIndex:row] forState:UIControlStateNormal];
}
else {

}

 }

 - (void)dealloc {
[unitArray release];
[ToolsView release];
[toolBar release];
[nextBtn release];
[prevBtn release];
[doneBtn release];
[picker release];
    [super dealloc];

   }

   @end

A: Ok sorted....added
[picker selectRow:0 inComponent:0 animated:NO];
to the button action method presenting the picker


text:
Q: populating a numpy ndarray of an arbitrary shape (preferably without using for loops) Consider a NumPy ndarray A of floats, with a dimension of n and an arbitrary shape of D=[d1,...,dn] (dis are nonnegative integers). How can I populate A to have for example:
A[j1,...,jn]=sqrt(j1*...*jn)

where 0<=ji<=di. If I knew n and it was fixed then I could nest n for loops to simply populate the ndarray. however in my program that's not the case, apart from the fact that will not be efficient. I was wondering if there is any way to

*

*populate the ndarray A of the given arbitrary shape D (for example with the formula above or any other nonthrivial function of the indices).

*preferably avoid using python for loops and take advantage of NumPy's underlying functionality.

Thanks for your help in advance.

A: One important fact to realize is that you can use broadcasting to solve this problem efficiently. So for the 2D case you could do
d1, d2 = (3, 4)
A = numpy.sqrt(numpy.arange(d1)[:, None] * numpy.arange(d2)[None, :])
# array([[0.        , 0.        , 0.        , 0.        ],
#        [0.        , 1.        , 1.41421356, 1.73205081],
#        [0.        , 1.41421356, 2.        , 2.44948974]])

Once you feel comfortable with using broadcasting to do these outer products (or sums, or comparisons etc.) we can try to solve this for the nD case.
Looking at the input arrays of the above code we realize they have shapes
(d1,  1)
( 1, d2)

So to do this in nD we need to find a method that takes linear index arrays and automatically creates arrays of shapes
(d1,  1,  1, ...)
( 1, d2,  1, ...)
( 1,  1, d3, ...)

Numpy offers such a function: numpy.meshgrid(..., sparse=True)
numpy.meshgrid(numpy.arange(3), numpy.arange(4), sparse=True)

Knowing this we can put it all together in one line:
D = (3, 4, 5)
numpy.sqrt(numpy.prod(numpy.meshgrid(*[numpy.arange(d) for d in D], sparse=True, indexing='ij')))
# array([[[0.        , 0.        , 0.        , 0.        , 0.        ],
#         [0.        , 0.        , 0.        , 0.        , 0.        ],
#         [0.        , 0.        , 0.        , 0.        , 0.        ]],
#
#        [[0.        , 0.        , 0.        , 0.        , 0.        ],
#         [0.        , 1.        , 1.41421356, 1.73205081, 2.        ],
#         [0.        , 1.41421356, 2.        , 2.44948974, 2.82842712]],
#
#        [[0.        , 0.        , 0.        , 0.        , 0.        ],
#         [0.        , 1.41421356, 2.        , 2.44948974, 2.82842712],
#         [0.        , 2.        , 2.82842712, 3.46410162, 4.        ]],
#
#        [[0.        , 0.        , 0.        , 0.        , 0.        ],
#         [0.        , 1.73205081, 2.44948974, 3.        , 3.46410162],
#         [0.        , 2.44948974, 3.46410162, 4.24264069, 4.89897949]]])

Performance evaluation
To evaluate the performance of all three solutions, let's time their speed for several different tensor sizes:
D=(2,3,4,5)

%timeit np.fromfunction(function=myfunc2, shape=D)
# 501 µs ± 9.34 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
%timeit np.fromfunction(function=creation_function, shape=D)
# 24.2 µs ± 455 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
%timeit numpy.sqrt(numpy.prod(numpy.meshgrid(*[numpy.arange(d) for d in D], sparse=True, indexing='ij')))
# 30.9 µs ± 1.02 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)

D=(20,30,40,50)

%timeit np.fromfunction(function=myfunc2, shape=D)
# 4.64 s ± 36.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%timeit np.fromfunction(function=creation_function, shape=D)
# 36.7 ms ± 1.17 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
%timeit numpy.sqrt(numpy.prod(numpy.meshgrid(*[numpy.arange(d) for d in D], sparse=True, indexing='ij')))
# 9 ms ± 237 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

D=(200,30,40,50)

%timeit np.fromfunction(function=myfunc2, shape=D)
# never completed
%timeit np.fromfunction(function=creation_function, shape=D)
# 508 ms ± 7.41 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%timeit numpy.sqrt(numpy.prod(numpy.meshgrid(*[numpy.arange(d) for d in D], sparse=True, indexing='ij')))
# 88.1 ms ± 1.63 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

D=(200,300,40,50)

%timeit np.fromfunction(function=myfunc2, shape=D)
# never completed
%timeit np.fromfunction(function=creation_function, shape=D)
# 5.8 s ± 565 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
%timeit numpy.sqrt(numpy.prod(numpy.meshgrid(*[numpy.arange(d) for d in D], sparse=True, indexing='ij')))
# 1.29 s ± 15.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

A: A modified version of ibarronds solution without using labmda and works with higher dimensions above 3:
import numpy as np

def myfunc(*J):
    return np.sqrt(np.prod(np.array(J)))
myfunc2=np.vectorize(myfunc)

D=(2,3,4,5)

np.fromfunction(function=myfunc2 , shape=D)

P.S. Unfortunately he has removed his answer so I copy it here for reference:
creation_function = lambda *args: np.sqrt(np.prod(np.array([*args]), axis=0))
np.fromfunction(function=creation_function, shape=D)


text:
Q: UVa #112 Tree Summing I'm working on UVa #112 Tree Summing. I have what I think should be a working solution but it is not accepted by the online judge due to a basic misunderstanding of the problem on my part. Consider the following inputs:
-1 (-1()())
77 (77(1()())())

or diagrammatically, the trees look like:
  -1              77
 /   \           /  \
()    ()        1    ()
               / \
              ()  ()

According to at least two working solutions, the correct output for the above inputs is:
yes
no

However, I don't understand why the second one should be 'no'. It looks to me like the rightmost path of the tree should give the proper sum. What am I missing?

A: Easy.
The tree:
(77(1()())())

A leaf is of this form: (integer () ())
Thus the tree has only one leaf: (1 () ())
The sum of the nodes to this leaf is 78. 78 is not 77. Result: no.
What you think is a rightmost path, is none according to the definition.
The first tree:
(-1()())

It is just a single leaf node. One path. The sum is -1. -1 = -1. Result: yes.
We can check it with a Lisp program:
(defun leaf-p (node)
  "is the node a leaf?"
  (and (= (length node) 3)
       (integerp (first node))
       (null (second node))
       (null (third node))))

(defun path-sums (tree)
  "returns a list of all sums for each path"
  (if (leaf-p tree)
      (list (first tree))
    (mapcar (lambda (s)
              (+ (first tree) s))
            (append (when (second tree)
                      (path-sums (second tree)))
                    (when (third tree)
                      (path-sums (third tree)))))))

(defun tree-sum-p (sum tree)
  (member sum (path-sums tree)))

CL-USER 223 > (path-sums '(-1()()))
(-1)

CL-USER 224 > (path-sums '(77(1()())()))
(78)


text:
Q: How to intercept message from Chatbot in a React component ? (Microsoft botframework-webchat) I have to run a soundtrack (mp3 file) according to the reply given by Chatbot. So I need to identify the reply that comes from chatbot from my React component (or using pure JS). How can I do that?

A: You can quickly found what you are looking for by searching the Webchat repository on Github.
If you search incoming you will go to these lines which may be interesting for your needs:
private handleIncomingActivity(activity: Activity) {
    let state = this.store.getState();
    switch (activity.type) {
        case "message":
            this.store.dispatch<ChatActions>({ type: activity.from.id === state.connection.user.id ? 'Receive_Sent_Message' : 'Receive_Message', activity });
            break;

        case "typing":
            if (activity.from.id !== state.connection.user.id)
                this.store.dispatch<ChatActions>({ type: 'Show_Typing', activity });
            break;
    }
}

A: Thank you @Nicolas R. I changed that handleIncomingActivity() function as follows and send the activity.text value in to my chatbot react component as sending data from child(Chat.js) to parent(My react component) using callbacks. Here giveTextForBot() is a callback function which is given to react chatbot component as a prop.
Chat.prototype.handleIncomingActivity = function (activity) {
        var state = this.store.getState();
        switch (activity.type) {
            case "message":
                this.store.dispatch({ type: activity.from.id === state.connection.user.id ? 'Receive_Sent_Message' :'Receive_Message' , activity: activity });
                if(activity.from.id === "<appName>"){
                    this.props.giveTextForBot(activity.text);
                   }
            break;
            case "typing":
                if (activity.from.id !== state.connection.user.id)
                    this.store.dispatch({ type: 'Show_Typing', activity:activity });
                break;
        }
};


text:
Q: How do I fix the report viewer error in Visual Studio 2019? Error:

An error occurred during local report processing.
The definition of the report 'Include\Impresiones\Rport.rdlc' is invalid.
The definition of this report is not valid or supported by this version of Reporting Services.
The report definition may have been created with a later version of Reporting Services, or contain content that is not well-formed or not valid based on Reporting Services schemas.
Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition' which cannot be upgraded.

When I had VS2012 I could edit it without problem but now I updated to VS2019 and when I edited a report and I wanted to show it in the report viewer I get that error, how do I solve it?
In my web.config I have:
<system.web>
    <httpHandlers>
        <add path="Reserved.ReportViewerWebControl.axd" verb="*"
             type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false"/>
    </httpHandlers>
    <compilation debug="true" targetFramework="4.5">
        <assemblies>
            <!--<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>-->
            <add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
            <add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
            <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        </assemblies>
        <buildProviders>
            <!--<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        </buildProviders>
    </compilation>
    <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
        <controls>
            <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
        </controls>
    </pages>
</system.web>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
        <!--<add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler" resourceType="Unspecified" />-->
        <!--<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
        <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
    </handlers>
</system.webServer>

A: Upgrade Microsoft Reports to support Visual Studio 2019 / 2022
Run through the following steps to upgrade a project using Microsoft Report Viewer Runtimes 9-13 to Sql Server Reporting Services 14 or 15.

*

*Backup Visual Studio solution

*Check Microsoft Report Designer is installed for Visual Studio 2019 (min version 15.3.1) or Visual Studio 2022 (min version 17.0.0)

*Uninstall or manually remove the following assembly references (any versions: 9.0.0.0, 10.0.0.0, 11.0.0.0, 13.0.0.0) from project

*

*Microsoft.ReportViewer.WebForms

*Microsoft.ReportViewer.Common

*Install Microsoft.ReportingServices.ReportViewerControl.WebForms OR Microsoft.ReportingServices.ReportViewerControl.Winforms which includes both updated dll's

ASP.NET - For Target Runtime .NET 4.5.2 (14.0.0.0)
Install-Package Microsoft.ReportingServices.ReportViewerControl.WebForms -Version 140.1000.523

ASP.NET - For Target Runtime .NET 4.6 and above (15.0.0.0)
Install-Package Microsoft.ReportingServices.ReportViewerControl.WebForms -Version 150.1537.0

WinForms - For Target Runtime .NET 4.5.2 (14.0.0.0)
Install-Package Microsoft.ReportingServices.ReportViewerControl.Winforms -Version 140.1000.523

WinForms - For Target Runtime .NET 4.6 and above (15.0.0.0)
Install-Package Microsoft.ReportingServices.ReportViewerControl.Winforms -Version 150.1537.0

This will install the following assemblies to the project...

*

*Microsoft.ReportViewer.Common.dll

*Microsoft.ReportViewer.DataVisualization.dll

*Microsoft.ReportViewer.Design.dll

*Microsoft.ReportViewer.ProcessingObjectModel.dll

*Microsoft.ReportViewer.WebDesign.dll

*Microsoft.ReportViewer.WebForms.dll

*Microsoft.ReportViewer.WinForms.dll

*In ASP.NET - The App_Code folder will have new SqlServerTypes directory containing  Loader.cs.
and include package Microsoft.SqlServer.Types.14.0.314.76
This folder will also appear in any Library project the package is also installed in.
        \SqlServerTypes\
        - Loader.cs or Loader.vb
        - readme.htm

        \SqlServerTypes\x64\
        - msvcr120.dll
        - SqlServerSpatial140.dll

        \SqlServerTypes\x86\
        - msvcr120.dll
        - SqlServerSpatial140.dll

*If the App_Code directory is configured for VB.NET, a new VB class should be added called Loader.vb and the autogenerated Loader.cs can be removed from App_Code\SqlServerTypes.
    Imports System
    Imports System.IO
    Imports System.Runtime.InteropServices

    Namespace SqlServerTypes
        Public Class Utilities

            <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
            Public Shared Function LoadLibrary(ByVal libname As String) As IntPtr

            End Function

            Public Shared Sub LoadNativeAssemblies(ByVal rootApplicationPath As String)
                Dim nativeBinaryPath = If(IntPtr.Size > 4, Path.Combine(rootApplicationPath, "SqlServerTypes\x64\"), Path.Combine(rootApplicationPath, "SqlServerTypes\x86\"))
                LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll")
                LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll")
            End Sub

            Private Shared Sub LoadNativeAssembly(ByVal nativeBinaryPath As String, ByVal assemblyName As String)
                Dim path = System.IO.Path.Combine(nativeBinaryPath, assemblyName)
                Dim ptr = LoadLibrary(path)

                If ptr = IntPtr.Zero Then
                    Throw New Exception(String.Format("Error loading {0} (ErrorCode: {1})", assemblyName, Marshal.GetLastWin32Error()))
                End If
            End Sub
        End Class
    End Namespace

*Configuration
In ASP.NET update the web config for Target .NET 4.5.2 (Reporting Services 14.0.0.0)
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5.2">
      <assemblies>
        <!-- All assemblies updated to version 14.0.0.0. -->
        <add assembly="Microsoft.ReportViewer.Common, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.DataVisualization, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.Design, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.WebDesign, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.WinForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
      </assemblies>
      <buildProviders>
        <!-- Version updated to 14.0.0.0. -->
        <add extension=".rdlc"
          type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
      </buildProviders>
    </compilation>
    <httpRuntime targetFramework="4.5.2"/>
    <httpHandlers>
      <!-- Version updated to 14.0.0.0 -->
      <add path="Reserved.ReportViewerWebControl.axd" verb="*"
        type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"
        validate="false"/>
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <!-- Version updated to 14.0.0.0 -->
      <add name="ReportViewerWebControlHandler" verb="*" path="Reserved.ReportViewerWebControl.axd" preCondition="integratedMode"
        type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
      <bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Or Update Web config for Target .NET 4.6 and above (Reporting Services 15.0.0.0)
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.6">
      <assemblies>
        <!-- All assemblies updated to version 15.0.0.0. -->
        <add assembly="Microsoft.ReportViewer.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.DataVisualization, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.Design, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.WebDesign, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
        <add assembly="Microsoft.ReportViewer.WinForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
      </assemblies>
      <buildProviders>
        <!-- Version updated to 15.0.0.0. -->
        <add extension=".rdlc"
          type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
      </buildProviders>
    </compilation>
    <httpRuntime targetFramework="4.6"/>
    <httpHandlers>
      <!-- Version updated to 15.0.0.0 -->
      <add path="Reserved.ReportViewerWebControl.axd" verb="*"
        type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"
        validate="false"/>
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <!-- Version updated to 15.0.0.0 -->
      <add name="ReportViewerWebControlHandler" verb="*" path="Reserved.ReportViewerWebControl.axd" preCondition="integratedMode"
        type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
      <bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

*Build the solution and confirm the whole project compiles.

*Upgrade the reports to support the Visual Studio IDE if created in an older version of Visual Studio Report Designer.
Double click the report in Visual Studio and convert when prompted "Do you want to convert this Report". This will automatically update the XML to the current supported schema.

When the report has been upgraded, you must click Save to finalise the changes to the report file. A backup copy is automatically made of the original file and a new file is created in it's place.
Then when the report is viewed in an XML editor the following schema definition changes will have been made by the conversion tool.
On a report without report parameters
From: VS2013
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
            xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition"
            xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">

To: VS2019 / VS2022
        <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition"
                xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

What a Default New VS2019 / VS2022 report uses
        <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
                xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

On a report with report parameters
From: VS2013
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
            xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition"
            xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">

To: VS2019 / VS2022
    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition"
            xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

The conversion tool adds a ReportParametersLayout block if report has ReportParameters element. For example;
      <ReportParametersLayout>
        <GridLayoutDefinition>
          <NumberOfColumns>1</NumberOfColumns>
          <NumberOfRows>1</NumberOfRows>
          <CellDefinitions>
            <CellDefinition>
              <ColumnIndex>0</ColumnIndex>
              <RowIndex>0</RowIndex>
              <ParameterName>Test</ParameterName>
            </CellDefinition>
          </CellDefinitions>
        </GridLayoutDefinition>
      </ReportParametersLayout>

If you click Cancel when prompted to convert the report, there is an option to manually Edit the schema.
It is possible to Edit the xml schema and downgrade the supported specification to allow the report to load in the current version of Visual Studio Report Designer.

Downgrade report from 2016 or 2010 to 2008 schema definition
If the Report was created in a newer unsupported version of the current Report Designer the upgrade will fail. The Report will need to be downgraded for the file to open in Visual Studio 2019.
Please try the following XML markup changes only if the automatic upgrade failed;
From: 2016 schema
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition"
        xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

From: 2016 schema including default font family
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition"
        xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"
        xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily"
        MustUnderstand="df">

From: 2010 schema
    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition"
            xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

To: 2008 schema
    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
            xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

Then Downgrade the SSRS report by removing elements that are not used in the 2008 schema.
Remove the tag ReportSections but not any child elements for it
<ReportSections></ReportSections>

Remove the tag ReportSection but not any child elements for it
<ReportSection></ReportSection>

Remove the element ReportParametersLayout and all child elements (including GridLayoutDefinition)
<ReportParametersLayout></ReportParametersLayout>

If the report contains the default font attribute "df" remove the following also...
Remove the Report MustUnderstand="df" attribute if it has one.
Remove the Report xmlns:df attribute if it has one.
Remove the element df and all child elements if it has one.

*For WinForms - Include file in output directory

If the project is WinForms, to include the report in the output directory right click on the Report file and click Properties.
Change the file Properties Copy To Output Directory to "Copy if newer" and Save project.

*Finally: Build and Test

Once all changes have been saved, build the solution to confirm the project is correctly compiling using the SQL Server Reporting Services runtimes and then test processing an SSRS Local Report using your custom code.
Setting up SQL Server native assemblies for spatial data types

ASP.NET applications For ASP.NET applications, add the following line
of code to the Application_Start method in Global.asax.cs:
SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
Desktop applications For desktop applications, add the following line
of code to run before any spatial operations are performed:
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);

Report Viewer Control Versions

*

*8.0 (2005) - 8.0.50727.42 - Visual Studio 2005

*9.0 (2008)   - 9.0.30729.1  - Visual Studio 2008

*10.0 (2010)  - 10.0.40219.1 - Visual Studio 2010

*11.0 (2012)  - 11.1.3452.0  - Visual Studio 2012/2013

*12.0 (2014) for SQL Server 2014 - 12.0.2000.8 - SQL Server 2014

*12.0 (2015 Report Viewer or using SSDT)  - 12.0.2402.15 - Visual Studio 2015 (SSDT)

*13.0 for SQL Server 2016 (NuGet) - 13.0.1700.305 - SQL Server 2016

*13.0 for SQL Server 2016 - 13.0.x.x  - SQL Server 2016 Feature Pack

*14.0 (NuGet) - 14.0.1016.229 - Visual Studio 2017

*14.0 (2017 SSDT) - 14.0.x.x - Visual Studio 2017 (SSDT)

*15.0 (NuGet) - 15.0.1537.0 - Visual Studio 2017/2019/2022

*15.0 (2017/2019 Report Designer Extension) - 15.0.1322.137 - VS 2017/2019 Report Designer

*15.0 (2022 Report Designer Extension) - 15.0.1509.0  - VS 2022 Report Designer


text:
Q: python script working when run in cmd but not when run from file I have a module installed in to my python. I try to run it from CMD and it works but when I run a file with the exact same commands it doesn't work. any ideas?

The top row is when I run the file and the file
The bottom row is when I run the command and the program that runs.
any ideas?
UPDATE
doesn't work also when moved to the same dir:

UPDATE 2
Also when I change the file name I get a traceback blaming a drive which doesnt exist (E)
F:\>python env.py
Traceback (most recent call last):
    File "env.py", line 1, in <module>
         import Envyronment.GUI.welcome
    File "E:\Envyronment.py", line 1, in <module>
ImportError: No module named GUI.welcome

UPDATE 3
when I run the code via pycharm I get the following error:
  File "F:/env.py", line 1, in <module>
    import Envyronment.GUI.welcome
ImportError: bad magic number in 'Envyronment': b'\x03\xf3\r\n'

A: The problem is that your script has the same name as the module that you want to import. In the working case, you run python in C:\Users\Isaac\Desktop and then import. Python finds the Envyronment module and everyone is happy.
In the non-working case, you change directories to C:\Users\Isaac and run a script called Envyronment.py. When you import a module, python (quite unfortunately IMHO) checks your local directory for the module before moving on to other python paths. It finds your Envyronment.py script and re-imports it instead of the system script.
You can test this by changing your code to
import os
import Envyronment
print(os.path.abspath(Envyronment.__file__)

The solution is to rename your script. Scripts should not be named the same as modules they want to import.

A: in the upper window, you are in the "Desktop" directory.  In the lower window, you are in your home directory.

A: Try to put the lib in the same folder of the script and it should work


text:
Q: Window.location.href Set no-follow Newbie Question:
$(document).ready(function(){
    $("#phone").click(function(){
        window.location.href = window.location.href + "&set=phone";
    });
});

I want to set this to nofollow. I dont' want google to index the link that says &set=phone. How would I do it ?

A: If you don't want Google to index a URL, then mention it in robots.txt or include a <meta name="robots" content="noindex"> in it.
The nofollow relationship only applies to links (and your JavaScript is not a link) and doesn't mean "Don't index this" anyway (it means "this link is not an endorsement").

The use of the word "set" implies that you are sending the server an instruction to store some data. This would make it a non-idempotent request and you should not use GET for it. If that is the case, then submit a form with the POST method instead of assigning a value to location.href. Google won't submit such forms.


text:
Q: Excel - SUM to the end of the list I have a database-like table in Excel 2003, with a single header row containing AutoFilters in row 6, and data from row 7 to -say- row 160. Rows 1 - 5 are the sheet title, column group titles and instructions I cannot get rid of.
I also display the SUM(X6:X160) and SUBTOTAL(109,X6:X160) in this area for numeric columns. I don't want to display this at the bottom of the table because several users add rows to that table frequently and they destroyed the formulas on a regular basis.
Problem: whenever a user adds data to the end of the table, one would need to update the SUM and SUBTOTAL formulas to expand the range which - needless to say - is mostly forgotten.
I could myself extend the formulas to cover all rows up to -say- row 500 and hide the remaining rows, so a user would need to "insert" rows when the visible end of the table is reached - which in turn would update the formulas, but I don't regard this as a very safe way ... knowing my users.
Question: Is there a way to create SUM and SUBTOTAL from X6 "to the end of column X wherever that is"?
CONCLUSION
I used SUM(OFFSET(....)), taking the "height" parameter from a new field in the header that displays the "number of records" by a =COUNTA($A:$A)-1 (-1 for the column heading text that is counted as well), as it is clear from the business context that a key value must exist in column A for any valid data record and no blank rows are allowed (I can train users that much at least) - plus the user benefit of not only seeing the SUM but now as well the COUNT of records in the header frozen pane.

A: Using Offset() and Count() seems to be the most popular, and I'm sure the most efficient, to use.
=SUM(OFFSET($X$6,0,0,COUNT($X$6:$X$1000)))

Personally, I tend to use Indirect() a lot for things.  It will probably run slower but it works.  It helps me to see the range that is being created.  Careful though, since part of the range is held in text, it will not update when you move the formula around.  That can trip you up.  Here you are anyway.
=SUM(INDIRECT("$X$6:$X$" & COUNT($X$6:$X$1000)))

You can use the dynamic ranges that iDevlop points out or put the Offset() or Indirect() inside the Sum() like I just did.
Either way you want to be careful because Indirect() and Offset() are Volatile Functions.  Which generally you want to avoid.
I also found this guy, who uses Index() and Match(), which are not volatile functions.
EDIT:
Thinking of it (because I just did on a spreadsheet of mine)..
Provided you know your data will have a reasonable limit, say 1000, you can just use =SUM($X$6:$X$1000) and it will skip the blanks, even for Subtotal method 1 or 101 (average).

A: Well i think you can use something like =SUM(C:C) to sum all the cells in column C and it will exclude the text automatically i tried it and it worked

A: Sure ! And I find it much better to have the total at the top, since you can also freeze the first row(s) to keep those totals visible.
Just ask Google for "Excel dynamic range". Here are a few links:
http://www.ozgrid.com/Excel/DynamicRanges.htm
http://support.microsoft.com/kb/830287
It's all done with a combination of Offset() and Count() functions.

A: Put this formula to the last row of your range of data (must not be table/list) this may solve your problem
=SUM(INDIRECT(("x6:x"&ROW()-1)))

or if you are having table/list then you may use this formula
=sum([table header name])

like you want to sum the column of "Amount" heading the type
=sum([Amount])

at the last row of your list/table


text:
Q: Maven Unable to Resolve Groovy Class In Library I have two maven projects I'm currently working on; project-data and project-base. project-data has a dependency on project-base defined in the pom as
<dependency>
        <groupId>com.tura.jetty</groupId>
        <artifactId>project-base</artifactId>
        <version>0.0.1-SNAPSHOT</version>
</dependency>

For java files everything is working fine, I can do imports and make references to classes in project-base in classes of project-data. The problem is, I also have to deal with dependencies on Groovy classes defined in project-base. When I try to reference a groovy class defined in project base from within a groovy class in project-data I get a
'Groovy:unable to resolve class' error. I tried moving my groovy classes into src/main/groovy but the error remained. Is there something more I need to be doing to make the groovy classes in project-base available to projects that depend on it?
For reference, here are some snippets from my pom.xml files. I'm using an archiva server for storing my custom libraries.
project-base
<project>
<groupId>com.tura.jetty</groupId>
  <artifactId>project-base</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
            <compilerId>groovy-eclipse-compiler</compilerId>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
        <dependencies>
        <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>2.9.1-01</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-batch</artifactId>
                <version>2.1.1-01</version>
            </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.1.1</version>
        <type>jar</type>
    </dependency>
  </dependencies>
</project>

project-data
<project>
<artifactId>project-data</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
            <compilerId>groovy-eclipse-compiler</compilerId>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
        <dependencies>
        <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>2.9.1-01</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-batch</artifactId>
                <version>2.1.1-01</version>
            </dependency>
        </dependencies>
      </plugin>
     </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.1.1</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>com.tura.jetty</groupId>
        <artifactId>project-base</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
</dependencies>
</project>


text:
Q: Physical description of spin wave theory and Bogoliubov transformation I am trying to understand how spin-wave theory explain the behaviour of a spin-wave in a spin system. To clarify my question, I will start with a simple case of a antiferromagnet (AFM). The Hamiltonian is given as:
$$H = J\sum_{\langle i,j\rangle}\vec{S}_i\cdot \vec{S}_{j}$$
where $\langle i,j\rangle$ denoted sum is on nearest neighbors (NN) only. We assume that we have two sublattices denoted by $A$ and $B$ with index $i$ and $j$, respectively. The spin-wave theory can be applied in three steps:

*

*apply Holstein-Primikoff transformation (HPT): it basically says that the small deviation (precession motion) of $\vec{S}_i$ is created (destroyed) by operator $a_i^+(a_i)$ on lattice $A$ and $b_j^+(b_j)$ on lattice $B$:
$$H= -\frac{NzJS^2}{2}+H_1$$
where
$$H_1 = zJS\sum_{i\epsilon A} a_i^+a_i + zJS\sum_{j\epsilon B} b_j^+b_j + JS\sum_{\langle i,j \rangle} (a_ib_{j}+a_{i}^+b_j^+)$$
and we ignore higher-order interaction.

*apply the Fourier transform:
$$H_1 = zJS\sum_k [\gamma_k^* a_kb_{-k} + \gamma_k a_k^+b_{-k}^+ + a_k^+a_k + b_{-k}^+b_{-k}]$$
where $\gamma_k =1/z\sum_\delta e^{ik\cdot \delta}$. And $z$ is number of NN and $\delta$ is location of NN.

*to diagonalize apply Bogoliubov transformation
$$\alpha_k = u_k a_k - v_k b_{-k}^+ \quad ; \quad \beta_k^+ = -v_k a_k + u_k b_{-k}^+$$
this gives us the following results
$$H_1 = \sum_k \epsilon_k (\alpha_k^+ \alpha_k + \beta_k^+ \beta_k)$$
where $\epsilon_k = zJS\sum_k \sqrt{1-\gamma_k^2}$
My question:
Till 2nd step, I know what's going on. But I am confused about what exactly happen in 3rd step. We now have new operators. How these new operators ($\alpha, \beta$) describe a spin-wave?
Does the last equation mean that a spin-wave of energy $\epsilon_k$ can exist in this AFM? And there can be only one spin-wave (two-fold degenerate) of this energy?


text:
Q: css transition doesn't work on chrome extension I am building a chrome extension, when user click on the button I am loading a custom popup window from my content div
/contentScript.js

var contentDiv = `

`;

chrome.runtime.onMessage.addListener(gotMessage);

function gotMessage (request, sender, sendResponse) {
$("body").append(contentDiv);
$('#mydiv-container').addClass('visible');
}

This works, problem is that I use a css transition that doesn't work
/content.css

#mydiv-container {
    opacity: 0;
    height: 390px;
    width: 400px;
    position: fixed;
    top: -200px;
    z-index: 999999999;
    transition: all 2s;
}

#mydiv-container.visible {
  opacity: 1;
  top: 20px;
  transition: all 2s;
}

This doesn't work as it expected, the transition is not taking place.
How can I fix this.

A: Use this Webkit is the property of CSS supported by google chrome
-webkit-transition: all 2s;

A: I have fixed that with the use of the setTimeout method.
setTimeout(function() {
    $('#mydiv-container').addClass('visible');
});

A: using Webkit works for me and when i try to copy your code on a jsfiddle didnt work because the mydivcontainer was on top of the button so the button never triggers so i change the top: -200px; to top: -400px
https://jsfiddle.net/jvgx4ucj/1/


text:
Q: Possible tiling patterns for equiangular hexagon with alternating side lengths I want to make a pattern of an equiangular hexagons with side lengths of 1-5-1-5-1-5. Here are 3 examples I made:

Which different patterns exist? Are there more than the ones I show? And which one is the most space-efficient, so that it minimizes the wasted space between the hexagons?
I checked the wikipedia page on hexagonal tilings but I cannot find examples for this specific hexagon.

A: Here are the patterns I could think of, represented by their unit cells and with their densities listed beside:

The first tiling shown in the question has no code in my diagram and has density $\frac{46}{49}=0.9388$. This is not very interesting because it is a rearrangement of the A0 tiling (the second in the question), which has the same density.
From the A0 tiling we can shift the hexagons on their long edges by one to five units to create the A1 to A5 tilings. As the holes between the tiles grow, so does the density decrease:

*

*A1 has density $\frac{23}{26}=0.8846$

*A2 has density $\frac{46}{61}=0.7541$

*A3 has density $\frac{23}{38}=0.6053$

*A4 has density $\frac{46}{97}=0.4742$

*A5 has density $\frac{23}{62}=0.3710$

The B tiling is the last one shown in the question and has density $\frac{23}{27}=0.8519$.
Now to answer the question of densest possible tiling. When I started typing this I thought it was tiling M, which has density $\frac{23}{24}=0.9583$ and features rows of tiles that can slide over each other.

Then I realised the rows could be pushed into each other a bit more, resulting in the real winner: tiling N with density $\frac{46}{47}=0.9787$.

So if you want to tile a real wall or floor with this shape, your best bets are tilings M and N. While M is less dense, it isn't chiral like N, and its rows may make it better suited to the (usually) rectangular areas tiles are supposed to cover.