text:
Q: login.xhtml: The requested resource is not available I created a Dyamic Web Project in Eclipse to try the login part of the example at http://www.simtay.com/simple-crud-web-application-with-jsf-2-1-primefaces-3-5-maven-and-jpa/
Project Facets I enabled in project properties are:

*

*CDI

*Dynamic web module

*Java

*JavaScript

*JavaServerFaces

*JPA

and as container I use TomEE.
The moment I try to start the login.xhtml page, I obtain
HTTP Status 404 - /LAI_pezzi_Login/faces/Login.xhtml

type Status report

message /LAI_pezzi_Login/faces/Login.xhtml

description The requested resource is not available.

Apache Tomcat (TomEE)/7.0.37

TomEE console:
SEVERE: StandardWrapper.Throwable
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

    at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:286)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:206)
    at javax.faces.webapp.FacesServlet.init(FacesServlet.java:116)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

giu 14, 2013 5:17:59 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /PrimeFaces_DataTable_DB_editable threw load() exception
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

    at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:286)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:206)
    at javax.faces.webapp.FacesServlet.init(FacesServlet.java:116)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

giu 14, 2013 5:17:59 PM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /LAI_pezzi_Login
giu 14, 2013 5:17:59 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile
WARNING: jar '/home/caterpillar/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/LAI_pezzi_Login/WEB-INF/lib/javax.persistence_1.0.0.jar' contains offending class: javax.persistence.Entity. It will be ignored.
giu 14, 2013 5:18:00 PM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: /home/caterpillar/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/LAI_pezzi_Login
giu 14, 2013 5:18:00 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
giu 14, 2013 5:18:00 PM org.apache.openejb.config.AutoConfig createContainer
INFO: Auto-creating a container for bean LAI_pezzi_Login.Comp1241762921: Container(type=MANAGED, id=Default Managed Container)
giu 14, 2013 5:18:00 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=Default Managed Container)
giu 14, 2013 5:18:00 PM org.apache.openejb.core.managed.SimplePassivater init
INFO: Using directory /tmp for stateful session passivation
giu 14, 2013 5:18:00 PM org.apache.openejb.config.AutoConfig deploy
INFO: Configuring PersistenceUnit(name=LAI_pezzi_Login)
giu 14, 2013 5:18:00 PM org.apache.openejb.config.AutoConfig setJtaDataSource
INFO: Adjusting PersistenceUnit LAI_pezzi_Login <jta-data-source> to Resource ID 'My DataSource' from 'null'
giu 14, 2013 5:18:00 PM org.apache.openejb.config.AutoConfig setNonJtaDataSource
INFO: Adjusting PersistenceUnit LAI_pezzi_Login <non-jta-data-source> to Resource ID 'My Unmanaged DataSource' from 'null'
giu 14, 2013 5:18:00 PM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "/home/caterpillar/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/LAI_pezzi_Login" loaded.
giu 14, 2013 5:18:00 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: /home/caterpillar/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/LAI_pezzi_Login
giu 14, 2013 5:18:02 PM null
INFO: You have enabled runtime enhancement, but have not specified the set of persistent classes.  OpenJPA must look for metadata for every loaded class, which might increase class load times significantly.
giu 14, 2013 5:18:03 PM null
INFO: OpenJPA dynamically loaded a validation provider.
giu 14, 2013 5:18:03 PM org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory createDelegate
INFO: PersistenceUnit(name=LAI_pezzi_Login, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 2951ms
giu 14, 2013 5:18:03 PM org.apache.openejb.cdi.CdiBuilder initSingleton
INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@3f894493
giu 14, 2013 5:18:03 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container is starting...
giu 14, 2013 5:18:03 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
giu 14, 2013 5:18:03 PM org.apache.webbeans.plugins.PluginLoader startUp
INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
giu 14, 2013 5:18:03 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
INFO: All injection points are validated successfully.
giu 14, 2013 5:18:03 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication
INFO: OpenWebBeans Container has started, it took 23 ms.
giu 14, 2013 5:18:03 PM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=/home/caterpillar/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/LAI_pezzi_Login)
giu 14, 2013 5:18:04 PM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.apache.myfaces.webapp.StartupServletContextListener" is already configured for this context. The duplicate definition has been ignored.
giu 14, 2013 5:18:04 PM org.apache.myfaces.config.DefaultFacesConfigurationProvider getStandardFacesConfig
INFO: Reading standard config META-INF/standard-faces-config.xml
giu 14, 2013 5:18:04 PM org.apache.myfaces.config.DefaultFacesConfigurationProvider getWebAppFacesConfig
INFO: Reading config /WEB-INF/faces-config.xml
giu 14, 2013 5:18:04 PM org.apache.myfaces.config.DefaultFacesConfigurationProvider getClassloaderFacesConfig
INFO: Reading config : jar:file:/home/caterpillar/Universita/Programmazione/apache-tomee-plus-1.5.2/lib/openwebbeans-jsf-1.1.8.jar!/META-INF/faces-config.xml
giu 14, 2013 5:18:04 PM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-api' was found in version '2.1.10' from path 'file:/home/caterpillar/Universita/Programmazione/apache-tomee-plus-1.5.2/lib/myfaces-api-2.1.10.jar'
giu 14, 2013 5:18:04 PM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-impl' was found in version '2.1.10' from path 'file:/home/caterpillar/Universita/Programmazione/apache-tomee-plus-1.5.2/lib/myfaces-impl-2.1.10.jar'
giu 14, 2013 5:18:05 PM org.apache.myfaces.util.ExternalSpecifications isBeanValidationAvailable
INFO: MyFaces Bean Validation support enabled
giu 14, 2013 5:18:05 PM org.apache.myfaces.application.ApplicationImpl getProjectStage
INFO: Couldn't discover the current project stage, using Production
giu 14, 2013 5:18:05 PM org.apache.myfaces.config.FacesConfigurator handleSerialFactory
INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
giu 14, 2013 5:18:05 PM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider
giu 14, 2013 5:18:05 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.LinkageError: loader (instance of  sun/misc/Launcher$ExtClassLoader): attempted  duplicate class definition for name: "com/sun/crypto/provider/DESKeyGenerator"
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.security.Provider$Service.getImplClass(Provider.java:1279)
    at java.security.Provider$Service.newInstance(Provider.java:1237)
    at javax.crypto.KeyGenerator.nextSpi(KeyGenerator.java:328)
    at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:157)
    at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:207)
    at org.apache.myfaces.shared.util.StateUtils.findSecret(StateUtils.java:887)
    at org.apache.myfaces.shared.util.StateUtils.findSecret(StateUtils.java:876)
    at org.apache.myfaces.shared.util.StateUtils.initSecret(StateUtils.java:781)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:148)
    at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

giu 14, 2013 5:18:05 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
giu 14, 2013 5:18:05 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/LAI_pezzi_Login] startup failed due to previous errors
giu 14, 2013 5:18:05 PM org.apache.openejb.assembler.classic.Assembler destroyApplication
INFO: Undeploying app: /home/caterpillar/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/LAI_pezzi_Login
giu 14, 2013 5:18:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9080"]
giu 14, 2013 5:18:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-9009"]
giu 14, 2013 5:18:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 21399 ms

I know that the code must be adapted to my needs, but the web page as is, should at least start (and obiously have to fail when you trigger buttons)
Here are most important files and the complete files list:
Login.xhtml
<ui:composition template="/templates/layout.xhtml"
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui"
>
     <ui:define name="content">
         <h:form styleClass="loginPanelStyle">
                 <p:growl id="msgs" showDetail="true" sticky="false" />
                <p:panelGrid columns="2">
                <f:facet name="header">
                    Login Panel
                </f:facet>
                <h:outputText value="Username : "></h:outputText>
                <p:inputText id="username" value="#{loginController.username}" required="true" requiredMessage="Please Enter Username!" message="fc">
                    <f:validateLength minimum="1" />
                </p:inputText>
                <h:outputText value="Password : "></h:outputText>
                <p:password id="password" value="#{loginController.password}" required="true" requiredMessage="Please Enter password!">
                    <f:validateLength minimum="1" />
                </p:password>
                <f:facet name="footer">
                <p:commandButton value="Submit" update="msgs" actionListener="#{loginController.login}" type="submit" icon="ui-icon-check" style="margin:0"></p:commandButton>
                </f:facet>
            </p:panelGrid>
        </h:form>
     </ui:define>
</ui:composition>

LoginController.java
package controller;

import util.DateUtility;
import java.io.IOException;
import java.io.Serializable;
import java.security.Principal;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Login Controller class allows only authenticated users to log in to the web application.
 * @author Emre Simtay <emre@simtay.com>
 */

@Named
@SessionScoped
public class LoginController implements Serializable {
    @Inject
    private transient Logger logger;
    private String username;
    private String password;

    /** Creates a new instance of LoginController */
    public LoginController(){
    }

    //  Getters and Setters

    /**
     * @return username
     */
    public String getUsername() {
            return username;
    }

    /**
     *
     * @param username
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     *
     * @return  password
     */
    public String getPassword() {
    return password;
    }

    /**
     *
     * @param password
     */
    public void setPassword(String password) {
    this.password = password;
    }

    /**
     * Listen for button clicks on the #{loginController.login} action,
     * validates the username and password entered by the user and
     * navigates to the appropriate page.
     * @param actionEvent
     */
    public void login(ActionEvent actionEvent){

        FacesContext context = FacesContext.getCurrentInstance();
        HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
        try {
                String navigateString = "";
                // Checks if username and password are valid if not throws a ServletException
                request.login(username, password);
                // gets the user principle and navigates to the appropriate page
                Principal principal = request.getUserPrincipal();
                if(request.isUserInRole("Administrator")){
                        navigateString = "/admin/AdminHome.xhtml";
                }else if(request.isUserInRole("Manager")){
                        navigateString = "/manager/ManagerHome.xhtml";
                }else if(request.isUserInRole("User")){
                        navigateString = "/user/UserHome.xhtml";
                }
                try {
                    logger.log(Level.INFO, "User ({0}) loging in #" +DateUtility.getCurrentDateTime(), request.getUserPrincipal().getName());
                    context.getExternalContext().redirect(request.getContextPath() + navigateString);
                } catch (IOException ex) {
                    logger.log(Level.SEVERE, "IOException, Login Controller" + "Username : " + principal.getName(), ex);
                    context.addMessage(null, new FacesMessage("Error!", "Exception occured"));
                }
        } catch (ServletException e) {
                logger.log(Level.SEVERE, "IOException, Login Controller: The username or password you provided does not match our records.");
                context.addMessage(null, new FacesMessage("Error!", "The username or password you provided does not match our records."));
        }
    }

    /**
     * Listen for logout button clicks on the #{loginController.logout} action
     * and navigates to login screen.
     */
    public void logout(){

        HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
        HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
        logger.log(Level.INFO, "User ({0}) loging out #" +DateUtility.getCurrentDateTime(), request.getUserPrincipal().getName());
        if(session != null){
            session.invalidate();
        }
        FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(FacesContext.getCurrentInstance(), null, "/Login.xhtml?faces-redirect=true");
    }

}

Files list:
ls -R
.:
build  src  WebContent

./build:
classes

./build/classes:
controller  META-INF  util

./build/classes/controller:
LoginController.class

./build/classes/META-INF:
persistence.xml

./build/classes/util:
DateUtility.class

./src:
controller  META-INF  util

./src/controller:
LoginController.java

./src/META-INF:
persistence.xml

./src/util:
DateUtility.java

./WebContent:
ErrorAccessDenied.xhtml  Login.xhtml  META-INF  resources  WEB-INF

./WebContent/META-INF:
MANIFEST.MF

./WebContent/resources:
css  primefaces-nz

./WebContent/resources/css:
default.css

./WebContent/resources/primefaces-nz:
images  theme.css

./WebContent/resources/primefaces-nz/images:
ui-bg_flat_30_cccccc_40x100.png           ui-bg_highlight-soft_35_222222_1x100.png  ui-icons_292cd1_256x240.png
ui-bg_flat_50_5c5c5c_40x100.png           ui-bg_highlight-soft_44_444444_1x100.png  ui-icons_a83300_256x240.png
ui-bg_glass_40_ffc73d_1x400.png           ui-bg_highlight-soft_80_1442c8_1x100.png  ui-icons_cccccc_256x240.png
ui-bg_highlight-hard_20_16475f_1x100.png  ui-bg_inset-hard_30_dedede_1x100.png      ui-icons_ffffff_256x240.png
ui-bg_highlight-soft_33_1258bf_1x100.png  ui-icons_222222_256x240.png

./WebContent/WEB-INF:
beans.xml  faces-config.xml  lib  web.xml

./WebContent/WEB-INF/lib:

P.S. Can be a problem having libraries in both TomEE and project files? I am forced to do that because when I used Tomcat I missed many libraries and I did not know where to get them, then I moved to TomEE

A: The webapp's runtime classpath is a mess. The webapp's /WEB-INF/lib seems to contain JSF and JPA libraries which are already provided by TomEE itself as being a Java EE web profile compliant container.
Tomcat is a barebones JSP/Servlet container and does therefore not ship with e.g. JSF, JPA, EJB, etc. That's exactly why you need to provide and configure JSF, JPA, EJB, etc manually along with the webapp for Tomcat. But for TomEE (and Glassfish, JBoss AS, etc) that's thus absolutely not necessary and would only end up in classloading conflicts because of duplicate different versioned libaries in the runtime classpath.
Get rid of libraries in /WEB-INF/lib which are already provided by the target container itself.


text:
Q: Summing a decimal field using Linq to datatable I was able to get this to work after much frustration, but I was hoping someone could explain to me why this works:
var monthCharges = WRVUData.AsEnumerable()
                               .Where(dr => dr.Field<DateTime>("Posting_Month") == new DateTime(month.Year, i, 1))
                               .Where(dr => dr.Field<string>("Report_Producer_Name") == provider || dr.Field<string>("Group_Name") == group)
                               .Where(dr => dr.Field<decimal?>("Charges") != null)
                               .Sum(dr => dr.Field<decimal>("Charges"));

but this doesn't:
var monthCharges = (from r in WRVUData.AsDataView()
                 select new
                 {
                     charges = r.Field<decimal?>("Charges"),
                     activityType = r.Field<string>("Activity_Type"),
                     postingMonth = r.Field<DateTime>("Posting_Month"),
                     provider = r.Field<string>("Report_Producer_Name"),
                     groupName = r.Field<string>("Group_Name"),
                     WRVUs = r.Field<decimal>("W_RVUs")
                 })
                                    .Where(dr => dr.postingMonth == new DateTime(month.Year, i, 1))
                                    .Where(dr => dr.provider == provider || dr.groupName == group)
                                    .Where(dr => dr.charges != null)
                                    .Sum(dr => dr.charges);

The second version throws a "Specified cast is not valid" error. Aren't the two basically the same thing?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Probability- tree diagram I have a question that I need to solve. It goes like this:

The chance of rain today if it was rainy yesterday is $0.7$.
  The chance of rain today if it was not rainy yesterday  is $0.2$.
  We know that it was not rainy on Sunday. Given the fact that it was rainy on Tuesday, what are the chances that it was rainy on Monday?

I believe that it's $0.2(0.2\cdot0.7+0.7\cdot0.7)$ but I'm not sure.

A: $$\text{Sunday not rainy}
\cases{
0.2\text{: Monday rainy}\cases{
0.7\text{: Tuesday rainy}\\
0.3\text{: Tuesday not rainy}
}\\
0.8\text{: Monday not rainy}\cases{
0.2\text{: Tuesday rainy}\\
0.8\text{: Tuesday not rainy}}
}$$
$$\begin{align*}
\Pr (\text{Monday rainy} \mid \text{Tuesday rainy})
&=\frac{\Pr(\text{Monday rainy} \cap \text{Tuesday rainy})}{\Pr(\text{Tuesday rainy})}\\
&=\frac{ \Pr(\text{Monday rainy})\Pr(\text{Tuesday rainy}\mid\text{Monday rainy})}{\Pr(\text{Tuesday rainy})}\\
&= \frac{0.2\cdot 0.7}{0.2\cdot 0.7 + 0.8\cdot0.2}\\
&= \frac7{15}
\end{align*}$$

A: Let $R_s$, $R_m$ and $R_t$ be the events that it was raining on sunday/monday/tuesday and $R_s^c$, $R_m^c$ and $R_t^c$ be the events that it was not raining on sunday/monday/tuesday.
We want to compute $\Pr (R_m \ \vert \ R_t)$ and in all our calculations we need to keep in mind that we are operating in a universe in which $R_s^c$ is a given fact. Applying Bayes theorem, we can compute:
$$\Pr (R_m \ \vert  R_t) =\frac{ \Pr (R_t \ \vert  R_m) \Pr (R_m)} {\Pr (R_t)}$$.
We observe:
$$ \Pr (R_t \ \vert  R_m) = 0.7 $$
$$ \Pr (R_m) = 0.2  $$
$$ \Pr (R_t) = \Pr (R_t \ \vert  R_m)\Pr (R_m) + \Pr (R_t \ \vert  R_m^c)\Pr (R_m^c) = 0.7*0.2 + 0.2*0.8 = 0.3  $$
In total: $$\Pr (R_m \ \vert  R_t) = 0.7*0.2 / 0.3 = (14/100)/(30/100) = 14/30 = 7/15 $$


text:
Q: Is there a more efficient way of sensing mouse over a bunch of dots? if mouseX < dotA1.x + 7:
    if mouseX > dotA1.x - 7:

        if mouseY < dotA1.y + 7:
            if mouseY > dotA1.y - 7:
                pygame.draw.circle(win, (20, 255, 20), (dotA1.x, dotA1.y), dotA1.radius)

        if mouseY < dotA2.y + 7:
            if mouseY > dotA2.y - 7:
                pygame.draw.circle(win, (20, 255, 20), (dotA2.x, dotA2.y), dotA2.radius)

        if mouseY < dotA3.y + 7:
            if mouseY > dotA3.y - 7:
                pygame.draw.circle(win, (20, 255, 20), (dotA3.x, dotA3.y), dotA3.radius)

If I keep going I'm going to have to copy and paste this and change the variables over a hundred times
I automized creating each of these variables from an object, and I plan to add additional functions when interacting with the dots, so I couldn't just use arrow keys to move around the dots

A: Something like this would simplify it. You would need to put all your dots in a list. Consider reading about and/or operators to avoid extra if statements and for/while loops to avoid repeating the same code.
dots = [dotA1, dotA2, dotA3]
if dotA1.x - 7 < mouseX < dotA1.x + 7:
    for dot in dots:
        if dot.y - 7 < mouseY < dot.y + 7:
            pygame.draw.circle(win, (20, 255, 20), (dot.x, dot.y), dot.radius)


text:
Q: Apache not responding due to port mapping [centos@staging03 ~]$ sudo netstat -tulpn | grep LISTEN
tcp        0      0 127.0.0.2:80                0.0.0.0:*                   LISTEN      18336/varnishd
tcp        0      0 127.0.0.1:80                0.0.0.0:*                   LISTEN      15636/fcgi-
tcp        0      0 172.31.22.60:80             0.0.0.0:*                   LISTEN      1557/nginx
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1274/sshd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1524/master
tcp        0      0 127.0.0.1:443               0.0.0.0:*                   LISTEN      15636/fcgi-
tcp        0      0 127.0.0.1:6082              0.0.0.0:*                   LISTEN      18335/varnishd
tcp        0      0 127.0.0.1:11211             0.0.0.0:*                   LISTEN      1252/memcached
tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      1063/redis-server 1
tcp        0      0 :::22                       :::*                        LISTEN      1274/sshd
tcp        0      0 :::3306                     :::*                        LISTEN      1406/mysqld

So in the above, it's the mapping of the faulty server.
[root@webdev01 ~]# sudo netstat -tulpn | grep LISTEN
tcp        0      0 127.0.0.2:80                0.0.0.0:*                   LISTEN      1679/varnishd
tcp        0      0 172.31.23.5:80              0.0.0.0:*                   LISTEN      1644/nginx
tcp        0      0 127.0.0.1:80                0.0.0.0:*                   LISTEN      1620/httpd
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1177/sshd
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1439/master
tcp        0      0 172.31.23.5:443             0.0.0.0:*                   LISTEN      1644/nginx
tcp        0      0 127.0.0.1:443               0.0.0.0:*                   LISTEN      1620/httpd
tcp        0      0 127.0.0.1:6082              0.0.0.0:*                   LISTEN      1678/varnishd
tcp        0      0 127.0.0.1:11211             0.0.0.0:*                   LISTEN      1155/memcached
tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      1072/redis-server 1
tcp        0      0 :::22                       :::*                        LISTEN      1177/sshd
tcp        0      0 :::3306                     :::*                        LISTEN      1315/mysqld
[root@webdev01 ~]#

And here's the mapping in the server it works.
# FILE: /etc/httpd/conf/httpd.conf
User apache Group apache

ServerAdmin root@localhost

UseCanonicalName Off

DocumentRoot "/var/www/html"

<Directory /> Options FollowSymLinks AllowOverride None </Directory>

<Directory "/var/www/html">

Options Indexes FollowSymLinks

AllowOverride None

Order allow,deny
Allow from all
</Directory>

This is my apache configs
The content of my http file:
<?php print_r('hello'); ?>

File permission is:
-rw-r--r-- 1 root apache 19 Nov  4 17:02 test.php

For some reason, the port 80 is mapped to fcgi instead of httpd, but looking at the configs of both server, I didn't find any difference, so I am wondering what's causing httpd to not be mapped correctly. Is there any config file I am missing somehow?

A: The difference is fcgi is running on server 1 and not server 2.
Check your service manager.


text:
Q: imagemagick installation error - architecture mismatch I am trying to install ImageMagick via macports but am getting the following error msg:
Error: Cannot install imagemagick for the arch(s) 'x86_64' because
Error: its dependency bzip2 is only installed for the arch 'i386'
Error: and the configured universal_archs 'i386 ppc' are not sufficient.
Error: Unable to execute port: architecture mismatch
To report a bug, see <http://guide.macports.org/#project.tickets>

Any suggestion would be greatly appreciated :)

A: This looks like the same question that was asked on Superuser, "Mac ports installation of gcc46 failing due to architecture problems", and on Apple.Stackexchange, "Mac ports installation of gcc46 failing due to architecture problems".
Did you start building these MacPort binaries on MacOS 10.5, then upgrade to 10.6 -- or move to a new machine with 10.6 and copy the MacPorts files from the old machine -- and then build imagemagick under MacOS 10.6?
Does your configuration file /opt/local/etc/macports/macports.conf differ from macports.conf.default? That's a sign that the MacPorts environment was migrated from 10.5 instead of being created new on 10.6.  There should be a line there, reading universal_archs ppc i386 ppc64 x86_64.
The official MacPorts migration instructions explain how to essentially update your environment for MacOS X 10.6 and do a complete rebuild. Their instructions:

*

*Reinstall Xcode and MacPorts

*Update macports.conf

*Save a list of installed ports

*Uninstall all ports

*Reinstall just those you still want

The blog post Universal Binaries in Macports gives slightly different instructions.  Basically it comes down to:

*

*update the universal_archs line in macports.conf

*force a complete rebuild with $ sudo port upgrade --force installed  -


text:
Q: Get user_id based data in google analytics 4 Currently I'm logging events using firebase analytics, but I want to have one user specific data like whatever user has done, I want all info using just userid.
Using firebase_analytics : in flutter.
I have tried turning on user_id enabled in google analytics/admin/reporting identify/
But I have not succeeded to get a view with specific user based view.

A: I have found a solution these articles helped me first make sure to setUserId() using goole analytics and attach your firebase project from default google analytics to new google analytics project. Go to explorer -> open timeline -> user explorer.
Now u can see user specific data (This will reflects after some time user generates data)

Resources
article 1
article 2


text:
Q: How to write this css and javascript better I wanted to know how this piece of code can be improved.
I don't know how well written it is to begin with.
How it can be written better.
Is there anything here you would write a different way?
code https://jsfiddle.net/7keLvajm/
.container2 {
  display: none;
}

.container2.active  {
  display: flex;
}

.container1.active2  {
 display: none;
}

  function resetBackground(backgroundSelector) {
    const background = document.querySelector(backgroundSelector);
    background.classList.add("bg1");
  }

  function resetContainer1(containerSelector) {
    const container = document.querySelector(containerSelector);
    container.classList.add("active");
  }

  function resetContainer2(containerSelector2) {
    const allContainers = document.querySelectorAll(containerSelector2);

    function hideContainer(container1) {
      container1.classList.add("active2");
    }
    allContainers.forEach(hideContainer);
  }

  function resetPage() {
    resetBackground("body");
    resetContainer1(".container2");
    resetContainer2(".container1");
  }

A: Your code seems pretty good how it is, the only thing that I would want to draw attention to is your resetContainer2() function:
function resetContainer2(containerSelector2) {
    const allContainers = document.querySelectorAll(containerSelector2);

    function hideContainer(container1) {
      container1.classList.add("active2");
    }
    allContainers.forEach(hideContainer);
}

You are declaring a function inside of a function, which means it will only be able to be used inside resetContainer2(). If you're okay with that, then your code seems good!


text:
Q: Opening RSS page errors with "This XML file does not appear to have any style information associated with it." I have BuddyPress on my website, and when I'm trying to go the link RSS, the result is this:

This XML file does not appear to have any style information associated with it

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" version="2.0">
    <channel>
        <title>SmartCrow | Activités du site</title>
        <link>http://smartcrow.pe.hu/activites-du-site/</link>
        <atom:link href="http://smartcrow.pe.hu/activites-du-site/feed/" rel="self" type="application/rss+xml" />
        <description>Fil d'activité de tout le site</description>
        <lastBuildDate>Tue, 25 Apr 2017 17:32:58 +0000</lastBuildDate>
        <generator>https://buddypress.org/?v=2.8.2</generator>
        <language>fr-FR</language>
        <ttl>30</ttl>
        <sy:updatePeriod>hourly</sy:updatePeriod>
        <sy:updateFrequency>2</sy:updateFrequency>
        <item>
            <guid isPermaLink="false">2fae35002159291b18f0446066133f9f</guid>
            <title>admin a publié une note: j</title>
            <link>http://smartcrow.pe.hu/activites-du-site/p/3/</link>
            <pubDate>Tue, 25 Apr 2017 17:28:05 +0000</pubDate>
            <content:encoded><![CDATA[
j
]]></content:encoded>
            <slash:comments>0</slash:comments>
        </item>
    </channel>
</rss>

What should I do?

A: That message says the XML doesn't haves any style to present it in a better way than a simple xml.
This style can be a simple css like the css you use to style yout html webpages.
You should add this code to the header of the RSS file
<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="http://your.site/rss.css" ?>

And create an external css file with the filename which the xml-stylesheet tag previously added to your RSS will call.
rss {
    display: block;
    font-family: verdana, arial;
}
title {
    display: block;
    margin: 5px;
    padding: 2px;
    color: gray;
    border-bottom: 1px solid silver;
}
link {
    display: block;
    font-size: small;
    padding-left: 10px;
}
item {
    display: block;
    padding: 2px 30px 2px 30px;
}
docs {
    display: block;
    background-color: #ffffe6;
    margin: 20px;
    text-align: center;
    padding: 5px;
    color: #7f7f7f;
    border: 1px solid silver;
}
/* all hidden elements */
language, lastBuildDate, ttl, guid, category, description, pubDate {
    display: none;
}

Feel free to modify the css ;-)

A: Re root system cat logs and  start KAI 12 to run a new firewall from a built-in 1 with the program its running then when completed just use troubleshooting to configure all system networks.


text:
Q: Show div and hold it when hover on image Sorry for the bad title, don't realy know how te explain it in that short.
Well I have a img, when I hover it it shows a div with some text.
That div appears in the img you were hoverd in, and when you hover that div...
You exualy leave the img so the div with the text dissapear.
So what my question realy is, is how can I let it still display it as block?
I already tried something;
The jQuery part;
$("img#hover-for-text").on("mouseover", function(){
    $(this).next().stop().fadeIn();
});
$("#text-hold").on("mouseover", function(){
    $(this).next().stop().fadeIn();
});

$("img#hover-for-text").on("mouseleave", function(){
    $(this).next().stop().fadeOut();
});

The HTML part;

    <img src="images/projects/<?=$data['picture']?>" class="img-responsive" id="hover-for-text">

      <?=$data['content']?>

The CSS part;
.carousel-caption {
  display: none;
}

A: Instead of putting mouse over for the image you have to put mouse over for the parent component
$("#mycarousel").on("mouseover", function(){
    $(".carousel-caption",this).stop().fadeIn();
});

$("#mycarousel").on("mouseleave", function(){
    $(".carousel-caption",this).stop().fadeOut();
});

will be better choice
Here the ",this" will allow you to select "carousel-caption" only the currently focused carousel
Check http://jsfiddle.net/ZigmaEmpire/6a18txbu/1/
In case your #mycarousel is the parent most then introduce another div inside it and write mouse event for it with class name instead of id

A: You can bind the events to the .slide div and work with the children of it, so the mouse never leaves the parent div.
Like this:
$(document).ready(function () {
    $(".slide").on("mouseover", function () {
        $(this).find(".carousel-caption").stop().fadeIn();
    });

    $(".slide").on("mouseleave", function () {
        $(this).find(".carousel-caption").stop().fadeOut();
    });

})

Fiddle


text:
Q: SWT SystemTray in OSX I'm trying to add a system tray icon to my Snow Leopard java application, which seems to work fairly well. Unfortunately, it seems like SWT does not align the systemtray icon with the top menubar, but instead aligns it with where my mouse clicked
(e.g. http://kobyleha.com/files/azureus_2_250.png instead of http://kobyleha.com/files/power_250.png ... I am borrowing the images since this site describes similar problems)
It seems to have been a problem with SWT since 3.3. I'm wondering if there are any good workarounds available that someone could share?
Thanks!

A: I know it's been long since you asked the question, but here's what works for me at least.
The vital line is item.setToolTip(tip); which will align the balloon to the tray item.
if (tray != null) {
    TrayItem item = new TrayItem(tray, SWT.NONE);
    image = display.getSystemImage(SWT.ICON_INFORMATION);
    item.setImage(image);
    tip.setText("Notification from a tray item");
    item.setToolTip(tip); // <<<-----
}


text:
Q: GZip HttpServletResponse in Servlet Filter based on "Content-Length" I have a specific requirement to Zip the HttpServletResponse based on the content length. The application I am working on is Spring based and exposes several services with JSON payload. However some of the payloads are quite huge in size ~2MB but are not consistently so i.e. are dependent on responses from external systems.
I have tried searching but could only succeed in Zipping based on URL mappings and not based on actual size of the payload. The server used is weblogic but does not support the GZIP configuration and hence looking to achieve this through Servlet Filter. Following is the code from my filter that I have so far but doesn't seem to be working. Any pointers in how to achieve dynamic GZipping based on the Content-Length and what would be the best way to do so?
public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse, FilterChain paramFilterChain) throws IOException, ServletException {
    if ((paramServletRequest instanceof HttpServletRequest)) {
        HttpServletRequest localHttpServletRequest = (HttpServletRequest) paramServletRequest;
        HttpServletResponse localHttpServletResponse = (HttpServletResponse) paramServletResponse;

        if (supportsGzip(localHttpServletRequest)) {
            // This block is where response is being validated for
            // eligibility of compression based on "Content-Length" header
            paramFilterChain.doFilter(paramServletRequest, localHttpServletResponse);
            String contentLengthString = localHttpServletResponse.getHeader("Content-Length");
            int contentLength = contentLengthString != null && !contentLengthString.isEmpty() ? Integer.parseInt(contentLengthString) : 0;

            //GZip only if the content length is greater than 750 KB
            if (contentLength > (750*1024)) {
                System.out.println("This should be zipped content");
                localHttpServletResponse = new GZipResponseWrapper(localHttpServletResponse);
                localHttpServletResponse.addHeader("Content-Encoding", "gzip");
                ((GZipResponseWrapper)localHttpServletResponse).finishResponse();
                return;
            }
        }

        paramFilterChain.doFilter(paramServletRequest, paramServletResponse);
    }
}

Quite new to the forum and apologize in advance for any incorrect formats / structure.


text:
Q: How to create a Bash script to execute a command until it success for max number of tries I'm trying to executing a bash script that tries to connect to a VP with a max of 3 retrie. I'm new to bash scripting so maybe there are several error, my code is the following:
current_server=$(nordvpn status | grep 'Current server:' | cut -c 17-| cut -d'.' -f1)
recommended_server=$(curl --silent 'https://nordvpn.com/wp-admin/admin-ajax.php?action=servers_recommendations' | jq --raw-output '.[].hostname' | head -n 1| cut -d'.' -f1)
command = 'nordvpn c $recommended_server | grep "You are connected"'

if [[ $current_server == $recommended_server ]]; then
   echo "Uguali"
   echo "   Current: $current_server"
   echo "   Recommended: $recommended_server"
else
   echo "Diversi: "
   echo "   Current: $current_server"
   echo "   Recommended: $recommended_server"
   nordvpn d
   counter=0
   max_retry=3
   until $($command)
   do
      sleep 1
      [[ counter -eq $max_retry ]] && echo "Failed!" && exit 1
      echo "Retrying. Try #$counter"
      ((counter++))
   done
fi

thanx in advance!

A: Use until $command

until Test_COMMANDS; do Block_Of_COMMANDS; done

The until executes a Block_Of_COMMANDS until the Test_COMMANDS does not succeed.
Moreover, it expands and executes Test_COMMANDS each time.
The problem is that you wrote $($command) that is a proper command for bash,
even if not probably the one you had in mind:

*

*until $($command) executes $command then try to execute its output and to put it in a variable used for the test of until.

*until $command executes $command and use the exit code of the last command inside the $command as test for the loop.

*until ($command) do the same of the above case, but executing $command in a subshell (that takes the exit code from the final command executed inside)... same result.

From help until

until: until COMMANDS; do COMMANDS; done
      Execute commands as long as a test does not succeed.
Expand and execute COMMANDS as long as the final command in the
      'until' COMMANDS has an exit status which is not zero.

Ok not so clear. Better so

until: until Test_COMMANDS; do Block_Of_COMMANDS; done


text:
Q: Disabling indent guides in Monaco Editor I've done an app with the Monaco Editor library which allows to change the language of the editor (as here). I would like to have the indentation guides except when the language is plaintext. Is it possible? I can hide the indent guide lines in the theme, but I don't know how to conditionally hide them. I didn't find any option for doing so.

A: You can set this through the renderIndentGuides property. See: https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.ieditoroptions.html#renderindentguides
A simple monaco playground example to demonstrate this is shown below. Note that you can set this property after the editor has been created, using updateOptions.
var editor = monaco.editor.create(document.getElementById("container"), {
    value: [
        "function hello() {",
        "\tfor (let i = 0; i < 2; i++) {",
        "\t\tconsole.log('Hello world!');",
        "\t}",
        "}",
    ].join("\n"),

    language: "javascript",
    renderIndentGuides: false
});
setTimeout(function() {
    editor.updateOptions({
        renderIndentGuides: true
    });
}, 3000);


text:
Q: laravel-dompdf - Japanese IPAex gothic font is not working I am using Laravel-dompdf to build my pdf file. Here's the open source project I used.
https://github.com/barryvdh/laravel-dompdf/
The errors show when using Japanese ipaex gothic font family in pdf. I have been struggling for the day just to make pdf show me Japanese characters but it doesn't. Here's the error I got.
PS. I have setup everything like symbolic the vendor/phenx/php-font-lib folder to vendor/dompdf/dompdf/lib folder.
exception 'ErrorException' with message 'Undefined offset: 12238'
in /home/vagrant/Code/myPdfProject/vendor/phenx/php-font-lib/classes/Font_Table_post.php:59
Stack trace:
#0 /home/vagrant/Code/myPdfProject/vendor/phenx/php-font-lib/classes/Font_Table_post.php(59): Illuminate\Exception\Handler->handleError(8, 'Undefined offse...', '/home/vagrant/C...', 59, Array)
#1 /home/vagrant/Code/myPdfProject/vendor/phenx/php-font-lib/classes/Font_Table.php(82): Font_Table_post->_parse()
#2 /home/vagrant/Code/myPdfProject/vendor/phenx/php-font-lib/classes/Font_TrueType.php(307): Font_Table->parse()
#3 /home/vagrant/Code/myPdfProject/vendor/phenx/php-font-lib/classes/Font_TrueType.php(117): Font_TrueType->readTable('post')
#4 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/lib/class.pdf.php(2353): Font_TrueType->parse()
#5 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/cpdf_adapter.cls.php(737): Cpdf->selectFont('/home/vagrant/C...')
#6 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/font_metrics.cls.php(122): CPDF_Adapter->get_font_height('/home/vagrant/C...', 24)
#7 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/text_frame_reflower.cls.php(167): Font_Metrics::get_font_height('/home/vagrant/C...', 24)
#8 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/text_frame_reflower.cls.php(332): Text_Frame_Reflower->_layout_line()
#9 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/frame_decorator.cls.php(711): Text_Frame_Reflower->reflow(Object(Block_Frame_Decorator))
#10 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/block_frame_reflower.cls.php(750): Frame_Decorator->reflow(Object(Block_Frame_Decorator))
#11 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/frame_decorator.cls.php(711): Block_Frame_Reflower->reflow(Object(Block_Frame_Decorator))
#12 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/block_frame_reflower.cls.php(750): Frame_Decorator->reflow(Object(Block_Frame_Decorator))
#13 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/frame_decorator.cls.php(711): Block_Frame_Reflower->reflow(NULL)
#14 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/page_frame_reflower.cls.php(123): Frame_Decorator->reflow()
#15 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/frame_decorator.cls.php(711): Page_Frame_Reflower->reflow(NULL)
#16 /home/vagrant/Code/myPdfProject/vendor/dompdf/dompdf/include/dompdf.cls.php(949): Frame_Decorator->reflow()
#17 /home/vagrant/Code/myPdfProject/vendor/barryvdh/laravel-dompdf/src/PDF.php(210): DOMPDF->render()
#18 /home/vagrant/Code/myPdfProject/vendor/barryvdh/laravel-dompdf/src/PDF.php(156): Barryvdh\DomPDF\PDF->render()
#19 /home/vagrant/Code/myPdfProject/vendor/barryvdh/laravel-dompdf/src/PDF.php(193): Barryvdh\DomPDF\PDF->output()
#20 /home/vagrant/Code/myPdfProject/app/controllers/OrderController.php(236): Barryvdh\DomPDF\PDF->stream()
#21 [internal function]: OrderController->showInvoice('1')
#22 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array)
#23 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('showInvoice', Array)
#24 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(OrderController), Object(Illuminate\Routing\Route), 'showInvoice')
#25 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Routing/Router.php(967): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'OrderController', 'showInvoice')
#26 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}('1')
#27 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#28 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#29 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#30 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#31 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#32 /home/vagrant/Code/myPdfProject/vendor/barryvdh/laravel-debugbar/src/Middleware/Stack.php(34): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#33 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Barryvdh\Debugbar\Middleware\Stack->handle(Object(Illuminate\Http\Request), 1, true)
#34 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#35 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#36 /home/vagrant/Code/myPdfProject/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#37 /home/vagrant/Code/myPdfProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#38 /home/vagrant/Code/myPdfProject/public/index.php(49): Illuminate\Foundation\Application->run()
#39 {main} [] []

Here's my environment

*

*laravel 4.2

*barryvdh/laravel-dompdf (v0.4.6)

*dompdf/dompdf (v0.6.1)

*phenx/php-font-lib (0.2.2)

Thank you


text:
Q: Mathematica saying "NIntegrate failed to converge to prescribed accuracy " for this integral ploting Plot[y/(32*\[Pi]^4)*12^2*(2.09*10^-11)^2*100^2/(192 \[Pi])
 NIntegrate[((x - 2*100^2)^2 - 4*100^4)/Sqrt[x]
 Sqrt[(x - 4*100^2) (x - 4*100^2)/
 x^2] (x^2 - 4*100^2*x +
  12*100^4)/((x - 5^2)^2 ((x - 100^2)^2 + (4.15*10^-3*100)^2))
 BesselK[1, Sqrt[x]/y], {x, 4*10^4, \[Infinity]}], {y, 8*10^-3,
10^10}, PlotRange -> {{8*10^-3, 10^10}, {8*10^-44, 10^16}}]

When i am trying to plot it , Mathematica gives an empty plot and shows
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {5.57963*10^7}. NIntegrate obtained 2.5480460753667857`*^6 and 21453.774416999564` for the integral and error estimates.

A: Writing:
a = 2 100^2;
b = 415 10^-3;

f[x_] := ((x - a)^2 - a^2)/Sqrt[x] (x - 2 a)/x (x^2 - 2 a x + 3 a^2)/((x - 25)^2 ((x - a/2)^2 + b^2))
g[x_, y_] := 131043/128 10^-22/Pi^5 f[x] y BesselK[1, Sqrt[x]/y]
h[y_] := NIntegrate[g[x, y], {x, 2 a, Infinity}, Method -> "Trapezoidal"]

Plot[h[y], {y, 8 10^-3, 10^10}]

I get:

which is what is desired.

Wanting to specialize everything in the case of several plots to compare in the same plan, writing:
listA = {2, 10, 50} 100^2;
listB = {415, 420, 425} 10^-3;
listC = {Blue, Green, Red};
listD = {{"first"}, {"second"}, {"third"}};

f[x_] := ((x - a)^2 - a^2)/Sqrt[x] (x - 2 a)/x (x^2 - 2 a x + 3 a^2)/((x - 25)^2 ((x - a/2)^2 + b^2))
g[x_, y_] := 131043/128 10^-22/Pi^5 f[x] y BesselK[1, Sqrt[x]/y]
h[y_] := NIntegrate[g[x, y], {x, 2 a, Infinity}, Method -> "Trapezoidal"]

plots = Table[a = listA[[i]];
              b = listB[[i]];
              Plot[h[y], {y, 8 10^-3, 10^10},
                   PlotStyle -> listC[[i]],
                   PlotLegends -> listD[[i]]],
              {i, 3}];

Show[plots, AxesLabel -> {"x", "y"}]

I get:

that seems to make her look good!

A: With adapted PrecisionGoal and PlotRange your code works without warning:
Plot[y/(32*\[Pi]^4)*12^2*(2.09*10^-11)^2*100^2/(192 \[Pi]) NIntegrate[((x - 2*100^2)^2 - 4*100^4)/Sqrt[x]Sqrt[(x - 4*100^2) (x - 4*100^2)/x^2] (x^2 - 4*100^2*x +12*100^4)/((x - 5^2)^2 ((x - 100^2)^2 + (4.15*10^-3*100)^2)) BesselK[1, Sqrt[x]/y], {x, 4*10^4, \[Infinity]}
,PrecisionGoal->5 ], {y, 8*10^-3,10^10}, PlotRange -> All]


text:
Q: Display specific lines from a .txt file to a listbox I am trying to display specific lines that i have now stored in an array from a text file into a list box.
string[] lines = File.ReadAllLines(@"C:\Users\James Dunn\Documents\Visual Studio 2012\Projects\Assignment 2\Assignment 2\MyJukeBox\bin\Debug\Media\Genre.txt");
mediaLibrary[0] = genreListBox;
for (int l = 3; l < lines.Length; l++)
{
   mediaLibrary[0].Items.Add(lines[l]);
}
genreListBox.Items.Add(mediaLibrary[0]);

This code so far displays all but the first 3 lines of text. how do i get it to stop after its displayed the lines I require? I have tried using the following in the for loop but it gives me errors.
int ll = 6; != lines.Length;

My txt file layed out like so
3
2
Other
Big Bad John (1961) - Jimmy Dean.mp3
My Ding A Ling - Chuck Berry.mp3
2
Rap
2pac-ghost.mp3
B.I.G-Spit Your Game.mp3
1
Rock
Linkin park-Numb.mp3

A: You could use Skip() and Take() if the elements are always in the same position.
So if you always wanted the 3rd and 4th lines you would do
mediaLibrary[0].Items.AddRange(lines.Skip(2).Take(2).ToArray<object>());

A: I managed to solve my problem by using an if statement and adding break.
{
// Adding first genre title
string[] lines = File.ReadAllLines(@"C:\Users\James Dunn\Documents\Visual Studio 2012\Projects\Assignment 2\Assignment 2\MyJukeBox\bin\Debug\Media\Genre.txt");
for (int l = 3; l < lines.Length; l++)
{
mediaLibrary[0].Items.Add(lines[l]);
if (l == 4)
break;
}
genreTitleTextBox.(mediaLibrary[0]);
}


text:
Q: find emp_names,max,min salary and number of employees on each department? I use oracle 11g , so i have 2 tables(employees,departments):
desc employees:      desc departments

 EMPLOYEE_ID        DEPARTMENT_ID
 FIRST_NAME         DEPARTMENT_NAME
 LAST_NAME          MANAGER_ID
 EMAIL              LOCATION_ID
 PHONE_NUMBER
 HIRE_DATE
 JOB_ID
 SALARY
 COMMISSION_PCT
 MANAGER_ID
 DEPARTMENT_ID

and i want to get

employee_name,emp_names,emp_salary,dep_id,dep_names,max salary on each
  dep , and min salary on each dep , and number of employees on each
  department .

so i do this qouery:
 select FIRST_NAME,DEPARTMENT_ID,max(SALARY),min(SALARY),count(EMPLOYEE_ID)
from employees join departments on employees.department_id = departments.departm
ent_id group by first_name,department_id;

but its give an error:

ERROR at line 1: ORA-00918: column ambiguously defined

however does my sql query right ?

A: I don't have your tables so I created views out of Scott's ones, to simulate what you have.
SQL> create or replace view employees as
  2    select empno  employee_id,
  3           ename  last_name,
  4           deptno department_id,
  5           sal    salary
  6    from emp;

View created.

SQL> create or replace view departments as
  2    select deptno department_id,
  3           dname  department_name
  4    from dept;

View created.

SQL>

Here's how I understood the question: list of employees per department should be separated from the rest (minimums, maximums, counts).
So: list of employees:
SQL> select d.department_name, e.last_name
  2  from departments d join employees e on d.department_id = e.department_id
  3  order by d.department_name;

DEPARTMENT_NAM LAST_NAME
-------------- ----------
ACCOUNTING     CLARK
ACCOUNTING     KING
ACCOUNTING     MILLER
RESEARCH       JONES
RESEARCH       FORD
RESEARCH       ADAMS
RESEARCH       SMITH
RESEARCH       SCOTT
SALES          WARD
SALES          TURNER
SALES          ALLEN
SALES          JAMES
SALES          BLAKE
SALES          MARTIN

14 rows selected.

Aggregates: outer join for departments that don't have any employees:
SQL> select d.department_name,
  2    min(e.salary) min_sal,
  3    max(e.salary) max_sal,
  4    count(e.employee_id) cnt_emp
  5  from departments d left join employees e on d.department_id = e.department_id
  6  group by d.department_name
  7  order by d.department_name;

DEPARTMENT_NAM    MIN_SAL    MAX_SAL    CNT_EMP
-------------- ---------- ---------- ----------
ACCOUNTING           1300       5000          3
OPERATIONS                                    0
RESEARCH              800       3000          5
SALES                 950       2850          6

LISTAGG allows you to list all employees per department in the same statement, though; see line 5. I, somehow, doubt that you learnt about that function yet (as you struggle with such a problem).
SQL> select d.department_name,
  2    min(e.salary) min_sal,
  3    max(e.salary) max_sal,
  4    count(e.employee_id) cnt_emp,
  5    listagg(e.last_name, ', ') within group (order by e.last_name) employees
  6  from departments d left join employees e on d.department_id = e.department_id
  7  group by d.department_name
  8  order by d.department_name;

DEPARTMENT_NAM    MIN_SAL    MAX_SAL    CNT_EMP EMPLOYEES
-------------- ---------- ---------- ---------- -------------------------------------------
ACCOUNTING           1300       5000          3 CLARK, KING, MILLER
OPERATIONS                                    0
RESEARCH              800       3000          5 ADAMS, FORD, JONES, SCOTT, SMITH
SALES                 950       2850          6 ALLEN, BLAKE, JAMES, MARTIN, TURNER, WARD

SQL>


text:
Q: Update TextView within custom ListView I'm trying to update the TextView within a custom ListView at a set time interval, for example the TextView will update every 200ms however I can't figure out how to do this. The object updates with a number internally and I would like to show that in the mTitleText Textview however as the code below shows at the moment I can only achieve it when the user presses a button.
public class ListAdapter extends BaseAdapter {
private ArrayList< Object > mObjects;
private int mNumObjs = 0;

private LayoutInflater mLayoutInflater;
private Context mContext;

public ListAdapter ( Context context, ArrayList< Object > objects ) {
    mObjects;= objects;
    mLayoutInflater = LayoutInflater.from(context);
    mContext = context;
}

public int getCount() {
    return mObjects;.size();
}

public Object getItem( int position ) {
    return mObjects;.get(position);
}

public long getItemId( int position ) {
    return position;
}

public void addObject( Object obj) {
    obj.setId(mNumObjs);
    mObjects.add( obj );
    (mNumObjs);++;
    notifyDataSetChanged();
}

public void deleteObject( int pos ) {
    mObjects;.remove( pos );
    notifyDataSetChanged();
}

public View getView( final int position, View convertView, ViewGroup parent ) {
    final TimerView holder;

    if( convertView == null ) {
        convertView = mLayoutInflater.inflate( R.layout.customlistview, null );

        holder = new HolderView();
        holder.mListPosition = position;
        holder.mDeleteButton = (Button)convertView.findViewById(R.id.Delete);
        holder.mDeleteButton.setText( "Button No: " + position );
        holder.mDeleteButton.setOnClickListener( new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                deleteObject(holder.mListPosition);
            }
        });

        holder.mButton = (Button)convertView.findViewById(R.id.Button);
        holder.mButton.setOnClickListener( new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Object obj = mObjects.get(holder.mListPosition);

                mTitleText.setText(obj.getNum());
            }
        });

        convertView.setTag(holder);
    }
    else {
        holder = (TimerView) convertView.getTag();
    }
    holder.mListPosition = position;
    holder.mDeleteButton.setText( "Button No: " + position );

    return convertView;
}

class HolderView{
    int mListPosition;
    Button mDeleteButton;
    Button mButton;

    TextView mTitleText;
}
}

A: Okay I managed to figure this out myself, if your updates don't need to be very frequent ( >1 sec ) you can use notifyDataSetChanged() however if like me you need to constantly update the listview every 200ms or so you need to iterate through the visible objects on the list view and update it.
private Runnable showUpdate = new Runnable(){
    public void run(){
        mAdapter.updateList();
        //mAdapter.notifyDataSetChanged();
        int count = mListView.getCount();

        for( int i = 0; i < count; i ++ )
        {
            View convertView = mListView.getChildAt( i );

            if( convertView != null )
            {
                HolderView holder = (HolderView) convertView.getTag();

                Object obj = (Object)mAdapter.getItem( holder.mListPosition );

                holder.mTitleText.setText( obj.getText() );
            }
        }
    }
};

Thread mThread = new Thread()
{
    @Override
    public void run() {
       try {
            while(true) {
                sleep(100);
                mHandler.post(showUpdate);

                //mHandler.sendEmptyMessage(MSG_UPDATE);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
};

A: Update the text in your list mObjects and call notifyDataSetChanged()  on your adapter.


text:
Q: ObservableCollection - binding to HierarchicalDataTemplate shows type I am trying to create a simple logging system with a hierarchical 'feel'. I hope this screen shot explains my object clearly:

As you can see, I create a new object of type LogDetails which exposes just 4 fields:
public string Message;
        public LogStatus Status;
        public string ErrorDetails;

        public enum LogStatus
        {
            Complete, Failed, Error, FatalError, Progress, Started
        }

I have another class which has a Title property (string) and a LogDetails property.
When I bind to XAML, my tree view shows this:

As you can see, the root is fine and expected/desired (red) but each sub category isn't broken down - I want to be able to bypass a level and go direct to ErrorDetails, Message and Status. So, I would like to create this (mocked up in Word, but hopefully you get the idea):

This is my xaml:
<Grid>
<TreeView ItemsSource="{Binding}">
    <TreeView.ItemTemplate>
        <HierarchicalDataTemplate ItemsSource="{Binding LogDetailsList}" >
            <TextBlock Text="{Binding Title}" />
            <HierarchicalDataTemplate.ItemTemplate>

                <DataTemplate>
                    <TextBlock Text="{Binding}" />
                </DataTemplate>

            </HierarchicalDataTemplate.ItemTemplate>
        </HierarchicalDataTemplate>
    </TreeView.ItemTemplate>
</TreeView>
</Grid>

And my MainWindow code behind
public partial class MainWindow : Window
    {
        static public ObservableCollection<Log> logList;

        public MainWindow(List<Log> logs)
        {
            InitializeComponent();

            logList = new ObservableCollection<Log>();

            foreach (var item in logs)
            {
                logList.Add(item);
            }

            this.DataContext = logList;
        }
    }

Can anyone please point me in the right direction, or at least let me know if my design is flawed?
EDIT
When I try to add another text block or ItemTEmplate, I get the error message "The property ItemTemplate is set more than once" or "The property VisualTree is set more than once"

A: You should provide a path to the binding expression.


text:
Q: how to search into array's title mongodb nodejs? I want to search my page, which is stored in Book (MongoDB). there are many books and books that have many pages, so I want to search one page according to the query (want to search ). plz, give me some solution for this.
here is MongoDB
book1{
  object1;
  object2;
  object3{
    title:"this is page " /// this is that page I want search
    text:"wjhjd jkdjkwdwkjdhw"
  }
}
book2;
book3;

all books have many objects.
here is API
route.get('/query/',async (req,res) => {
  var url =new URL( req.protocol + '://' + req.get('host') + req.originalUrl)
  const query = url.searchParams.get('search_type')
  console.log(query)

  const article= await Books.find({})
  console.log( )
  console.log(article)
  const search =   article.find((value)=>{
    return value.articles.title === query
  })
  console.log(search)
  if(!result) return res.render('search',{user:user})
  res.render('search',{searchResult:result,user:user})
})


text:
Q: How to generate html TOC identifier in XSLT? I would like to generate table of content identifiers in an HTML document generated with XSL.
From the following format:
<?xml version="1.0" encoding="utf-8"?>

  Heading 1

        Heading 4

    Heading 2

          Heading 5

      Heading 3

    Heading 2

I am already able to generate:
<?xml version="1.0" encoding="utf-8"?>

Heading 1

Heading 4

Heading 2

Heading 5

Heading 6

Heading 2

Thanks to:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="UTF-8" />

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="header">
<xsl:variable name="level" select="count(ancestor-or-self::section)"/>
<xsl:element name="h{$level}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

But I need to add an additional TOC identifier to have:
<?xml version="1.0" encoding="utf-8"?>

Heading 1

Heading 4

Heading 2

Heading 5

Heading 6

Heading 2

Is this possible with pure XSLT processing?

A: Although this won't quite match your current expected output, you could possible make use of the xsl:number element here:
<xsl:number count="section" level="multiple" />

You would need to combine this with the translate function to replace . with _ though. Try the following XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="html" indent="yes" encoding="UTF-8"/>
   <xsl:template match="/">
      <xsl:apply-templates/>
   </xsl:template>

   <xsl:template match="header">
      <xsl:variable name="level" select="count(ancestor-or-self::section)"/>
      <xsl:variable name="name">
         <xsl:number count="section" level="multiple"/>
      </xsl:variable>

      <xsl:element name="h{$level}">
         <xsl:apply-templates/>
      </xsl:element>
   </xsl:template>
</xsl:stylesheet>

This would output the following:

Heading 1

Heading 4

Heading 2

Heading 5

Heading 3

Heading 2


text:
Q: cannot load txt as numeric matrix The following code is to load my matrix (in float/double) into R script. But the final matrices are not numeric. what is wrong with my code? can anyone help?
datdir = paste(getwd(), '/../dat/', sep="")
trainX = read.table(paste(datdir, 'trainX.txt', sep=""), header=FALSE)
trainL = read.table(paste(datdir, 'trainL.txt', sep=""), header=FALSE)
testX = read.table(paste(datdir, 'testX.txt', sep=""), header=FALSE)
testL = read.table(paste(datdir, 'testL.txt', sep=""), header=FALSE)
dims = dim(trainX)
trainX = as.numeric(trainX)
dim(trainX) = dims

dims = dim(trainL)
trainL = as.numeric(trainL)
dim(trainL) = dims

dims = dim(testX)
testX = as.numeric(testX)
dim(testX) = dims

dims = dim(testL)
trainX = as.numeric(testL)
dim(testL) = dims


text:
Q: prototype object inheritance I'm Codeyear fellow and unfortunately prototype object concept is not explained.I google it and found tutorial. After learning,my understanding says that we use prototype object inheritance to save memory and share common properties between objects . am i right ? if yes , dont you think the below code is the bad practice. Since car constructor has already defined price,speed and & getPrice,why we need to define same thing again,since we are using the concept of inheritance . please  explain . below is the code .
function Car( listedPrice ) {
    var price = listedPrice;
    this.speed = 0;

    this.getPrice = function() {
        return price;
    };
}

Car.prototype.accelerate = function() {
    this.speed += 10;
};

function ElectricCar( listedPrice ) {
    var price = listedPrice;
    this.speed = 0;

    this.getPrice = function() {
        return price;
    };
}

ElectricCar.prototype = new Car(); // Please also explain why car constructor
                                   // is not thowing error since we are not passing
                                   // listedPrice parameter

myElectricCar = new ElectricCar(500);

console.log(myElectricCar instanceof Car);

A: The constructor and the prototype are two separate concepts. When you apply the prototypal inheritance with ElectricCar.prototype = new Car();, it inherits only the methods defined on the object and its prototype, not the constructor itself.
You can actually see the way this works with some quick console.log() calls:
console.log(ElectricCar);
console.log(ElectricCar.prototype);
console.log(ElectricCar.prototype.__proto__);

This returns:
[Function: ElectricCar]
{ speed: 0, getPrice: [Function] }
{ accelerate: [Function] }

The first line is the constructor.
The second is the actual prototype, as set by ElectricCar.prototype = new Car(); above. Remember that in the constructor of Car, this.speed and this.getPrice were set, which explains the values of ElectricCar.prototype.speed and ElectricCar.prototype.getPrice.
What is perhaps least clear is the last line, the ElectricCar.prototype.__proto__. This is the prototype of the prototype. Car objects have a prototype object in which accelerate was defined. This prototype is copied over to the prototype of ElectricCar in its internal __proto__ property. This is called prototype chaining.
Because the constructor is not part of the prototype, and the prototype is all you're inheriting, the constructor for Car has been copied and pasted into ElectricCar. As you point out, there are definitely cleaner ways to do this. Here's an alternative:
function ElectricCar( listedPrice ) {
    Car.apply(this, arguments);
}

ElectricCar.prototype = new Car();

See apply for more details.
As for your final question (why doesn't new Car() throw an error), as the other answers say, that's kind of how JavaScript works. If you supply fewer arguments to a function than it has parameters, any unset (so to speak) parameters will be set to undefined. To demonstrate:
function returnMe(a) {
    return a;
}

console.log(returnMe(5));
console.log(returnMe(2+2));
console.log(returnMe());
console.log(returnMe(undefined));

This will return:
5
4
undefined
undefined

As you can see undefined is actually a variable that you can pass around (as in returnMe(undefined)). For more on this, see undefined.

A: getPrice is such way to create a closure over price var in its outer scope, effectively making price a private member, separate for each different instances, that only this function can ever have access to.
Constructor doesn't throw an error, because supplying arguments to a function in JavaScript is never mandatory. You supply as much as you want and as long as there's named arguments, first from the list you've supplied are assigned to that names.


text:
Q: Time series cross section forecasting with R I have a (I suspect) simple question. I have time series cross section data on voting behaviour in the Council of the European Union (the monthly number of yes, no and abstentions for each member state from 1999 to 2007). So basically the variables are counts, thus a Poisson/negative binomial regression would be appropriate, possibly with lagged dependent variables on the right hand side to control for time dependencies. I have seen papers with people using such negative binomial models to forecast, for instance the number of monthly legislative acts adopted in the future, and I have three questions in this regard:

*

*How can i run a negative binomial regression on panel data without making any inferential mistakes?

*How can I use a negative binomial model with lags to forecast future values of the dependent variable.

*Can this be done in R?
Thomas

A: After a bit of research, I can give a partial answer. In his book  Wooldridge discusses Poisson and negative binomial regressions for cross-section and panel data. But for regression with lagged variables he only discusses Poisson regression. Maybe negative binomial is discussed in the new edition. The main conclusion is that for random effects Poisson regression with lagged random variable can be estimated by mixed effects Poisson regression model. The detailed description can be found here. The mixed effects Poisson regression in R can be estimated with glmer from package lme4. To adapt it to work with panel data, you will need to create lagged variable explicitly. Then your estimation command should look something like this:
glmer(y~lagy+exo+(1|Country),data,family=quasipoisson)

You should also look  into gplm package suggested by @dickoa. But be sure to check, whether it supports lagged variables. Yves Croissant, the creator of gplm and plm packages writes wonderful code, but unfortunately in my personal experience, the code is not tested enough, so bugs crop up more frequently than in standard R packages.

A: May be you can take a look at the pglm package (from the same author of plm), use the family negbin.  You can also try from a Bayesian point of view the MCMCglmm package.


text:
Q: Authenticating another user when using Windows Authentication I have a .NET MVC 4 application that uses Windows authentication. Some users are administrators, and need to be able to enter data on behalf of other users.
I have a text box where the admin enters the name of another user. How can I check to verify that the text entered is an existing Windows username?

A: You could use the FindByIdentity method:
string username = "Some username you retrieved from the TextBox";

using (var ctx = new PrincipalContext(ContextType.Domain, "YOUR_DOMAIN"))
using (var user = UserPrincipal.FindByIdentity(ctx, IdentityType.SamAccountName, username))
{
    bool userExists = user != null;
    // here you know whether the user exists or not
}

A: You can query the Active Directory of your organization for this.
DirectoryEntry entry = new DirectoryEntry("LDAP://DomainName");
DirectorySearcher Dsearch = new DirectorySearcher(entry);
String Name="Richmond";
dSearch.Filter = "(&(objectClass=user)(l=" + Name + "))";

See this article:
http://www.codeproject.com/Articles/6778/How-to-get-User-Data-from-the-Active-Directory


text:
Q: Laravel Cashier setting the quality with newSubscription for Stripe I am developing a Laravel application. I am installing Stripe payment method using the Cashier. Now, I am having a bit of an issue setting up quality for the Stripe plan on creating new subscription. This is how I create new subscription.
auth()->user()->newSubscription('prod_xxx', 'plan_x')-xx>create(request('stripeToken'));

The above code works perfectly fine. But when I tried to set the quality like this
auth()->user()->newSubscription('prod_xxx', 'plan_x')->updateQuality(5)->create(request('stripeToken'));

It does not work. It is saying updateQuality method does not exist. How can I set the quality with newSubscription all in one go?

A: https://laravel.com/docs/5.7/billing#subscription-quantity
You want updateQuantity instead, I believe.

A: Better late than never, this might help others.
auth()->user()
    ->newSubscription('prod_xxx', 'plan_x')
    ->quantity(5)
    ->create(request('stripeToken'));


text:
Q: Pasting data into a DataGridView vb.net So this morning I ran into a wall:
Using this Code I randomly get another row to show up when i paste my data.
It is meant to receive values ranging from 1 to 99999
So when i copy this:

And paste it into the Program this happens:

    Private Sub DataGridView101_KeyDown(sender As Object, e As KeyEventArgs) Handles DataGridView101.KeyDown

    If e.Control And
       e.KeyCode = Keys.V Then

        IsCopyPaste = True
        Dim _ClipboardRows As String() = System.Windows.Forms.Clipboard.GetText().Split({System.Environment.NewLine}, StringSplitOptions.None)

        Me.DataGridView101.BeginEdit(True)

        For Each _ClipboardRow As String In _ClipboardRows
            If _ClipboardRow <> "" Then

                Dim _CellL As String = ""
                Dim _CellR As String = ""

                For Each _ClipboardColumn As String In _ClipboardRow.Split(System.Convert.ToChar(vbTab))

                    If _CellL = "" Then
                        _CellL = _ClipboardColumn
                    Else
                        If _CellR = "" Then
                            _CellR = _ClipboardColumn
                        End If
                    End If

                Next

                Dim _DataRow As System.Data.DataRow = (CType(Me.DataGridView101.DataSource, System.Data.DataTable)).NewRow()

                _DataRow("1") = _CellL
                _DataRow("2") = _CellR

                CType(Me.DataGridView101.DataSource, System.Data.DataTable).Rows.Add(_DataRow)

            End If

        Next

        Me.DataGridView101.EndEdit()
        CType(Me.DataGridView101.DataSource, System.Data.DataTable).AcceptChanges()

        IsCopyPaste = False
    End If

End Sub

A: Below is my solution for that. You must call the functions from your event. In my application I need to decide allow pasting or not in the PasteUnboundRecords sub, which is controlled by the Allowed boolen
Public Sub CopyRows(MyDataGridView As DataGridView)
    Dim d As DataObject = MyDataGridview.GetClipboardContent()
    Try
        Clipboard.SetDataObject(d)
    Catch
        MessageBox.Show("Text not copied, null value")
    End Try
End Sub

Sub PasteUnboundRecords(MyDataGridView As DataGridView)
    Dim Allowed As Boolean
    Dim OriginLines As String() = Clipboard.GetText(TextDataFormat.Text).Split(New String(0) {vbCr & vbLf}, StringSplitOptions.None)
    Dim Xo As Integer = SelectedAreaMinColumn(MyDataGridview)
    Dim Yo As Integer = SelectedAreaMinRow(MyDataGridview)
    Dim X As Integer
    Dim Y As Integer
    Dim i As Integer
    Dim j As Integer
    Dim ii As Integer
    Dim jj As Integer = 0
    Dim m1 As Integer
    Dim n1 As Integer = OriginLines.Length
    Dim m2 As Integer = SelectedAreaColumns(MyDataGridView)
    Dim n2 As Integer = SelectedAreaRows(MyDataGridview)
    Dim m2Max As Integer = MyDataGridview.Columns.Count
    Dim n2Max As Integer = MyDataGridview.Rows.Count

    For j = 0 To Math.Max(n1-1, n2-1)
        Y = Yo + j
        If Y = n2Max Then Exit For
        If j-jj*n1 = n1 Then jj = jj+1
        Dim OriginValue As String() = OriginLines(j-jj*n1).Split(New String(0) {vbTab}, StringSplitOptions.None)
        m1 = OriginValue.Length
        ii = 0
        For i = 0 To Math.Max(m1-1, m2-1)
            X = Xo + i
            If X = m2Max Then Exit For
            If i-ii*m1 = m1 Then ii = ii+1
            If X > 0 Then 'Avoid pasting in first column containing codes
                If Y = 0 Then 'Avoid first line
                    Allowed = True
                Else 'Check DataValidatios
                    If DataValidations(OriginValue(i-ii*m1), X) = "OK" Then
                        Allowed = True
                    Else
                        Allowed = False
                    End If
                End If
                'Avoid pasting in Readonly columns
                If MyDataGridview.Rows(Y).Cells(X).ReadOnly Then
                    Allowed = False
                End If
                If Allowed Then
                    MyDataGridview.Rows(Y).Cells(X).Value = OriginValue(i-ii*m1)
                    End If
                End If
            End If
        Next i
    Next j
End Sub

Private Function SelectedAreaMinRow(MyDataGridView As DataGridView) As Integer
    Dim minRowIndex As Integer
    For i As Integer = 0 To MyDataGridView.SelectedCells.Count - 1
        If i = 0 Then
            minRowIndex = MyDataGridView.SelectedCells.Item(i).RowIndex
        End If
        minRowIndex = Math.Min(MyDataGridView.SelectedCells.Item(i).RowIndex, minRowIndex)
    Next i

    Return minRowIndex
End Function

Private Function SelectedAreaMinColumn(MyDataGridView As DataGridView) As Integer
    Dim minColumnIndex As Integer
    For i As Integer = 0 To MyDataGridView.SelectedCells.Count - 1
        If i = 0 Then
            minColumnIndex = MyDataGridView.SelectedCells.Item(i).ColumnIndex
        End If
        minColumnIndex = Math.Min(MyDataGridView.SelectedCells.Item(i).ColumnIndex, minColumnIndex)
    Next i

    Return minColumnIndex
End Function

Private Function SelectedAreaRows(MyDataGridView As DataGridView) As Integer
    Dim minRowIndex As Integer
    Dim MaxRowIndex As Integer
    For i As Integer = 0 To MyDataGridView.SelectedCells.Count - 1
        If i = 0 Then
            minRowIndex = MyDataGridView.SelectedCells.Item(i).RowIndex
            MaxRowIndex = MyDataGridView.SelectedCells.Item(i).RowIndex
        End If
        minRowIndex = Math.Min(MyDataGridView.SelectedCells.Item(i).RowIndex, minRowIndex)
        MaxRowIndex = Math.Max(MyDataGridView.SelectedCells.Item(i).RowIndex, MaxRowIndex)
    Next i

    Return MaxRowIndex-minRowIndex+1
End Function

Private Function SelectedAreaColumns(MyDataGridView As DataGridView) As Integer
    Dim minColumnIndex As Integer
    Dim MaxColumnIndex As Integer
    For i As Integer = 0 To MyDataGridView.SelectedCells.Count - 1
        If i = 0 Then
            minColumnIndex = MyDataGridView.SelectedCells.Item(i).ColumnIndex
            MaxColumnIndex = MyDataGridView.SelectedCells.Item(i).ColumnIndex
        End If
        minColumnIndex = Math.Min(MyDataGridView.SelectedCells.Item(i).ColumnIndex, minColumnIndex)
        MaxColumnIndex = Math.Max(MyDataGridView.SelectedCells.Item(i).ColumnIndex, MaxColumnIndex)
    Next i

    Return MaxColumnIndex-minColumnIndex+1
End Function


text:
Q: syntax error; unexpected symbol: I'm making a bunch of c/src files, and get:
syntax error; unexpected symbol: "EnableUART"

It is referenced in a driver.c file and defined in a .src file.
It is XDEF'd correctly,
Here is  the c snippet:
int main() {
EnableUART(0, 9600, 'N');
}

Any ideas of why something gives this error?
TYTY

A: Where is the EnableUART() defined?  You need to include the header file at the top of your source file like this:
#include "library.h"

replacing library.h with the header file that includes the declaration of EnableUART().


text:
Q: On Click error? Start a New Activity or in including another activity? I have a Application in that I want to add QR reader as a Activity/Module
So,I followed this to Read QR code..
and Here Its working fine..
So I have added this code to My application and I want to use this activity for that I have designed a new activity in that On-click it should start Qr reader..
But I am getting this error...
Here I Tried with this
Button b = (Button) findViewById(R.id.main);
b.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
      Intent i = new Intent(Qdata.this,DecoderActivity.class);
      startActivity(i);
    }

Here DecoderActivity.calass is northig But another application or activity which is Qr reader form the above example so I want to Include this in my activity....
This at Manifest
   <activity
        android:name=".adata.Qdata"
        android:label="@string/app_name" >
        <intent-filter>
            <action   android:name="com.my.adata.Qdata" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity
        android:name=".adata.DecoderActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait">
        <intent-filter>
            <action   android:name="com.my.adata.DecoderActivity" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

Actually here adata is a another package in my Application... and Main package is com.my
So in com.my I have another files for QR purpose I have separated this two activities
This is Error
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my/com.my.adata.DecoderActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
at android.app.ActivityThread.access$600(ActivityThread.java:128)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.support.v7.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:98)
at android.support.v7.widget.ToolbarWidgetWrapper.<init>(ToolbarWidgetWrapper.java:91)
at android.support.v7.app.ToolbarActionBar.<init>(ToolbarActionBar.java:73)
at android.support.v7.app.AppCompatDelegateImplV7.setSupportActionBar(AppCompatDelegateImplV7.java:205)
at android.support.v7.app.AppCompatActivity.setSupportActionBar(AppCompatActivity.java:99)
at com.my.adata.DecoderActivity.onCreate(DecoderActivity.java:43)
at android.app.Activity.performCreate(Activity.java:4470)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
at android.app.ActivityThread.access$600(ActivityThread.java:128)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)

Can any one suggest me what is problem...

A: Do this changes in manifest...
    <activity
            android:name="com.my.adata.Main"
            android:label="@string/app_name" >
            <intent-filter>
             <action android:name="android.intent.action.MAIN"/>
             <category android:name="android.intent.category.LAUNCHER">
            </intent-filter>
        </activity>

        <activity
            android:name="com.my.adata.Qdata"
            android:screenOrientation="portrait">
           <intent-filter>
           <action   android:name="com.my.adata.Qdata" />
           <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
        </activity>

A: Why are you using two launcher activity try to make one louncher activity and than call your activity.
<activity
    android:name=".adata.Main"
    android:label="@string/app_name" >
     <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>

<activity
    android:name="com.my.adata.Qdata">
</activity>


text:
Q: Could not start a new session. Response code 500. Message: unknown error: DevToolsActivePort file doesn't exist error using Selenium ChromeDriver Java I am new in selenium  and i am trying to open a page so chome open but it can not load URL.
Code trials:
System.setProperty("webdriver.chrome.driver","C:\\Users\\user\\Desktop\\ecli\\chromedriver.exe")
WebDriver driver= new ChromeDriver();
driver.get("https://rahulshettyacademy.com/");
System.out.println(driver.getTitle());

I tried re install chrome, add thread.sleep(5000), add dependency WebDriverManager.chromedriver().setup(); and WebDriver driver = new ChromeDriver();
After close the chrome I have this:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 103.0.5060.134 (8ec6fce403b3feb0869b0732eda8bd95011d333c-refs/branch-heads/5060@{#1262}) on port 54404
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: DevToolsActivePort file doesn't exist
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: 'PC', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.3'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: []}}}]
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:144)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:102)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:264)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:179)
    at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:101)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:81)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:49)
    at PrimerEjercicio.main(PrimerEjercicio.java:29)

Environment:

*

*OS: W10

*Chrome version :104.0.5112.102

*jve1.8.0_101 (java version)

A: This error message...
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: DevToolsActivePort file doesn't exist

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. google-chrome session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:

*

*You are using chrome=104.0

*But you are using chromedriver=103.0

*Release Notes of chromedriver=103.0 clearly mentions the following :

Supports Chrome version 103

So there is a clear mismatch between chromedriver=103.0 and the chrome=104.0

Solution
Ensure that:

*

*Selenium is upgraded to  current released Version 4.4.0.

*ChromeDriver is updated to  current ChromeDriver v104.0 level.

*Chrome Browser is updated to  current chrome=104.0 (as per chromedriver=104.0 release notes).


text:
Q: Getting form data in nodeJS with Jade I am trying to make my first website in NodeJS with Jade and Express. Now I want to make a form on a page called Lipinsky but I can't figure out how I can store the input into a variable.
I tried console.logging res and req and they're big objects without any body, so req.body is undefined.
My app.js for rendering and getting the form looks like this:
app.get('/lipinsky', function (req, res, next) {
  try {
    let html = lipinsky({ title: 'Lipinsky RO5' })
    res.send(html)
  } catch (e) {
    next(e)
  }
})

app.post('/lipinsky', function (req, res) {
    let html = lipinsky({ title: 'Lipinsky RO5' })
    res.send(html);
});

And my lipinsky.jade is:
extend default

block content
  h3.
    Lipinsky rule of five calculator

  p.
    Calculate Lipinsky RO5 for molecules with a known CAS registry number.
  div
  form(action='/lipinsky',method='post')
    div(data-role='fieldcontain')
      fieldset(data-role='controlgroup')
        label(for='name') Molecule name
           input(id='name',type='text',value='',name='name')

So I don't know if I'm doing it right and how to get the entered form data into a variable in app.js.

A: What the hell is lipinsky()?
1. Anyway, you can use res.render( { title: "foo" } ) to render the template and return it.
2. And you haven't used title in you jade.
doctype html
html(lang="en")
    body
        h3= title

3. I guess you haven't added any middleware. So, you should not call next(e).
app.get('/lipinsky', function (req, res) {
    res.render("./views/lipinsky", {title: "foo"});
})


text:
Q: How do I display my list control in Report View. I want to see the VIEW on the properties of list control visual studio 2013 update 4 Please, I am having problem with my control list in MFC programs, I use visual studio 2013. On the properties of the control list, I cannot access VIEW. The list control cannot display columns.
Some errors  I get are:
"CListBox" has no member "InsertColumn";
"CListBox" has no member "SetItemText";

How can I make my control list to be in Report View?
    // Column width and heading
m_ListControl.InsertColumn(0, "Emp ID", LVCFMT_LEFT, -1, 0);
m_ListControl.InsertColumn(1, "Name", LVCFMT_LEFT, -1, 1);
m_ListControl.InsertColumn(2, "Age", LVCFMT_LEFT, -1, 1);
m_ListControl.SetColumnWidth(0, 120);
m_ListControl.SetColumnWidth(1, 200);
m_ListControl.SetColumnWidth(2, 200);

// Insert values into the list control
iRec = m_ListControl.InsertItem(0, strID, 0);
m_ListControl.SetItemText(0, 1, strName);
m_ListControl.SetItemText(0, 2, strAge);

A: CListBox and CListCtrl are two different control types.
CListCtrl is what you are clearly wanting, yet the error messages you get indicate you have added a CListBox.


text:
Q: Selenium - Xpath pathing to table Syntax Problem I want to extract the ¨BMW Serie 2 Active Tourer¨ table, first column, which appears by clicking ¨MOSTRAR VERSIONES (14)¨ in https://motorgiga.com/bmw/2-series.
The Xpath '//div[@data-nql="ve:car:bmw:serie-2-active-tourer"]' works.
The Xpath '//div[@data-nql="ve:car:bmw:serie-2-active-tourer"]/table/tbody/tr[1]/td[1]/a'
doesn't work.
Can you please help me to write correctly the Xpath syntax to get here?
The script tries to get the table through the tag "serie-2-active-tourer", since i want to relate each table to its model.
Pd: my screen capture is at the end, showing the html.
Thank you,
Jose Luis
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--window-size=1920x1080")
chrome_options.add_argument('--headless') # ESTO ES OROOOO
chrome_options.add_argument('--disable-gpu') # ESTO ES OROOOO :)

driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=r"chromedriver_win32/chromedriver.exe")
url = 'https://motorgiga.com/bmw/2-series/precios'
driver.get(url)

# 1. This works

xpath = driver.find_elements_by_xpath('//div[@data-nql="ve:car:bmw:serie-2-active-tourer"]')
result = [xpath[i].get_attribute('class') for i in range(0, len(list(xpath)))]
print(result)

# 2. Now we enter into the table division. This doesn't work

xpath = driver.find_elements_by_xpath(
'//div[@data-nql="ve:car:bmw:serie-2-active-tourer"]/table/tbody/tr[1]/td[1]/a')

My html screen capture: www.i.stack.imgur.com/Z0V0U.png


text:
Q: Git: doesn't add filename with dash lastest git versin on archlinux that doesn't add filename that contain dash, e.g: test-abc (git version 2.19.2)
How to automatically add filename with dash (or folder) with git?