text:
Q: trouble finding file source in .rmd chunk when knitting .rmd from master .R file Let's say I have a project directory called testknit (and I do, see github for MRE), and inside this I have several subdirectories, including scripts where I keep .R and .rmd files.
In RStudio, I create a project and select this testknit directory so that when I open the project, the working directory is mypath/testknit.
Inside testknit/scripts I have a master.R file. If I want to source a file called testsource1.R, which is also in testknit/scripts, I can run source("scripts/testsource1.R") from within master.R.
library(knitr)
getwd()
# [1] "mypath/testknit"
source("scripts/testsource1.R")

So far so good.
But let's say I also want to knit a .rmd file called test.rmd that is located in testknit/scripts. I can run knit("scripts/test.rmd") from master.R.
My test.rmd file does the following:
```{r setup}
  library(knitr)
  opts_knit$set(root.dir='../')
```

```{r option1}
  source("scripts/testsource2.R")
```

```{r option2}
  source("testsource2.R")
```

Since test.rmd exists within testknit/scripts, I specify opts_knit$set(root.dir='../') in the first chunk so knitr knows that my root directory is really one level up.
When I open test.rmd in RStudio and click knit HTML, predictably, the option1 chunk works and the option2 chunk does not.
But when I try to knit test.rmd by running knit("scripts/test.rmd") from master.R instead of knitting from within the .rmd file, neither chunk option works. Both return an error that there is no file by that name.
What am I doing wrong? Why can't R find testsource2.R when knitting the .rmd file from the master .R?
See github link above for reproducible example.
Update:
As I noted below in the comments, I tried adding wd <- getwd() just before opts_knit$set and changed (root.dir='../') to (root.dir=wd). So when I run knit("scripts/test.rmd") from master.R, the option2 chunk runs because the wd I added gets set to mypath/testknit/scripts. But if i open the .rmd file and run all chunks, wd is set to the root directory, mypath/testknit, and the option1 chunk runs.
I need the working directory to remain the project root. This does not seem like an elegant solution to me, but changing:
```{r setup}
  library(knitr)
  opts_knit$set(root.dir='../')
```

to
```{r setup}
  library(knitr)
  wd <- ifelse(basename(getwd())=="scripts",
               gsub("/scripts", "", getwd()),
               getwd())
  opts_knit$set(root.dir=wd)
```

lets me run all chunks when in the .rmd file or knit("scripts/test.rmd") from master.R. It works, but it feels like I am taking the wrong approach.

A: @Yihui: Perhaps you can make ../ an absolute path using normalizePath('../'). A relative working directory can be confusing to reason about (at least my head hurts after I read too many levels of relative paths :). BTW, when you Knit HTML in RStudio, RStudio first changes the working directory to the input Rmd file.
Me: yes! using just opts_knit$set(root.dir=normalizePath('../')) works for knitting the .rmd file from master.R and knitting to html or running all chunks from within the .rmd. I updated the github example. test-b.rmd now shows this. thanks!


text:
Q: What is the SQL Statement to delete all entries of an ID after a certain activity occurs? I am struggling with the Vertica SQL Statement to delete all entries of an OrderID after a certain event had occurred.
This is a representation of my data.
**OrderID     Activity**
1             Item Started
1             Task 1 complete
1             In storage
1             Deletion
1             Deletion Complete
2             Item Started
2             Deletion
2             Deletion Complete

In this scenario, I would like to delete the entries "Deletion" and "Deletion Complete" of the OrderID 1, since they occur after the activity "In storage". I want to keep all entries of OrderID 1 until (and including) "In Storage".
For OrderID 2 this is not the case, therefore I want to keep it.

A: If your situation is exactly as you described it - and you indeed have no relevant timestamps, to check what happened before and what happened later - then you can delete all rows whose activity is either 'Deletion' or 'Deletion Complete' and whose orderid is equal to any order id of any rows that have an activity of 'In storage'.
If, however, 'In storage' needs to happen before 'Deletion' or 'Deletion Complete', then you also need to verify that in the subselect I'm using below.
-- create the example table - drop any table of that name existing before ...
DROP TABLE IF EXISTS input;
CREATE TABLE input(OrderID,Activity) AS (
          SELECT 1,'Item Started'
UNION ALL SELECT 1,'Task 1 complete'
UNION ALL SELECT 1,'In storage'
UNION ALL SELECT 1,'Deletion'
UNION ALL SELECT 1,'Deletion Complete'
UNION ALL SELECT 2,'Item Started'
UNION ALL SELECT 2,'Deletion'
UNION ALL SELECT 2,'Deletion Complete'
);
-- here goes
DELETE
FROM  input
WHERE orderid IN (
  SELECT orderid FROM input WHERE activity='In storage'
)
  AND activity IN('Deletion','Deletion Complete')
;

A: you can delete in two steps 1st delete all the records where 'In storage' not available
 DELETE FROM table t1 WHERE
 not exists ( select 1 from table t2 where t1.id=t2.id
                                 and Activity in ('In storage')
 )

second step where 'In storage' available
DELETE FROM table t1 where activity in('Deletion','Deletion Complete')

redpajama_set_name: RedPajamaStackExchange


text:
Q: Graphs that are not $\mathbb{R}^2$-realizable We say that a finite, simple, undirected graph $G=(V,E)$ is $\mathbb{R}^2$-realizable if there is an injective map $\varphi:V\to \mathbb{R}^2$ such that for $v\neq w \in V$ we have $\{v,w\} \in E$ if and only if $|\varphi(v)-\varphi(w)| < 1$ where $|\cdot|$ denotes the Euclidean distance.
What is an example of a finite graph that is not $\mathbb{R}^2$-realizable?

A: How about the star $S_6$? To realize this graph in the way you describe, you would have to map the center point to some $c \in \mathbb R^2$; then you would need to map the $6$ other points of $S_6$ inside the unit circle around $c$, but all at distance $\geq\!1$ from each other. This is impossible.


text:
Q: Typescript: initialize an event listener within a class I'm building a web application using Typescript react. I'm trying to make an accordion menu that expands on click, but it only responds to the second click. I think it's because it only starts listening after the first click.
Is there any way to make it listen from the beginning? I tried initializing the event listener in the constructor but it doesn't seem to be working.
This is my class:
class SelectionMenu extends React.Component {
    constructor(props: Readonly<{}>){
        super(props);
        this.listenForAccordion = this.listenForAccordion.bind(this);
    }

    // opens and closes the accordian menu
    public listenForAccordion(): void {
        for (i = 0; i < acc.length; i++) {
            acc[i].addEventListener("click", function() {
                this.classList.toggle("active");
                var panel = this.nextElementSibling;
                if (panel.style.maxHeight){
                panel.style.maxHeight = null;
                } else {
                panel.style.maxHeight = panel.scrollHeight + "px";
                }
            });
        }
    }

    public render() {
        return (

            <button className="Accordion" onClick={this.listenForAccordion}>Section 1</button>

Lorem ipsum...

            <button className="Accordion" onClick={this.listenForAccordion}>Section 2</button>

Lorem ipsum...

            <button className="Accordion" onClick={this.listenForAccordion}>Section 3</button>

Lorem ipsum...

        );
    }
}

A: Instead of manually manipulating the DOM, you could keep the accordion row information in your component state and set the row to be active on click and change styles applied to that row in the render method.
Example

class SelectionMenu extends React.Component {
  state = {
    rows: [{ active: false }, { active: false }, { active: false }]
  };

  onClick = index => {
    this.setState(previousState => {
      const rows = [...previousState.rows];
      rows[index] = { ...rows[index], active: !rows[index].active };
      return { rows };
    });
  };

  render() {
    return (

        {this.state.rows.map((row, index) => (

            <button className="Accordion" onClick={() => this.onClick(index)}>
              Section 1
            </button>

Lorem ipsum... {row.active && " (Active!)"}

        ))}

    );
  }
}

ReactDOM.render(<SelectionMenu />, document.getElementById("root"));


text:
Q: Using object from other class I have mainActivity class and class1. In class1 i have something like this
public void ownedAdd(int a)
{
    owned = owned +a;
}

Simple. But when i want to call this method in MainActivity
    Class1 obj1 = new Class1();
    Button button1 = (Button) findViewById(R.id.button1);

    button1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            obj1.ownedAdd(10);
        }
    });

And in this place i have few question. Android Studio saying that obj1 need to be declared as final. I dont like that. What i want to do is using class1 object in main method. Is that possible? I want to make few objects of class1 each with some variable as price, owned etc and i have no idea how. For any help, thanks a lot ;)

A: What's wrong is that in JAVA, you cannot access a variable from a method to an anonymous class inside that method unless the variable is declared final inside the method, or the variable is itself global to the parent Class.
To solve your problem, set the obj1 variable to be global. Something like:
public class MainActivity extends AppCompatActivity {
    //Declare the obj1 object here
    Class1 obj1;

   @Override
   public void onCreate(Bundle savedInstanceState) {
       //inflate layout and do other stuff

       //from where you posted
       obj1 = new Class1();
       Button button1 = (Button) findViewById(R.id.button1);

       button1.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               obj1.ownedAdd(10);
           }
       });
   }
}

A: From the code given, you don't need the reference to the Class1 instance other than in the click listener, so you can simply make it a member variable of the View.OnClickListener:
   button1.setOnClickListener(new View.OnClickListener() {
       final Class1 obj1 = new Class1();

       @Override
       public void onClick(View v) {
           obj1.ownedAdd(10);
       }
   });

(Although it is still worth making it final).
However, it's not super-useful like that, since only the click listener can access the instance - you can't display the value in another control, for example. It is simplest just to make your current local variable final.


text:
Q: Can I have a logical AND inside an array formula in excel? I have a worksheet like the following
ID|AVAILABILITY|PRICE
1 |1           |10,00
1 |1           |15,00
1 |0           |12,00
2 |1           |10,00

And in the same worksheet I do the following in MIN PRICE to get Minimun Price of available only products
I Save it as array formula
ID|MIN PRICE
1 |=MIN(IF(AND(table1[AVAILABILITY]=1;table1[ID]=L2);table1[PRICE]))
2 |

But I get 0,
is there any work around on this?

A: You won't need the AND in this case, just:
{=MIN(IF(A:A=1;IF(B:B=1;C:C)))}
See here for more information about this!

A: You can do something like this array formula:

A: If you use Excel for Office 365, Excel for Office 365 for Mac, Excel 2019 or Excel 2019 for Mac you can use the MINIFS function.
If you use an older Excel version you can try to replace it with.
With 1 criterion, you could use these.

*

*MAXIFS:  =MAX(INDEX(range-(criterion<>criterion_range)*1E300,0))

*MINIFS:  =MIN(INDEX(range+(criterion<>criterion_range)*1E300,0))
That is, if the criterion isn't met, subtract/add a huge number to put the corresponding value from range out of consideration. These aren't array formulas.
For 2 or more criteria,

*

*MAXIFS:  =MAX(IF(criterion1=criterion1_range,IF(criterion2=criterion2_range,range)))

*MINIFS:  =MIN(IF(criterion1=criterion1_range,IF(criterion2=criterion2_range,range)))
The idea of the nested IF calls is that when the 1st criterion isn't satisfied, there's no need to check subsequent criteria. This performs the fewest number of comparisons. The ideal is to put the least frequently satisfied criterion 1st, then the next least frequently satisfied criterion, and so on.

A: I try to create a VBA code. Any corrections all clarifications are welcome!
Option Explicit

Sub test()

    Dim LastrowA As Long, LastrowE As Long, i As Long, ID As Long, Availability As Long, y As Long
    Dim LowestPrice As Double
    Dim strValues As String
    Dim arr As Variant, element As Variant, IDarr As Variant

    With ThisWorkbook.Worksheets("Sheet1")

        LastrowA = .Cells(.Rows.Count, "A").End(xlUp).Row

        strValues = ""

        For i = 2 To LastrowA

            ID = .Range("A" & i).Value
            Availability = .Range("B" & i).Value

            If Availability > 0 And (InStr(strValues, ID) = 0) Then
                If i = LastrowA Then
                    strValues = strValues & ID
                Else
                    strValues = strValues & ID & "|"
                End If
            End If

        Next i

        arr = Split(strValues, "|")

        For Each element In arr

            IDarr = element
            LowestPrice = 0

            For y = 2 To LastrowA
                If CStr(.Range("A" & y).Value) = IDarr Then
                    If LowestPrice = 0 Then
                        LowestPrice = .Range("C" & y).Value
                    Else:
                        If LowestPrice > .Range("C" & y).Value Then
                            LowestPrice = .Range("C" & y).Value
                        End If
                    End If
                End If
            Next y

            LastrowE = .Cells(.Rows.Count, "E").End(xlUp).Row

            .Range("E" & LastrowE + 1).Value = IDarr
            .Range("F" & LastrowE + 1).Value = LowestPrice

        Next

    End With

End Sub

Result:


text:
Q: Finding status of GoogleTalk I am trying to create a program which will show me the status of my Gtalk (online/offline).

I can find the Status View 2 class, but how can I find the text within it.
Here's my code.
API decleration :
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);

[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

Code that calls Api :
IntPtr hwnd = IntPtr.Zero;

hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Google Talk - Google Xmpp Client GUI Window", "Google Talk");

hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Main View", "@main");

hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Status View 2", "Status Box");

hwnd = FindWindowEx(hwnd, IntPtr.Zero, "RichEdit20W", "String.Empty");

MessageBox.Show(hwnd.ToString());

Thanks.

A: I found a solution my self. Thanks to abazabam.

If you look at the figure, there is a panel whose class name is "#32770" and Window Caption is "Sign In Dialogue"
When the user is offline then this panel is visible, and when the user goes online the panel is not visible.
So the main logic is to detect the visibility of the panel.
You can use Spy++ to find the class name.

API decleration :
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);

[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern bool IsWindowVisible(IntPtr hWnd);

Code :
IntPtr hwnd = IntPtr.Zero;

bool check;

hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Google Talk - Google Xmpp Client GUI Window", "Google Talk");

hwnd = FindWindowEx(hwnd, IntPtr.Zero, "Main View", "@main");

hwnd = FindWindowEx(hwnd, IntPtr.Zero, "#32770", "Sign In Dialogue");

check = IsWindowVisible(hwnd);

if (check == true)
{
     MessageBox.Show("User is offline.");
}
else
{
     MessageBox.Show("User is online.");
}

Anyways thanks for reading my problem.


text:
Q: Uncaught SyntaxError: Unexpected token ( I want to show tooltip for my dojo button, I have tried the following code but getting error: Uncaught SyntaxError: Unexpected token (. Please solve this issue.
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Simple Map</title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">

 <button id="Info" data-dojo-type="dijit/form/Button">Draw PolyLine</button>

A: The function definition below (before addToMap)
function() {
    toolTip = new Tooltip({
    connectId: ["Info"],
    label: "value Draw PolyLine"
});

throws the syntax error.
You have to add a name to that function definition, like
function createTooltip() {
    toolTip = new Tooltip({
    connectId: ["Info"],
    label: "value Draw PolyLine"
});

A: You have to place the code executed by your addToMap(evt) function in curly brackets.The problem is that you missed the closing bracket at the end of the function:
function addToMap(evt) {
      //alert("Index");
      toolbar.deactivate();
} //<- expected token

So your browser expects to see the closing bracket, but it moves along to the next line and gets
var sls = new SimpleLineSymbol( //Not "{", so it's an unexpected token.

EDIT:
You have to pay attention to the closing brackets and paranthesis, otherwise your code won't work.
You missed a few more:
zoom: 5
});
}); //<- you should add } to close the function(Map,Draw,Graphic,...)
    //and ) to close the require
//map.on("load",createToolbar);


text:
Q: Volume of region in square column Find the volume of the region in the square column $|x| + |y| \leq 1 $ and bounded by $3x+z=3, z=0$
I have attempted to find the bounds, by letting $z=3-3x, \text{ then letting } z=0, \text{ to give } 3x=3 \text{ and } x=1$ as an upper bound for x
Then I arrived at the integral:$\int_{x=-1}^1\int_{y=1-|x|}^1\int_{z=0}^{3-3x}dzdydx$
I then evaluated this to be $3$.
This doesn't feel correct, I feel like I may have found the bounds incorrectly, it didn't feel correct having $y=1-|x|$ as the lower bound.

A: Since $|x| +|y| =1 $ is the boundary then
$ - (1 - |x| ) \le y \le 1 - |x| $
where $-1 \le x \le 1 $
The volume integral is
$V =\displaystyle \int_{x=-1}^{1} \int_{y = -(1 - |x|)}^{1 - |x|} \int_{z=0}^{z = 3 - 3 x } dz dy dx $
This simplifies to,
$V =\displaystyle \int_{x=-1}^{1} \int_{y = -(1 - |x|)}^{1 - |x|} ( 3 - 3 x )   dy dx $
Integrating with respect to $y$ yields,
$V =\displaystyle \int_{x=-1}^{1} \int_{y = -(1 - |x|)}^{1 - |x|} (3 - 3x)(2)(1 - |x|) dx $
Finally integrating with respect to $x$ and noting that $x |x| $ is odd, this becomes,
$V =  6 \displaystyle \int_{-1}^{1} ( 1 - |x| - x (1 - |x| ) ) dx = 6 ( 2 - 1 - 0 + 0) = 6 $
Another way to compute the volume is as follows:
The midpoint of $z$ is at $(0,0)$ and is equal to $3$ , so the volume is $3 \times (\sqrt{2})^2 = 6 $


text:
Q: Is the order guaranteed when iterating an array with keys? Is the order guaranteed when iterating an array with keys?
My code:
const data = {};
data["a"] = 1;
data["c"] = 2;
data["b"] = 3;

for (const id in data) {
    console.log(data[id]);
}

Result:
1
2
3

Is the result guaranteed to always be the same?


text:
Q: How can I update by tag and date with CVS? I have a working sandbox and would like to update it to a specified date and tag. How can I do it? I would have thought that the following would work:
cvs update -r <branch> -D <old date>

In this case, CVS seems to ignore the date specification. If I specify just the date, then CVS drops the branch and uses HEAD instead.

A: From researching on the web, it sounds like you need to do a checkout in this case and CVS is smart enough to recognize that the files need to be updated. It does not, however, recognized the branch so you have to explicitly provide it,


text:
Q: Express - can't serve static files in debug I cannot serve static files in debug mode. I am using Passport authentication. Index.html is login page with form (POST to /login). In debug mode after successful authentication server redirect to /home but I cannot GET my css and javascript files.
Files are in /public directory.
/public
   /css
   /javascripts
   /images
   index.html
   home.html
/routes

in app.js:
app.use(express.static(path.join(__dirname, 'public')));

in routes/index.js
/* GET Home Page */
router.get('/home', isAuthenticated, function(req, res){
    var root = join(__dirname, '/..');
    root = join(root, '/public/');
    res.sendFile('home.html', { root: root});
});
/* Handle Login POST */
    router.post('/login', passport.authenticate('login', {
        successRedirect: '/home',
        failureRedirect: '/',
        failureFlash : true
    }));

I am using VS Code. Here's launch.json.
{
"version": "0.2.0",
"configurations": [
    {
        "name": "Launch",
        "type": "node",
        "request": "launch",
        "program": "${workspaceRoot}/bin/www",
        "stopOnEntry": false,
        "args": [],
        "cwd": "${workspaceRoot}",
        "preLaunchTask": null,
        "runtimeExecutable": null,
        "runtimeArgs": [
            "--nolazy"
        ],
        "env": {
            "NODE_ENV": "development"
        },
        "console": "internalConsole",
        "sourceMaps": false,
        "outDir": null
    },
    {
        "name": "Attach",
        "type": "node",
        "request": "attach",
        "port": 5858,
        "address": "localhost",
        "restart": false,
        "sourceMaps": false,
        "outDir": null,
        "localRoot": "${workspaceRoot}",
        "remoteRoot": null
    },
    {
        "name": "Attach to Process",
        "type": "node",
        "request": "attach",
        "processId": "${command.PickProcess}",
        "port": 5858,
        "sourceMaps": false,
        "outDir": null
    }
]

}

A: I had this problem too. For me it was that the working directory was not set correctly. Setting it to the folder containing my static root worked. In your case you might try:
"cwd": "${workspaceRoot}/bin/www",


text:
Q: How to split an array in java or Kotlin? How can we split an array of objects? For example, I have a variety of chars like this:
['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd']

I want to split the array with the spaces seen in position 6. After breaking, the collection will look like this:
Array1 = ['H', 'e', 'l', 'l', 'o']
Array2 = ['W', 'o', 'r', 'l', 'd']

I did find a post something like this over here, but that is not in java or Kotlin.
I know I could have done it this way:
String str = TextUtils.join(",", arr);

String[] splittedString = str.split(" ");

But, I want another way if it is possible. Using this .split method takes up a lot of memory and about 30-40 milliseconds on large arrays.
How can I do this with java or Kotlin?

A: A simple solution is joining the original array into a string, split by space and then split again into the characters (here in kotlin):
arr.joinToString().split(" ").map{ it.split() }

This is not optimized but still in O(n) (linear complexity). It benefits from readability which most often should be preferred whereas performance should be addressed if this is critical to your task at hand.

A: Did it in Java for fun. Not very concise though. I cant seem to be able to do it using Streams properly.
public static void main(String[] args) {
        char[] chars = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'};
        char[][] char2d;

        String[] tokens = String.valueOf(chars).split(" ");
        char2d = new char[tokens.length][];
        for (int i=0; i< tokens.length; i++) {
            char2d[i] = tokens[i].toCharArray();
        }

        for (int i=0; i< char2d.length; i++){
            System.out.println(Arrays.toString(char2d[i]));
        }
    }

Output:
[H, e, l, l, o]
[W, o, r, l, d]

Managed to replicate it with streams as follows:
char[][] char2d2 = Arrays.stream(tokens).map(String::toCharArray).toArray(char[][]::new);
for (int i=0; i< char2d2.length; i++){
    System.out.println(Arrays.toString(char2d2[i]));
}

Gives the same output as above.

A: I assume a generic array with elements that does have a proper implementation of Object::equals; for a mere array of char, the suggested solutions based on the String operations are the most effective implementations.
Try this:
final Element [] input = …
final Element split = …
final List<Element[]> output = new ArrayList<>();

var start = 0;
var end = 0;
while( end < input.length )
{
  if( input [end].equals( split ) )
  {
    output.add( Arrays.copyOfRange( input( start, end ) ) );
    start = end + 1;
  }
  ++end;
}
if( start < end ) output.add( Arrays.copyOfRange( input( start, end ) ) );

A: Here is one way to do it with just an extra ArrayList and StringBuilder, no converting the whole input to a String.
String[] splitOnSpaces(char[] chars) {
    List<String> strings = new ArrayList<>();
    StringBuilder word = new StringBuilder();
    for (int i = 0; i < chars.length; ) {
        while (i < chars.length && chars[i] == ' ') {
            ++i;
        }
        while (i < chars.length && chars[i] != ' ') {
            word.append(chars[i++]);
        }
        if (word.length() > 0) {
            strings.add(word.toString());
            word.setLength(0);
        }
    }
    return strings.toArray(String[]::new);
}

It could be even more concise if you allow single statements to be on the same line as if or while statements.
String[] splitOnSpaces(char[] chars) {
    List<String> strings = new ArrayList<>();
    StringBuilder word = new StringBuilder();
    for (int i = 0; i < chars.length; ) {
        while (i < chars.length && chars[i] == ' ') ++i;
        while (i < chars.length && chars[i] != ' ') word.append(chars[i++]);
        if (word.length() > 0) strings.add(word.toString());
        word.setLength(0);
    }
    return strings.toArray(String[]::new);
}

A: Converting the array to a String and splitting it in Java:
    final String[] array = { "H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d" };
    final String[] arr = String.join("", array).split(" ");
    final String[] subArray1 = arr[0].split("");
    final String[] subArray2 = arr[1].split("");


text:
Q: cannot assign or copy iostream object? iostream and other stream class are not actually class, but typedefs, right?
Here is the problem, I tried to initialize a istream object in initialization list, but unfortunately I got an error, code goes bellow:
class A
{
    public:
        A(istream &is=cin): ais(is)
        {}

    private:
        istream ais;
};

Can't compile with g++, error:
synthesized method 'std::basic_istream<char, std::char_traits<char> >::basic_istream(const std::basic_istream<char, std::char_traits<char> >&)' first required here

I searched SO, found that, iostream cannot be assigned or copy. But why cannot I initialize it in the initialization list?
Cuz I think, the initialization list will invoke the object's constructor/copy-constructor, right?

A: Your code attempts to turn one istream, the one passed to the constructor, into two istreams, the one that was passed to the constructor and ais. An istream object represents that actual stream itself. There is only one stream and there is no way to somehow turn it into two streams.
It's not even clear what that would mean. If there's some data on the stream, does whichever stream reads first get it? Or do they both get it? If so, who or what duplicates it?
An istream is like a file itself. You cannot turn one file into two files without copying the data from one to the other yourself. You can, however, have as many references or pointers to the same istream as you want. The solution to your problem is probably to make ais a reference.

A: You have the member variable declared as:
istream ais;

meaning the copy constructor will be invoked in the initializer list. This is not specific to the initializer list: you can't do this anywhere.
You could change the member variable to be a reference:
istream& ais;

but that means you have to ensure that the istream to which ais refers is valid for the lifetime of A.

A:
iostream and other stream class are not actually class, but typedefs, right?

Yes, but that's not relevant.

But why cannot I initialize it in the initialization list?

Because it can be neither copied nor assigned. Ctor init list is not magical. To create ais from is you need to make a copy, and you can't.

A: The stream object represent a handle to streams of data. Copying that doesn't make sense. Also, this wouldn't be the right thing to copy only tge base part of a stream: this would be slicing off the interesting bit (although you could get hold of thr actually interesting portion by using the stream buffer).
What you want to initialize in your class if it holds a stream is a reference to the stream:
std::istream& ais;

Of course, this means that some external needs to keep the stream alive as long as you are using it. If this isn't what you want or need you can have your class hold e.g. an std::ifstream and take a std::string as constructor argument: if the string is non-empty you'd open the corresponding file. Otherwise you'd set your stream's rdbuf() to the one from std::cin:
if (name.empty())
    ais.open(name.c_str());
else
    ais.rdbuf(std::cin.rdbuf());

A: In addition to the answers you already got, you can also initialize ais (as of your definition) with the streambuf of the stream you passed in (of course, the same caveat as with the reference applies: You must ensure that the streambuf stays valid until the object is destructed).
Initializing with the underlying streambuf is probably the closest to copying a stream you can do: While both still read from the same file and use the same buffering (and other processing the streambuf may do), all the formatting and error handling flags are separate.
To initialize ais with the streambuf, you write:
class A
{
public:
  A(std::istream& is = std::cin):
    ais(is.rdbuf())
  {
  }
private:
  std::istream ais;
};

A: class A
{
    public:
        A(istream &is=cin): ais(is)
        {}

    private:
        istream& ais;
};

Notice the member is a reference type. As you've written it, you're making a copy to initialize the member.


text:
Q: How do I design my very own ARM based processors? I have several questions about how I would design my own ARM-based CPU?

*

*How does one start with an ARM license and end up with a package ready to be soldered on to a board?

*What do I get from ARM (I am sure they have multiple license options to dish out - Architecture License (Qualcomm Snapdragon style) and Core License (TI OMAP style))?

*What tools do I need to proceed once I have 'that something' from ARM?

*What do I send to the fab?

*I believe only certain foundaries are licensed to etch an ARM core on to a silicon wafer. Am I right?

*As a student, can I afford to do this on an FPGA? How do I get hands on experience for something like this?

A: Here is how companies do it:

*

*Raise about US$10 million.

*Negotiate with ARM to get a license.  This will probably cost at least US$1 million.

*Get the design files from ARM.  It will likely be in some form of VHDL, Verilog, or an "encrypted" netlist.

*Design your own chip using a mix of your own logic (for the peripherals) and what ARM gave you.  This step will likely require some expensive CAD software and a small team of experts.  Expect to spend at least US$5 million and several years.

*Get the masks made for the chip itself.  If you use any modern semiconductor process then this will run around US$1 million.

*Get the chip itself made.  Price varies, but should be less than US$0.5 million.

*Debug the chip you created, fix the bugs, then go back to Step 5 until you have something that you can sell.

Here is how YOU do it:

*

*Take a graduate level computer architecture course at your local university.

*Take more courses in digital logic and whatever else.

*Design a CPU from scratch in VHDL or Verilog.

*Design another CPU from scratch.

*Look at the ARM instruction set and design a compatible CPU.

*Make your ARM-Compatible CPU work in an FPGA.

*Don't distribute your VHDL/Verilog source code unless you want to be sued.

*Use your ARM experience to write a good dissertation for your PhD.

*Use your PhD to get a job at ARM, or TI, or whoever.  Then repeat the process using the previous 7 steps on how a company does it.

Ok, so this list is a little tongue-in-cheek but it is basically correct.  The point is, don't even bother dealing with ARM directly because odds are you don't have the money.  And don't do anything that will get you sued by ARM either.

A: Take a look at this ARM core on OpenCores.

A: The ARM Cortex-M1 (probably the simplest of the ARM processors) is the first ARM processor specifically designed to be implemented as a soft processor in FPGAs.  It is optimized for the following FPGA types:
Actel (M1 ProASIC3 and M1 Fusion)
Altera (Cyclone-II, Stratix-III)
Xilinx (Spartan-3, Virtex-5)

ARM itself is making a Cortex-M1 Development Kit for Altera Cyclone III although it is a little pricey at $625 from DigiKey.  You do get all of the ARM Cortex-M1 IP though, and a license to do development  (plus a free royalty grant for 1000 boards for those going into production, pretty cool).
There may be some options for getting the IP by itself (perhaps they have an academic program, someone else mentioned a university program, but that was for the M0). Then you could buy a development board separately.
Here is some more information about the ARM Cortex-M1 on Altera.
Here's some information about putting a ARM Cortex-M1 on an Actel FPGA.
Meanwhile there is some interest in other versions of the ARM Cortex on FPGA; here is a paper from someone that implemented a ARM Cortex-M0 on a Xilinx FPGA.

A: ARM has a University DesignStart Program. As a student, you can only access basic Cortex-M0 material. But if you are really interested, get your faculty involved and then you can have access to much more design material (Verilog FPGA code, Evaluation IP, Simulations, etc.)

A: You can now get access to the Cortex-M3 processor (and an extendable AHB/APB subsystem) through ARM's DesignStart program.
The Eval option provides an FPGA target (simulation is supported, with obfuscated RTL of the core, everything else in Verilog). This currently targets the ARM MPS2+ FPGA, with mbed support.
The Pro version (only available to companies/universities who can sign a license) allows manufacture, and includes the processor core in Verilog (this covers both Cortex-M0 and Cortex-M3).


text:
Q: Flutter - convert dropdownformfield to autocompleteFormField I have a dropdownFormField which takes data from snapshot and working fine.
now the data has grown bigger, as such want to change it to autocompleteFormField.
The code for dropdownFormField I am using is like this:
Container(
                                height: 50.0,
                                padding: EdgeInsets.only(
                                    left: 15, right: 15, top: 5),
                                child: DropdownButtonHideUnderline(
                                    child: ButtonTheme(
                                  child: FutureBuilder(
                                      future: _testkit,
                                      builder: (context,
                                          AsyncSnapshot<TestkitList> snapshot) {
                                        switch (snapshot.connectionState) {
                                          case ConnectionState.none:
                                            return Text('none');
                                          case ConnectionState.waiting:
                                            return Center(
                                                child:
                                                    CircularProgressIndicator());
                                          case ConnectionState.active:
                                            return Text('');
                                          case ConnectionState.done:
                                            if (snapshot.hasError) {
                                              return Text(
                                                'error',
                                                //  '${snapshot.error}',
                                                style: TextStyle(
                                                    color: Colors.red),
                                              );
                                            } else {
                                              return DropdownButtonFormField<
                                                  String>(
                                                hint:
                                                    Text("Select Testkit Name"),
                                                value: _selectedTestkit,
                                                onChanged: (newValue) async {
                                                  _selectedTestkit = newValue;
                                                  _selectedTestType =
                                                      await getTestType();
                                                  setState(() {});
                                                  print(
                                                      "the below line is printed in dropdownfield");
                                                  print(_selectedTestType);
                                                },
                                                validator: (value) => value ==
                                                        null
                                                    ? 'Please select the Testkit'
                                                    : null,
                                                items: (snapshot.data.data)
                                                    .map((item) =>
                                                        DropdownMenuItem<
                                                            String>(
                                                          child: Text(
                                                            item.attributes.name
                                                                        .length >
                                                                    30
                                                                ? item
                                                                    .attributes
                                                                    .name
                                                                    .substring(
                                                                        0, 30)
                                                                : item
                                                                    .attributes
                                                                    .name,
                                                          ),
                                                          value: item.id,
                                                        ))
                                                    .toList(),
                                              );
                                            }
                                        }
                                      }),
                                )),
                              ),

Now plugin example for autocompleteFormField is like below:
SimpleAutocompleteFormField<Person>(
                decoration: InputDecoration(labelText: 'Person', border: OutlineInputBorder()),
                suggestionsHeight: 80.0,
                itemBuilder: (context, person) => Padding(
                  padding: EdgeInsets.all(8.0),
                  child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
                    Text(person!.name, style: TextStyle(fontWeight: FontWeight.bold)),
                    Text(person.address)
                  ]),
                ),
                onSearch: (search) async => people
                    .where((person) =>
                        person.name.toLowerCase().contains(search.toLowerCase()) ||
                        person.address.toLowerCase().contains(search.toLowerCase()))
                    .toList(),
                itemFromString: (string) {
                  final matches = people.where((person) => person.name.toLowerCase() == string.toLowerCase());
                  return matches.isEmpty ? null : matches.first;
                },
                onChanged: (value) => setState(() => selectedPerson = value),
                onSaved: (value) => setState(() => selectedPerson = value),
                validator: (person) => person == null ? 'Invalid person.' : null,
              )

somehow I am not able to make it pickup and work as whether I am using classname TestkitList' or snapshot.data.data' replacing the person which is in my case is a future.

A: You could flutter-typeahead package
https://pub.dev/packages/flutter_typeahead/install
TypeAheadField(
  textFieldConfiguration: TextFieldConfiguration(
    autofocus: true,
    style: DefaultTextStyle.of(context).style.copyWith(
      fontStyle: FontStyle.italic
    ),
    decoration: InputDecoration(
      border: OutlineInputBorder()
    )
  ),
  suggestionsCallback: (pattern) async {
    return await BackendService.getSuggestions(pattern);
  },
  itemBuilder: (context, suggestion) {
    return ListTile(
      leading: Icon(Icons.shopping_cart),
      title: Text(suggestion['name']),
      subtitle: Text('\$${suggestion['price']}'),
    );
  },
  onSuggestionSelected: (suggestion) {
    Navigator.of(context).push(MaterialPageRoute(
      builder: (context) => ProductPage(product: suggestion)
    ));
  },
)


text:
Q: .read() reinterpret_cast c++ I've got a file with some doubles (9 to be exact, for a 3x3 matrix) written in binary. I'm trying to make use of them as the real double value they represent (the number ej: 5.66 / -1.882 / etc..).
They are placed in the file one after another without any spaces: 3.245-2.453.253...... and they are exactly 9 numbers.
Then I have an struct with a pointer pointing to a vector of 9 slots (0-8) which I want to fill with the value of the doubles, SO, here's what I'm trying so far:
struct input{
    double data*;
    double myvector[9];
};

and then
input test;
test.data = test.myvector;
ifstream f(file,ios::binary);

f.read(reinterpret_cast<char *>(test.data),sizeof(double)*3*3);

Then when I went to check the values with some simple std::cout I got some weird numbers printed into console:
-0.1667 was printed as: -1,57218e+26
Is this supposed to happen? If not, what I'm doing wrong? In case I'm doing it right, what do I have to do with this value to get my "-0.1667"?
Thank you.
EDIT: By the time they created the file they had a pointer (pointing to a vector of doubles like my example) and they just made a f.write(whatever you put here); and that's what I mean when I sayd the numbers are one after another, there are no black characters in between any double there.
EDIT 2: full code:
#include <iostream>
#include <fstream>

using namespace std;

struct input{
    double data*;
    double myvector[9];
};

int main(int argc, char * argv[]){

    input test;
    test.data=test.myvector;

    ifstream f(argv[1], ios::binay); // argv[1] is the file EJ: ./program myfile
    f.read(reinterpret_cast <char *> (test.data), sizeof(double)*9); // being 9 values.

    for(int i=0;i<9;i++){

        cout << test.data[i] << endl;

    }
return 0;
}

A: Real numbers are stored as floating-point numbers. floating-point arithmetic is not exact: The value of the number is stored as a significant number of fixed digits, and an exponent of fixed digits.
When you try to print a floating-point value as a string, the number is formatted in "decimal-real-number" format. For this formatting, the value of the number is rounded (You want a representation with certain precission, not infinite digits).
Because of this formatting, what you see as "-0.1667" its really the rounded form of the real value. The other notation, -1.572218e+26 , is much similar to the true floating-point representation.
I supposed that when you talk about "-0.1667", you are talking about the original value you printed to the file. But -1.667 is the value that you see when outputs the value of the variable (on the console, for example), not? This is the point: -1.667 is a rounded value. The true value is "-1.572218e+26".
You are storing the flotating-point values in a file in binary-mode, so you print in the file the real representation of the number (The binary representation). When you read the file, you read the same value that you stored before. When you puts this value in std::cout, cout prints the value, without rounding (This can be configured).
If you want rounded format, you could use setprecision to configure the format.


text:
Q: ListBox does not fire MouseRightButtonUp event Is there any particular reason why ListBox does not fire the MouseRightButtonUp event?
<ListBox x:Name="Users"
             ItemsSource="{Binding Users}"
             MouseRightButtonUp="MouseRightButtonUp" />

A: When a routed event is not fired in your control it means a control which is deeper in the visual tree is "eating" the event by marking it as handled in the event chain. In your case I suspect it is the ScrollViewer inside the ListBox eating the event.

A: here the answer taken from my previous comment ;)
I guess the problem is like Murven said, that the RightButtonUp event is handled by another control and is not getting to the ListBox. But if you add a MouseRightButtonDownHandler and just set e.handled = true in this handler, the MouseRightButtonUpHandler is called...
XAML:
<ListBox x:Name="Users" MouseRightButtonDown="downHandler" MouseRightButtonUp="upHandler"...>

Code Behind:
private void downHandler(object sender, MouseButtonEventArgs e) { e.Handled = true; }

BR,
TJ


text:
Q: MS CRM - Duplicate tracking tokens when sending emails from workflows I have recently helped some of our users set up several workflows to send emails. Now that these have been in use for a couple of weeks we have noticed that each time the workflow runs, emails to different recipients are sometimes given the same email Tracking Token. This has resulted a number of emails tracking to the wrong Lead when their recipient replies.
For a workflow that sends the same email to 10 - 15 people most of the emails sent will receive a unique tracking code, however between 2 and 5 from the same workflow execution  frequently have the same Tracking Token appended.
Emails sent using the standard send email functionality consistently have unique Tracking Tokens.
No custom code or 3rd party add ons are being used in the email sending process. We are running CRM version 4.0, and are yet to perform roll up 7 (we are in the process of doing that at the moment). |We have also disabled smart matching, and rely on the tracking codes.
Finally the workflow sends the email from an email template.
Thanks
Update:
Workflow Screen shot url: http://img515.imageshack.us/img515/4710/stackoverflowworkflowsc.png (I haven't been a member long enough to post the image)


text:
Q: and two predicate functions in c++ I am looking for a way to create a binary operation between two predicate functions. This is my predicate function declaration:
template <typename T>
using Predicate = std::function<bool(T const&)>;

I am looking for a way to 'concat' two predicate functions into one:
template <typename T>
static Predicate<T> andPredicate(Predicate<T> a, Predicate<T> b) {
   // ???
}

Expected behaviour:
Predicate<int> a = [](int a) { return a < 5; };
Predicate<int> b = [](int a) { return a > 0; };

Predicate<int> c = andPredicate(a, b); // a < 5 && a > 0

int number = 3;
bool result = c(number);

Is something like this possible in C++?

A: Sure, just use a lambda:
template <typename T>
Predicate<T> andPredicate(Predicate<T> a, Predicate<T> b) {
    return [=](T i) { return a(i) && b(i); };
}

You can even avoid the extra overhead of std::function by leveraging templates:
template <typename P1, typename P2>
auto andPredicate(P1&& a, P2&& b) {
    return [a = std::forward<P1>(a), b = std::forward<P2>(b)](const auto& i) {
        return a(i) && b(i);
    };
}

Live Demo
This avoids the extra type-erasure overhead of std::function by accepting the actual types needed for the original predicates and returning the lambda directly.  You can then store that in a std::function if you need, or just let the compiler deduce the type with auto.

A: This should work:
template <typename T>
static Predicate<T> andPredicate(Predicate<T> a, Predicate<T> b) {
   return [a,b]( T const &val ) { return a( val ) and b( val ) };
}

it is not clear why you want to make it static though.


text:
Q: compress.zlib adding symbols to the end of xml string I wrote the following php code to:
1. download an xml.gz file
2. decompress the file and get the contents as a string
3. save it as an xml file.
$data = file_get_contents('compress.zlib://'.$url);
file_put_contents($name, $data);
echo file_get_contents($name);

The code works absolutely fine except for one irritating bug.
The XML file it generates (after decompressing), has several symbols attached to the end of it such as these:
    qD�_}7

I need to fix this bug because when I parse this XML string in javascript to convert into an XML object, it gives the following error - "Invalid XML"
Please suggest corrections or alternative solutions to the problem.


text:
Q: How can you add a script reference to a page from a custom webpart? I'm developing a custom webpart and I'd like to leverage jQuery for some of my client side functionality.  I found a few articles that lay out the following technique for adding a script reference to a page from a custom webpart.
In my CreateChildControls method I added this line:
ScriptLink.Register(this.Page, "/_layouts/1033/jquery.js", false);

Then ensured that the script file is being deployed as part of my feature.
But after following this example I get the following error:
Cannot make a cache safe URL for "/_layouts/1033/jquery.js", file not found. Please verify that the file exists under the layouts directory.

I can take that path string and throw it in the address bar after "http://%servername%" and the browser tries to download the script file so it's obviously there.  What am I missing here?

A: this.Page.ClientScript.RegisterClientScriptInclude(this.Page, this.GetType(), insertuniquekeyhere, "/_layouts/1033/jquery.js");

See the RegisterClientScriptInclude page on MSDN for details. Other ScriptManager methods might also help.


text:
Q: BigQuery How to update multiple numeric columns by the same rule? Is there any way to update multiple numeric columns by the same rules?
Before:

After:
Numeric columns multiple 10

My Query:
select id, (sales*10) as sales, (spend*10) as spend, product
from table

But I have many columns in one table, is there any other simple way to update the data?

A:
I'd like to update all the numeric columns, which data type is int or float. (data multiple 10)

Use below
execute immediate (
  select 'update project.dataset.your_table set ' ||
    string_agg(column_name || ' = 10 * ' || column_name, ', ') ||
    ' where true'
  from `project.dataset.INFORMATION_SCHEMA.COLUMNS`
  where table_name = 'your_table'
  and data_type in ('INT64', 'FLOAT64')
)

your_table before update (select * from project.dataset.your_table)

your_table after update

However, I don't expect to update the original table. I only want the result.

execute immediate (
select 'select *  replace(' ||
  string_agg('10 * ' || column_name || ' as ' || column_name, ', ') ||
  ') from project.dataset.your_table'
from `project.dataset.INFORMATION_SCHEMA.COLUMNS`
where table_name = 'your_table'
and data_type in ('INT64', 'FLOAT64')
)

How could I get the result data?

After above is run - you should click on VIEW RESULTS


text:
Q: Word for tiny bits of gold left after panning for gold? Is there a specific word to describe tiny pieces of gold, like those left from panning for gold?
Something like "gold nugget" has the connotation of being way too big. "Tiny piece of gold" feels a bit clumsy. Example sentence: "I went panning and found a <word> today."

A: In the gold panning community, some options are:
'Nugget' - for large pieces
'Picker' - a piece of gold that is large enough to be picked up between the fingers, but not large enough to be called a nugget
'Flake' - a flat gold piece that can float on the water's surface tension
'Flour' - very small gold pieces, about the size of grains of flour or dust
'Color' - any visible gold of any size

A: "Flecks of gold" is the usual phrase. One wouldn't get excited about a single fleck, though.

[A]nd it is from this region that rumors thicken of the discovery of gold--not gold as it exists in masses, or imbedded [sic] in the primeval rock, but merely little flecks of gold, from the size of flax seed down to all manner of small gunpowder grains...
(Shelby County Herald (Shelbyville, MO), 13th Oct 1875, pg.1)

By a casual look ... can be seen flying particles of dust similar to flecks of gold...
(Champaign County Gazette (Champaign, IL), 29th May 1872)

But prospectors and assayers didn't talk much about gold in those terms; they talked about it more like sugar, as specific quantities and weights of nuggets or dust.

[A] traveler can get off his horse in the bed of any mountain stream, where the hills on either side are of gravelly red clay, and the slate creeps out in the bed of the gully, and there, in an hour's washing, he is sure to get some gold, sometimes a vial, sometimes two, three, or ten dollars [sic] worth. But the gold is scattered in all the hills of clayey and slatey formation...
(New Orleans Crescent (New Orleans, LA), 1st Jan 1849, pg.4)

I assayed about sixty ounces of the said gold, deposited in the form of dust, by T A Minard, and when melted and assayed, the total proved to be 895 [thousandths purity].
(Baltimore Sun (Baltimore, MD), 1st Jan 1849, pg.4)

A: What you're describing is called gold dust

(Mining & Quarrying) gold in the form of small particles or powder, as found in placer-mining.

(Panning for gold is just one form of placer mining.)

A: The correct term for one particle is a "color", and multiple particles, "colors."

A small particle of gold visible to the naked eye, or under the ordinary magnifying glass, is called a color; . . . .

This is from the Ontario Department of Mines, from their Report of the Bureau of Mines, 1898, Part 3, Page 257. Retrieved from Google Books.
The terminology is still used today by placer miners when checking an ore sample by panning.


text:
Q: Failed to import bean definitions from URL location [classpath:/resources/config/spring/beans/Spring-Security.xml] DIRECTORY STRUCTURE IS
 ProjectNAame
   |   -----JavaResources
   |         :
   |         :-src/main/java
   |          -src/main/resources
   |                 |
   |                  |Hibernate-SessionFactory.xml
   |                  |Spring-Security.xml
   |
   |
   |________DeployedResources
                |
                |__webapps
                |__WEB-INF
                      |
                      |___ApplicationContext.xml
                      |
                      |___web.xml

I am running an project with Spring 2.5 version, Hibernate, JSF, and I am doing a Login by using Spring-Security I am getting a Mapping Issues.
Exception is:
Nov 24, 2016 10:59:42 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:dynaprice' did not find a matching property.
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/7.0.72
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Sep 14 2016 12:12:26 UTC
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         7.0.72.0
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 8.1
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            6.3
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jre7
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.7.0_79-b15
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         C:\Users\sp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Users\sp\Desktop\apache-tomcat-7.0.72
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:52817
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\sp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\sp\Desktop\apache-tomcat-7.0.72
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\sp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\sp\Desktop\apache-tomcat-7.0.72\endorsed
Nov 24, 2016 10:59:42 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Nov 24, 2016 10:59:42 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_79\bin;C:\Users\sp\AppData\Local\Microsoft\WindowsApps;.
Nov 24, 2016 10:59:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 24, 2016 10:59:43 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Nov 24, 2016 10:59:43 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3030 ms
Nov 24, 2016 10:59:43 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 24, 2016 10:59:43 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.72
Nov 24, 2016 10:59:45 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [361] milliseconds.
Nov 24, 2016 10:59:45 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(C:\Users\sp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dynaprice\WEB-INF\lib\el-api-2.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Nov 24, 2016 10:59:45 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(C:\Users\sp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dynaprice\WEB-INF\lib\javaee-api-6.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Nov 24, 2016 10:59:45 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(C:\Users\sp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dynaprice\WEB-INF\lib\jsp-api-2.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Nov 24, 2016 10:59:45 PM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(C:\Users\sp\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dynaprice\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Nov 24, 2016 10:59:54 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Nov 24, 2016 10:59:55 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Nov 24, 2016 10:59:55 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
Nov 24, 2016 10:59:55 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsf/core is already defined
Nov 24, 2016 10:59:55 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://mojarra.dev.java.net/mojarra_ext is already defined
Nov 24, 2016 10:59:55 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI:
        http://java.sun.com/jsf/html
     is already defined
Nov 24, 2016 10:59:55 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Nov 24, 2016 10:59:55 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Nov 24, 2016 10:59:55 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@22c4d80a: display name [Root WebApplicationContext]; startup date [Thu Nov 24 22:59:55 IST 2016]; root of context hierarchy
Nov 24, 2016 10:59:55 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Nov 24, 2016 10:59:55 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/config/spring/beans/DataSource.xml]
Nov 24, 2016 10:59:56 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/config/spring/beans/HibernateSessionFactory.xml]
Nov 24, 2016 10:59:56 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/com/dynaprice/customer/spring/CustomerBean.xml]
Nov 24, 2016 10:59:56 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [resources/config/spring/beans/Spring-Security.xml]
Nov 24, 2016 10:59:56 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/resources/config/spring/beans/Spring-Security.xml]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [resources/config/spring/beans/Spring-Security.xml]; nested exception is java.io.FileNotFoundException: class path resource [resources/config/spring/beans/Spring-Security.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:182)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [resources/config/spring/beans/Spring-Security.xml]; nested exception is java.io.FileNotFoundException: class path resource [resources/config/spring/beans/Spring-Security.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:174)
    ... 27 more
Caused by: java.io.FileNotFoundException: class path resource [resources/config/spring/beans/Spring-Security.xml] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    ... 31 more

Nov 24, 2016 10:59:56 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/resources/config/spring/beans/Spring-Security.xml]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [resources/config/spring/beans/Spring-Security.xml]; nested exception is java.io.FileNotFoundException: class path resource [resources/config/spring/beans/Spring-Security.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:182)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [resources/config/spring/beans/Spring-Security.xml]; nested exception is java.io.FileNotFoundException: class path resource [resources/config/spring/beans/Spring-Security.xml] cannot be opened because it does not exist
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:174)
    ... 27 more
Caused by: java.io.FileNotFoundException: class path resource [resources/config/spring/beans/Spring-Security.xml] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
    ... 31 more

Nov 24, 2016 10:59:56 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.1.0 (SNAPSHOT 20100817) for context '/dynaprice'
Nov 24, 2016 10:59:59 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
Nov 24, 2016 11:00:00 PM com.sun.faces.mgbean.BeanManager addBean
WARNING: JSF1074: Managed bean named 'pieChartBean' has already been registered.  Replacing existing managed bean class type com.dynaprice.PieChartBean with com.dynaprice.PieChartBean.
Nov 24, 2016 11:00:02 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 6.0
Nov 24, 2016 11:00:02 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/localhost/dynaprice/WEB-INF/faces-config.xml for modifications
Nov 24, 2016 11:00:02 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Nov 24, 2016 11:00:02 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/dynaprice] startup failed due to previous errors
Nov 24, 2016 11:00:02 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Nov 24, 2016 11:00:02 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 24, 2016 11:00:02 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Nov 24, 2016 11:00:02 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 19165 ms

Spring-Security.xml
    <b:beans xmlns="http://www.springframework.org/schema/security"
         xmlns:b="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">

    <b:bean  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   <b:property name="location">
     <b:value>classes/config/spring/beans/DataSource.xml</b:value>
   </b:property>
</b:bean>

    <http auto-config="true" >
    <intercept-url pattern="/webapp/*" access="UserName"/>
    <form-login login-page="/Login.xhtml" authentication-failure-url="/Login.xhtml"/>
    </http>

`<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"/>
</authentication-provider>
</authentication-manager>
</b:beans>
`

ApplicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:security="http://www.springframework.org/schema/security"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security.xsd">

<!-- Database Configuration -->
    <import resource="classes/config/spring/beans/DataSource.xml"/>

<import resource="classes/config/spring/beans/HibernateSessionFactory.xml"/>

    <!-- Beans Declaration -->
    <import resource="classes/com/dynaprice/customer/spring/CustomerBean.xml"/>

    <import resource="classpath:/resources/config/spring/beans/Spring-Security.xml"/>

</beans>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>
    /WEB-INF/applicationContext.xml
  classpath:/resources/config/spring/beans/Spring-Security.xml
   </param-value>
  </context-param>

  <listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>
  <listener>
    <listener-class>

org.springframework.web.context.request.RequestContextListener
</listener-class>
  </listener>
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>
  <welcome-file-list>
    <welcome-file>Home.xhtml</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
 </servlet-mapping>

<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

</web-app>

A: Spring-Security.xml file resides in classpath (src/main/resources folder), so in your ApplicationContext.xml, you need to change from <import resource="classpath:/resources/config/spring/beans/Spring-Security.xml"/>
to <import resource="classpath:Spring-Security.xml"/>
Similarly, you need to change the other files which are available in src/main/resources


text:
Q: How do I read a specific line on a text file? Let me try to lay this out. I have a text file, each line of the text file is a different string. My trouble is if I want to grab line 3. When I try to use file.readline(3) or file.read(3) I will get the first 3 characters of the first line of the text file instead of all of line 3. I also tried file.readlines(3) but that just returned ['one\n'] which happens to yet again be the first line with [' \n'] around it. I am having more trouble with this that I already should be but I just gave up and need help. I am doing all of this through a discord bot if that helps, though that shouldn't be affecting this.

A: as what Barmar said use the file.readlines(). file.readlines makes a list of lines so use an index for the line you want to read. keep in mind that the first line is 0 not 1 so to store the third line of a text document in a variable would be line = file.readlines()[2].
edit: also if what copperfield said is your situation you can do:
def read_line_from_file(file_name, line_number):
    with open(file_name, 'r') as fil:
        for line_no, line in enumerate(fil):
            if line_no == line_number:
                file.close()
                return line
        else:
            file.close()
            raise ValueError('line %s does not exist in file %s' % (line_number, file_name))

line = read_line_from_file('file.txt', 2)
print(line)
if os.path.isfile('file.txt'):
    os.remove('file.txt')

it's a more readable function so you can disassemble it to your liking

A: unfortunately you just can't go to a particular line in a file in a simple easy way, you need iterate over the file until you get to the desire line or know exactly where this line start withing the file and seek it and then read one line from it
for the first you can do:
def getline(filepath,n):
    with open(filepath) as file:
        for i,line in enumerate(file):
            if i == n:
                return line
    return ""

Of course you can do file.readlines()[2] but that read ALL the file and put ALL its lines it into a list first, which can be a problem if the file is big
For the other option check this answer here


text: Q: How to Terraform Plan multiple AWS accounts and then review and then apply to multiple accounts Currently we have about 30 AWS accounts (and growing)  and we have a script that goes through and plans them all one by one and then we look at the plan and then we apply it if it looks correct.  Then it goes on to the next account.  I am wondering if there is a way to get the plan for all accounts and then if they all look good to kick off the apply for all accounts at once so we don't have to do it one by one each time.


text:
Q: service not getting executed when bash script is triggered from php I trigger with PHP this code:
    $dexec="cd /var/server_status/ && sh server_restart.sh";
    $d=exec($dexec,$a,$b);

server_restart.sh:
service mysql stop
$b dump is int 127, command not found, not in the path when it was triggered from php? the service command? what could be the steps to have this working

A: Thats a path problem. PHP can't find the file.
Add a chdir("/var/server_status"); to switch to the dir where server_restart.sh is.


text:
Q: Geometric Riemann-Roch for Hyperelliptic curves I'm studying Riemann surfaces and I just met the geometric interpretation of Riemann-Roch according to which
$$
dim(span(D))=deg D- l(D)
$$
where $D$ is a positive divisor and $span(D)$ is the intersection of every hyperplane intersecting the image of $supp(D)$ via the canonincal map $\phi$ with proper multiplicity.
I see that it is always assumed that the Riemann surface $X$ is not hyperellip^tic so that $\phi$ is an embedding. It is possible to generalize this to the hyperelliptic case?
I tried to repeat the argument for an explicit example: the hyperelliptic curve of genus 3 arising by considering $y^2 = x^8+1$.
Take the points $p_1 = (1,0),\ p_2=(-1,0),\ p_3=(i,0),\ p_4=(-i,0) $ and consider the positive divisor $D = p_1+p_2+p_3+p_4$. Consider now the canonical map $\phi:(x,y)\rightarrow (1:x:x^2)\in\Bbb{P}^1$, so that the images of the $p_i$ are
$$
\phi(p_1) = (1:1:1)\\
\phi(p_2) = (1:-1:1)\\
\phi(p_3) = (1:i:-1)\\
\phi(p_4) = (1:-i:-1)
$$
It seems to me that the only linear combination annihilating them is $-x_0+x_1-ix_2+ix_3$, so I would say that the smallest linear subspace of $\Bbb{P}^3$ containing the images is
$$
H: -x_0+x_1-ix_2+ix_3=0
$$
whose dimension is 2.
By algebraic Riemann-Roch I know that $l(D)=1+4-3=2$ and so, in fact, I get $2 = 4-2$.
First question: is this argument right?
Second question: if previous answer is "yes", how does it differ from non-hyperelliptic case?
Now I consider a divisor whose support is made of point where tha canonical map fails to be an embedding. Consider $D'=q_1+q_2+q_3+q_4$ where $q_1=(0,1),\ q_2=(0,-1),\ q_3=(1,\sqrt{2}),\ q_4=(1,-\sqrt{2})$.
Now we get
$$
\phi(q_1)=\phi(q_2) = (1:0:0)\\
\phi(q_3)=\phi(q_4) = (1:1:1)
$$
And we have two hyperplanes $H_1,\ H_2$ annihilating them, namely
$$
H_1 = x_0-x_1\\
H_2 = x_2-x_3
$$
$H_1\cap H_2$ should be the projective line given by $(x:x:y:y)$, so it has dimension 1, but again $degD' = 4$ and $l(D')=2$ and $1\neq 4-2$
Am I missing something?
Thank you for any hint!

A: First, yes, the geometric interpretation of Riemann-Roch works for hyper-elliptic curve.
You seems to be confused with the target of the canonical map. The canonical map for a genus 3 curve has target $\mathbb P^2$, instead of $\mathbb P^3$. The map is given by $(x,y)\mapsto x\mapsto (1:x:x^2)$ as composite of projection to the $x$-line and the degree-$2$ Veronese embedding. So for the divisor $D$ in your first example, $\text{Span}(D)=\mathbb P^2$, and the formula reads
$$2=4-l(D),$$
so $l(D)=2$.
For the divisor $D'$ in your second example, it actually coincides with the canonical divisor $K_X$ on $X$, so $\text{Span}(D')=\mathbb P^1$, and the formula reads
$$1=4-l(D'),$$
so $l(D')=3$, which coincides with the genus of the curve. You know $h^0(K_X)=3$, so the formula is correct.


text:
Q: Play a random sound on a button click I wonder if you could help. Im trying to play a random sound (from a set of 7 available sounds) when a user clicks on a button. So far I have:
Random rand = new Random();
int rndm = rand.nextInt(6) + 1; // I have 7 random sounds to play sequentially named 'my sound' + n.
String sndName = "mysound" + rndm;  // Assign a random # to the end of the sound file.
mp1 = MediaPlayer.create(getApplicationContext(), R.raw.sndName); // ERROR HERE: Expects an Int
mp1.start();

My hope was that one of my sound files (mysound1, mysound2, mysound3,...) would play randomly  but eclipse complains that the mp1 assignment is expecting an int. Any ideas?
Thanks much.

A: Use
 int[] sounds={R.raw.mysound1, R.raw.mysound2, R.raw.mysound3,R.raw.mysound4,R.raw.mysound5,R.raw.mysound6,R.raw.mysound7};

Then
 Random r = new Random();
 int Low = 0;
 int High = 7;
 int rndm = r.nextInt(High-Low) + Low;
 mp1 = MediaPlayer.create(getApplicationContext(),sounds[rndm]);
 mp1.start();

A: The issue is that you need to get the resource id to pass in.  You'll need to use something like this.
int id = getResources().getIdentifier("mysound" + rndm, "raw", getApplicationInfo().packageName);
mp1 = MediaPlayer.create(getApplicationContext(), id);

A: Two things. First I recommend you look at the line above where you create the string. If I remember correctly you may need to use a function such as to String to get the integer to be a string to concatenate on your string.
Next, I don't believe the r.raw is going to work like that.
My recommendation is if you have only 7 items, make an array holding the resources.
int [] resources = {R.raw.mysound1, R.raw.mysound2} etc
Then use the index from before to select the right R file.
So in the media create line, replace R.raw.sndName with resources[rndm]

A: your program  using  variable error.     see below code:
    //  1. R.raw.sndName is Constant
    mp1 = MediaPlayer.create(getApplicationContext(), R.raw.sndName);
    // 2. android resource  must integer,  Starting from this idea


text:
Q: MongoDB sharded cluster and replica sets sharing servers I'm trying to define the architecture for a production sharded mongoDB server, I see in the documentation that each shard has to contain 3 replica-sets. I would like to have the sharding advantages(being able to compute distributed queries in the nodes depending on the shard key) and the replication failover functionality, but reducing the budget (and the number of servers).
The idea is to use small machines of 7GB RAM and 2 core 2GHz:
I have been searching and I found some people was installing the different replicas of the shards sharing nodes in the following schema:
Server 1: shard1, rep-shard2, arbitrer3
Server 2: shard2, rep-shard3, arbitrer1
Server 3: shard3, rep-shard1, arbitrer2

I tried this using docker and it works, however I don't know if I can have any performance issues by sharing the same node as the replica-set and the shard.
Another option is to use 4 cluster and 2 shards with the following schema which I don't like that much (1 more node, 1 less shard) but maybe would be could be better in terms of performance.
Server1: shard1,
Server2: rep-shard1 arbitrer2
Server3: shard2,
Server4: rep-shard2 arbitrer1

A: Replication is used for fault tolerance; sharding is used for performance (to scale out).
If you have a total of 3 servers, you should simply set up a 3-node replica set.
Your post misuses some of the terminology which makes it difficult to figure out what it is you are saying. "3 replica-sets" for example means 9 or more servers are involved.


text:
Q: Status bar: how to detect touch events? I've successfully added a NSStatusItem to the menu bar, showing an regular NSMenu.
Is it possible to capture a hover event on this and in that case, display a different menu?

A: You need to create a new custom view, override method [NSView mouseEntered:] with [NSView addTrackingRect:...]  and then set to the status item [NSStatusItem setView:]


text:
Q: C++ environmental variable What I am trying to do is to get environmental variable value and use it in code itself.
What I am trying to do is (with variable set as export UTMZONE="33T"):
char UTMZone[4] = getenv("UTMZONE");

With that I receive following error:
error: array must be initialized with a brace-enclosed initializer

I presume issue is with mixing types, but I have no idea what kind of conversion do I have to make.

A: getenv returns a char*.  There isn't a way to initialize a char[N] from a char*.  What you would need to do is capture the pointer and then copy the string to the array like
char UTMZone[4];
char* ret = getenv("UTMZONE");
if (ret)
    strncpy(UTMZone, ret, 4);
else
    // abort

That said, if you can use a std::string, that is constructable from a char*.  Using
char* ret = getenv("UTMZONE");
if (ret)
    std::string UTMZone = ret;
else
    // abort

gives you a string populated with the environment variable.  If you need to pass it to a something that needs a char* or const char* then you can use the data() or c_str() member functions respectively. That would look like
function_that_needs_char_star(UTMZone.data());
function_that_needs_const_char_star(UTMZone.c_str());

A: If you really want to use a char array and know for sure that you only need the first three chars of UTMZONE you could use this:
char* envptr = std::getenv("UTMZONE");
if(envptr){ // check the pointer isn't null
  char UTMZone[4];

  // set null terminator
  UTMZone[4] = '\0';

  // copy 3 chars as the null terminator is already there
  std::strncpy(UTMZone, 3, envptr);
}

you should really use strings instead of char[] though as those are much safer.

edit: Nathan was both quicker and more eloquent :(
edit: adjusted for use of strncpy instead of strcpy and added NULL check


text:
Q: How can I add 2 error messages in one box? I am trying to do some form validation with this plugin http://1000hz.github.io/bootstrap-validator/
Right now I have it like this:

with this code:
    .row
        .form-group
            label(for="firstName") First Name*
            input(required type="text" id="firstName" data-error="We can't verify your name.")

            .help-block.with-errors

        .form-group
            label(for="lastName") Last Name*
            input(required type="text" id="lastName" data-error="We can't verify your last name.")
            .help-block.with-errors

But I need to be like this according to the designers:

I am trying to do it with this code:
    .row.form-group
        .col-xs-12.col-sm-6
            label(for="firstName") First Name TEST*
            input(required type="text" id="firstName" data-error="We can't verify your name.")
        .col-xs-12.col-sm-6
            label(for="lastName") Last Name TEST*
            input(required type="text" id="lastName" data-error="We can't verify your last name.")

        .help-block.with-errors.full

but I am getting only the last error message:

Any suggestions?


text:
Q: Interchange contents of variables? How would I interchange the contents of variables A and B?
temp = A
B = A
A = temp

The following code doesn't work. I'm not sure how to fix it. I must not understand python syntax or variables correctly.

A: Python provides particularly elegant syntax for swapping variables:
A, B = B, A

A: Erm...
temp = A
A = B
B = temp