text:
Q: ReactJS: material-ui error when import Component I'm trying my app using material-ui lib.
I create a Table and just follow the code in Custom Table Pagination Action, but I got the error like this.
Error I got:
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `TablePaginationActions`.
    in TablePaginationActions (created by WithStyles(TablePaginationActions))
    in WithStyles(TablePaginationActions) (created by TablePagination)

My DataTables component:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import {
  ListItem,
  TableFooter,
  TablePagination,
  ListItemText,
  Avatar,
  Table,
  TableBody,
  TableCell,
  TableHead,
  TableRow,
  Paper
} from '@material-ui/core';

import TablePaginationActionsWrapped from './TablePaginationActions'

const CustomTableCell = withStyles(theme => ({
  body: {
    fontSize: 14,
    paddingRight: 0,
  },
  head: {
    paddingRight: 0,
  }
}))(TableCell);

const CustomTableRow = withStyles(theme => ({
  root: {},
}))(TableRow);

const CustomTableHead = withStyles(theme => ({
  root: {
    padding: '0'
  },
}))(TableHead);

const styles = theme => ({
  root: {
    width: '100%',
    marginTop: theme.spacing.unit * 3,
    overflowX: 'auto',
    borderRadius: '0'
  },
  table: {
    minWidth: 500,
  },
  tableWrapper: {
    overflowX: 'auto',
  },
});

class DataTables extends Component {

  state = {
    data: this.props.reportsList,
    page: 0,
    rowsPerPage: 10,
  }

  handleChangePage = (event, page) => {
    this.setState({page});
  };

  handleChangeRowsPerPage = event => {
    this.setState({rowsPerPage: event.target.value});
  };

  render() {
    const {classes, reportsList} = this.props;
    const {data, rowsPerPage, page} = this.state;
    const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage);

    return (
      <Paper className={classes.root}>

            <CustomTableHead>
              <CustomTableRow>
                <CustomTableCell>ID</CustomTableCell>
                <CustomTableCell>Report Title</CustomTableCell>
                <CustomTableCell>Author</CustomTableCell>
                <CustomTableCell>Date created</CustomTableCell>
              </CustomTableRow>
            </CustomTableHead>
            <TableBody>
              {data.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map(report => {
                return (
                  <CustomTableRow key={report.id}>
                    <CustomTableCell>{report.id}</CustomTableCell>
                    <CustomTableCell component="th" scope="row">
                      {report.title}
                    </CustomTableCell>
                    <CustomTableCell padding="none" component="th" scope="row">
                      <ListItem>
                        <Avatar alt="Avatar image" src={report.userId.avatar}/>
                        <ListItemText>{report.userId.firstName}</ListItemText>
                      </ListItem>
                    </CustomTableCell>
                    <CustomTableCell component="th" scope="row">
                      {report.date}
                    </CustomTableCell>
                  </CustomTableRow>
                );
              })}
              {emptyRows > 0 && (
                <TableRow style={{ height: 48 * emptyRows }}>
                  <TableCell colSpan={6} />
                </TableRow>
              )}
            </TableBody>
            <TableFooter>
              <TableRow>
                <TablePagination
                  colSpan={3}
                  count={reportsList.length}
                  rowsPerPage={this.state.rowsPerPage}
                  page={this.state.page}
                  onChangePage={this.handleChangePage}
                  onChangeRowsPerPage={this.handleChangeRowsPerPage}
                  ActionsComponent={TablePaginationActionsWrapped}

                  // ActionsComponent={TablePaginationActionsWrapped} If not use this, my app work fine.
                />
              </TableRow>
            </TableFooter>

      </Paper>
    );
  }
}

DataTables.propTypes = {
  classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(DataTables);

And my TablePaginationActionsWrapped component:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import IconButton from '@material-ui/core/IconButton';
import { FirstPageIcon, KeyboardArrowLeft, KeyboardArrowRight, LastPageIcon } from '@material-ui/icons'

const actionsStyles = theme => ({
  root: {
    flexShrink: 0,
    color: theme.palette.text.secondary,
    marginLeft: theme.spacing.unit * 2.5,
  },
});

class TablePaginationActions extends Component {

  handleFirstPageButtonClick = event => {
    this.props.onChangePage(event, 0);
  };

  handleBackButtonClick = event => {
    this.props.onChangePage(event, this.props.page - 1);
  };

  handleNextButtonClick = event => {
    this.props.onChangePage(event, this.props.page + 1);
  };

  handleLastPageButtonClick = event => {
    this.props.onChangePage(
      event,
      Math.max(0, Math.ceil(this.props.count / this.props.rowsPerPage) - 1),
    );
  };

  render() {

    const { classes, count, page, rowsPerPage, theme } = this.props;

    return (

        <IconButton
          onClick={this.handleFirstPageButtonClick}
          disabled={page === 0}
          aria-label="First Page"
        >
          {theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
        </IconButton>
        <IconButton
          onClick={this.handleBackButtonClick}
          disabled={page === 0}
          aria-label="Previous Page"
        >
          {theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
        </IconButton>
        <IconButton
          onClick={this.handleNextButtonClick}
          disabled={page >= Math.ceil(count / rowsPerPage) - 1}
          aria-label="Next Page"
        >
          {theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
        </IconButton>
        <IconButton
          onClick={this.handleLastPageButtonClick}
          disabled={page >= Math.ceil(count / rowsPerPage) - 1}
          aria-label="Last Page"
        >
          {theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
        </IconButton>

    );
  }
}

TablePaginationActions.propTypes = {
  classes: PropTypes.object.isRequired,
  count: PropTypes.number.isRequired,
  onChangePage: PropTypes.func.isRequired,
  page: PropTypes.number.isRequired,
  rowsPerPage: PropTypes.number.isRequired,
  theme: PropTypes.object.isRequired,
};

const TablePaginationActionsWrapped = withStyles(actionsStyles, { withTheme: true })(
  TablePaginationActions,
);

export default TablePaginationActionsWrapped;

What did I'm wrong here. please help me.

A: There is only one issue. You are using wrong name for icon components. It is LastPage and FirstPage not LastPageIcon and FirstPageIcon. Just correct it, and it will work fine.
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { withStyles } from '@material-ui/core/styles'
import IconButton from '@material-ui/core/IconButton'
import { FirstPage, KeyboardArrowLeft, KeyboardArrowRight, LastPage } from '@material-ui/icons'

const actionsStyles = theme => ({
  root: {
    flexShrink: 0,
    color: theme.palette.text.secondary,
    marginLeft: theme.spacing.unit * 2.5
  }
})

class TablePaginationActions extends Component {
  handleFirstPageButtonClick = event => {
    this
      .props
      .onChangePage(event, 0)
  }

  handleBackButtonClick = event => {
    this
      .props
      .onChangePage(event, this.props.page - 1)
  }

  handleNextButtonClick = event => {
    this
      .props
      .onChangePage(event, this.props.page + 1)
  }

  handleLastPageButtonClick = event => {
    this
      .props
      .onChangePage(event, Math.max(0, Math.ceil(this.props.count / this.props.rowsPerPage) - 1))
  }

  render() {
    const { classes, count, page, rowsPerPage, theme } = this.props

    return (

        <IconButton
          onClick={this.handleFirstPageButtonClick}
          disabled={page === 0}
          aria-label='First Page'>
          {theme.direction === 'rtl'
            ? <LastPage/>
            : <FirstPage />}
        </IconButton>
        <IconButton
          onClick={this.handleBackButtonClick}
          disabled={page === 0}
          aria-label='Previous Page'>
          {theme.direction === 'rtl'
            ? <KeyboardArrowRight />
            : <KeyboardArrowLeft />}
        </IconButton>
        <IconButton
          onClick={this.handleNextButtonClick}
          disabled={page >= Math.ceil(count / rowsPerPage) - 1}
          aria-label='Next Page'>
          {theme.direction === 'rtl'
            ? <KeyboardArrowLeft />
            : <KeyboardArrowRight />}
        </IconButton>
        <IconButton
          onClick={this.handleLastPageButtonClick}
          disabled={page >= Math.ceil(count / rowsPerPage) - 1}
          aria-label='Last Page' />

    )
  }
}

TablePaginationActions.propTypes = {
  classes: PropTypes.object.isRequired,
  count: PropTypes.number.isRequired,
  onChangePage: PropTypes.func.isRequired,
  page: PropTypes.number.isRequired,
  rowsPerPage: PropTypes.number.isRequired,
  theme: PropTypes.object.isRequired
}

export default withStyles(actionsStyles, { withTheme: true })(TablePaginationActions)

Try replacing, it should work. You can check icon name from https://material.io/tools/icons/?icon=first_page&style=baseline. You just need to use it by converting it to Capital case. Like icon first_page becomes FirstPage in @material-ui/icons.


text:
Q: How do I enable continuations in Scala? Question says it all.
(Yet, the details of how to get access to the shift and reset operations has changed over the years. Old blog entries and Stack Overflow answers may have out of date information.)
See also What are Scala continuations and why use them? which talks about what you might want to do with shift and reset once you have them.

A: Non SBT solution:
scala -Xpluginsdir /.../scala/lib/ -P:continuations:enable

Works on scala 2.11.6, but the plugin/library said that it will no longer be included with Scala 2.12

A: Scala 2.11
The easiest way is to use sbt:
scalaVersion := "2.11.6"

autoCompilerPlugins := true

addCompilerPlugin(
  "org.scala-lang.plugins" % "scala-continuations-plugin_2.11.6" % "1.0.2")

libraryDependencies +=
  "org.scala-lang.plugins" %% "scala-continuations-library" % "1.0.2"

scalacOptions += "-P:continuations:enable"

In your code (or the REPL), do import scala.util.continuations._
You can now use shift and reset to your heart's content.
historical information for Scala 2.8, 2.9, 2.10
You have to start scala (or scalac) with the -P:continuations:enable flag.
In your code, do import scala.util.continuations._
You can now use shift and reset to your heart's content.
If you're using sbt 0.7, see https://groups.google.com/forum/#!topic/simple-build-tool/Uj-7zl9n3f4
If you're using sbt 0.11+, see https://gist.github.com/1302944
If you're using maven, see http://scala-programming-language.1934581.n4.nabble.com/scala-using-continuations-plugin-with-2-8-0-RC1-and-maven-td2065949.html#a2065949

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unwanted automatically changed MAC address almost every boot On a Windows 10 notebook since some weeks the MAC address of the integrated Intel 3165 Wifi card changes almost every (re)boot. I could not find settings to fix it.
Do you have an idea?

A: Try disabling Settings->Network & Internet->WiFi->"Random hardware addresses" and see if that fixes it.


text:
Q: how to print logback internal errors and status logs? I am using logback api and have a logback.xml in my classpath which looks like this
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration scan="true">

    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
        <resetJUL>true</resetJUL>
    </contextListener>
    <appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>
    <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILE">
        <file>/${path}/logs/application.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>/${path}/logs/application.%i.log</fileNamePattern>
        </rollingPolicy>
        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>50MB</maxFileSize>
        </triggeringPolicy>
        <encoder>
            <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
        </encoder>
    </appender>

<!--  ~~~ PERFORMANCE TRACKING LOGGER CONFIGURATION (USING PERF4J) || END ||~~~
  -->
    <logger name="com.nucleus">
        <level value="DEBUG"/>
        <!-- <appender-ref ref="STDOUT" />  -->
        <appender-ref ref="FILE"/>
    </logger>
    <logger level="DEBUG" name="org.hibernate.transaction.JDBCTransaction"/>
    <logger level="DEBUG" name="org.hibernate.jdbc.ConnectionManager"/>
    <logger level="DEBUG" name="org.springframework.orm.jpa.JpaTransactionManager"/>
    <!-- <root level="info">
        <appender-ref ref="FILE" />
    </root>  -->

</configuration>

Now the rollback that i have implemented is not working in the production environment only. I wish to debug the same and hence want to put a trace for this logback api. Can anyone suggest what i might be doing wrong or what should i do to resolve this issue?

A: From Logback 1.0.4 you can use system property -Dlogback.debug=true to enable debugging of your Logback setup which will allow you to debug your configuration.


text:
Q: No Ethernet even in macOS Recovery mode Catalina 10.5.7 on an iMac 27" 2020.
From one day to another the Ethernet connection to the router has stopped. It went from a green to a red dot.
Whatever I try the message stays always the same:
Either the cable for Ethernet is not plugged in or the device at the other end is not responding.
Checked the cable with a MacBook, no problem.
Checked all ports in the router with a MacBook, no problem.
Installed a "clean copy" of Catalina on an external drive and booted the iMac from the external drive: no Ethernet.
BUT: Booting a Macbook from the same external drive: Ethernet is alive
Tried also this: I started up from macOS Recovery on the iMac, using Recovery > MacOS Utilities > Get Help Online: Ethernet is not working there either. Only WiFi.
Conclusion:
damaged ethernet port on the iMac just like this?
Or is there a way to make Ethernet working again?
What else can I do?

A: Yes, according to your tests and observations it sounds like the Ethernet port in the iMac is physically damaged.
This could happen due to some sort of electrical issue such as a transient or similar spike of electricity. Perhaps it was lightning weather around the time it happened - perhaps it was a malfunction in the router - perhaps it was just tired hardware in the iMac.


text:
Q: Using different classes with the same name as a return type in a c# webservice I am creating a webservice that should return two complex types from the same class library that have the same class name (but live in different namespaces).
When I open the TestService.asmx in my browser I get an exception (see below).
Is there a way to fix this (other than renaming the classes of course :D )
I tried decorating my methods with
[WebMethod(MessageName="MyNamespace1.SomeClass")]

and with
[return: XmlElement("SomeClass1", Namespace = "http://tempuri.org/NameSpace1")]

-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace MyWebservice
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class TestService : System.Web.Services.WebService
    {

        public MyNamespace1.SomeClass GetSomeClass1()
        {
            return new MyNamespace1.SomeClass() { Name = "SomeClass1" };
        }

        public MyNamespace2.SomeClass GetSomeClass2()
        {
            return new MyNamespace2.SomeClass() { Name = "SomeClass1" };
        }

    }

}

namespace MyNamespace1
{
    public class SomeClass
    {
        public string Name { get; set; }
    }
}

namespace MyNamespace2
{
    public class SomeClass
    {
        public string Name { get; set; }
    }
}

throws this exception:
[InvalidOperationException: Die Typen 'MyNamespace2.SomeClass' und 'MyNamespace1.SomeClass' verwenden den XML-Typnamen 'SomeClass' im Namespace 'http://tempuri.org/'. Geben Sie mit XML-Attributen einen eindeutigen XML-Namen und/oder Namespace für den Typ an.]
   System.Xml.Serialization.XmlReflectionImporter.GetTypeMapping(String typeName, String ns, TypeDesc typeDesc, NameTable typeLib, Type type) +4071889
   System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) +150
   System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) +1604

A: Ok, I found the solution by trial and error.
The key is to combine the [return: XmlRoot...] and [return: XmlElement...]` decoration to make it work.
    [WebMethod]
    [return: XmlRoot(Namespace = "http://tempuri.org/Namespace1")]
    [return: XmlElement(Namespace = "http://tempuri.org/Namespace1",
        ElementName = "SomeClass")]
    public MyNamespace1.SomeClass GetSomeClass1()
    {
        return new MyNamespace1.SomeClass() { Name = "SomeClass1" };
    }

    [WebMethod]
    [return: XmlRoot(Namespace = "http://tempuri.org/Namespace2")]
    [return: XmlElement(Namespace = "http://tempuri.org/Namespace2",
        ElementName = "SomeClass")]
    public MyNamespace2.SomeClass GetSomeClass2()
    {
        return new MyNamespace2.SomeClass() { Name = "SomeClass1" };
    }

Update: This also applies to method parameters. Just change return: to param: and you're done. (You can't add the XmlRoot to params, but that's not necessary anyway.
    [WebMethod]
    public void AddSomeClass1([param: XmlElement(
        Namespace = "http://tempuri.org/Namespace1",
        ElementName = "SomeClass")] MyNamespace1.SomeClass class1)
    {

    }

    [WebMethod]
    public void AddSomeClass2([param: XmlElement(
        Namespace = "http://tempuri.org/Namespace2",
        ElementName = "SomeClass")] MyNamespace2.SomeClass class2)
    {

    }

A: try adding the following attribute above your classes
[XmlRoot(Namespace = "http://tempuri.org/SubNameSpace")]

With a different value for the sub namespace.

A: For the people, who want to know what the syntax for VB is (since I lost some time trying to find out what the equivalent to the return: statement is):
<WebMethod> _
Public Function GetSomeClass1() As <XmlRoot(Namespace:="http://tempuri.org/Namespace1"), XmlElement("SomeClass", Namespace:="http://tempuri.org/Namespace1")> MyNamespace1.SomeClass
    ' Return Stuff
End Function


text:
Q: Why showing it Cannot resolve method 'isHeavier()' in my code? Here is my code:
public class Main {
Book[] listOfBooks;
    public Main (Book p1, Book p2, Book p3, Book p4, Book p5){
        listOfBooks = new Book[5];
        listOfBooks[0] = p1;
        listOfBooks[1] = p2;
        listOfBooks[2] = p3;
        listOfBooks[3] = p4;
        listOfBooks[4] = p5;
    }

    int z=0;
    public int compareTo() {
        if(this.listOfBooks[0].numberOfPages > this.listOfBooks[1].numberOfPages) {
            z=1;
        } else if(this.listOfBooks[0].numberOfPages == this.listOfBooks[1].numberOfPages) {
            z=0;
        } else {
            z = -1;
        }
        return z;
    }
    boolean s = true;
    public boolean isHeavier() {
        for (int i = 0; i < listOfBooks.length; i++) {
            if (listOfBooks[i].numberOfPages > 500) {
                s = true;
            } else {
                s = false;
            }
        }
        return s;
    }

    public String displayAll() {
        String x= " " + listOfBooks[0].numberOfPages + " ";
        return x;
    }

    public static void main(String[] args) {
        Book p1 = new Book(3, "s", 400);
        Book p2 = new Book(4, "t", 500);
        Book p3 = new Book(5, "u", 600);
        Book p4 = new Book(6, "v", 700);
        Book p5 = new Book(7, "w", 200);

        Main m1 = new Main(p1, p2, p3, p4, p5);

        System.out.println(m1.compareTo());

        System.out.println(m1.displayAll());

        System.out.println(p1.numberOfPages.isHeavier());
    }
}
public class Book {
int ISBN;
String bookTitle;
int numberOfPages;
int count;

public Book() {
    this.ISBN = 0;
    this.bookTitle = null;
    this.numberOfPages = 0;
    this.count = 0;
}

public Book(int ISBN, String bookTitle, int numberOfPages) {
    this.ISBN = ISBN;
    this.bookTitle = bookTitle;
    this.numberOfPages = numberOfPages;
}

public int getCount() {
    return count;
}

public int getNumberOfPages() {
    return numberOfPages;
}

int z=0;
public int compareTo(int numberOfPages2) {
    if(this.numberOfPages>numberOfPages2) {
        z=1;
    } else if(this.numberOfPages == numberOfPages2) {
        z=0;
    } else {
        z = -1;
    }
    return z;
}

}
Why am I getting the error

Cannot resolve method 'isHeavier()'

IntelliJ told me to rename method name but it cannot be solving.
Same problem acquires no matter what I do.
I have edited my code.
I have added book class this time.
IntelliJ told me to rename method name but it cannot be solving.
Same problem acquires no matter what I do.
I have edited my code.
I have added book class this time.

A: While your example lacks the Book implementation, it is very likely that Book.numberOfPages() returns an integer and not a Book. This has no isHeavier() method, only Main has.
Without knowing anything from your code except your example, I think the most likely fix is: change System.out.println(p1.numberOfPages.isHeavier()); to System.out.println(m1.isHeavier());.


text:
Q: phpMyAdmin import Database that is missing! My sql database in phpMyAdmin is gone but i kept the files in the directory of xampp/mysql/data/mydatabase with extensions like .MYD .MYI .frm .opt...
the thing is when i try to open it in notepad++ to see the information they seem corrupted or damaged. Then i've tried to import these files directly to the database through phpMyAdmin, but again with no results because it's full of syntax errors...
Can someone tell me how to solve this?
Thanks in advance!

A: Back the files up (back up the entire directory structure just in case), recreate a database with the same name (destroying the files), stop mysql, replace the files, start mysql.
Make sure you keep your backup in case things go wrong!


text:
Q: Order of Browserify Transforms Trying to write some code that uses babelify and then brfs
var wiz = browserify(root, watchify.args);
wiz.transform(babelify, {
    modules: 'common',
    global: true,
    ignore: /\/node_modules\/angular|.json/
});
wiz.transform('brfs');

but no matter what order I put the transforms in, browserify complains about there being import/export syntax which should be already taken care of by babel
{ [SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (1:0) while parsing file: C:\Users\splee_000\Documents\GitHub\experimental-theatre\audience_client_src\root.js]

How do I make sure the brfs transform happens after babelify?

A: Global transforms are applied after non-global ones.
In your case you need to make brfs global too:
wiz.transform(require('brfs'), {global: true});


text:
Q: Processing json where the number of json array is dynamic I have a json response from php to ajax. The thing is depending on the value entered in a text box the number of json arrays vary. Example: sometimes it may return {"count1":10, "ccc1":30} and sometimes like this {"count1":10, "ccc1":32, "count2":40, "ccc2":123,"count3":32,"ccc3":21}. I extract the value in jquery this way:
success: function(response){
    var count = response.count1;
    //do something
}

But now since the number of counts are different I used a loop. Question is I can figure out how many of them I am receiving but how can I process them? The var count = response.count needs to be specific right? I cannot just concate any strings like this:
var count = 0;
while(something){
    count = count + 1;
    var str = "count"+count;
    var whatever = response.str;
}

So, can someone please help me with a suitable solution in this case?

A: Loop through all properties and add them in a variable like following.
var response = { "count1": 10, "ccc1": 32, "count2": 40, "ccc2": 123, "count3": 32, "ccc3": 21 };
var count = 0;
for (var prop in response) {
    if (prop.startsWith('count'))
        count += response[prop];
}
console.log(count);

A: You are on the right track there. Something like this should work for you.
var i = 1;
while(response['count' + i]) {
    var count = response['count' + i++];
}

You can access the properties as if they were array indices. so response['count'+i] works.

A: To retrieve all values use jQuery $.each function.

var data_tmp = '{"count1":10, "ccc1":32, "count2":40, "ccc2":123,"count3":32,"ccc3":21}';
var data = $.parseJSON(data_tmp);

 $.each(data, function(k,val){
  if(k.toLowerCase().indexOf("count") >= 0){
      $('.wr').append('
' + val + '
')
  }
});

A: success: function(response){
var count = response.count1;
    var object = JSON.parse(response);
    alert(object.length);
    for (i = 0; i < object.length; i++) {
        console.log(object[i]);
    }
}


text:
Q: Why does "a == x or y or z" always evaluate to True? How can I compare "a" to all of those? I am writing a security system that denies access to unauthorized users.
name = input("Hello. Please enter your name: ")
if name == "Kevin" or "Jon" or "Inbar":
    print("Access granted.")
else:
    print("Access denied.")

It grants access to authorized users as expected, but it also lets in unauthorized users!
Hello. Please enter your name: Bob
Access granted.

Why does this occur? I've plainly stated to only grant access when name equals Kevin, Jon, or Inbar. I have also tried the opposite logic, if "Kevin" or "Jon" or "Inbar" == name, but the result is the same.

This question is intended as the canonical duplicate target of this very common problem. There is another popular question How to test multiple variables for equality against a single value? that has the same fundamental problem, but the comparison targets are reversed. This question should not be closed as a duplicate of that one as this problem is encountered by newcomers to Python who might have difficulties applying the knowledge from the reversed question to their problem.

A: Summarising all existing answers
(And adding a few of my points)
Explanation :
if name == "Kevin" or "Jon" or "Inbar":

is logically equivalent to:
if (name == "Kevin") or ("Jon") or ("Inbar"):

Which, for user Bob, is equivalent to:
if (False) or ("Jon") or ("Inbar"):

NOTE : Python evaluates the logical value of any non-zero integer as True. Therefore, all Non-empty lists, sets, strings, etc. are evaluable and return True
The or operator chooses the first argument with a positive truth value.
Therefore, "Jon" has a positive truth value and the if block executes, since it is now equivalent to
if (False) or (True) or (True):

That is what causes "Access granted" to be printed regardless of the name input.
Solutions :
Solution 1 : Use multiple == operators to explicitly check against each value
if name == "Kevin" or name == "Jon" or name == "Inbar":
    print("Access granted.")
else:
    print("Access denied.")

Solution 2 : Compose a collection of valid values (a set, a list or a tuple for example), and use the in operator to test for membership (faster, preferred method)
if name in {"Kevin", "Jon", "Inbar"}:
    print("Access granted.")
else:
    print("Access denied.")

OR
if name in ["Kevin", "Jon", "Inbar"]:
    print("Access granted.")
else:
    print("Access denied.")

Solution 3 : Use the basic (and not very efficient) if-elif-else structure
if name == "Kevin":
    print("Access granted.")
elif name == "Jon":
    print("Access granted.")
elif name == "Inbar":
    print("Access granted.")
else:
    print("Access denied.")

A: There are 3 condition checks in if name == "Kevin" or "Jon" or "Inbar":

*

*name == "Kevin"

*"Jon"

*"Inbar"

and this if statement is equivalent to
if name == "Kevin":
    print("Access granted.")
elif "Jon":
    print("Access granted.")
elif "Inbar":
    print("Access granted.")
else:
    print("Access denied.")

Since elif "Jon" will always be true so access to any user is granted
Solution

You can use any one method below
Fast
if name in ["Kevin", "Jon", "Inbar"]:
    print("Access granted.")
else:
    print("Access denied.")

Slow
if name == "Kevin" or name == "Jon" or name == "Inbar":
    print("Access granted.")
else:
    print("Access denied.")

Slow + Unnecessary code
if name == "Kevin":
    print("Access granted.")
elif name == "Jon":
    print("Access granted.")
elif name == "Inbar":
    print("Access granted.")
else:
    print("Access denied.")

A: Not-empty lists, sets, strings, etc. are evaluable and, therefore, return True.
Therefore, when you say:
a = "Raul"
if a == "Kevin" or "John" or "Inbar":
    pass

You are actually saying:
if "Raul" == "Kevin" or "John" != "" or "Inbar" != "":
    pass

Since at least one of "John" and "Inbar" is not an empty string, the whole expression always returns True!
The solution:
a = "Raul"
if a == "Kevin" or a == "John" or a == "Inbar":
    pass

or:
a = "Raul"
if a in {"Kevin", "John", "Inbar"}:
    pass

A: In many cases, Python looks and behaves like natural English, but this is one case where that abstraction fails. People can use context clues to determine that "Jon" and "Inbar" are objects joined to the verb "equals", but the Python interpreter is more literal minded.
if name == "Kevin" or "Jon" or "Inbar":

is logically equivalent to:
if (name == "Kevin") or ("Jon") or ("Inbar"):

Which, for user Bob, is equivalent to:
if (False) or ("Jon") or ("Inbar"):

The or operator chooses the first operand that is "truthy", i.e. which would satisfy an if condition (or the last one, if none of them are "truthy"):
if "Jon":

Since "Jon" is truthy, the if block executes. That is what causes "Access granted" to be printed regardless of the name given.
All of this reasoning also applies to the expression if "Kevin" or "Jon" or "Inbar" == name. the first value, "Kevin", is true, so the if block executes.

There are two common ways to properly construct this conditional.

*

*Use multiple == operators to explicitly check against each value:
if name == "Kevin" or name == "Jon" or name == "Inbar":

*Compose a collection of valid values (a set, a list or a tuple for example), and use the in operator to test for membership:
if name in {"Kevin", "Jon", "Inbar"}:

In general of the two the second should be preferred as it's easier to read and also faster:
>>> import timeit
>>> timeit.timeit('name == "Kevin" or name == "Jon" or name == "Inbar"',
    setup="name='Inbar'")
0.4247764749999945
>>> timeit.timeit('name in {"Kevin", "Jon", "Inbar"}', setup="name='Inbar'")
0.18493307199999265

For those who may want proof that if a == b or c or d or e: ... is indeed parsed like this. The built-in ast module provides an answer:
>>> import ast
>>> ast.parse("a == b or c or d or e", "<string>", "eval")
<ast.Expression object at 0x7f929c898220>
>>> print(ast.dump(_, indent=4))
Expression(
    body=BoolOp(
        op=Or(),
        values=[
            Compare(
                left=Name(id='a', ctx=Load()),
                ops=[
                    Eq()],
                comparators=[
                    Name(id='b', ctx=Load())]),
            Name(id='c', ctx=Load()),
            Name(id='d', ctx=Load()),
            Name(id='e', ctx=Load())]))

As one can see, it's the boolean operator or applied to four sub-expressions: comparison a == b; and simple expressions c, d, and e.

A: Simple engineering problem, let's simply it a bit further.
In [1]: a,b,c,d=1,2,3,4
In [2]: a==b
Out[2]: False

But, inherited from the language C, Python evaluates the logical value of a non zero integer as True.
In [11]: if 3:
    ...:     print ("yey")
    ...:
yey

Now, Python builds on that logic and let you use logic literals such as or on integers, and so
In [9]: False or 3
Out[9]: 3

Finally
In [4]: a==b or c or d
Out[4]: 3

The proper way to write it would be:
In [13]: if a in (b,c,d):
    ...:     print('Access granted')

For safety I'd also suggest you don't hard code passwords.

A: Using match/case in Python 3.10 and above
Python 3.10 adds a new syntax to the language. It's officially described as "structural pattern matching", but most people call it according to the syntax: "match/case".

*

*Technical specification

*Motivation and rationale (i.e., why it was added, and what inspired the design)

*Official tutorial
We can use this special syntax for an example like in the question, by making one "case" that matches all the accepted usernames, and using the "wildcard" case _ in place of the else. Thus:
name = input("Hello. Please enter your name: ")
match name:
    case "Kevin" | "Jon" | "Inbar":
        print("Access granted.")
    case _:
        print("Access denied.")

Note that cases are "combined" using |, not or. This is a special syntax: Python does not try to compute "Kevin" | "Jon" | "Inbar" first (| doesn't work with strings), but instead interprets the entire line differently because it starts with case.

A: Besides some other rather rarer useful cases for the walrus operator already mentioned. This also tend to be a useful case as well.
def calc_value():
    return 43

if (v := calc_value()) == 43 and v > 42:
    print('happy short, efficient and readable code')

This works because each part of the if-statement is read separately. So (v := calc_value()) is executed and a value is assigned to v and if the first fails, you still have v in the namespace for different conditions or calculations.

A: Approaches
How a data scientist approaches this problem
The simplest way possible is to eliminate the need for comparison operators and use a list. This looks impressive on security systems because you learn to access ORMs.
user = input("Enter name: ")

if user in {"Bob", "Kevin", "Joe"}:
   print("Access granted, " + str(user) + ".")
else:
   print("Access denied.")

Or, you can resemble the exact same code above, just put the list of registered users in their own list:
user = input("Enter name: ")
users = {"Bob", "Kevin", "Joe", "a million more users if you like"}

if user in users:
   print("Access granted, " + str(user) + ".")
else:
   print("Access denied.")

If you wanted to complete this protocol safely without the risk of attack, set up double parameters. This would check your mini-ORM for first and last name fields, as well as a password or secret question key. Objects can be sorted like this if you want to efficiently lazy-load user credentials without hashing:
def lazy(i):
   j = 0 # For example
   while j < i:
      yield j
      j += 1

The loop will consume only the yielded values to save time and energy on your system:
You can then do something with the iterated list:
for j in lazy_range(10):
   do_something_here(j)

This problem can be approached from any angle: memory management, security, or simply by an organic list or packaged ORM.


text:
Q: How to show an additional single point on a line graph in Excel? I have a data set which shows the "efficient frontier" curve and a data point showing the decision made. I wish to have the data point be plotted in relation to the frontier but as an isolated point (the frontier is a curve/connected lines). I'm stumped as far as accomplishing this is concerned.
Here is a picture of the data set. I wish to have the point "My Choice" show up as a single point on the graph in relation to the frontier curve. Any way I can get the "My choice" point to be below the curve in the appropriate order?

A: Since your x-axis is not uniform, you should convert your chart to a scatter plot type (e.g., straight lines, no markers) from line graph.
Plot the single point as a separate series. You can then update the data for the single point and it will appear as a single point on the graph.


text:
Q: Convenient method for statically rendering 3d shapes into image files My basic problem is to generate 2d renders of 3d objects, such as one could accomplish with openGL or DirectX. However I have no interest in displaying the rendered objects to the screen, only to generate the shaded/ textured/ rotated images as bitmaps (not necessarily written to disk). This process is likely to be a problematic bottleneck in my design, so I would prefer to keep my solution as compact as possible (ie, don't waste the time sending the image to the screen), and would be most pleased if I could make use of hardware-accelerated rendering. Does anyone know of a convenient library or tool to help in this?
Right now I would prefer a C/C++ option, however speed is what I'm going for, so I'm willing to deal with ASM/ super optimized anything if it gets what I want the fastest.

A: What you need is a so called technique "rendering to texture". With OpenGL you can do it very easy. Take a look at example here: http://www.songho.ca/opengl/gl_fbo.html#example

A: You can do this using "render to texture"

This process is likely to be a problematic bottleneck in my design, so I would prefer to keep my solution as compact as possible (ie, don't waste the time sending the image to the screen)

If you want rendering to be fast, you want to use the GPU for this. Sending a image to the screen comes for free with those things. But reading an image back to the CPU memory, that is actually quite a bottleneck. But unavoidable in you case probably.


text:
Q: How to execute jobs in sequence? I my WebApi project I save information about recurring jobs in a database. One piece of information is the recurrence in the form of the standard RRULE.
I can convert the RRULE and the get the occurrence for the current date.
I need to use Quartz.Net to add these jobs (for the day) and then make them execute sequentially. I do not know which jobs might run.
Is is possible to achieve this with Quartz.Net?


text:
Q: Specify anything in brackets - vscode I have a file that contains texts and inside each text there is a number in parentheses
Is there a way in vscode to select all the numbers in parentheses and delete or replace them in an easy way, I can't do it manually because the scripts exceed 5000
image

A: You can use the search function in VS Code.

*

*Click on the magnifying glass, in the sidebar.

*toggle search details by clicking on the 3 dots in the search pane

*name your file in the files to include

*enable regular expression

*use a regular expression that fits your case, i.e \(\d+\)

*enter a replace text (or leave it empty to remove), in the second input and click replace all

You could also use sed to do that.
sed -E 's/\([0-9]+\)/(something else)/g' file.txt > newfile.txt


text:
Q: How to specify covariates that don't interact with factors when using rstatix package? When adding covariates to a between-subjects ANOVA model specified using rstatix package syntax, can one specify these covariates as having no interaction with the main effects?
For example, results from running the "RUN1" code below results in both main effects for the covariates (e.g., "CV1") but also interactions with the "Date" variable (e.g., "CV1:Date) displayed. However, some covariate interactions with the time variable may make no theoretical sense (for example, an individual's gender typically wouldn't change after 6 measurements 1 week apart), therefore, I would like to try and exclude these interactions from the model. "RUN2" and "RUN3" are some attempts so far to resolve this issue, but didn't work.
Does anybody know how this could be achieved?
My data:
MyData <- structure(list(ID = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 10L, 11L, 12L, 13L, 14L, 15L, 1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L), levels = c("5f609c2408813b0009898419",
"5f9aacf32ab79c000bb1d56e", "5f9feef22ab79c000bb264c8", "5fa48df02ab79c000bb2ec4a",
"5fa7d6c12ab79c000bb3495d", "5fac7ad22ab79c000bb3d6af", "6003785e2ab79c000978297b",
"6003a1132ab79c0009782c8e", "6007a18d2ab79c000978526d", "600b9db52ab79c000bcf6d2e",
"600e2b582ab79c000bcfeebe", "6010990c2ab79c000bd0698f", "6017a8992ab79c000b55eb27",
"601b29eb2ab79c000b57a8d1", "60ff895fadbe1d0009fd07b2"), class = "factor"),
    Date = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
    3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L), levels = c("1", "2", "3"), class = "factor"),
    MeanValue = c(1.57142857142857, 3, 0.857142857142857, 1.28571428571429,
    1.42857142857143, 1, 0.714285714285714, 0.142857142857143,
    1.71428571428571, 0.285714285714286, 1.14285714285714, 1,
    1.42857142857143, 0.428571428571429, 1.14285714285714, 1.14285714285714,
    2.71428571428571, 1, 1.71428571428571, 0.857142857142857,
    1.71428571428571, 0.857142857142857, 0.571428571428571, 1.57142857142857,
    2.14285714285714, 1, 1.28571428571429, 1.71428571428571,
    2.57142857142857, 3, 1.14285714285714, 2.57142857142857,
    1.14285714285714, 1.42857142857143, 1.57142857142857, 1.57142857142857,
    0.571428571428571, 0.142857142857143, 2.14285714285714, 0.428571428571429,
    0.714285714285714, 0.714285714285714, 1.28571428571429, 3,
    0.714285714285714), CV1 = c(43, 56, 73, 43, 49, 52, 52, 33,
    35, 45, 51, 60, 45, 44, 59, 43, 56, 73, 43, 49, 52, 52, 33,
    35, 45, 51, 60, 45, 44, 59, 43, 56, 73, 43, 49, 52, 52, 33,
    35, 45, 51, 60, 45, 44, 59), CV2 = c("1", "2", "2", "1",
    "1", "2", "2", "2", "2", "2", "2", "1", "1", "2", "1", "1",
    "2", "2", "1", "1", "2", "2", "2", "2", "2", "2", "1", "1",
    "2", "1", "1", "2", "2", "1", "1", "2", "2", "2", "2", "2",
    "2", "1", "1", "2", "1"), CV3 = c(0, 1, 1, 1, 0, 1, 0, 0,
    0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1,
    1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0), CV4 = c(5,
    5, 1, 1, 2, 5, 5, 4, 5, 5, 3, 5, 5, 5, 5, 5, 5, 1, 1, 2,
    5, 5, 4, 5, 5, 3, 5, 5, 5, 5, 5, 5, 1, 1, 2, 5, 5, 4, 5,
    5, 3, 5, 5, 5, 5), CV5 = c(0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
    1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
    1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), CV6 = c(0,
    1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0,
    1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1,
    0, 0, 1, 0, 1, 1)), row.names = c(NA, -45L), class = c("tbl_df",
"tbl", "data.frame"))

And the commands I ran:
# Load packages
library(tidyverse)
library(rstatix)

# RUN1: between subjects ANOVA using rstatix
res.aov <- anova_test(data = MyData, dv = MeanValue, wid = ID, within = Date,
                      covariate=c("CV1","CV2",
                                  "CV4","CV5"))
get_anova_table(res.aov)

# RUN2: specify formula
res.aov <- anova_test(data = MyData, dv = MeanValue, wid = ID, within = Date,
                      formula = MeanValue ~ Date + Error(ID/Date),
                      covariate=c("CV1","CV2",
                                  "CV4","CV5"))
get_anova_table(res.aov)

# RUN3: specify formula adding covariates directly in
res.aov <- anova_test(data = MyData, dv = MeanValue, wid = ID, within = Date,
                      formula = MeanValue ~ Date + CV1 + CV2 + CV4 + CV5 + Error(ID/Date))
get_anova_table(res.aov)


text:
Q: jQuery MVC architecture what is the best way to create MVC architecture in jQuery?
Should I use jQuery.extend()?
jQuery.extend({
  View: function(){}
});

...or jQuery Plugin?
(function($) {

  $.fn.model = function() { return this; };

})(jQuery);

...or just objects in JavaScript?
var model = {}
var view = {}
var controller = {}

Thank you!

A: Just use objects in javascript. The view can contain all the knowledge of things like jquery and other UI concerns, while the controller/model can deal with other logic and communication with the server (assuming ajax). I wrote a blog post about this:
MVC Pattern with Javascript

A: Here is a great approach using jQuery.extend: http://welcome.totheinter.net/tutorials/model-view-controller-in-jquery/


text:
Q: How can I update HTTP custom headers in IIS6 using Powershell? I have the following Powershell script which uses WMI to update the HTTP custom headers on a website in IIS 6.
The script seems to work fine, no errors generated, and the resultant $website object correctly shows the updated HttpCustomHeaders value.  When I look at that site in IIS, though, the values have not been updated.  This is also verified by visiting the site and looking at the headers in Firebug - the values are not saved.
Any ideas what I'm doing wrong?
$website = Get-WmiObject -Class IIsWebServerSetting -Namespace "root\microsoftiisv2" -ComputerName $computerName -filter "ServerComment = '$websiteName'" -Authentication 6

$headers = $webSite.HttpCustomHeaders
$headers[0].Keyname = 'P3P: policyref="http://somewebsite.com/p3p.xml", CP="IDC DSP COR CUR DEV PSA IVA IVD CONo HIS TELo OUR DEL UNRo BUS UNI"'
$headers[0].Value = $null
$website.HttpCustomHeaders = $headers
$website.Put()

I'm more than open to an alternative script that provides a better way of setting this value as above assumes there is already at least one header present.
I've also tried Set-WmiInstance -InputObject $website instead of $website.Put() but that made no difference.

A: Your code example saves the value to the metabase but it saves to the root object (w3svc/1) instead of the root vdir (w3svc/1/root).
Here's what will work in place of what you have:
$website = Get-WmiObject -Class IIsWebServerSetting -Namespace "root\microsoftiisv2" -ComputerName $computerName -filter "ServerComment = '$websiteName'" -Authentication 6

$path = $website.name + '/root'
$vdir = [wmi]"root\MicrosoftIISv2:IIsWebVirtualDirSetting='$path'"

$headers = $vdir.HttpCustomHeaders
$headers[0].Keyname = 'P3P: policyref="http://somewebsite.com/p3p.xml", CP="IDC DSP COR CUR DEV PSA IVA IVD CONo HIS TELo OUR DEL UNRo BUS UNI"'
$headers[0].Value = $null
$vdir.HttpCustomHeaders = $headers
$vdir.Put()

However, one more thing to watch for is that that replaces the first value rather than adding a new value.  I'm out of time today to figure out how to do with with my limited PowerShell expertise, but it's going to be something along the lines of:
$bindingClass = [wmiclass]'root\MicrosoftIISv2:HttpCustomHeader'
$newheader = $bindingClass.CreateInstance()
$newheader.KeyName = "New Value"
$newheader.Value = $null

$headers += $header

There's a casting error so it's not quite right, but hopefully that points you in the right direction.

A: Try outputting the current value first while you're testing.  Then you can know that you properly bound to the site that you expected.  For example, for the line after $headers=, do a Write-Host $headers[0].Keyname. Or do a Write-Host $webSite.ServerComment.
Basically, narrow it down to make sure that you have a handle on the correct website.
Also, I don't now PowerShell as well as I should at this point, but can you edit [0] and have it 'add' an entry?  I bet that you need to do something else to actually add a value to an array.


text:
Q: Code Analysis is not working with ruleset from nuget package (from .props) I'm trying to use custom ruleset file form our nuget package. I've added to the build folder of the package .props file:
<Project>
  <PropertyGroup>
    <CodeAnalysisRuleSet>
      $(MSBuildThisFileDirectory)..\My.Shared.ruleset
    </CodeAnalysisRuleSet>
    <RunCodeAnalysis>true</RunCodeAnalysis>
  </PropertyGroup>
</Project>

Rule set file is in the package root folder, the paths are correct, it's adding import of the .props file into csproj file.
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\My.Shared.Rulesets.1.0.0.7118\build\My.Shared.Rulesets.props" Condition="Exists('..\packages\My.Shared.Rulesets.1.0.0.7118\build\My.Shared.Rulesets.props')" />
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  ...

But Visual Studio is not seeing correct rule set. When I open active rule set from References -> Analyzers, it's pointing to different file: MinimumRecommendedRules.ruleset and it's using rules from this file not my custom one.

*

*Visual Studio Comunity 2017 Version 15.5.0

*Project Target framework 4.6.1

A:
Code Analysis is not working with ruleset from nuget package (from .props)

You should set the Rule set file in the content folder in the package folder, so that VS/MSBuild will add this file to your project, then VS\MSBuild could change the default MinimumRecommendedRules.ruleset to your My.Shared.ruleset.ruleset file.
For example, your NuGet source folder structure might look like this ("My.Shared.ruleset" is your package ID):

*

*build

*

*My.Shared.ruleset.props

*content

*

*My.Shared.ruleset.ruleset

where the contents of My.Shared.ruleset.props are something like the following:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <RunCodeAnalysis>true</RunCodeAnalysis>
        <CodeAnalysisRuleSet>My.Shared.Rulesets.ruleset</CodeAnalysisRuleSet>
    </PropertyGroup>
</Project>

Step to create nuget package:

*

*Open NuGet Package Explorer, select new a package, Edit->Edit
Metadata, change Id to My.Shared.Rulesets->Save.

*Content->Add->Content Folder->Add Existing file->Select your My.Shared.Rulesets.ruleset

*Content->Add->Build Folder->Add Existing file->Select your My.Shared.ruleset.props->Save.

Then add this package to the test project:

Then you will find the active ruleset was changed to the one from nuget package.
Update for comment:

We were trying to avoid copying ruleset file to each project. Developers tend to change it and push to repository

If you do not want to copy ruleset file to each project, you just need to change the path in the .props file, but you should make sure the path is correct in the .props file, for example. I set the .ruleset file in the local path: D:\ShareFolder\My.Shared.Rulesets.ruleset, then move the .ruleset from the nuget package and change the path to D:\ShareFolder\My.Shared.Rulesets.ruleset in the .props.

Hope this helps.


text:
Q: Interpretation of "She didn't come home because it was raining." How do native speakers interpret the setence if you hear (not read) it? If my understanding is correct, it can be interpreted in two ways as below.

*

*She didn't come home, because it was raining.

*She came home, but it is not because it was raining.

If it is written, then punctuation (with or without a comma before "because") is a key to figure out, but what if it is spoken? I understand the meaning can vary depending on the context, but what if the context does not give you any clear clues?

A: I would interpret it as 1. I would most likely hear this as a cause and effect.
The effect:

*

*"She didn't come home"

The Cause:

*

*"it was raining"

"because" is what gives me the clue that everything after "because" caused everything before "because".

A: You're right that in written form, the comma makes a big difference in interpretation:

*

*She didn't come home, because it was raining.This means that she didn't come home, and the reason she didn't come home was because it was raining.It's the same as if there were two difference sentences, or if the sentence was reversed:She didn't come home. Because it was raining.Because it was raining, she didn't come home.

*She didn't come home because it was raining.This means that the reason she didn't come home was because of something other than the fact that it was raining:She didn't come home because it was raining, but because she remembered she'd left the stove on.

In verbal communication, there are generally two indicators that distinguish between the two versions:

*

*In the first version, there is a slight pause in speech between home and because. Normally, there is a 1–1 correspondence between a written comma and a verbal pause—although this is not always the case. The pause can also be shown by making it two complete sentences.

*In the second version, if the reason is not the rain itself, emphasis will commonly be put on the word because or the word raining—although that is also not always the case:She didn't come home because it was raining.She didn't come home because it was raining.
If there is neither pause nor emphasis to signal the meaning, then it's only possible to infer the meaning from context. But if that's not possible, then the only recourse is to ask the person what they meant.


text:
Q: Laravel 4 content yielded before layout I am using a fresh build today of Laravel 4.
I have a dashboardController
class DashboardController extends BaseController {

protected $layout = 'layouts.dashboard';

public function index()
    {
        $this->layout->content = View::make('dashboard.default');
    }

}

I have a simple route
Route::get('/', 'DashboardController@index');

I have a blade layout in views/layouts/dashboard.blade.php
For the sake of saving everyone from all of the actual HTML ill use a mock up.

  <title></title>

@yield('content')

I have a default blade file in views/dashboard/ that has the following (edited for simplicity)
@section('content')

This is not rocket science

@stop

For some reason the content gets generated before the layout.

A: I am using a different approach to set the layouts globally to routes using a custom filter. Put the following filter into the app/filters.php
Route::filter('theme', function($route, $request, $response,  $layout='layouts.default')
{
    // Redirects have no content and errors should handle their own layout.
    if ($response->getStatusCode() > 300) return;

    //get original view object
    $view = $response->getOriginalContent();

    //we will render the view nested to the layout
    $content = View::make($layout)->nest('_content',$view->getName(), $view->getData())->render();

    $response->setContent($content);
});

and now instead of setting layout property in the controller class, you can group the routes and apply the filter as shown below.
Route::group(array('after' => 'theme:layouts.dashboard'), function()
{

    Route::get('/admin', 'DashboardController@getIndex');

    Route::get('/admin/dashboard', function(){ return View::make('dashboard.default'); });

});

When creating the views, make sure to use the @section('sectionName') in all the sub views and use @yield('sectionName') in the layout views.

A: I find it easier to do my layout like this for example. I would create my master blade file like so

      @yield('content');

layout->..., then you get access to data as variables, not sections.  So to access content in your layout you should use...

  <title></title>

  <?php echo $content; ?>

And in your partial, you would not use @section or @stop...

This is not rocket science


text:
Q: How to wait for a grunt task to complete before running mocha tests In a nutshell...
I have some grunt tasks with external configs that I want to test (make sure they do what they're supposed to do). So I'd like to write a mocha test running the tasks in the before function and asserting everything went well.
...and with some details
In my gruntfile there is something like
# Load task configs from `grunt` dir.
configs = require('load-grunt-configs') grunt,
    config:
        src: ['tasks/*{.js,.json,.coffee,.cson}']

# Load all **grunt tasks** with patter `grunt-*`
require('load-grunt-tasks') grunt, pattern: [
    'grunt-*'
]

# Pass configs to grunt
grunt.initConfig configs

and afterwards some task registration...
However I now have access to my less task residing as a less.cson in my tasks folder
(which uses grunt-contrib-less).
So far so good. :)
I'm using chai for assertions:
describe('Checking static resources for dev', function () {

    describe('less task', function () {

        before(function () {
            grunt.task.run('less');
        });

        it('should have a compiled css file for docs', function () {
            grunt.file.isFile('public/css/docs.css').should.be.ok;
            grunt.file.isFile('public/css/docs.css.map').should.be.ok;
        });

As expected, the task completes after the tests were run since it's not async and I don't know a way to tell grunt (without modifying the existing task/config) that it should call a possible done function when ready and then make the assertion.
I also tried grunt-run-task but could not manage to run any task (they abort with a timeout although I gave them more than 20 seconds to complete).
Guess I'm looking for something like
before(function (done) {
    grunt.task.run('less', done);
});

Anyone some advice?


text:
Q: Qt Application: VERIFIER STOP 00000013: First chance access violation for current stack trace Since one week my Qt Application does not work. I was not familiar with this heap corruption, access violation etc. stuff. Now I know it "hurts" terribly,-)
Meanwhile I installed the application verifier. I'm using VS2010, Qt 4.8.4, qwt 6.0.0. Now I reduced the GUI class to its minimum and still got a access violation via application verifier. This is the GUI code:
#include "mygui.h"
#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MYGUI w;
    w.show();
    return a.exec();
}

mygui.h:
#ifndef PFEGUI_H
#define PFEGUI_H

#include <QtGui/QMainWindow>
#include "ui_mygui.h"

#include <myengine.hpp>

class MYGUI : public QMainWindow
{
    Q_OBJECT

public:
    MYGUI(QWidget *parent = 0, Qt::WFlags flags = 0);
    ~MYGUI();

    Ui::MYGUIClass ui;

private:
    boost::shared_ptr<MYengine> myEngine_;
    boost::shared_ptr<QMenu> treeWidgetMenu_;
    boost::shared_ptr<QAction> treeWidgetMenuDeleteAction_;

};

mygui.cpp:
#include "mygui.h"

MYGUI::MYGUI(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags)
{
    ui.setupUi(this);
    myEngine_ = boost::shared_ptr<MYengine>(new MYengine());
}

MYGUI::~MYGUI() {}

and the large autogenerated ui_mygui.h (because of the character limitation I skipped some part in the middle):
/********************************************************************************
** Form generated from reading UI file 'mygui.ui'
**
** Created: Thu 11. Apr 22:55:21 2013
**      by: Qt User Interface Compiler version 4.8.4
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_MYGUI_H
#define UI_MYGUI_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QDateEdit>
#include <QtGui/QDoubleSpinBox>
#include <QtGui/QFormLayout>
#include <QtGui/QFrame>
#include <QtGui/QGridLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLCDNumber>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QProgressBar>
#include <QtGui/QPushButton>
#include <QtGui/QRadioButton>
#include <QtGui/QScrollArea>
#include <QtGui/QSlider>
#include <QtGui/QSpacerItem>
#include <QtGui/QSpinBox>
#include <QtGui/QStackedWidget>
#include <QtGui/QStatusBar>
#include <QtGui/QTabWidget>
#include <QtGui/QTextBrowser>
#include <QtGui/QToolBar>
#include <QtGui/QTreeWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
#include "qwt_plot.h"

QT_BEGIN_NAMESPACE

class Ui_MYGUIClass
{
public:
    QWidget *centralWidget;
    QTabWidget *tabWidgetMYGUI;
    QWidget *tab;
    QWidget *layoutWidget;
    QVBoxLayout *verticalLayout;
    QPushButton *pushButtonSzenarienBerechnen;
    QPushButton *pushButtonMYBerechnen;
    QWidget *layoutWidget1;
    QVBoxLayout *verticalLayout_2;
    QHBoxLayout *horizontalLayout_4;
    QProgressBar *progressBarMY;
    QLCDNumber *lcdNumberWatch;
    QScrollArea *scrollAreaOutput;
    QWidget *scrollAreaWidgetContents;
    QGridLayout *gridLayout_6;
    QTextBrowser *textBrowserOutput;
    QWidget *tab_2;
    QGroupBox *groupBox_2;
    QGridLayout *gridLayout_5;
    QGridLayout *gridLayout_4;
    QPushButton *pushButtonPortfolioPfeBerechnen;
    QTreeWidget *treeWidgetPortfolioSimPort;
    QGroupBox *groupBox_3;
    QGridLayout *gridLayout_2;
    QHBoxLayout *horizontalLayout_10;
    QLabel *label_4;
    QComboBox *comboBoxPortfolioCtpNumbers;
    QHBoxLayout *horizontalLayout_11;
    QPushButton *pushButtonPortfolioShowCtp;
    QPushButton *pushButtonPortfolioAddCtp;
    QPushButton *pushButtonPortfolioAddAll;
    QGroupBox *groupBox_5;
    QGridLayout *gridLayout_10;
    QStackedWidget *stackedWidgetPortfolioAddDeal;
    QWidget *pageVanillaSwap;
    QGridLayout *gridLayout_11;
    QHBoxLayout *horizontalLayout_5;
    QRadioButton *radioButtonPortfolioPayer;
    QRadioButton *radioButtonPortfolioReceiver;
    QHBoxLayout *horizontalLayout_9;
    QLabel *label_19;
    QSpacerItem *horizontalSpacer_2;
    QDoubleSpinBox *doubleSpinBoxPortfolioFixRate;
    QHBoxLayout *horizontalLayout_6;
    QLabel *label_8;
    QSpacerItem *horizontalSpacer;
    QComboBox *comboBoxPortfolioIndices;
    QFormLayout *formLayout;
    QLabel *label_15;
    QComboBox *comboBoxPortfolioFixFreq;
    QLabel *label_16;
    QComboBox *comboBoxPortfolioFloatFreq;
    QFormLayout *formLayout_2;
    QLabel *label_18;
    QComboBox *comboBoxPortfolioFixDC;
    QLabel *label_20;
    QComboBox *comboBoxPortfolioFloatDC;
    QSpacerItem *verticalSpacer;
    QWidget *pagefxproducts;
    QGridLayout *gridLayout_12;
    QSpacerItem *verticalSpacer_2;
    QHBoxLayout *horizontalLayout_16;
    QLabel *label_21;
    QDoubleSpinBox *doubleSpinBoxPortfolioFxSpot;
    QHBoxLayout *horizontalLayout_14;
    QLabel *label_13;
    QDoubleSpinBox *doubleSpinBoxPortfolioForwardRate;
    QHBoxLayout *horizontalLayout_13;
    QLabel *label_12;
    QComboBox *comboBoxPortfolioCurrencyPairs;
    QHBoxLayout *horizontalLayout_8;
    QLabel *label_11;
    QSpinBox *spinBoxPortfolioNominal2;
    QLabel *labelPortfolioCurrency2;
    QComboBox *comboBoxPortfolioBuySell;
    QHBoxLayout *horizontalLayout_7;
    QLabel *label_10;
    QSpacerItem *horizontalSpacer_3;
    QLineEdit *lineEditPortfolioDealMaturity;
    QSpacerItem *horizontalSpacer_6;
    QDateEdit *dateEditPortfolioEndDate;
    QHBoxLayout *horizontalLayout_12;
    QLabel *label_9;
    QSpacerItem *horizontalSpacer_5;
    QDateEdit *dateEditPortfolioStartDate;
    QHBoxLayout *horizontalLayout_2;
    QLabel *label_6;
    QComboBox *comboBoxPortfolioInstrumentNames;
    QHBoxLayout *horizontalLayout_3;
    QLabel *label_7;
    QSpinBox *spinBoxPortfolioNominal;
    QComboBox *comboBoxPortfolioCurrencies;
    QPushButton *pushButtonPortfolioAddDeal;
    QHBoxLayout *horizontalLayout;
    QLabel *label_14;
    QSpacerItem *horizontalSpacer_4;
    QComboBox *comboBoxPortfolioAddDealCtpNumbers;
    QFrame *line;
    QHBoxLayout *horizontalLayout_15;
    QLabel *label_17;
    QLineEdit *lineEditPortfolioNPV;
    QPushButton *pushButtonPortfolioCalculateNPV;
    QComboBox *comboBoxPortfolioCtpNumbers_2;
    QWidget *tab_3;
    QwtPlot *qwtPlot;
    QWidget *layoutWidget_2;
    QHBoxLayout *horizontalLayout_18;
    QLabel *label_23;
    QComboBox *comboBoxAnalysisContractNumbers;
    QWidget *layoutWidget_3;
    QHBoxLayout *horizontalLayout_19;
    QLabel *label_24;
    QComboBox *comboBoxAnalysisCompNumbers;
    QPushButton *pushButtonAnalysisPlotCtp;
    QPushButton *pushButtonAnalysisPlotContract;
    QPushButton *pushButtonAnalysisPlotComp;
    QWidget *layoutWidget2;
    QHBoxLayout *horizontalLayout_17;
    QLabel *label_22;
    QComboBox *comboBoxAnalysisCtpNumbers;
    QCheckBox *checkBoxAnalysisSimulationPaths;
    QCheckBox *checkBoxAnalysisStatisticCurves;
    QGroupBox *groupBox_11;
    QWidget *layoutWidget3;
    QHBoxLayout *horizontalLayout_39;
    QRadioButton *radioButtonAnalysisBarStyle;
    QRadioButton *radioButtonAnalysisTubeStyle;
    QGroupBox *groupBox_12;
    QWidget *layoutWidget4;
    QHBoxLayout *horizontalLayout_20;
    QLabel *label_25;
    QSpinBox *spinBoxAnalysisSimStep;
    QLabel *label_26;
    QDateEdit *dateEditAnalysisChoosenDate;
    QPushButton *pushButtonAnalysisShowMarketData;
    QWidget *tab_7;
    QwtPlot *qwtPlot_2;
    QGroupBox *groupBox_6;
    QSpinBox *spinBoxAnalysisSimStep_2;
    QPushButton *pushButton;
    QPushButton *pushButton_2;
    QPushButton *pushButton_3;
    QPushButton *pushButton_4;
    QWidget *OptionsTab;
    QGroupBox *groupBox;
    QWidget *layoutWidget5;
    QGridLayout *gridLayout;
    QLabel *label;
    QSpinBox *spinBoxSimSteps;
    QSlider *horizontalSliderSimSteps;
    QLabel *label_2;
    QSpinBox *spinBoxForwardSteps;
    QSlider *horizontalSliderSimSteps_2;
    QLabel *label_3;
    QDoubleSpinBox *spinBoxJumpProb;
    QGroupBox *groupBox_4;
    QLabel *label_5;
    QLineEdit *lineEditSettingsInstrumentFile;
    QPushButton *pushButtonSettingsInstFileBrowse;
    QTextBrowser *textBrowserPortfolioCtpTrades;
    QStackedWidget *stackedWidget_2;
    QWidget *page_3;
    QWidget *page_4;
    QMenuBar *menuBar;
    QMenu *menuOptions;
    QToolBar *mainToolBar;
    QStatusBar *statusBar;
    QButtonGroup *buttonGroup_2;

    void setupUi(QMainWindow *MYGUIClass)
    {
        if (MYGUIClass->objectName().isEmpty())
            MYGUIClass->setObjectName(QString::fromUtf8("MYGUIClass"));
        MYGUIClass->resize(1538, 777);
        centralWidget = new QWidget(MYGUIClass);
        centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
        tabWidgetMYGUI = new QTabWidget(centralWidget);
        tabWidgetMYGUI->setObjectName(QString::fromUtf8("tabWidgetMYGUI"));
        tabWidgetMYGUI->setGeometry(QRect(11, 0, 1521, 751));
        tabWidgetMYGUI->setIconSize(QSize(16, 16));
        tab = new QWidget();
        tab->setObjectName(QString::fromUtf8("tab"));
        layoutWidget = new QWidget(tab);
        layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
        layoutWidget->setGeometry(QRect(10, 50, 401, 62));
        verticalLayout = new QVBoxLayout(layoutWidget);
        verticalLayout->setSpacing(6);
        verticalLayout->setContentsMargins(11, 11, 11, 11);
        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
        verticalLayout->setContentsMargins(0, 0, 0, 0);
        pushButtonSzenarienBerechnen = new QPushButton(layoutWidget);
        pushButtonSzenarienBerechnen->setObjectName(QString::fromUtf8("pushButtonSzenarienBerechnen"));
        pushButtonSzenarienBerechnen->setEnabled(true);
        QFont font;
        font.setPointSize(12);
        font.setBold(true);
        font.setWeight(75);
        pushButtonSzenarienBerechnen->setFont(font);
        pushButtonSzenarienBerechnen->setCheckable(false);

        verticalLayout->addWidget(pushButtonSzenarienBerechnen);

        pushButtonMYBerechnen = new QPushButton(layoutWidget);
        pushButtonMYBerechnen->setObjectName(QString::fromUtf8("pushButtonMYBerechnen"));
        pushButtonMYBerechnen->setEnabled(true);
        pushButtonMYBerechnen->setFont(font);
        pushButtonMYBerechnen->setCheckable(false);

        verticalLayout->addWidget(pushButtonMYBerechnen);

        verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);

        gridLayout_11->addItem(verticalSpacer, 4, 0, 1, 1);

        stackedWidgetPortfolioAddDeal->addWidget(pageVanillaSwap);
        pagefxproducts = new QWidget();
        pagefxproducts->setObjectName(QString::fromUtf8("pagefxproducts"));
        gridLayout_12 = new QGridLayout(pagefxproducts);
        gridLayout_12->setSpacing(6);
        gridLayout_12->setContentsMargins(11, 11, 11, 11);
        gridLayout_12->setObjectName(QString::fromUtf8("gridLayout_12"));
        verticalSpacer_2 = new QSpacerItem(20, 80, QSizePolicy::Minimum, QSizePolicy::Expanding);

// Tons of other autogenerated stuff are deleted here

        QTreeWidgetItem *___qtreewidgetitem = treeWidgetPortfolioSimPort->headerItem();
        ___qtreewidgetitem->setText(9, QApplication::translate("MYGUIClass", "MY Exposure", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(8, QApplication::translate("MYGUIClass", "MY Date", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(7, QApplication::translate("MYGUIClass", "MY", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(6, QApplication::translate("MYGUIClass", "Maturity", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(5, QApplication::translate("MYGUIClass", "int. NPV", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(4, QApplication::translate("MYGUIClass", "ext. NPV", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(3, QApplication::translate("MYGUIClass", "Comp Id", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(2, QApplication::translate("MYGUIClass", "Contract Id", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(1, QApplication::translate("MYGUIClass", "Ctp Id", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(0, QApplication::translate("MYGUIClass", "Kategorie", 0, QApplication::UnicodeUTF8));
        groupBox_3->setTitle(QApplication::translate("MYGUIClass", "Add Counterparty", 0, QApplication::UnicodeUTF8));
        label_4->setText(QApplication::translate("MYGUIClass", "Counterparty number", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
        pushButtonPortfolioShowCtp->setToolTip(QApplication::translate("MYGUIClass", "
Kundenportfolio anzeigen...
", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
        pushButtonPortfolioShowCtp->setText(QApplication::translate("MYGUIClass", "Show", 0, QApplication::UnicodeUTF8));
        pushButtonPortfolioAddCtp->setText(QApplication::translate("MYGUIClass", "Add", 0, QApplication::UnicodeUTF8));
        pushButtonPortfolioAddAll->setText(QApplication::translate("MYGUIClass", "Add all", 0, QApplication::UnicodeUTF8));
        groupBox_5->setTitle(QApplication::translate("MYGUIClass", "Add Deal", 0, QApplication::UnicodeUTF8));
        radioButtonPortfolioPayer->setText(QApplication::translate("MYGUIClass", "Payer", 0, QApplication::UnicodeUTF8));
        radioButtonPortfolioReceiver->setText(QApplication::translate("MYGUIClass", "Receiver", 0, QApplication::UnicodeUTF8));
        label_19->setText(QApplication::translate("MYGUIClass", "Fix Rate (in %)", 0, QApplication::UnicodeUTF8));
        label_8->setText(QApplication::translate("MYGUIClass", "Index", 0, QApplication::UnicodeUTF8));
        label_15->setText(QApplication::translate("MYGUIClass", "Fix Freq", 0, QApplication::UnicodeUTF8));
        label_16->setText(QApplication::translate("MYGUIClass", "Float Freq", 0, QApplication::UnicodeUTF8));
        label_18->setText(QApplication::translate("MYGUIClass", "Fix DC", 0, QApplication::UnicodeUTF8));
        label_20->setText(QApplication::translate("MYGUIClass", "Float DC", 0, QApplication::UnicodeUTF8));
        label_21->setText(QApplication::translate("MYGUIClass", "Spot", 0, QApplication::UnicodeUTF8));
        label_13->setText(QApplication::translate("MYGUIClass", "Forward rate", 0, QApplication::UnicodeUTF8));
        label_12->setText(QApplication::translate("MYGUIClass", "Currency pair", 0, QApplication::UnicodeUTF8));
        label_11->setText(QApplication::translate("MYGUIClass", "Notional 2", 0, QApplication::UnicodeUTF8));
        spinBoxPortfolioNominal2->setSuffix(QString());
        labelPortfolioCurrency2->setText(QApplication::translate("MYGUIClass", "USD", 0, QApplication::UnicodeUTF8));
        label_10->setText(QApplication::translate("MYGUIClass", "Maturity", 0, QApplication::UnicodeUTF8));
        lineEditPortfolioDealMaturity->setInputMask(QApplication::translate("MYGUIClass", "00y + 00m;_", 0, QApplication::UnicodeUTF8));
        lineEditPortfolioDealMaturity->setText(QApplication::translate("MYGUIClass", "05y + 00m", 0, QApplication::UnicodeUTF8));
        label_9->setText(QApplication::translate("MYGUIClass", "Start date", 0, QApplication::UnicodeUTF8));
        label_6->setText(QApplication::translate("MYGUIClass", "Inst-Type", 0, QApplication::UnicodeUTF8));
        label_7->setText(QApplication::translate("MYGUIClass", "Notional", 0, QApplication::UnicodeUTF8));
        spinBoxPortfolioNominal->setSuffix(QString());
        pushButtonPortfolioAddDeal->setText(QApplication::translate("MYGUIClass", "Add", 0, QApplication::UnicodeUTF8));
        label_14->setText(QApplication::translate("MYGUIClass", "Kunde", 0, QApplication::UnicodeUTF8));
        label_17->setText(QApplication::translate("MYGUIClass", "NPV", 0, QApplication::UnicodeUTF8));
        lineEditPortfolioNPV->setText(QApplication::translate("MYGUIClass", "not calculated", 0, QApplication::UnicodeUTF8));
        pushButtonPortfolioCalculateNPV->setText(QApplication::translate("MYGUIClass", "Calculate", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(tab_2), QApplication::translate("MYGUIClass", "Portfolio", 0, QApplication::UnicodeUTF8));
        label_23->setText(QApplication::translate("MYGUIClass", "Contract number", 0, QApplication::UnicodeUTF8));
        label_24->setText(QApplication::translate("MYGUIClass", "Component number", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisPlotCtp->setText(QApplication::translate("MYGUIClass", "Plot", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisPlotContract->setText(QApplication::translate("MYGUIClass", "Plot", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisPlotComp->setText(QApplication::translate("MYGUIClass", "Plot", 0, QApplication::UnicodeUTF8));
        label_22->setText(QApplication::translate("MYGUIClass", "Counterparty number", 0, QApplication::UnicodeUTF8));
        checkBoxAnalysisSimulationPaths->setText(QApplication::translate("MYGUIClass", "Show simulated NPV Paths", 0, QApplication::UnicodeUTF8));
        checkBoxAnalysisStatisticCurves->setText(QApplication::translate("MYGUIClass", "Show statistics", 0, QApplication::UnicodeUTF8));
        groupBox_11->setTitle(QApplication::translate("MYGUIClass", "Style Statistics", 0, QApplication::UnicodeUTF8));
        radioButtonAnalysisBarStyle->setText(QApplication::translate("MYGUIClass", "Bars", 0, QApplication::UnicodeUTF8));
        radioButtonAnalysisTubeStyle->setText(QApplication::translate("MYGUIClass", "Tube", 0, QApplication::UnicodeUTF8));
        groupBox_12->setTitle(QApplication::translate("MYGUIClass", "Simulation Parameters", 0, QApplication::UnicodeUTF8));
        label_25->setText(QApplication::translate("MYGUIClass", "Sim Step", 0, QApplication::UnicodeUTF8));
        label_26->setText(QApplication::translate("MYGUIClass", "Date", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisShowMarketData->setText(QApplication::translate("MYGUIClass", "Show Market Data", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(tab_3), QApplication::translate("MYGUIClass", "Analysis MY", 0, QApplication::UnicodeUTF8));
        groupBox_6->setTitle(QApplication::translate("MYGUIClass", "GroupBox", 0, QApplication::UnicodeUTF8));
        pushButton->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        pushButton_2->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        pushButton_3->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        pushButton_4->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(tab_7), QApplication::translate("MYGUIClass", "Analysis MD", 0, QApplication::UnicodeUTF8));
        groupBox->setTitle(QApplication::translate("MYGUIClass", "Simulation parameters", 0, QApplication::UnicodeUTF8));
        label->setText(QApplication::translate("MYGUIClass", "Number of Simulation Steps", 0, QApplication::UnicodeUTF8));
        label_2->setText(QApplication::translate("MYGUIClass", "Number of Forward Steps", 0, QApplication::UnicodeUTF8));
        label_3->setText(QApplication::translate("MYGUIClass", "Jump Probability", 0, QApplication::UnicodeUTF8));
        groupBox_4->setTitle(QApplication::translate("MYGUIClass", "Input Files", 0, QApplication::UnicodeUTF8));
        label_5->setText(QApplication::translate("MYGUIClass", "Instrument File:", 0, QApplication::UnicodeUTF8));
        pushButtonSettingsInstFileBrowse->setText(QApplication::translate("MYGUIClass", "...", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(OptionsTab), QApplication::translate("MYGUIClass", "Settings", 0, QApplication::UnicodeUTF8));
        menuOptions->setTitle(QApplication::translate("MYGUIClass", "Options", 0, QApplication::UnicodeUTF8));
    } // retranslateUi

};

namespace Ui {
    class MYGUIClass: public Ui_MYGUIClass {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_MYGUI_H

This compiles without any problem. But when I start the application (using the aplication verifier) I get a triggered breakpoint after the method
void setupUi(QMainWindow *MYGUIClass)

in ui_mygui.h is finished and the constructor of MYengine is entered. No line of the constructor is executed it just triggers a breakpoint. This is the verifier report:
=======================================
VERIFIER STOP 00000013: pid 0x1CDC: First chance access violation for current stack trace.
0AF79000 : Invalid address causing the exception.
00E15057 : Code address executing the invalid access.
0032F134 : Exception record.
0032F184 : Context record.

=======================================
This verifier stop is continuable.
After debugging it use `go' to continue.
=======================================
If I just delete the single line
myEngine_ = boost::shared_ptr<MYengine>(new MYengine());

in mygui.cpp the Gui opens, no application verifier breakpoint, everything seems to work fine.
I'm completly lost. class MYengine is a large class embedded in a static library with hundreds additional classes. The error occurs even before the first line of the constructor of Myengine is executed. So why is the behaviour so different with or without the above line? Any ideas would be highly appreciated. This code is starting to make me made,-(

A: Without knowing the remainder of your code, I'm pretty sure that you should not put Qt Pointers into boost shared pointers - Qt has its own object lifecycle management and will delete memory without asking your shared pointer, so you might end up with a boost-pointer pointing to released memory.
But this only applies to
boost::shared_ptr<QMenu> treeWidgetMenu_;
boost::shared_ptr<QAction> treeWidgetMenuDeleteAction_;

which should probably be QMenu* and QAction* respectively.
I assume, that MYengine is not a Qt class. Probably, you should show us the interface of MyEngine so that we can understand, why a shared pointer to MyEngine is causing trouble.


text:
Q: How to create a List from Map and List of keys? Using Java 8 lambdas, what's the "best" way to effectively create a new List<T> given a List<K> of possible keys and a Map<K,V>?  This is the scenario where you are given a List of possible Map keys and are expected to generate a List<T> where T is some type that is constructed based on some aspect of V, the map value types.
I've explored a few and don't feel comfortable claiming one way is better than another (with maybe one exception -- see code).  I'll clarify "best" as a combination of code clarity and runtime efficiency.  These are what I came up with.  I'm sure someone can do better, which is one aspect of this question.  I don't like the filter aspect of most as it means needing to create intermediate structures and multiple passes over the names List.  Right now, I'm opting for Example 6 -- a plain 'ol loop.  (NOTE: Some cryptic thoughts are in the code comments, especially "need to reference externally..." This means external from the lambda.)
public class Java8Mapping {
    private final Map<String,Wongo> nameToWongoMap = new HashMap<>();
    public Java8Mapping(){
        List<String> names = Arrays.asList("abbey","normal","hans","delbrook");
        List<String> types = Arrays.asList("crazy","boring","shocking","dead");
        for(int i=0; i<names.size(); i++){
            nameToWongoMap.put(names.get(i),new Wongo(names.get(i),types.get(i)));
        }
    }

    public static void main(String[] args) {
        System.out.println("in main");
        Java8Mapping j = new Java8Mapping();
        List<String> testNames = Arrays.asList("abbey", "froderick","igor");
        System.out.println(j.getBongosExample1(testNames).stream().map(Bongo::toString).collect(Collectors.joining(", ")));
        System.out.println(j.getBongosExample2(testNames).stream().map(Bongo::toString).collect(Collectors.joining(", ")));
        System.out.println(j.getBongosExample3(testNames).stream().map(Bongo::toString).collect(Collectors.joining(", ")));
        System.out.println(j.getBongosExample4(testNames).stream().map(Bongo::toString).collect(Collectors.joining(", ")));
        System.out.println(j.getBongosExample5(testNames).stream().map(Bongo::toString).collect(Collectors.joining(", ")));
        System.out.println(j.getBongosExample6(testNames).stream().map(Bongo::toString).collect(Collectors.joining(", ")));
    }

    private static class Wongo{
        String name;
        String type;
        public Wongo(String s, String t){name=s;type=t;}
        @Override public String toString(){return "Wongo{name="+name+", type="+type+"}";}
    }

    private static class Bongo{
        Wongo wongo;
        public Bongo(Wongo w){wongo = w;}
        @Override public String toString(){ return "Bongo{wongo="+wongo+"}";}
    }

    // 1:  Create a list externally and add items inside 'forEach'.
    //     Needs to externally reference Map and List
    public List<Bongo> getBongosExample1(List<String> names){
        final List<Bongo> listOne = new ArrayList<>();
        names.forEach(s -> {
                  Wongo w = nameToWongoMap.get(s);
                  if(w != null) {
                      listOne.add(new Bongo(nameToWongoMap.get(s)));
                  }
              });
        return listOne;
    }

    // 2: Use stream().map().collect()
    //    Needs to externally reference Map
    public List<Bongo> getBongosExample2(List<String> names){
        return names.stream()
              .filter(s -> nameToWongoMap.get(s) != null)
              .map(s -> new Bongo(nameToWongoMap.get(s)))
              .collect(Collectors.toList());
    }

    // 3: Create custom Collector
    //    Needs to externally reference Map
    public List<Bongo> getBongosExample3(List<String> names){
        Function<List<Wongo>,List<Bongo>> finisher = list -> list.stream().map(Bongo::new).collect(Collectors.toList());
        Collector<String,List<Wongo>,List<Bongo>> bongoCollector =
              Collector.of(ArrayList::new,getAccumulator(),getCombiner(),finisher, Characteristics.UNORDERED);

        return names.stream().collect(bongoCollector);
    }
    // example 3 helper code
    private BiConsumer<List<Wongo>,String> getAccumulator(){
        return (list,string) -> {
            Wongo w = nameToWongoMap.get(string);
            if(w != null){
                list.add(w);
            }
        };
    }
    // example 3 helper code
    private BinaryOperator<List<Wongo>> getCombiner(){
        return (l1,l2) -> {
            l1.addAll(l2);
            return l1;
        };
    }

    // 4: Use internal Bongo creation facility
    public List<Bongo> getBongosExample4(List<String> names){
        return names.stream().filter(s->nameToWongoMap.get(s) != null).map(s-> new Bongo(nameToWongoMap.get(s))).collect(Collectors.toList());
    }

    // 5: Stream the Map EntrySet.  This avoids referring to anything outside of the stream,
    // but bypasses the lookup benefit from Map.
    public List<Bongo> getBongosExample5(List<String> names){
        return nameToWongoMap.entrySet().stream().filter(e->names.contains(e.getKey())).map(e -> new Bongo(e.getValue())).collect(Collectors.toList());
    }

    // 6: Plain-ol-java loop
    public List<Bongo> getBongosExample6(List<String> names){
        List<Bongo> bongos = new ArrayList<>();
        for(String s : names){
            Wongo w = nameToWongoMap.get(s);
            if(w != null){
                bongos.add(new Bongo(w));
            }
        }
        return bongos;
    }
}

A: Radiodef's answer pretty much nailed it, I think. The solution given there:
return names.stream()
    .map(namesToWongoMap::get)
    .filter(Objects::nonNull)
    .map(Bongo::new)
    .collect(toList());

is probably about the best that can be done in Java 8.
I did want to mention a small wrinkle in this, though. The Map.get call returns null if the name isn't present in the map, and this is subsequently filtered out. There's nothing wrong with this per se, though it does bake null-means-not-present semantics into the pipeline structure.
In some sense we'd want a mapper pipeline operation that has a choice of returning zero or one elements. A way to do this with streams is with flatMap. The flatmapper function can return an arbitrary number of elements into the stream, but in this case we want just zero or one. Here's how to do that:
return names.stream()
    .flatMap(name -> {
        Wongo w = nameToWongoMap.get(name);
        return w == null ? Stream.empty() : Stream.of(w);
    })
    .map(Bongo::new)
    .collect(toList());

I admit this is pretty clunky and so I wouldn't recommend doing this. A slightly better but somewhat obscure approach is this:
return names.stream()
    .flatMap(name -> Optional.ofNullable(nameToWongoMap.get(name))
                             .map(Stream::of).orElseGet(Stream::empty))
    .map(Bongo::new)
    .collect(toList());

but I'm still not sure I'd recommend this as it stands.
The use of flatMap does point to another approach, though. If you have a more complicated policy of how to deal with the not-present case, you could refactor this into a helper function that returns a Stream containing the result or an empty Stream if there's no result.
Finally, JDK 9 -- still under development as of this writing -- has added Stream.ofNullable which is useful in exactly these situations:
return names.stream()
    .flatMap(name -> Stream.ofNullable(nameToWongoMap.get(name)))
    .map(Bongo::new)
    .collect(toList());

As an aside, JDK 9 has also added Optional.stream which creates a zero-or-one stream from an Optional. This is useful in cases where you want to call an Optional-returning function from within flatMap. See this answer and this answer for more discussion.

A: One approach I didn't see is retainAll:
public List<Bongo> getBongos(List<String> names) {
    Map<String, Wongo> copy = new HashMap<>(nameToWongoMap);
    copy.keySet().retainAll(names);

    return copy.values().stream().map(Bongo::new).collect(
        Collectors.toList());
}

The extra Map is a minimal performance hit, since it's just copying pointers to objects, not the objects themselves.

A: If namesToWongoMap is an instance variable, you can't really avoid a capturing lambda.
You can clean up the stream by splitting up the operations a little more:
return names.stream()
    .map(n -> namesToWongoMap.get(n))
    .filter(w -> w != null)
    .map(w -> new Bongo(w))
    .collect(toList());

return names.stream()
    .map(namesToWongoMap::get)
    .filter(Objects::nonNull)
    .map(Bongo::new)
    .collect(toList());

That way you don't call get twice.
This is very much like the for loop, except, for example, it could theoretically be parallelized if namesToWongoMap can't be mutated concurrently.

I don't like the filter aspect of most as it means needing to create intermediate structures and multiple passes over the names List.

There are no intermediate structures and there is only one pass over the List. A stream pipeline says "for each element...do this sequence of operations". Each element is visited once and the pipeline is applied.
Here are some relevant quotes from the java.util.stream package description:

A stream is not a data structure that stores elements; instead, it conveys elements from a source such as a data structure, an array, a generator function, or an I/O channel, through a pipeline of computational operations.
Processing streams lazily allows for significant efficiencies; in a pipeline such as the filter-map-sum example above, filtering, mapping, and summing can be fused into a single pass on the data, with minimal intermediate state.


text:
Q: Not able to open Splash after exit the application I am working on an application in which I want to exit the app onBackPressed. I have wrote code for it but the problem is this when I press back button my app exits and not cleared from RAM and when I reopen the app after exit it opens from second screen not from splash. What is the problem?
Code:
moveTaskToBack(true);
android.os.Process.killProcess(android.os.Process.myPid());
finish();
System.exit(0);

A: Best way of handle splash screen is clear splash stack from Intent. So you don't need to kill your application manually
Intent intent = new Intent(splashActivity.this, SecondActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();

Don't forgot to remove below code
moveTaskToBack(true);
android.os.Process.killProcess(android.os.Process.myPid());
finish();
System.exit(0);

A: Put this in onCreate() splash screen activity .
 @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.activity_splash_screen);

            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {

                            intent = new Intent(ActivitySplachScreen.this, MainActivity.class);
                            intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                            startActivity(intent);
                            finish();
                }
            }, 3000);
        }

& activity_splash_screen is.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/splash"
    android:orientation="vertical">
</LinearLayout>


text: Q: Rubik's Cube with a missing color Suppose a color of the Rubik's cube(3x3) is missing, is it possible to find the missing color? Now a brute force method would be solve for all other colors, but that is quite naive.


text:
Q: How do I diagnose an error in Azure SignalR 404 with upstream and Azure Function App? I have an Azure SignalR service setup with upstream. Negotiate is working, but I am getting a 404 error when trying to use connection.invoke('events', { ... });
In the SignalR event log, I am getting (irrelevant bits omitted):
{
  "properties": {
    "message": "Sending message during operation {hub}=map,{event}=events,{category}=messages got unexpected response with status code 404. Detail: ",
    "type":"MessagingLogs",
    "collection":"Serverless"
  },
  "operationName": "HttpHandlerUnexpectedResponse",
  "callerIpAddress": "null"
}

What might be causing the 404?
There is a Azure Function app setup with an events function with the following bindings:
{
  "disabled": false,
  "bindings": [
    {
      "authLevel": "anonymous",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    },
    {
      "type": "signalR",
      "name": "$return",
      "hubName": "map",
      "direction": "out"
    }
  ]
}

I believe the function app is getting setup correctly. I have the following setup as my upstream (with  info replaced in the actual call:
<function_app_server>/runtime/webhooks/signalr?code=<signalr_extension_key>

A: Apparently the bindings have changed for Azure when using Upstream. The following bindings worked:
{
    "bindings": [
        {
            "type": "signalRTrigger",
            "name": "invocation",
            "hubName": "map",
            "category": "messages",
            "event": "events",
            "parameterNames": [
                "message"
            ],
            "direction": "in",
        },
        {
            "type": "signalR",
            "name": "signalRMessages",
            "hubName": "map",
            "connectionStringSetting": "AzureSignalRConnectionString",
            "direction": "out"
        }
    ]
}

module.exports = function (context, invocation) {
  context.bindings.signalRMessages = [{
    "target": "newMessage", // name of the client method to invoke
    "arguments": [
      context.bindingData.message // arguments to pass to client method
    ]
  }];
  context.done();
};


text:
Q: Passar um valor em botão tipo link pela url para ser ultilizando em outra página com javascript ou php Bom dia a todos!
Sou novo em desenvolvimento web e estou desenvolvendo uma aplicação web com Php, javascript e mysql. Minha duvida consiste na seguinte pergunta: Tenho uma tabela, onde estou carregando as informações que recuperei do meu banco de dados, e estão sendo exibidas como devem ser. O que eu preciso é, em uma das células, eu carrego o id da informação e ao clicar nele quero abrir uma outra aba, contendo as informações desse determinado id, o que eu não estou conseguindo fazer é passar esse id usando .
E a outra duvida seria, como eu pegar uma outra célula dessa mesma tabela e verificar se o valor nela é maior que zero, e se for, mudar o background.
Desde já agradeço a ajuda de todos!

A: de maneira bem simples no php:

<?php
    $foo = $_GET['foo']; // 'bar';
?>


text:
Q: Spatialite does not use gpkg_spatial_ref_sys in GPKG mode Spatialite and GPKG mode are enabled:
SELECT load_extension('mod_spatialite');
SELECT EnableGpkgMode();

Spatialite knows about gpkg_spatial_ref_sys (gpkgInsertEpsgSRID() uses it), and the table
is populated:
sqlite> SELECT srs_name, srs_id FROM gpkg_spatial_ref_sys;
Undefined cartesian SRS|-1
Undefined geographic SRS|0
WGS 84 geodetic|4326
Amersfoort / RD New|28992

Yet when I try to use ST_Transform() it tries to look for (and fails to find) spatial_ref_sys:
sqlite> SELECT ST_Transform(gpkgMakePoint(5.140743, 51.630698, 4326), 28992);
unknown SRID: 4326      <no such table: spatial_ref_sys>
unknown SRID: 28992     <no such table: spatial_ref_sys>
Error: ST_Transform exception - unable to find the origin SRID.

What am I doing wrong? Does GPKG mode not support ST_Transform()? What is gpkgInsertEpsgSRID() for then?
Version info:
sqlite> SELECT spatialite_version(), sqlite_version();
5.0.1|3.34.1

A: As @user30184 says it is in fact necessary to have a separate spatial_ref_sys table. However, instead of using InitSpatialMetadata() and getting many other tables, the following SQL seems to have worked as well (for ST_Transform() at least).
CREATE TABLE spatial_ref_sys (
  srid       INTEGER NOT NULL PRIMARY KEY,
  auth_name  VARCHAR(256),
  auth_srid  INTEGER,
  srtext     VARCHAR(2048),
  proj4text  VARCHAR(2048)
);
INSERT INTO spatial_ref_sys SELECT
  srs_id AS srid,
  organization AS auth_name,
  organization_coordsys_id AS auth_srid,
  definition AS srtext,
  NULL
FROM gpkg_spatial_ref_sys;


text:
Q: Sharepoint 2010 Email document in document library as an attachment I have a document Library in sharpoint. I see that I can email a link of a document in a library but is it possible to send the document as an attachment. I need to send the document to someone external to our company and they will not have access to sharepoint.

A: You need to enable SMTP on the Server go to System Manager then click on Features then SMTP install it.  I have tested and this works on Windows 2008 Share Point 2010


text:
Q: laravel 5.4 - socket io need csrf token to send ajax to laravel server , how to get that? My socket io want to send ajax to laravel server , but I need the csrf token to set to my ajax header , how to do that?
I have found a page seems discuss this ,
socketio_client_authentication_using_laravel_session_data,
const SOCKET_PARAMS  = 'laravel_session_cookie={{ $_COOKIE[config('session.cookie')] }}&csrf_token={{ csrf_token() }}'

but this code make my ide compile error , how to fix this?

A: That error is probably caused by the quotes. Just change them like this and try again:
const SOCKET_PARAMS  = "laravel_session_cookie={{ $_COOKIE[config('session.cookie')] }}&csrf_token={{ csrf_token() }}";

Remember that PHP does not distinguish between strings and characters, so you could combine them as you want.
If you need more information check the PHP string documentation.
Hope this helps you.


text:
Q: Testing a (new) firewall I have a small home-LAN. I want to install a gateway PC running my own firewall/DNS/DHCP/VPN/etc. I plan to run either pfSense, OPNsense, IPfire or Debian 8. I'm not sure which, so I want to do some testing first.
Current State:
Internet --- [ISP modem] ----------------- switch --- (LAN)
The ISP modem has NAT/firewall functionality.
Future State:
Internet --- [ISP modem] --- {gateway} --- switch --- (LAN)
The ISP modem will be put in bridge mode. NAT/firewall/etc functionality will be migrated to the new gateway.
How can I (temporarily) set things up, before implementing the future state, so that I can test the various options while the current state network remains operational for my family and without risk of "de-firewalling" the existing network?
Note: The switch is managed, maybe that could help?