text:
Q: javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError I'm currently working on a vaadin project to which I am a beginner and I ran into some trouble, the following stack trace are what's being displayed when i try to run it in jetty,
@EnableJpaRepositories
@Theme("valo")
public class LoInf extends UI implements View {

    @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
    @VaadinServletConfiguration(ui = LoInf.class, productionMode = false)
    public static class MyUIServlet extends VaadinServlet {
    }
    //getPage().setTitle("login");
    final VerticalLayout layout = new VerticalLayout();
    public Navigator navigator;
    public static final String Inter = "interface";
    Button button = new Button("Login");
    @Override
    protected void init(VaadinRequest vaadinRequest) {

        final TextField Username = new TextField();
        Username.setCaption("Type your username here:");

        final PasswordField Password = new PasswordField();
        Password.setCaption("Type your password here:");

        ComponentContainerViewDisplay viewDisplay = new ComponentContainerViewDisplay(layout);
        navigator = new Navigator(UI.getCurrent(),viewDisplay);
        navigator.addView("", new LoInf());
        navigator.addView(Inter,new RMQcl(null,null));

        layout.addComponents(Username ,Password , button);

        setContent(layout);
    }

    @Override
    public void enter(ViewChangeEvent event) {
        // TODO Auto-generated method stub
        //Notification.show("logged in , welcome");
        button = new Button("Login", new Button.ClickListener(){
            @Override
            public void buttonClick(ClickEvent event){
            layout.addComponent(new Label("establishing connection ..."));
            getUI().getNavigator().navigateTo(Inter);

            }

        });

    }
}

and this is the class i'm trying to navigate to :
@SpringUI
public class RMQcl extends VerticalLayout implements UserRep,View{

    UserRep repo;
    Grid <UserModel> grid;
    TextField filter = new TextField();
    UserEdit editor;
    Button addnew;
    UserModel User;
    Binder<UserModel> binder = new Binder<>(UserModel.class);
    final VerticalLayout layout = new VerticalLayout(filter,grid);
    @Autowired
    public RMQcl(UserRep repo,UserEdit editor){
        this.repo = repo;
        this.grid = new Grid<>(UserModel.class);
        this.editor = editor;
        this.filter = new TextField();
        binder.bindInstanceFields(this);
        this.addnew = new Button("New User",FontAwesome.PLUS);

        Button logout = new Button("Logout");
        logout.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;
                public void buttonClick(ClickEvent event) {
                     getUI().getNavigator().navigateTo("");

            }

    });

}

at first run this is the stack trace :
oct. 30, 2017 11:06:46 AM com.vaadin.server.DefaultErrorHandler doDefault
GRAVE:
java.lang.NoClassDefFoundError: org/springframework/data/jpa/repository/JpaRepository
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:549)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:475)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:549)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:475)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    at my.vaadin.Project.LoInf.init(LoInf.java:56)
    at com.vaadin.ui.UI.doInit(UI.java:745)
    at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:216)
    at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:74)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1568)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:381)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:524)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.springframework.data.jpa.repository.JpaRepository
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:487)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    ... 60 more

2017-10-30 11:06:46.268:WARN:oejs.ServletHandler:qtp31994222-41:
javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: org/springframework/data/jpa/repository/JpaRepository
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:383)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:524)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
Caused by:
com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: org/springframework/data/jpa/repository/JpaRepository
    at com.vaadin.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1620)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1580)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:381)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:524)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
Caused by:
java.lang.NoClassDefFoundError: org/springframework/data/jpa/repository/JpaRepository
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:549)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:475)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:549)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:475)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    at my.vaadin.Project.LoInf.init(LoInf.java:56)
    at com.vaadin.ui.UI.doInit(UI.java:745)
    at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:216)
    at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:74)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1568)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:381)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:524)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
Caused by:
java.lang.ClassNotFoundException: org.springframework.data.jpa.repository.JpaRepository
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:487)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:549)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:475)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at org.eclipse.jetty.webapp.WebAppClassLoader.findClass(WebAppClassLoader.java:549)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:475)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
    at my.vaadin.Project.LoInf.init(LoInf.java:56)
    at com.vaadin.ui.UI.doInit(UI.java:745)
    at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:216)
    at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:74)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1568)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:381)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:524)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)

and when I refresh the web page I get the following :
oct. 30, 2017 11:14:04 AM com.vaadin.server.DefaultErrorHandler doDefault
GRAVE:
java.lang.NoClassDefFoundError: my/vaadin/Project/RMQcl
    at my.vaadin.Project.LoInf.init(LoInf.java:56)
    at com.vaadin.ui.UI.doInit(UI.java:745)
    at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:216)
    at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:74)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1568)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:381)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
    at org.eclipse.jetty.server.Server.handle(Server.java:524)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)

I checked many forums and searched through google but no solutions were found,
Help is much appreciated

A: the problem was that the compiler did not recongnize the class i was trying to navigate to, so the solution was to use Spring Views instead of simple views and referencing the classes directly,
@SpringView(name = LoInf.NAME)

and
@SpringUI
@SpringView(name = RMQcl.NAME)

and then adding views and a view provider
navigator = new Navigator(UI.getCurrent(),this);
navigator.addView(LoInf.NAME, LoInf.class);
        navigator.addView(RMQcl.NAME,RMQcl.class);

button = new Button("Login", new Button.ClickListener(){
            @Override
            public void buttonClick(ClickEvent event){
            layout.addComponent(new Label("establishing connection ..."));
                navigator.navigateTo(RMQcl.NAME);

            }

        });

now it's navigating properly


text:
Q: Select from either of two tables I have 2 tables.
Lets call them Table1 and Table2. Both tables have the same structure and data type.
Table1 is a transaction table and Table2 is a historical data table.
I need to do something like this:
Select * from case  when 'transnational' then Table1 else Table2 end

I do not want to use 2 select statement to do this however.
Can I use the CASE statement for this?

A: Great question! Let's try:
Create Table tab0 (col int primary key);
Create Table tab1 (col int primary key);

Insert Into tab0 (col) Values (0);
Insert Into tab1 (col) Values (1);
GO

Minimalist Union All solution would be:
Declare @tabindex bit = 0;
Select * From tab0 Where @tabindex = 1 Union All
Select * From tab1 Where @tabindex = 0;

Execution plan indicate two table scans and filters with one concatenation.
That is not good enough. Let's see whether optimizer can actually skip table processing if conditions are not right:
Select * From tab0 Where 1 = 1 Union All
Select * From tab1 Where 1 = 0
GO

... and Execution plan indicate one table scan and one Compute Scalar at cost 0%. So, technically optimizer can do it. The problem is any condition involving variable would get evaluated against the table resulting in a table scan. So we just need to evaluate the condition before Select. Well, there is an answer to that too by the name of table-valued function:
Create Function tab (@tabNo int)
Returns @RetTab Table (col int)
As
Begin
  If @tabNo = 1 Insert Into @RetTab Select * From tab1
  Else          Insert Into @RetTab Select * From tab0;
  Return;
End;

Now if we run Select * From tab(1); or Select * From tab(0); Execution plan would indicate just one table scan, one Table Valued Function and one Sequence both costing 0%.
So the answer is yes, we can use CASE statement in table-valued function.
Update following Shnugo comment. The function can actually be improved:
Create Function tab (@tabNo int)
Returns Table
As
  Return
    Select * From tab0 Where @tabNo = 0 Union All
    Select * From tab1 Where @tabNo = 1;
GO

Now Select * From tab(1); or Select * From tab(0); results in one Table Scan and one Compute Scalar only. Apparently with compiled function the optimizer know not to look for the parameter variable in the table.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Using Metachars in Lookbehind, (?<=test this zzzz .+L) The text is like this:
$string = "  <L UXUHSXUS>importantText</L>";

I would like to use the lookbehind feature in PHP Regular Expression
but it generates an error everytime I try to put .+ or any regular expression things
preg_match_all('%(?<=<L.+>)([\s\S]*?)(?=</LF>)%',$string, $matches);

this gives an error.
what should I do to add .+ or .* or any reserved regular expression things in lookbehind and lookahead?

A: Since you only use positive lookarounds you could probably replace all lookarounds with non-capturing groups (?:) instead:
(?:<L.+>)([\s\S]*?)(?:</LF>)

Note that you might want to make the first search non-greedy:
(?:<L.+?>)([\s\S]*?)(?:</LF>)

A: You can't. Lookbehinds don't support full regexes. The pattern(s) must have a fixed length, though if you're using alternate patterns (with |), each alternate doesn't have to have the same length as the others:
/(?<=foo|quux|foobar)duck/


text:
Q: What does the red symbol mean here? I found this symbol on the schematics of an FPGA board. AIN stand for Analog input.

A: If you didn't cut off the picture, you'd see the wires are labelled AIN15_P, AIN15_N, AIN16_P, AIN16_N. The red symbol tells Altium that these signals (each matching P and N pair) should be considered a differential pair.
This can allow the layout tool to invoke special design rules for these nets, and the autorouter or interactive router to treat them specially.


text:
Q: Unchecked cast warning from compiler I am trying to create a game. It is almost ready, but I get unchecked cast warning when I try to compile it.
Here is the beginning of my code:
public class GUI extends JFrame implements ListSelectionListener {

    private Tiles tiles;
    private ConfigurationStore st;

    public GUI(ConfigurationStore cs) {
        super("My Game");
        st = cs;
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(1000,700);

        add(ConfigurationsPanel(), BorderLayout.WEST);
    }

This is my ConfigurationsPanel():
    private JPanel ConfigurationsPanel() {
        JPanel conf = new JPanel(new BorderLayout());
        addBorder(conf, "Configurations");
        ArrayList<Configuration> configurations = new ArrayList<>();
        configurations = store.getConfigurations();
        Configuration[] configurationsArray = new Configuration[configurations.size()];
        for(int i = 0; i < configurations.size(); i++) {
            configurationsArray[i] = configurations.get(i);
        }
        JList<Configuration> list = new JList<Configuration>(configurationsArray);
        list.addListSelectionListener(this);
        JScrollPane scrollPane = new JScrollPane(list);
        conf.add(scrollPane);
        return conf;
    }

And this is my valueChanged method:
    public void valueChanged(ListSelectionEvent e) {
        JList<Configuration> list = (JList<Configuration>) e.getSource();
        Configuration configuration = list.getSelectedValue();
        tiles = new Tiles(c);
    }

Compiler gives warning in the valueChanged method where I wrote  JList<Configuration> list = (JList<Configuration>) e.getSource(); by saying: required: JList<Configuration> found: Object.
Can you please tell me what part of my code is not right and how can I remove that warning.
Thanks in advance.

A: Read and understand the warning.
Acknowledge that JVM cannot protect you from bad cast, and take responsibility for knowing what you're doing.
Then suppress the warning:
public void valueChanged(ListSelectionEvent e) {
    @SuppressWarnings("unchecked")
    JList<Configuration> list = (JList<Configuration>) e.getSource();
    ...

A: You can either @supressWarnings("unchecked") as Andreas answer says, or you can check it. In your case, probably suppresswarning sound better. In other cases though, it might be better to check the type:
public void valueChanged(ListSelectionEvent e) {
    JList<?> list = (JList<?>) e.getSource();
    Object selectedValue = list.getSelectedValue();
    if (selectedValue instanceof Configuration)
    {
        Configuration configuration = (Configuration) selectedValue;
        tiles = new Tiles(c);
    }
}


text:
Q: Fortran "ANY" function error while checking if a array contains a value I wish to check if one 2D array contains a value from other 1D array.
   do i=1,nlines
   do j=1,nchecks(i)
   if (type(i).eq.4) then
   do k=1,nlines
   do l=1,nchecks(k)
   if (type(k).eq.3) then
   if (ANY(con(i,j)==id(k))) then
   ...

But I face following error:
test1.f(98): error #6361: An array-valued argument is required in this context.   [ANY]
       if (ANY(conn(i,j)==id2(k))) then

What am I doing wrong? I also tried something like
   do i=1,nlines
   do j=1,nchecks(i)
   if (type(i).eq.4) then
   r1=conn(i,j)
   do k=1,nlines
   do l=1,nchecks(k)
   if (type(k).eq.3) then
   if (ANY(r1==id(k))) then
   ...

But this also brought the same error. All variables are properly defined, and no mistakes in format. Am I using ANY command in wrong way?

A: Your problem is that ANY is a reduction operation, it takes many values stored in a logical array and reduces them down to a single value, in this case the value .True. is any of the values in the array are true, or .False. if all of them are false. Here's a very simple example
ian@eris:~/work/stack$ cat any.f90
Program Any_test

  Implicit None

  Write( *, * ) Any( [ .True. , .False. ] )
  Write( *, * ) Any( [ .False., .False. ] )

End Program Any_test

ian@eris:~/work/stack$ gfortran -std=f2008 -Wall -Wextra -fcheck=all any.f90
ian@eris:~/work/stack$ ./a.out
 T
 F

Your immediate problem is that you are just providing ANY with a scalar value, not an array, hence the error. Simply
if (r1==id(k)) then

will fix the immediate problem.
But there is a probably way in here where you could use ANY, and this might be the best way to address what you are doing. However without the rest of the code including the variable declarations it is impossible to say.


text:
Q: c# multiple choice test working on creating a web based revision resource and i am trying to create a multiple choice quiz in c# with asp.net.
I have created it and got it working but it is very long and was wondering if anyone had an idea of how i could make the code more compact,
also when it prints the final score it appears above my nav bar on my website by i have no idea why.
in addition, the answers can be changed and the submit button just re clicked, i cannot for the love of anything find anything on how to stop this.
I am extremely new to everything and am trying my best. if someone could point me in the right direction or suggest something that might help that would be awesome.
Thanks
I appologise for the length of the code:
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="server">
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>

    <asp:RadioButtonList ID="RadioButtonList1" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList2" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList3" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList4" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList5" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList6" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList7" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList8" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList9" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>
    <asp:RadioButtonList ID="RadioButtonList10" runat="server"
        RepeatDirection="Horizontal" RepeatLayout="Table">
        <asp:ListItem Text="*Answer 1*" Value="Incorrect 1" />
        <asp:ListItem Text="*Answer 2*" Value="Correct" />
        <asp:ListItem Text="*Answer 3*" Value="I" />
        <asp:ListItem Text="*Answer 4*" Value="4" />
    </asp:RadioButtonList>

    <asp:Button ID="Button1" runat="server" Text="Submit Final Answers" OnClick="Submit_Click" />
    <script runat="server">
        protected void Submit_Click(object sender, EventArgs e)
        {
            int Score = 0;
            string selectedValue1 = RadioButtonList1.SelectedValue;
            if (selectedValue1 == "Correct")
            {
                Score++;
            }
            string selectedValue2 = RadioButtonList2.SelectedValue;
            if (selectedValue2 == "Correct")
            {
                Score++;
            }
            string selectedValue3 = RadioButtonList3.SelectedValue;
            if (selectedValue3 == "Correct")
            {
                Score++;
            }
            string selectedValue4 = RadioButtonList4.SelectedValue;
            if (selectedValue4 == "Correct")
            {
                Score++;
            }
            string selectedValue5 = RadioButtonList5.SelectedValue;
            if (selectedValue5 == "Correct")
            {
                Score++;
            }
            string selectedValue6 = RadioButtonList6.SelectedValue;
            if (selectedValue6 == "Correct")
            {
                Score++;
            }
            string selectedValue7 = RadioButtonList7.SelectedValue;
            if (selectedValue7 == "Correct")
            {
                Score++;
            }
            string selectedValue8 = RadioButtonList8.SelectedValue;
            if (selectedValue8 == "Correct")
            {
                Score++;
            }
            string selectedValue9 = RadioButtonList9.SelectedValue;
            if (selectedValue9 == "Correct")
            {
                Score++;
            }
            string selectedValue10 = RadioButtonList10.SelectedValue;
            if (selectedValue10 == "Correct")
            {
                Score++;
            }
            Response.Write(Score);

        }
    </script>
</asp:Content>

A: This may shorten up the evaluation phase:
RadioButtonList[] lists = new RadioButtonList[] {RadioButtonList1, RadioButtonList2, RadioButtonList3, RadioButtonList4, RadioButtonList5, RadioButtonList6, RadioButtonList7, RadioButtonList8, RadioButtonList9, RadioButtonList10 };

foreach (RadioButtonList element in lists ) {
            if (element.SelectedValue == "correct") {
                Score++;
        }
}

A: For the Submit_Click method, I would encourage you to have all your CheckBoxes in a List or Enumerable of some sort. Then you could iterate on this List and evaluate the Result in each iteration. Something in the lines of:
protected void Submit_Click(object sender, EventArgs e)
{
     int score = 0;
     List<RadioButtonList> list = new List<RadioButtonList>() { RadioButtonList1, RadioButtonList2, ... RadioButtonList3 };
     foreach (var element in list)
     {
        if (element.SelectedValue == "correct") {
            score++;
     }
     Response.Write(score);
}

A: I do not have an exact solution but since you asked about being pointed to the right direction, here are the steps you should take:

*

*Create a User Control with a TextBox for question statement and a radio control list or anything for the choices, Also add a hidden field to put an identifier or something that identifies the question correctly.

*On the main webpage either you use a Repeater control or Add the User Control dynamically with the data.

*All the code for checking the correct Choice selection should be in the user control.

*In the main form, when it is submitted, access each user control and collect the result.

I made a similar app in ASP.NET webForms years ago but I had "<< Back" and "Next >>" buttons so on one page only one question was displayed and the whole app recorded time so when the test duration elapses it took the user to the end page.


text:
Q: How to split a text file into two in PowerShell? I have one text file with Script that I want to split into two
Below is the dummy script
--serverone

this is first part of my script

--servertwo

this is second part of my script

I want to create two text files that would look like
file1
--serverone

this is first part of my script

file2
--servertwo

this is second part of my script

So far, I have added a special character within the script that I know don't exist ("}")
$script = get-content -Path "C:\Users\shamvil\Desktop\test.txt"
$newscript = $script.Replace("--servertwo","}--servertwo")
$newscript.split("}")

but I don't know how to save the split into two separate places.
This might not be a best approach, so I am also open to different solution as well.
Please help, thanks!

A: Use a regex-based -split operation:
$i = 0
(Get-Content -Raw test.txt) -split '(?m)^(?=--)' -ne '' |
  ForEach-Object { $fileName = 'file' + (++$i); Set-Content $fileName $_ }

*

*This assumes that each block of lines that starts with a line that starts with -- is to be saved to a separate file.

*Get-Content -Raw reads the entire file into a single, multi-line string.

*As for the separator regex passed to -split:

*

*The (?m) inline regex option makes anchors ^ and $ match on each line

*^(?=--) therefore matches every line that starts with --, using a by definition non-capturing look-ahead assertion ((?=...)) to ensure that the -- isn't removed from the resulting blocks (by default, what matches the separator regex is not included).

*-ne '' filters out the extra empty element that results from the separator expression matching at the very start of the string.

*Note that Set-Content knows nothing about the character encoding of the input file and uses its default encoding; use -Encoding as needed.

zett42 points out that the file-writing part can be streamlined with the help of a delay-bind script-block parameter:
$i = 0
(Get-Content -Raw test.txt) -split '(?m)^(?=--)' -ne '' |
  Set-Content -LiteralPath { (Get-Variable i -Scope 1).Value++; "file$i" }

*

*The Get-Variable call to access and increment the $i variable in the parent scope is necessary, because delay-bind script blocks (as well as script blocks for calculated properties) run in a child scope - perhaps surprisingly, as discusssed in GitHub issue #7157

*

*A shorter - but even more obscure - option is to use ([ref] $i).Value++ instead; see this answer for details.

*zett42 also points to a proposed future enhancement that would obviate the need to maintain the sequence numbers manually, via the introduction of an automatic $PSIndex variable that reflects the sequence number of the current pipeline object: see GitHub issue #13772.


text:
Q: Xcode 8 PRODUCT_BUNDLE_IDENTIFIER I get following error when trying to build/test a app on my phone
Showing Recent Issues Bundle identifier is missing. QRCodeReader doesn't have a bundle identifier for the Debug build configuration. Add a value for PRODUCT_BUNDLE_IDENTIFIER in the build settings editor.

How can I change this to let the app work.
I got the app from a tutorial on appcoda here, I'm trying to build a super easy barcode scanner. My xcode/swift at beginnerslevel.
I used the build file to convert it to swift 3 and when simulating it, it worked. But when simulating it on my phone it didn't.
Can I add my own bundle_identifier and where do I sign this up?
I'm working on osx Sierra , Xcode 8

A: Just go to Target -> Build Settings -> Product Bundle Identifier -> Expand it -> Debug -> put here same bundle id from Release.


text:
Q: Returning partial view in specific folder I am trying to organize my MVC project and more specifically the views and partial views in the project. But because of where the folders are located, I have to give return view a string path.
I have this simple view called ContactSearch.cshtml
@{
    ViewBag.Title = "Contact Search";
}

<!-- Partial view - Search criteria -->
@{
    //Html.RenderPartial("_EnquiryBreadCrumb", "Enquiry");
    @Html.Action("_EnquiryBreadCrumb", "Enquiry")
}

<!-- Partial view - Search results grid -->
@{

}

The enquiry controller then handles the partialview:
public class EnquiryController : Controller
    {
        #region Partials
        public ActionResult _EnquiryBreadCrumb()
        {
            return View("~/PartialViews/Enquiry/_EnquiryBreadCrumb.cshtml");
        }
        #endregion
    }

When I return view I get this runtime error:
The view at '~/PartialViews/Enquiry/_EnquiryBreadCrumb.cshtml' must derive from WebViewPage, or WebViewPage<TModel>.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The view at '~/PartialViews/Enquiry/_EnquiryBreadCrumb.cshtml' must derive from WebViewPage, or WebViewPage<TModel>.

Source Error:

Line 7:  @{
Line 8:      //Html.RenderPartial("_EnquiryBreadCrumb", "Enquiry");
Line 9:      @Html.Action("_EnquiryBreadCrumb", "Enquiry")
Line 10: }
Line 11:

Source File: c:\Projects\2012\AMT2014_Prototype\AMT2014_Prototype\Views\Search\ContactSearch.cshtml    Line: 9

See screenshot for my file structure:

I want to fix this runtime error and display the partial view on the page. I am using MVC 5.

A: please refer to the following link for a more detailed explanation of how to fix your problem - The view must derive from WebViewPage, or WebViewPage<TModel>
But basically, the issue is that since you put the partial view in a custom location there is no web.config there that has a RAZOR include.
Try including a copy of your web.config in your partialviews folder and see if it works


text:
Q: Spring Security, Customizing Authorization, AccessDecisionManager vs Security Filter I'm going to implement a custom authorization based on ([User<-->Role<-->Right]) model and Rights should be compared to controller and method name (e.g. "controller|method").
I used customizing UserDetails and AuthenticationProvider to adjust granted authority (here), but as checked source codes and docs about how customizing the compare of authority I found there is a filter SecurityContextHolderAwareRequestWrapper) that implements isGranted and isUserInRole to compare authority, while the documents say using AccessDecisionManager voters to customize (As I understood). Which one should be used ? Where I have controller and method(action) name to compare authority with them ?
I got confused about Spring security a little. Is there any other resource than official docs that illustrate how it works, I mean sequence of actions and methods and how customize them.

A: There are several approaches:

*

*Role based, where you assign each user a role and check the role before proceeding

*Using Spring security expressions

*There is also a new spring acl components which lets you perform acl control on class level and are stored in a database.
My personal usage so far has been 1 and 2, where you only assign roles to users.
But option 3 allows you to create finer grained security model, without having to rebuild your webapp when chaning the security model

Role Based
A role based security mechanism can be realised implementing the UserDetailsService interface and configuring spring security to use this class.
To learn on how to such a project can be realized, take a look at the following tutorials:

*

*Form based login with in memory user database Link

*Form based login with custom userdetails service Link
In short spring security performs the following behind the scenes:

*

*Upon authentication (e.g. submitting a login form) an Authentication Object is created which holds the login credentials. For example the UsernamePasswordAuthenticationFilter creates an UsernamePasswordAuthenticationToken

*The authentication object is passed to an AuthenticationManager, which can be thought of as the controller in the authentication process. The default implementation is the ProviderManager

*The AuthenticationManager performs authentication via an AuthenticationProvider. The default implementation used is the DaoAuthenticationProvider.

*The DaoAuthenticationProvider performs authentication by retrieving the UserDetails from a UserDetailsService. The UserDetails can be thought of as a data Object which contains the user credentials, but also the Authorities/Roles of the user! The DaoAuthenticationProvider retrieves the credentials via its loadUserByUsername method
and then compare it to the supplied UsernamePasswordAuthenticationToken.

*UserDetailsService collects the user credentials, the authorities and builds an UserDetails object out of it. For example you can retrieve a password hash and authorities out of a database. When configuring the website url-patterns you can refer to the authorities in the access attribute.  Furthermore, you can retrieve the Authentication object in your controller classes via the SecurityContextHolder.getContext().getAuthentication().

Furthemore to get a better understanding of the inner workings of these classes you can read the javadocs:

*

*UserDetails - how the user credentials are stored and accessed

*AuthenticationManager.authenticate(..) - contract on how AuthenticationExceptions are handled

*UserDetailsService.loadUserByUsername(..)- contact on how username lookup failures are handled, e.g. user does not exist

Spel
Instead of checking authorities, SPEL enables you also to check other properties of a user.
You can use these in the URL patterns, but also annotate methods with @Preauthorize.
This way securing the business layer is less intrusive.
ACL Based
The ACL based model was introduced in spring security 3.0, but hasn't been well documented.
Their suggestion is to look at the Contacts XML example, since this one uses their new acl component.
Last this book contains great examples on how to further customize your security wishes.


text:
Q: How to not match string not containing two consecutive newlines Demo at regex101. I have the following text file (a bibtex .bbl file):
\bibitem[{\textit{Alfonsi et~al.}(2011{\natexlab{a}})\textit{Alfonsi, Spogli,
  De~Franceschi, Romano, Aquino, Dodson, and Mitchell}}]{alfonsi2011bcg}
Alfonsi, L., L.~Spogli, G.~De~Franceschi, V.~Romano, M.~Aquino, A.~Dodson, and
  C.~N. Mitchell (2011{\natexlab{a}}), Bipolar climatology of {GPS} ionospheric
  scintillation at solar minimum, \textit{Radio Science}, \textit{46}(3),
  \doi{10.1029/2010RS004571}.

\bibitem[{\textit{Alfonsi et~al.}(2011{\natexlab{b}})\textit{Alfonsi, Spogli,
  Tong, De~Franceschi, Romano, Bourdillon, Le~Huy, and
  Mitchell}}]{alfonsi2011gsa}
Alfonsi, L., L.~Spogli, J.~Tong, G.~De~Franceschi, V.~Romano, A.~Bourdillon,
  M.~Le~Huy, and C.~Mitchell (2011{\natexlab{b}}), {GPS} scintillation and
  {TEC} gradients at equatorial latitudes in april 2006, \textit{Advances in
  Space Research}, \textit{47}(10), 1750--1757,
  \doi{10.1016/j.asr.2010.04.020}.

\bibitem[{\textit{Anghel et~al.}(2008)\textit{Anghel, Astilean, Letia, and
  Komjathy}}]{anghel2008nrm}
Anghel, A., A.~Astilean, T.~Letia, and A.~Komjathy (2008), Near real-time
  monitoring of the ionosphere using dual frequency {GPS} data in a kalman
  filter approach, in \textit{{IEEE} International Conference on Automation,
  Quality and Testing, Robotics, 2008. {AQTR} 2008}, vol.~2, pp. 54--58,
  \doi{10.1109/AQTR.2008.4588793}.

\bibitem[{\textit{Baker and Wing}(1989)}]{baker1989nmc}
Baker, K.~B., and S.~Wing (1989), A new magnetic coordinate system for
  conjugate studies at high latitudes, \textit{Journal of Geophysical Research:
  Space Physics}, \textit{94}(A7), 9139--9143, \doi{10.1029/JA094iA07p09139}.

I want to match the whole \bibitem command for a single entry (with some capture groups) if I know the reference code at the end of the command. I use this regex, which works for the first entry, but not for the rest (second entry exemplified below):
\\bibitem\[{(.*?)\((.*?)\)(.*?)}\]{alfonsi2011gsa}

This doesn't work, since it matches everything from the start of the first \bibitem command to the end of the second \bibitem command. How can I match only the second \bibitem command? I have tried using a negative lookahead for ^$ and \n\n, but I couldn't get either to work - basically, I want the third (.*?) to match any string not including two consecutive newlines. (If there's any other way to do this, I'm all ears.)

A: You can use negative look-arounds (?!) to prevent the match from having multiple occurrences of 'bibitem'. With this, the match will start with the 'bibitem' which immediately precedes your reference code. This seems to work:
\\bibitem\[{(((?!bibitem).)*?)\((((?!bibitem).)*?)\)(((?!bibitem).)*?)}\]{alfonsi2011gsa}

A: regex is not my strong point but this will get all the content you want without reading all the content into memory at once:
from itertools import groupby
import re
with open("file.txt") as f:
    r = re.compile(r"\[{(.*?)\((.*?)\)(.*?)}\]\{alfonsi2011gsa\}")
    for k, v in groupby(map(str.strip, f), key=lambda x: bool(x.strip())):
        match = r.search("".join(v))
        if match:
             print(match.groups())

('\\textit{Alfonsi et~al.}', '2011{\\natexlab{b}}', '\\textit{Alfonsi, Spogli,Tong, De~Franceschi, Romano, Bourdillon, Le~Huy, andMitchell}')


text:
Q: MSSQL Field alias (AS) has stopped working We are trying to move a Linux machine with PHP 5.2.1 to a virtual machine with PHP 5.3.3. Using Apache web server.
All the scripts that have:
Select real_column as alias_column from some_table

return null for alias_column.
If we remove the "as alias_column" everything works correctly.
We are using the LibTDS ODBC driver, connecting to MS-SQL 2008.
Any ideas?
Thanks

A: alias_column should be surrounded by single quotes, ie:
SELECT real_column AS 'alias_column' FROM some_table

If you're still not getting any results you may want to look check if the statement is generating any error messages, which may also involve turning up the error_reporting level in PHP.
Also, try a var_dump() on your results to see if your results are still being returned in the expected format.


text:
Q: cant install rhythmbox in xenial when I try sudo apt install rhythmbox I get this:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
 rhythmbox : Depends: librhythmbox-core9 (= 3.3-1ubuntu7) but 3.3.0.0-1~wilyubuntu2 is to be installed
             Depends: rhythmbox-data (= 3.3-1ubuntu7) but 3.3.0.0-1~wilyubuntu2 is to be installed
             Depends: gir1.2-rb-3.0 (= 3.3-1ubuntu7) but 3.3.0.0-1~wilyubuntu2 is to be installed
             Recommends: rhythmbox-plugins but it is not going to be installed
             Recommends: rhythmbox-plugin-zeitgeist but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I tried using ppa:fossfreedom/rhythmbox as a source as well but that responds with this:
E: The repository 'http://ppa.launchpad.net/fossfreedom/rhythmbox/ubuntu xenial Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

I tried making sure I didn't have any weird sources enabled and even deleted anything related to rhythmbox from /etc/apt/sources.list.d
Regular install from Software doesn't work either.
Any ideas?
Thanks

A: It seems that the xenial package has been deleted:
http://ppa.launchpad.net/fossfreedom/rhythmbox/ubuntu/dists/
http://www.ubuntuupdates.org/package/core/xenial/universe/proposed/rhythmbox

A: The ppa versioned it's rhythmbox packages incorrectly in wily so they are are higher than the rhythmbox packages in xenial.
xenial - 3.3-1ubuntu7
ppa - 3.3.0.0-1~wilyubuntu2
3.3.0.0 is higher than 3.3, to fix just remove all Rb source packages, update sources & install Rb from Ubuntu repos

A: I had this same problem. I believe Doug is right about the Wily ppa. I purged rhythmbox and all rhythmbox data. I also purged the fossfreedom ppa. Then I found the Rhythmbox deb file for Rhythmbox 3.3-1 (the Xenial version rather than the Wily version) on pkgs.org and was able to install Rhythmbox that way. I can't find a ppa at the moment that has the Xenial version. Hopefully fossfreedom will update his ppa soon.


text:
Q: How to solve error "Retrieving package sensors failed to mount" to succeed installation of sensors package by zypper? I have a server, i need to check server temperature ,so simply i decided to use sensors package, using zypper to install it. So

*

*First I used
zypper install sensors command by root user, The result message is
:
Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: sensors Overall download size: 84.0 K. After the operation, additional 296.0 K will be used. Continue? [YES/no]: y Retrieving package sensors-3.0.3-3.6.i586 (1/1), 84.0 K (296.0 K unpacked) Failed to mount cd:///?devices=/dev/sr0 on /var/adm/mount/AP_0x00000001: No medium found (mount: No medium found on /dev/sr0) Abort, retry, ignore? [A/r/i]: a Problem occured during or after installation or removal of packages: Installation aborted by user Please see the above error message for a hint.

*After that i use zypper lr -u command, the result is:

 # | Alias           | Name                  | Enabled | Refresh | URI           --+-----------------+-----------------------+---------+---------+---------------  -------------------------------------------------                                1 | openSUSE 11.1-0 | openSUSE 11.1-0       | Yes     | No      | cd:///?devices =/dev/sr0                                                                        2 | repo-debug      | openSUSE-11.1-Debug   | No      | Yes     | http://downloaddopensuse.org/debug/distribution/11.1/repo/oss/                   3 | repo-non-oss    | openSUSE-11.1-Non-Oss | Yes     | Yes     | http://download.opensuse.org/distribution/11.1/repo/non-oss/        4 | repo-oss        | openSUSE-11.1-Oss     | Yes     | Yes     | http://download.opensuse.org/distribution/11.1/repo/oss/                         5 | repo-source     | openSUSE-11.1-Source  | No      | Yes     | http://download.opensuse.org/source/distribution/11.1/repo/oss/                    6 | repo-update     | openSUSE-11.1-Update  | Yes     | Yes     | http://download.opensuse.org/update/11.1/
3- By lsb_release -d command cleared the my OS description is:
Description     open SUSE 11.1 (i586)
Now any body can advise how to solve the error and successfully install Sensors package by zypper?
*** It is necessary to mention that i don't have any installation CD of my server, but i can connect it to internet.

A: zypper mr -d 1 will disable the optical disk and that should bypass it and allow installation from the network.
I assume it's trying to get the files from that rather than the network as it's local with no updated file.
However, v11.1 is very old, it's 14 years old and and is no longer supported. It was eol'd 10 years ago. You may struggle to find installation files.
You really need to upgrade.


text:
Q: Can I make Firefox's address bar behave like Chrome? In chrome I can type a single word, such as 'cats', and it will google search it.
In firefox, it tries to go to cats.com or something. This functionality annoys the hell out of me, especially as I use Chrome at home and Firefox at work.
Is there a way to make firefox behave a bit more intelligently, ie. if there is no .com or other extension, don't bother trying to go to the URL, just go straight to search?

A: Also, Firefox 14 has this feature.

A: If it fits your needs, you can use the Omnibar Add-On, which is modeled after Chrome.

Integrates location bar and search bar into one. Shows search and url suggestions. Quickly switch search engine using search keywords. Provides different auto-complete popup styles for compact displays.

A: I have always used InstantFox for this purpose. Note that the Standard search without shortcuts option has to be turned on in this case.

A: It seems to work fine for me, I just typed cats and dogs in the address bar, and it looked it up in google. I have Firefox version 4.0

A: Posting here because I have been frustrated by the same problem and discovered a quick and painless workaround that saves us from having to install addons:
Just type a space somewhere in the address bar.  FF is at least smart enough to know immediately that any name lookup containing a space is doomed to fail, so it goes directly to the fallback search functionality.
Instead of "cats" search "cats ".


text:
Q: Works in sbt but not raw Java: after using `javac` to compile a .class file, why can't `java` find it? I used ObjectWeb's ASMifier to get a 'HelloDump.java', and added classloader and a main method to load and run a spoofed "HelloWorld".
If I run 'HelloDump.java' in the build tool sbt, everything works fine and outputs "HelloWorld!".
But if I use raw Java, it breaks. 'HelloDump.java' seems to compile OK, but the resulting 'HelloDump.class' is clearly present, yet doesn't seem to be recognized (check the sequence below):
$ julianpeeters@julianpeeters-virtual-machine ~/asm-example $ javac -cp lib/asm-all-4.1.jar HelloDump.java

$ julianpeeters@julianpeeters-virtual-machine ~/asm-example $ ls
DumpLoader.java.bak  HelloDump.class.bak                 Hello.java.bak
Hello.class.bak      HelloDump$DynamicClassLoader.class  lib
HelloDump.class      HelloDump.java                      README.md

$ julianpeeters@julianpeeters-virtual-machine ~/asm-example $ java -cp lib/asm/all/4.1.jar HelloDump
Exception in thread "main" java.lang.NoClassDefFoundError: HelloDump
Caused by: java.lang.ClassNotFoundException: HelloDump
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: HelloDump. Program will exit.

Explicitly adding . to the classpath doesn't help either.
So why does this work in sbt, but not in raw Java, and how can I fix it?
Thanks, any advice is appreciated,
-Julian

A: Add . to your CLASSPATH, so your command becomes:
java -cp lib/asm-all-4.1.jar:. HelloDump
The reason the JVM cannot find the class is that it looks only on the classpath and nowhere else.


text:
Q: OpenGL ES 2 Console Framebuffer Cursor I'm creating a very simple OpenGL ES 2.0 demo that runs on a Yocto Linux distribution on an iMX6 core.  I'm writing the image direct to the console frame buffer, as opposed to using X11.  I use the Vivante GPU drivers that implement EGL.
When I run the app, I see the cursor flashing away at the bottom of the screen and if I type during the program execution, the letters appear at the bottom.  How do I stop this happening as part of the program?

A: OK, I found an answer here.
The answer suggested doing this, which also removes power management:
#include <linux/kd.h>

int cfd;

// Set console to graphics mode
if((cfd=open("/dev/tty0", O_RDWR))<0){
  fprintf(stderr, "Error - cannot open tty0\n");
  return -1;
}
else{
  ioctl(cfd, KDSETMODE, KD_GRAPHICS);
}

I needed to add two further includes, <fnctl.h> and <sys/ioctl.h>.
Warning - if your program doesn't have a means of exiting, then this will disable your ability to stop the program by pressing CTRL C.


text:
Q: Why I am able to execute this it is showing ran 0 tests from selenium import webdriver
import unittest
import HtmlTestRunner
from selenium.webdriver.common.keys import Keys

class Environment(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path="D:\\auto\chromedriver.exe")

    def test_login(self):
        driver = self.driver
        driver.get("htt://localhost/dashboard/user/login")
        username = driver.find_element_by_id("uemail")
        username.send_keys("xyz@abc.com")
        password = driver.find_element_by_id("upwd")
        password.send_keys("1234567890")
        self.driver.find_element_by_id('upwd').send_keys(Keys.RETURN)

    def tearDown(self):
        self.driver.close()

    if __name__ == "__main__":
        unittest.main()

A: Try below code:
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

class PythonOrgSearch(unittest.TestCase):

    def setUp(self):

        self.driver = webdriver.Chrome(executable_path="C:\\Users\\dipak.bachhav\\Downloads\\New folder (2)\\chromedriver_win32\\chromedriver.exe")

    def test_search_in_python_org(self):
        driver = self.driver
        driver.get("http://www.python.org")
        self.assertIn("Python", driver.title)
        elem = driver.find_element_by_name("q")
        elem.send_keys("pycon")
        elem.send_keys(Keys.RETURN)
        assert "No results found." not in driver.page_source

    def tearDown(self):
        self.driver.close()

if __name__ == "__main__":
    unittest.main()


text:
Q: Is this jQuery AMD syntax? Recently, I can see all the jQuery plugins start with the below line.
function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD
        define(['jquery'], factory);
    } else if (typeof exports === 'object') {
        // CommonJS
        module.exports = factory;
    } else {
        // Browser globals
        factory(jQuery);
    }
}(function ($) {}));

I think it to be a similar concpet like Require.js, but I am not very sure. Can someone tell me what is this called or how it works? So that I can learn more on this.
PS: Please feel free to modify the Title of the question or mark it duplicate if we have it already in SO.

A: You are quite correct.
If we need to achieve AMD then we are inclined towards Require.js, but what if we want to achieve the same without Require.js? Then we would land up to the syntax mentioned by you. Which is called as UMD : Universal Module Definition
From the source:

jqueryPlugin.js
  - Defines a jQuery plugin that works with AMD and browser globals.
jqueryPluginCommonjs.js
  - Defines a jQuery plugin that works with AMD and browser globals, but also in a CommonJS environment. Use this version if you are running
  jQuery (or the jquip or jquery-untouched projects) in a CommonJS
  environment that can load jQuery appropriately.


text:
Q: csv with header (H) and related record (R) rows: how to scan R rows and input a value into the related H row I am hoping someone can help me out. I have searched extensively and can't find a solution.
I am unfortunately not knowledgeable about advanced programming within Excel and therefore if anyone has any thoughts or insights, please be as detailed as possible. Thank you in advance!
I have a large spreadsheet that has thousands of rows of data. There are many related groups within the spreadsheet, and each group has a single H row (header) and a bunch of associated R rows (records). The number of R rows will vary. The spreadsheet distinguishes between the two by placing either a "H" or a "R" in each cell in column A.
The H and R rows are linked by the fact that they have an exact (and unique to the sheet)match in column B.
Here is what I'm trying to do. I'd like to look at column J of each R row. If a column J cell says the word "INCONSISTENT" in any of the R rows that are linked to an H row, then I would like column L of the associated H row to say "INCONSISTENT".
But if the word "INCONSISTENT" does not exist in any column J cell in the R rows, then I want column L of the associated H row to say "CONSISTENT".
Hope this all makes sense.
To summarize, I want to find a way so that each H row will have either "CONSISTENT" or "INCONSISTENT" in the cell in column L. This tagging in column L of the H row will depend entirely on whether the word "INCONSISTENT" shows up in any of the associated R rows.
I have literally about 20,000 H rows to populate if possible. So I would like to find a way to program this in but have no clue how to do so.
I tried to attach an image of csv, but not sure if that worked. If someone wants, I can email a copy of it.
Data sample:

Thank you very much for your help.

A: I think this formula typed in L1 and autofilled down as required will do the job:
=IF($A1="H",IF(SUMPRODUCT(--($B1=$B:$B),--($J:$J="INCONSISTENT")),"INCONSISTENT","CONSISTENT"),"")
Sample file (with only relevant data columns): https://www.dropbox.com/s/a89u994zbi5hoki/HRConsistency.xlsx


text:
Q: Custom sort in Excel by first character and user-defined non-alphabetical order. I need to create my own sort order in Excel but I only want to sort by the first character of a cell. My cells look like:
T100
T101
S100
A100
I need them to auto sort with the T's first, A's second, and S's third. I have a massive number of T's in reality and I am adding unknown Txxx values to the sheet in the future, so I can't specify the entire cell value to sort by(list would constantly need updating and would be enormous).
Any help much appreciated, thanks.

A: The easy solution might be to add a column that converts the letter to a number so T205 becomes 1T205 and A100 becomes 2A100
I would structure this as:

*

*Column A has your values (e.g. "T101")

*Column B extracts the letter from column A and tacks on to the beginning of the value in column A =VLOOKUP(LEFT(A2),[some table],2,0) & A2
Then sort on Column B:


text:
Q: Is "could" interchangeable with "can"? Is "could" interchangeable with "can"?
for example, there are coversations like these:
example. 1

A: I could run faster than you.
  B: No way.

In this case, the "could" is referring to the less certain possibility of a skill in the present time.
example. 2

A: Even that small stadium could have ten thousand people.
  B: Isn't that too small for ten thousand people?

In this case, the "could" is referring to the less certain possibility of a capability as a fact.
I think these "could"s in the two examples express the same things as "can", and the difference from" can" is just that "could" is less certain about possibilities.
However, I'm not sure if it's allowed to use "could" like those, because "could" is used when expressing hypothetical or conditional things like "would".
Are the "could"s acceptable?
Thank you.

A: No. Could is defined as past of can. Could indicates possibility, while can means able to do so.


text:
Q: Check if list of four elements has two pairs of equal numbers in Python I was solving this problem on codesignal:
Call two arms equally strong if the heaviest weights they each are able to lift are equal.
Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right  and the left), and so are their weakest arms.
Given your and your friend's arms' lifting capabilities, find out if you two are equally strong.
I was able to find this solution and it worked on all tests. Can someone please help me find a shorter solution? I think mine is way too long. Thanks
def solution(yourLeft, yourRight, friendsLeft, friendsRight):

    lst_me = []
    lst_me.append(yourLeft)
    lst_me.append(yourRight)
    lst_me = sorted(lst_me)

    lst_friend = []
    lst_friend.append(friendsLeft)
    lst_friend.append(friendsRight)
    lst_friend = sorted(lst_friend)

    if lst_me[0] == lst_friend[0] and lst_me[1] == lst_friend[1]:
        return True
    else:
        return False

A: Put each pair of arms into an unordered collection (like a set) and compare those:
def solution(yourLeft, yourRight, friendsLeft, friendsRight):
    return {yourLeft, yourRight} == {friendsLeft, friendsRight}

>>> solution(100, 120, 120, 100)
True
>>> solution(100, 100, 120, 100)
False
>>> solution(100, 100, 100, 100)
True

Since equality comparisons between sets are order-insensitive, there's no need to sort them before doing the comparison.  {x, y} == {y, x}.
Note that this solution wouldn't work if it had to handle three arms, because {x, x, y} == {x, y, y} as well!  If you had a restriction like this that prevented you from using sets, a shorter way of doing the comparison between sorted lists would be:
def solution(yourLeft, yourRight, friendsLeft, friendsRight):
    return sorted([yourLeft, yourRight]) == sorted([friendsLeft, friendsRight])


text:
Q: Can I modify existing GPL software to use a proprietary (closed-source) library and then distribute one or both? Say I have GPL software A and proprietary library B. I modify A to use B. Am I then free to distribute A by itself? The GPL FAQ seems to indicate that is there case here:
https://www.gnu.org/licenses/gpl-faq.html#FSWithNFLibs
Now what if I already own the license to B. Am I now able to distribute both A and B together even though B is closed-source? I don't see how I could be forced to license B as GPL since it already existed independent from and is in no way derived from A.
All linking to B is done dynamically at runtime.

A: You can distribute software A as GPL, but only without the additional features provided by proprietary library B.  If you bind new features in software A to proprietary library B, then you must also distribute B's source code under the GPL.  Binding the two softwares in this fashion creates a derivative work.
The only way you might get away with licensing A separately is by dynamically binding library B at runtime.  If the library isn't made available by the user, the features simply won't be present in Software A.  But software A must be able to substantially function without library B.
There are other considerations as well.  The FSF only considers such an arrangement valid if the communication between Software A and Library B "takes place at arm's length."  The exact meaning of "arm's length" is not specifically stated by the FSF, but it's probably fair to say that your software can't be the only software that uses library B.
Further, to fulfill the spirit of the GPL, you must allow the consumer of Software A to substitute a suitable library for Library B, or even to write their own.  That's the freedom that the GPL is designed to provide; the freedom to use your software in any way they see fit, including redistributing it to others (provided they also follow the GPL).
So it is imperative that Software A's functionality is not impaired in any substantial way by the absence of proprietary library B.

A: First disclaimers
1. I'm not a lawyer - and this isn't a forum for a legal advice
2. if you ask 5 different IP lawyers RE GPL compliance, you will likely get 5 different answers. It has not been really tested much in US courts AFAIK.
With that, here's my take. In short, I believe you can release A by itself under GPL (provided you meet the source code availability and other license requirements).  The fact you made modification to A to call B means you also need to release your modification to A under GPL license, but it does not mean you need to also release B under GPL, or release B with A.
The license of B (whether GPL or not, or proprietary) or even how you call B (dynamic linking vs static) is irrelevant here because it's A calling B, not the other way around (so one cannot say B is a derivative of A).  You are still preserving the freedom of the users - which is really the intent and essence of the GPL license.  Users can make changes to the source code of A to use something other than B should they want to.


text:
Q: BOOTSTRAP: insert accordion after ajax request I need to insert an accordion thanks to bootstrap to organize my data. The fact is, I create all the elements with dom to create my tree after the first load of the page with an ajax request.
But bootstrap doesn't take account of it because it has been created after the page first initialization.
The aim is to have several lines of results and if you click on one line ,it expands and gives more details.
How  can I dynamically create this accordion?

A: By generating the HTML and inserting it into the page where you want it.
After you have added it to the page, then invoke:
$(".collapse").collapse()

All of Bootstrap's Javascript modules support manual creation.


text:
Q: MVC Web API Routing to Wrong Action I have a web API controller, when I call the default Get action this works, when I call another specific action (GetReservationsForCustomer) this also works, but one action gives an error (GetReservationsByDate), it seems to route to the default Get action. Here is the code:
    // GET: api/Reservations
    public IQueryable<Reservation> GetReservations()
    {
        return db.Reservations;
    }

    [ResponseType(typeof(ReservationDTO))]
    public IHttpActionResult GetReservationsForCustomer(int CustomerId)
    {
        IEnumerable<Reservation> reservations = db.Reservations.Where(r => r.CustomerId == CustomerId).ToList();
        List<ReservationDTO> reservationList = new List<ReservationDTO>();

        foreach(Reservation reservation in reservations)
        {
            reservationList.Add(new ReservationDTO
            {
                id = reservation.id,
                ReservationStart = reservation.ReservationStart,
                Covers = reservation.Covers
            });
        }

        return Ok(reservationList);
    }

    [ResponseType(typeof(ListReservationDTO))]
    public IHttpActionResult GetReservationsByDate(DateTime StartDate, DateTime EndDate)
    {
        IEnumerable<Reservation> reservations = new List<Reservation>();

        if (EndDate != null)
        {
            reservations = db.Reservations.Where(r => r.ReservationStart.Date >= StartDate.Date && r.ReservationStart.Date >= EndDate.Date).ToList();
        }
        else
        {
            reservations = db.Reservations.Where(r => r.ReservationStart.Date == StartDate.Date).ToList();
        }

        List<ReservationDTO> reservationList = new List<ReservationDTO>();
        foreach (Reservation res in reservations)
        {
            reservationList.Add(new ReservationDTO
            {
                id = res.id,
                ReservationStart = res.ReservationStart,
                Covers = res.Covers,
                CustomerEmail = res.Customer.EmailAddress,
                CustomerName = res.Customer.Name,
                CustomerPhone = res.Customer.PhoneNumber
            });
        }

        return Ok(reservationList);
    }

Here is my API call:
http://localhost:55601/api/Reservations/GetReservationsByDate/?StartDate=2018-03-04:T12:30:00
And here is the response:
{
    "Message": "The request is invalid.",
    "MessageDetail": "The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Http.IHttpActionResult GetReservation(Int32)' in 'GreenLionBookings.API.ReservationsController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter."
}

Please note the specifics of the action are not relevant at this stage, I've butchered it a fair bit trying to get this to work! I've tried specifying a start date and end date and neither seems to work. It always seems to get routed to the default Get action.
Here is my RouteConfig:
public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}

And here is my WebApiConfig:
    public static void Register(HttpConfiguration config)
    {
        // Web API configuration and services
        // Configure Web API to use only bearer token authentication.
        config.SuppressDefaultHostAuthentication();
        config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

        // Web API routes
        config.MapHttpAttributeRoutes();

        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );
    }

So both basically just default.
Why is this not routing to the correct action, just for this one and not the others? I have another controller (Customers) which seems to work correctly for all actions too. I've read this and this, and also this and this which I actually thought was pretty relevant and quite helpful, but didn't solve my problem.
What am I doing wrong here?

A: First of all, you have a typeo in the date.
This 2018-03-04:T12:30:00 should be 2018-03-04T12:30:00.
Then, to solve the routing problem, you could leave out the action name of the url and let the framework match the request against the parameters name.
Try it like this
api/Reservations?StartDate=2018-03-04T12:30:00&EndDate=2018-03-05T12:30:00

Then, if you want to be able to send nullable values to EndDate which is a value type of DateTime; make the DateTime nullable
[ResponseType(typeof(ListReservationDTO))]
public IHttpActionResult GetReservationsByDate(DateTime StartDate, DateTime? EndDate)

Notice the DateTime? which is a shorthand for Nullable<DateTime>


text:
Q: matlab user defined function, how to create and call them I have written a code in matlab script. I need to finish it up by creating a Function for center.
Here is the sample code i written
while(1)        % infinite loop

trigger(obj);
im=getdata(obj,1);   %get the image

trigger(obj);
im1=getdata(obj,1);  % the first time triggering occurs the image is just
                              % noise. Thus the 2nd image is used.
b=rgb2gray(im1);      % convert to grayscale
a=roicolor(b,[100:118]);  %define a region of interest
a=~a;

c=center(a);
                  % use disp(c) to see the values, while testing
if (c(2)>190)
fwrite(ser,'r');  % send move right
elseif (c(2)<170 && c(2)>10)
fwrite(ser,'l');
elseif c(2)<170
fwrite(ser,'l'); % stop

now in this center(a) its not a predefined function in matlab, its a user defined one.
The function center(a) that I have used is not an inbuilt function. I would suggest you write a function for center which I can work on
I want you people to help me to create a function in matlab and to call the user defined function, when ever I needed.

A: just create a file called center.m put all your code in there and start the file (at the top) with something like:
function c = center(a);


text:
Q: Strange error with AttributeError: 'NoneType' object has no attribute 'getText' import os, re, sys, urllib2
from bs4 import BeautifulSoup
import lxml

def get_epg(channel, html):
    soup = BeautifulSoup(html, "lxml")
    main_div = soup.find("div", {"class":"viewport-container"})
    elements = main_div.find_all("li")
    for element in elements:
        cmp = element.find("div", { "class" : "channel" } ).getText()
        #return cmp
        if channel == cmp:
            print "found"
            return element

EPG_URL = "http://www.hoerzu.de/tv-programm/jetzt/"
html = urllib2.urlopen(EPG_URL)
print get_epg("ZDF", html)

results in:
Traceback (most recent call last):
  File "epg.py", line 17, in <module>
    print get_epg("ZDF", html)
  File "epg.py", line 10, in get_epg
    cmp = element.find("div", { "class" : "channel" } ).getText()
AttributeError: 'NoneType' object has no attribute 'getText'

I really don't get what is wrong here, because when I do:
    for element in elements:
        cmp = element.find("div", { "class" : "channel" } ).getText()
        return cmp

the error doesn't shows up and all goes as expected ...

A: The second iteration clearly returns None.

Das Erste

None
None
None

ZDF

None
None
None

RTL

None
None
None

Sat.1

None
None
None

ProSieben

None
None
None

kabel eins

None
None
None

RTL II

None
None
None

VOX

None
None
None

Arte

None
None
None

3sat

None
None
None

Super RTL

None
None
None

KiKA

None
None
None

NDR

None
None
None

WDR

None
None
None

MDR

None
None
None

BR

None
None
None

SWR

None
None
None

HR

None
None
None

RBB

None
None
None

n-tv

None
None
None

N24

None
None
None

Servus TV

None
None
None

SPORT1

None
None
None

TV.Berlin

None
None
None

Hamburg 1

None
None
None

Eurosport

None
None
None

München TV

None
None
None

Franken Fernsehen

None
None
None

Tele 5

None
None
None

Das VIERTE

None
None
None

NRW TV

None
None
None

Nickelodeon / Comedy Central

None
None
None

So you have to check for this condition instead of calling blindly getText().

A:
from bs4 import BeautifulSoup

you should use "main_div.findAll"
for Bs4:
find_all ---> findAll


text:
Q: Differences between a field, its field strength, and the force an object experiences within this field My question is what are the conceptual and intuitive differences between these things. For example, the magnetic field B = F/(|q|v). In this case, B IS the field, and when a charged particle is travelling within this field, it experiences some magnetic force F. In this case, what is the magnetic field strength? Does it even matter, if from B we can calculate the the force the particle experiences anyway? More generally, what is the conceptual difference between a field, its field strength, and the force an object experiences when in this field? Thanks in advance, and I apologise if this question has already been answered, although I couldn't find anything answering this question precisely!

A: A field is usually a tensor field of arbitrary order, so a function from space(-time) to the corresponding tensor space. For example, in your case, $\vec{B}$ is a vector field, a function from time and space to three dimensional vectors. The field strength is in my experience usually used for the norm of a vector field. And usually, the field gives the force vector that an object of unit mass/charge/... experiences, so to obtain the force of an actual object in the field, you usually need to multiply the field vector with the objects "scaling value" - the mass/charge/...
Was this the kind of answer you were looking for?


text:
Q: Почему вместо строкового значения выдаётся цифра и как сделать правильно? type grupp2021=record
gruppa:integer;
end;
var
a:array [1..15] of grupp2021;
b:string;
i,n:integer;
begin
readln(n);
for i:= 1 to n do
begin
a[i].gruppa:=1+random(5);
case a[i].gruppa of
   1:b:='21ВИ1';
   2:b:='14ВИ1';
   3:b:='15ВИ1';
   4:b:='19ВП2';
   5:b:='13ВП3';
end;
end;
for i:=1 to n do begin
write('Номер группы:');
writeln(a[i].gruppa);
end;
end.

A: Так вы выводите gruppa, которая у вас тип integer. Строка у вас хранится в переменной b (причем она перезаписывается при каждой итерации).

A: type
grupp2021 = record
  gruppa: integer;
  b: string;
end;

...
case a[i].gruppa of
   1:a[i].b:='21ВИ1';
   ...
end;
...
for i := 1 to n do
begin
  write('Номер группы:');
  writeln(a[i].gruppa, a[i].b);
end;


text:
Q: Digitising - Separate fill and line opacities (or remove fill) I have a client who specialises in aerial photograph interpretation and is in the process of moving from AutoCAD to QGIS. They find the auto 'fill' when digitising polygons really disruptive and although we can tweak the opacity (see "add feature" tool QGIS 2.0 - polygon fill blocks view of what I want to digitize) ideally we would want a solid line with no fill while digitising.
So far as I am aware there isn't a plugin or other existing solution for this, so my question is how complicated would it be to change the settings to separate opacity of line and fill when digitising? Could this be done via a plugin or only through extending the core QGIS functions?


text:
Q: how to compare a given time, falls between a specific time range - javascript I am creating back-end for the fashion related application using node js where i need to show that the particular store is open or closed depending on current time. So, How do i compare the current time with the start and end time of the store? Any help would be appreciated. Timings data set which is stored in db is given below:
"timings" : [
    {
      "id": 1,
      "day": "Monday",
      "session_one": {
        "start_time": "10:00 AM",
        "end_time": "02:00 PM"
      },
      "session_two": {
        "start_time": "04:00 PM",
        "end_time": "09:00 PM"
      },
      "session_three": {
        "start_time": "03:00 PM",
        "end_time": "07:30 PM"
      }
    },
    {
      "id": 2,
      "day": "Tuesday",
      "session_one": {
        "start_time": "10:00 AM",
        "end_time": "02:00 PM"
      },
      "session_two": {
        "start_time": "04:00 PM",
        "end_time": "09:00 PM"
      },
      "session_three": {
        "start_time": "03:00 PM",
        "end_time": "07:30 PM"
      }
    },
    {
      "id": 3,
      "day": "Wednesday",
      "session_one": {
        "start_time": "10:00 AM",
        "end_time": "02:00 PM"
      },
      "session_two": {
        "start_time": "04:00 PM",
        "end_time": "09:00 PM"
      },
      "session_three": {
        "start_time": "03:00 PM",
        "end_time": "07:30 PM"
      }
    },
    {
      "id": 4,
      "day": "Thursday",
      "session_one": {
        "start_time": "10:00 AM",
        "end_time": "02:00 PM"
      },
      "session_two": {
        "start_time": "04:00 PM",
        "end_time": "09:00 PM"
      },
      "session_three": {
        "start_time": "03:00 PM",
        "end_time": "07:30 PM"
      }
    },
    {
      "id": 5,
      "day": "Friday",
      "session_one": {
        "start_time": "10:00 AM",
        "end_time": "02:00 PM"
      },
      "session_two": {
        "start_time": "04:00 PM",
        "end_time": "09:00 PM"
      },
      "session_three": {
        "start_time": "03:00 PM",
        "end_time": "07:30 PM"
      }
    },
    {
      "id": 6,
      "day": "Saturday",
      "session_one": {
        "start_time": "10:00 AM",
        "end_time": "02:00 PM"
      },
      "session_two": {
        "start_time": "04:00 PM",
        "end_time": "09:00 PM"
      },
      "session_three": {
        "start_time": "03:00 PM",
        "end_time": "07:30 PM"
      }
    },
    {
      "id": 7,
      "day": "Sunday",
      "session_one": {
        "start_time": "10:00 AM",
        "end_time": "02:00 PM"
      },
      "session_two": {
        "start_time": "04:00 PM",
        "end_time": "09:00 PM"
      },
      "session_three": {
        "start_time": "03:00 PM",
        "end_time": "07:30 PM"
      }
    }
  ]

A: Try this,
function timeCal(time) {
    let timeSplit = time.split(' ');
    let timeInMinutes = 0;

    if(timeSplit[1] === 'AM') {
        let timeArr = timeSplit[0].split(':');

        let hours = parseInt(timeArr[0]);
        let minutes = parseInt(timeArr[1]);

        timeInMinutes = (hours === 12) ? minutes : (hours * 60) + minutes;

    } else if(timeSplit[1] === 'PM') {
        let timeArr = timeSplit[0].split(':');

        let hours = parseInt(timeArr[0]);
        let minutes = parseInt(timeArr[1]);

        timeInMinutes = (hours === 12) ? (hours * 60 + minutes) : ((hours + 12) * 60) + minutes;
    }

    return timeInMinutes;
}

let time =  {
        "start_time": "10:20 AM",
        "end_time": "02:00 PM"
      };

let start = timeCal(time.start_time);
let end = timeCal(time.end_time);
let today = new Date();
let current = today.getHours() * 60 + today.getMinutes();

(start<=current && end>=current) ? console.log('open') : console.log('closed');


text:
Q: JS how to get month, week, past 3 days from today In js how can I get the timestamp of a date like 2 weeks ago. For example I get the current timestamp, Then I need to get the timestamp 3 days ago, or 2 weeks ago, or a month ago. Is there a moment library that does this? I cant find anything online.

A: As the comments say, check out Moment JS: https://momentjs.com/
moment().subtract(10, 'days').calendar(); // 02/11/2021
moment().subtract(6, 'days').calendar();  // Last Monday at 12:17 AM
moment().subtract(3, 'days').calendar();  // Last Thursday at 12:17 AM
moment().subtract(1, 'days').calendar();  // Yesterday at 12:17 AM
moment().calendar();                      // Today at 12:17 AM
moment().add(1, 'days').calendar();       // Tomorrow at 12:17 AM
moment().add(3, 'days').calendar();       // Wednesday at 12:17 AM
moment().add(10, 'days').calendar();

moment().format();                        // 2021-02-21T00:43:34-08:00

Try:
moment().subtract(6, 'days').format()

A: Handling date objects in javascript is bit tricky compared to other general purpose languages. However this could be achieved in Java script's Date.parse(date) method.
This method returns the timespan between the given date and 1970-01-01 in milliseconds.
So, I would do something like below to manipulate your scenario.
function getNewDate(originalDate, dateOffset){
    // converting original date to milliseconds
    var originalMS = Date.parse(originalDate);
    // calculating your date offest in milliseconds
    var offsetMS = dateOffset * 1000 * 3600 * 24;
    // apply the offset millisecons to original moment
    var newDateMS = originalMS + offsetMS;
    // Convert it back to new date object and return it
    return new Date(newDateMS);
}

You need to pass a date object and desired timespan in days as parameters to this function.
So you would call it as follows
var originalDate = new Date();

// To get new date after 2 weeks for the given original date
getNewDate(originalDate, 14)

// To get new date before 2 weeks for the given original date
getNewDate(originalDate, -14)

I hope this would answer you problem.