text:
Q: Issue using apache tiles 3 in spring mvc web project I am developing a Spring-based web application and I'm trying to use apache tiles 3. However, even though I think I got all required dependencies and files setup, I constantly get a error complaining about the Application Context Request Class not being found.
Does anybody see what I'm doing wrong?
This is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.phoebus</groupId>
    <artifactId>spittr</artifactId>
    <name>SpringMVCTest</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <java-version>1.8</java-version>
        <org.springframework-version>3.2.2.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
    </properties>
    <dependencies>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.2.1.RELEASE</version>
            <exclusions>

                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                 </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>4.2.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>3.0-alpha-1</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.2.1-b03</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.0.1.Final</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.0-b01</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>4.2.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-servlet</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>3.0.5</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-compat</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-request-api</artifactId>
            <version>1.0.6</version>
        </dependency>
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-template</artifactId>
            <version>3.0.5</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

This is my servlet context file:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <annotation-driven />

    <resources mapping="/resources/**" location="/resources/" />

    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>

    <context:component-scan base-package="com.phoebus.spittr" />

    <beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
        <beans:property name="definitions">
            <beans:list>
                <beans:value>/WEB-INF/layout/tiles.xml</beans:value>
                <beans:value>/WEB-INF/views/**/tiles.xml</beans:value>
            </beans:list>
        </beans:property>
    </beans:bean>
    <beans:bean id="viewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver" />

</beans:beans>

My tiles.xml:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE tiles-definitions PUBLIC
  "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
  "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">

<tiles-definitions>

    <definition name="base" template="/WEB-INF/layout/page.jsp">
        <put-attribute name="header" value="/WEB-INF/layout/header.jsp" />
        <put-attribute name="footer" value="/WEB-INF/layout/footer.jsp" />
    </definition>

    <definition name="home" extends="base">
        <put-attribute name="body" value="/WEB-INF/views/home.jsp"></put-attribute>
    </definition>

    <definition name="registerForm" extends="base">
        <put-attribute name="body" value="/WEB-INF/views/registerForm.jsp"></put-attribute>
    </definition>

    <definition name="profile" extends="base">
        <put-attribute name="body" value="/WEB-INF/views/profile.jsp"></put-attribute>
    </definition>

    <definition name="spittles" extends="base">
        <put-attribute name="body" value="/WEB-INF/views/spittles.jsp"></put-attribute>
    </definition>

    <definition name="spitter" extends="base">
        <put-attribute name="body" value="/WEB-INF/views/spitter.jsp"></put-attribute>
    </definition>

    <definition name="spittleView" extends="base">
        <put-attribute name="body" value="/WEB-INF/views/spittleView.jsp"></put-attribute>
    </definition>

</tiles-definitions>

my page.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="t" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Spittr</title>
<link rel="stylesheet" type="text/css" href='<c:url value="/resources/style.css"/>'>

        <t:insertAttribute name="header" />

        <t:insertAttribute name="body" />

        <t:insertAttribute name="heafooterder" />

And the exception that is thrown:
SEVERE: Allocate exception for servlet appServlet
java.lang.ClassNotFoundException: org.apache.tiles.request.ApplicationContext
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2693)
    at java.lang.Class.getDeclaredMethods(Class.java:1967)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:606)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:518)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:504)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1069)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I hope I pasted all relevant code snippets.
Thanks in advance!

A: The problem is in the footer, it must be equal.
In your tiles.xml
<definition name="base" template="/WEB-INF/layout/page.jsp">
    <put-attribute name="header" value="/WEB-INF/layout/header.jsp" />
    <put-attribute name="footer" value="/WEB-INF/layout/footer.jsp" />
</definition>

And your page.jsp

    <t:insertAttribute name="heafooterder" />

Then the name of tag "t:insertAttribute" heafooterder does not match with the name of "put-attribute". The solution is to rename heafooterder to footer in tiles.xml.

    <t:insertAttribute name="footer" />

PD: I think that it´s enought with the dependence tiles-extras.
<dependency>
    <groupId>org.apache.tiles</groupId>
    <artifactId>tiles-extras</artifactId>
    <version>3.0.5</version>
</dependency>


text:
Q: jQuery - animate / slide to height: 100% I have a siple code here:
$('.aktualita_sipky').toggle(function() {
    $(this).parent().find('.aktualita_content').animate({
        height: "100%",
      }, 1500 );
}, function() {
    $(this).parent().find('.aktualita_content').animate({
        height: "120px",
      }, 1500 );
});

Now when I click it as the first 'toggle', it just shows instantly (without the animation), when I click the the second 'toggle', it nicely slides up.
Is there a way to slide it down to 100% with that nice animation?

A: My workaround for this was to add up the heights of the child elements in the div, adding a little bit to account for margins:
function() {
  $('.accordionblock.open').removeClass('open');
  var childrenheight = 0;  $(this).children().each(function() {childrenheight += ($(this).height()*1.2)});
  $(this).animate({height:childrenheight},300).addClass('open');
  }
}

A: Maybe you could do something like:
$height = $(window).height();   // returns height of browser viewport
//Or
$height = $(document).height(); // returns height of HTML document
//Or
$height = $(whatever).height();
$('.aktualita_sipky').toggle(function() {
    $(this).parent().find('.aktualita_content').animate({
        height: $height + 'px',
      }, 1500 );
}, function() {
    $(this).parent().find('.aktualita_content').animate({
        height: $height + 'px',
      }, 1500 );
});

http://docs.jquery.com/CSS/height

A: I found this post while looking for a solution myself and Karim79 had the great suggestion of using a variable and the height() function.
For me I don't start with the height at 100% since I have a preset height defined in my stylesheet. So what I do in the function to expand is I make a variable that has a query to steps back to the specific element I want to expand and changes the css height to 100% and return the height to a variable. Then I set the css for the height back (I suppose I could have used to vars told the original preset height as well incase I edit the css in the future) and then run the animation function using the var with height.
function expandAlbum (){
    var fullHeight = jQuery(this).prev('.albumDropdown').css('height' , '100%').height();
    jQuery(this).prev('.albumDropdown').css('height' , '145px');
    jQuery(this).prev('.albumDropdown').animate({'height' : fullHeight}, 1000, function(){jQuery(this).stop();});
    jQuery(this).html('close');
}

I am also not very experienced so forgive sloppy coding.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Add text to div that increments alone with JS I'm trying to do the same thing as on this site http://www.internetlivestats.com/one-second/
As you can see there is a number on increment to infinity going up x times per second.
I'm stuck, if someone could help me out that'd be great.
This is what I've come up with so far (I'm aware it doesn't work for now)
index.html

script.js
var total = 0;
var twitterMultiplier = 7135;
var instagramMultiplier = 487;

var update = function() {
  document.getElementByClassName("twitter").innerHTML = "Tweets per second: " + Math.round(total + 7135);
  document.getElementByClassName("instagram").innerHTML = "Images per second: " + Math.round(total + 487);
}
window.setInterval(function(){
  update();
}, 100);

A: There is no getElementByClassName. There is a getElementsByClassName.
There can be multiple elements on the page with the same class name. As such the method returns multiple elements.
Since you are trying to retrieve specific individual elements, you should use id rather than class.

...

document.getElementById('twitter')...

A: Are you just getting the values returning and not incrementing? If so, it's because total isn't being increased. I'm guessing that you were going for something like this:
var twitterTotal = 0;
var instagramTotal = 0;
var twitterMultiplier = 7135;
var instagramMultiplier = 487;

var update = function() {
    twitterTotal += twitterMultiplier;
  instagramTotal += instagramMultiplier;
  document.getElementById("twitter").innerHTML = "Tweets per second: " + Math.round(twitterTotal);
  document.getElementById("instagram").innerHTML = "Images per second: " + Math.round(instagramTotal);
}
window.setInterval(function(){
  update();
}, 100);

https://jsfiddle.net/4f5h07w2/

A: You don't perform any mutation of the local variables, so the values you see are always going to be 7135 and 487. You also have some syntax errors.
Here's how I might approach this a little differently.

    // Maintain and simple map of the settings you need
    var timeMap = {
      'twitter': {
        total: 0,
        rate: 7135,
        label: 'Tweets per second: '
      },
      'instagram': {
        total: 0,
        rate: 487,
        label: 'Images per second: '
      }
    };

    // The update function loops over the map, updates each total by
    // the rate value, and uses the map key and label to find the element
    // by ID in the DOM and builds the output string
    var update = function() {
      for (var site in timeMap) {
        timeMap[site].total += timeMap[site].rate;
        document.getElementById(site).innerHTML = timeMap[site].label + timeMap[site].total.toString();
      }
    };

    // runs every 1000 milliseconds
    window.setInterval(update, 1000);

This approach will let you add more and more sites with ease -- no need to ever change the update() function.

A: First of all you are using document.getElementByClassName this function doesn't exist, it should be: document.getElementsByClassName. However when you are updating a specific element I would suggest you use document.getElementById instead.
your html then becomes:

secondly, you are not incrementing the total, so your value will remain static:
var total = 0;
var twitterMultiplier = 7135;
var instagramMultiplier = 487;

var update = function() {
  total++; //incrementing total every interval
  document.getElementById("twitter").innerHTML = "Tweets per second: " + Math.round(total * 7135); //multiply with total here.
  document.getElementById("instagram").innerHTML = "Images per second: " + Math.round(total * 487); //multiply with total here.
}

window.setInterval(function(){
  update();
}, 100);

See the fiddle here: https://jsfiddle.net/o6rmx1ds/

A: be sure to increment total.
you can use

*

*total++ (add one to it)

*total += 1

*total = total + 1

it's your choice!

A: You need to use "getElementsByClassName" (note the s in Elements) and then reference the first item in the array.
document.getElementsByClassName("twitter")[0].innerHTML = "Tweets per second: " + Math.round(total + 7135);
document.getElementsByClassName("instagram")[0].innerHTML = "Images per second: " + Math.round(total + 487);


text:
Q: Drools 6.5 Executing Specific Rule Using a Custom Agenda Filter Not Working I have a requirement to execute specific rules using their using associated values and tried implementing a custom Agenda Filter to only execute one particular rule at a time but it appears to execute all rules. I'm using a stateless session that i defined like this:
   @Bean
     @ConditionalOnMissingBean(KieSession.class)
     public StatelessKieSession kieSession() throws IOException {
         return kieContainer().newStatelessKieSession();
     }

My logic for iterating the Map and executing each rule is as follows:
for (Map.Entry<Long, String> entry : ruleIdsAndData.entrySet()){

    List<Object> facts = new ArrayList<Object>();
    facts.add(entry.getValue());

    Map<String, String> ruleResponse = new HashMap<String, String>();
    kieSession.setGlobal("ruleResponse", ruleResponse);

    TrackingAgendaEventListener agendaEventListener = new TrackingAgendaEventListener();
    kieSession.addEventListener(agendaEventListener);

    String ruleName = myRuleService.retrieveRuleNameById(entry.getKey());
    log.debug("Attempting to fire the following rule : " + ruleName);

    facts.add(new FireAllRulesCommand(new RuleNameEqualsAgendaFilter(ruleName)));
    kieSession.execute(facts);

    log.debug("RuleResponse after rule has fired is : " + ruleResponse);
}

and the RuleNameEqualsAgendaFilter class looks like this:
import lombok.extern.slf4j.Slf4j;
import org.kie.api.runtime.rule.AgendaFilter;
import org.kie.api.runtime.rule.Match;

    @Slf4j
    public class RuleNameEqualsAgendaFilter implements AgendaFilter {

        private final String ruleName;

        private final boolean accept;

        public RuleNameEqualsAgendaFilter(final String name) {
            this(name, true);
        }

        public RuleNameEqualsAgendaFilter(final String name, final boolean accept) {
            this.ruleName = name;
            this.accept = accept;
        }

        public String getName() {
            return ruleName;
        }

        public boolean isAccept() {
            return accept;
        }

        public boolean accept( Match match) {
            log.debug("Comparing : " + match.getRule().getName() + " to ruleName : " + this.ruleName);
            if (match.getRule().getName().equals(this.ruleName)) {
                return this.accept;
            } else {
                return !this.accept;
            }
        }
    }

Any ideas why this would execute a different rule to the one i specify in ruleName?

A: Here you are adding facts to a List:
List<Object> facts = new ArrayList<Object>();
facts.add(entry.getValue());

And here you add another Object, a FireAllRulesCommand:
facts.add(new FireAllRulesCommand(new RuleNameEqualsAgendaFilter(ruleName)));

And then you call
kieSession.execute(facts);

which inserts all facts and then calls fireAllRules. So the AgendaFilter is just a fact in WM.
Use a statefull session, insert the facts and call fireAllRules with the AgendaFilter as an argument.


text:
Q: Why Material-UI date overlaps value with placeholder and complains about controlled input? Here is the codesandbox.
I want to create a DateOnly component that I can use with ease throughout my projects.
And Material-UI complains that:

Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components

And here's how it shows the selected date:

I know that controlled input means that you bind both value={value} and onChange={(newValue) => setValue(newValue);}.
And here's my return value:
return (
    <div>
      <KeyboardDatePicker
        error={isValid() ? false : true}
        id={id}
        label={placeholder}
        format="MM/dd/yyyy"
        value={currentValue}
        onChange={(date) => {
          setCurrentValue(date);
        }}
        KeyboardButtonProps={{
          "aria-label": "Change " + placeholder
        }}
        fullWidth
      />
    </div>
  );

But I don't know why this date field fails to recognize that.
How can I fix this?

A: Change this code:
const [currentValue, setCurrentValue] = useState(
  new Date(value) || new Date()
);

To:
const [currentValue, setCurrentValue] = useState(
  value ? new Date(value) : new Date()
);

new Date(undefined) is an invalid date (because your component doesn't initialize value prop). When you pass invalid date value to the picker component, it can't register so it thinks you're using uncontrolled mode and unexpected result happens.


text:
Q: Using Generics in Typescript with Arrays In Typescript, if I'm defining a type that stipulates only strings can go into an array, I'm able to define that like this:
type stringArray = string[]
I'm able to specify that certain kinds of objects may go into an array like this:
type myObject  = {
    one: string,
    two: string,
}
type objectArray = myObject[]

However, I'm able to accomplish something very similar with generics, like this:
type stringArray = Array<string>
and
type objectArray = Array<myObject>
Is there any advantage to using either approach? When should one use the former and when is the latter a better approach?

A: Array<T> and T[] are 100% equivalent.
Which to use is mostly a code style choice. Though the T[] syntax is usually preferred in most codebases that I've seen as it looks like an array, and at a glance it is shorter.


text:
Q: Displaying Array Using Custom Component I want to display a list of pictures in the following format using react-admin.

{
    "images": [
        {
            "created_at": "2021-03-17",
            "images": [
                {
                    "image": "http://url.com/img.jpeg"
                }
            ]
        }
    ]
}

I can display the pictures using the following,
           <ArrayField source="images" label=''>
                <SingleFieldList>
                    <ArrayField source='images' label = '' sortable={false} >
                         <SingleFieldList>
                             <ImageField source='image' label = ''/>
                         </SingleFieldList>
                     </ArrayField>
                 </SingleFieldList>
             </ArrayField>

I would like to print these inside custom elements say each picture in a div. Reading through [1] and the docs [2] following example is provided,
const TagsField = ({ record }) => (

    {record.tags.map(item => (

{item.name}

    ))}

)
TagsField.defaultProps = {
    addLabel: true
};

but there is not a complete example of how this component is used? How can i impelent a custom component to print the array?
[1] https://github.com/marmelab/react-admin/issues/2383
[2] https://marmelab.com/react-admin/Fields.html#arrayfield


text:
Q: Visualizar las tabla existente que hay en una base de datos sql en un Combo Box Estoy tratando  en un ComboBox  mostrar las tablas que tengo en mi base de datos sql  el error es que me muestra en el ComboBox este mensaje  :
System.datadatarowview
String consulta = ("select * from sys.tables");
        SqlCommand cmd = new SqlCommand(consulta, cnn);
        SqlDataAdapter sqlDataAdap = new SqlDataAdapter(cmd);
        DataTable dtRecord = new DataTable();
        sqlDataAdap.Fill(dtRecord);

        Notificaciones_Consulta.DataSource = dtRecord;

Me podrían ayudar no encuentro la razón.
Gracias,

A: Si es un combobox en winforms debes asignar las propiedades DisplayMember y ValueMember indicando que columna quieres visualizar
Notificaciones_Consulta.DisplayMember = "nombrecol";
Notificaciones_Consulta.ValueMember = "nombrecol";
Notificaciones_Consulta.DataSource = dtRecord;


text:
Q: Selling Digital Goods using the REST API I'm trying to use the Express Checkout REST API to sell digital goods on my website.
The main problem I'm facing is that PayPal is showing the "Ship To" in the order review.
Is it possible to disable, or remove shipping when creating a payment using the REST API?
I saw a related question here: Selling Digital goods via REST API - however it's old and there hasn't been any update for a while. Basically it says the REST API doesn't support selling digital goods.
Thank you.

A: I managed to disable shipping by creating an Experience Profile,
https://developer.paypal.com/docs/api/payment-experience/
I used an application called Postman to send a POST request to PayPal on https://api.sandbox.paypal.com/v1/payment-experience/web-profiles
With this JSON data:
{
  "name": "AppName",
  "presentation": {
    "brand_name": "AppName Paypal",
    "locale_code": "US"
  },
  "input_fields": {
    "no_shipping": 1,
    "address_override": 1
  },
  "flow_config": {
    "landing_page_type": "login"
  }
}

Please note that I used no_shipping 1, which disables shipping. I also sent the Authorization Bearer token with this POST request.
If the request is successful, then you'll get the id of the newly created experience profile.
The id is used when creating an express checkout payment.
"experience_profile_id":"experience_profile_id",


text:
Q: Doubts on Providing Up Navigation I would like to provide UP navigation in my app, but i do not understand: how to do it if i have some activities without static parent activity (it can be run from different activities).
For example, i have "Main activity", "Activity1", "Activity2" and "Setting Activity":

*

*Main Activity - does not have parent activity

*Activity1, Activity2 - the parent activity is "Main Activity"

*Setting Activity - also, does not have parent activity, can be run from "Main activity", "Activity1" and "Activity2".

To provide UP navigation (according to the Google documentation) there are 3 steps:

*

*To declare which activity is the appropriate parent for each activity
<application ... >
    ...
<!-- The main/home activity (it has no parent activity) -->
<activity
    android:name="com.example.myfirstapp.MainActivity" ...>
    ...
</activity>
<!-- A child of the main activity -->
<activity
    android:name="com.example.myfirstapp.DisplayMessageActivity"
    android:label="@string/title_activity_display_message"
    android:parentActivityName="com.example.myfirstapp.MainActivity" >
    <!-- Parent activity meta-data to support 4.0 and lower -->
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value="com.example.myfirstapp.MainActivity" />
</activity>
</application>

*To show "UP" button:
public void onCreate(Bundle savedInstanceState) {
    ...
    getActionBar().setDisplayHomeAsUpEnabled(true);
}

*To add a button click handler:
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

QUESTIONS:

*

*How can i declare parent activity for my "Setting Activity" (step 1)? Or I need to modify the button click handle (step 3)?

*What difference between a launch mode "singleTop" and "standart"? Where do i need to put them?

Thanks in advance.

A: The way of providing a parent activity as you described is useful when a non-root activity (every one but the main activity) can be started via an intent external to your application. For these activities, it's useful: a tap on up should be different than a tap on back (up: go back to the parent activity, back: go back in the history stack, so go back to the external activity for example).
For activities like your SettingsActivity, you don't have a specific parent activity. You shouldn't use NavUtils.navigateUpFromSameTask(this). Instead, just call finish(). You'll have the desired behavior when navigating inside your application, and I guess your SettingsActivity won't be called from somewhere else.
Regarding the difference between singleTop and standard: when you start an activity in standard mode, a new instance will be created. Which is probably what you want, hence the default. In singleTop mode, if an instance already exists in the same task, a new one won't be created, but the existing one will be reused. onNewIntent() will be called on it.
To specify a specific launch mode, you'll have to add an attribute to your activity's entry in the manifest. For your MainActivity, for example:
<activity
    android:name="com.example.myfirstapp.MainActivity"
    android:launchMode="singleTop" />

Note that standard is the default mode and doesn't need to be specified.


text:
Q: SQL Select ID with the most recent date I am really stuck I am creating a temporary table that holds a list of customers, their last policy signed date and what type the business source is.
I am trying to find out what the last business source is for thousands of customers.
DROP TABLE #TEMP

CREATE TABLE #TEMP([user] INT, [policySignedDateTime] DATETIME, [BS] INT)

INSERT INTO #TEMP
SELECT TOP (100) PERCENT
    dbo.tblCustomerUser.IdentityID,
    MAX(dbo.tblApplication.PolicySignedDateTime) AS 'last',
    (dbo.tblApplication.BusinessSourceID) AS BS
FROM dbo.tblApplication
INNER JOIN dbo.tblCustomerUser
    ON dbo.tblApplication.CustomerUserID = dbo.tblCustomerUser.IdentityID
INNER JOIN dbo.tblIndividual
    ON dbo.tblCustomerUser.IdentityID = dbo.tblIndividual.IdentityID
    WHERE (dbo.tblApplication.BusinessSourceID in (1,11))
    AND (dbo.tblApplication.PolicySignedDateTime is not null)
    AND (dbo.tblCustomerUser.IdentityID = 54456)
GROUP BY
    dbo.tblCustomerUser.IdentityID,
    dbo.tblIndividual.FirstNames,
    dbo.tblIndividual.LastName,
    dbo.tblApplication.BusinessSourceID

The output looks like this for one user

*

*54456 // 2012-12-12 00:00:00.000 // 1

*54456 // 2012-01-09 00:00:00.000 // 11

So basically I am trying to only return the top row as it is the most recent date.
Any advice would be amazing!

A: Use a commnon table expression and a window function like ROW_NUMBER or DENSE_RANK:
WITH CTE AS
(
    SELECT dbo.tblcustomeruser.identityid,
          Max(dbo.tblapplication.policysigneddatetime)OVER(
              partition BY  dbo.tblcustomeruser.identityid,
                            dbo.tblindividual.firstnames,
                            dbo.tblindividual.lastname,
                            dbo.tblapplication.businesssourceid) AS 'last',
         dbo.tblapplication.businesssourceid  AS BS,
         Row_number() OVER (
              partition BY  dbo.tblcustomeruser.identityid,
                            dbo.tblindividual.firstnames,
                            dbo.tblindividual.lastname,
                            dbo.tblapplication.businesssourceid
              ORDER BY dbo.tblapplication.policysigneddatetime DESC) AS RN
     FROM   dbo.tblapplication
        INNER JOIN dbo.tblcustomeruser
                ON dbo.tblapplication.customeruserid =
                   dbo.tblcustomeruser.identityid
        INNER JOIN dbo.tblindividual
                ON dbo.tblcustomeruser.identityid = dbo.tblindividual.identityid
     WHERE  ( dbo.tblapplication.businesssourceid IN ( 1, 11 ) )
        AND ( dbo.tblapplication.policysigneddatetime IS NOT NULL )
        AND ( dbo.tblcustomeruser.identityid = 54456 )
)
SELECT *
FROM   CTE
WHERE  RN = 1

A: I am using the ranking method – zx8754 suggested.
The code now looks like this
DROP TABLE #TEMP

CREATE TABLE #TEMP([user] INT, [policySignedDateTime] DATETIME, [BS] INT)

INSERT  INTO #TEMP
SELECT        TOP (100) PERCENT dbo.tblCustomerUser.IdentityID, MAX(dbo.tblApplication.PolicySignedDateTime) AS 'last', (dbo.tblApplication.BusinessSourceID) AS BS, rank() OVER (Partition by MAX(dbo.tblCustomerUser.IdentityID) order by MAX(dbo.tblApplication.PolicySignedDateTime)desc) as ranking
FROM            dbo.tblApplication INNER JOIN
                     dbo.tblCustomerUser ON dbo.tblApplication.CustomerUserID = dbo.tblCustomerUser.IdentityID INNER JOIN
                     dbo.tblIndividual ON dbo.tblCustomerUser.IdentityID = dbo.tblIndividual.IdentityID
                     WHERE (dbo.tblApplication.BusinessSourceID in (1,11))
                     and (dbo.tblApplication.PolicySignedDateTime is not null)
                    and (dbo.tblCustomerUser.IdentityID = 54456)
GROUP BY dbo.tblCustomerUser.IdentityID, dbo.tblIndividual.FirstNames, dbo.tblIndividual.LastName, dbo.tblApplication.BusinessSourceID


text:
Q: WordPress, Posts are being displayed on front page(index.php)? I have three Posts in WordPress that each have the category Event.
I'm assuming that i use a WordPress codex to call those Posts to display when i want to.
What is happening is these Posts are all being displayed on index.php.  I want to be able to use the WordPress codex and get the Posts for a certain category and display them.  For example, display the posts in a pop up div.
How do i get Posts not to be displayed on the front page?
How do i get Posts of a specific category to display?
Or am i going about this the wrong way?  I assume that Posts can be fetched from the database and be put in a popup div.
Here is my main inner html of my index.php

        <?php

            if(!isset($_GET['page_id'])) {

                wp_nav_menu( array( 'theme_location' => 'main-menu'));
            }
        ?>

            <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
            the_content();
            endwhile; else: ?>

Sorry, no posts matched your criteria.

            <?php endif; ?>

I want it to fetch the current Page content and not the Posts.

A: <?php
if(!is_home() || !is_front_page) { // dont display on home page

if ( have_posts() ) : while ( have_posts() ) : the_post();
            the_content();
            endwhile; else: ?>

Sorry, no posts matched your criteria.

            <?php endif;
}
 ?>

look here for more conditional tags template tags
and to get posts from a particular category you can pass args in wp_query look here category args


text:
Q: In Scala, how to override a method that takes a java.util.Map The Java class I am trying to subclass has a method like:
public abstract void foo(Map var1);

I can't figure out how to override that method. The Java class I am subclassing from does not use generics.
In Scala I tried:
override def foo(var1:java.util.Map[Int,Int]){ }

But the compiler gives me the error message that it overrides nothing..
The heart of the problem is that Scala expects type parameters on the Map, however the Java class doesn't use them.

A: This is going to make it work
override def foo(var1:java.util.Map[_,_]){ }


text:
Q: List of characters to table in R I have a list of objects of class character. In this list, there are supposed to be four classes: class SN N, class S F, class S SN, and class S N F. Notice these are not all the same length.
> list1
[[1]]
[1] "SN" "N"

[[2]]
[1] "S"  "F"

[[3]]
[1] "S"      "SN"

[[4]]
[1] "S" "N" "F"

[[5]]
[1] "SN" "N"

How can I get a table out of this? I'd like a count of the number of times each class appears in the data set. This is the error I'm getting:
> table(list1)
Error in table(list1) : all arguments must have the same length


text:
Q: jQuery Textfill Problems I'm using the jquery textfill plugin from https://plugins.jquery.com/textfill/. Originally coded on my mac in chrome and everything's working fine. When I checked it on windows in chrome it's not filling the div all the way. I can see that it's functioning, it shows

but it should be 9 to fill the container completely. When I tested the same page on the same computer in firefox it worked flawlessly. What could the problem be?

body...

<?  echo $list1; ?>
<? echo $list2; ?>

A: removing table-layout:fixed; works for me


text:
Q: Div "margin-top" is relative to body instead of parent div The HTML for my page:

#header {
  background-color: #0cf;
  border: 1px solid black;
  height: 20%;
  width: 100%;
}

#menu {
  background-color: #ff0;
  color: black;
  font-size: 1.5em;
  height: 29%;
  width: 70%;
  margin-top: 9%;
}

    this is menu

The problem is that the "#menu" has its margin relative to "body" element I want its margin to be relative  to "#header".
You can probably see that i am creating a fluid grid here, and margin of my "#menu" div should be relative to the "#header" otherwise it will not work(see the screen shots).
Here are the screenshots.
First one at resolution of 1024*768.
Second is at resolution of 1280*1024

In second screenshot the "#menu" is a little high from the bottom of "#header".
My question is how can i apply a margin which changes as the height of "#header" changes?
I have already read about the "margin collapsing" thing but i don't think this is what's happening here,as my parent div has a border.

A: I usually solve this problem by using:
position:absolute;
top: xxx px; /* (or bottom, left, right) */

A: the 9% that you used in #menu { margin-top: 9%; } means 9% of ducument size which is all maximum browser window .
use position:relative for both #header and #menu . then give top:9% to #menu .

A: The percentage height property in CSS can only be applied to elemets whose parent's have a position other than static.
Just add position: relative to #header and you should good to go!


text:
Q: Not able to use XCTUnwrap in Test Framework I am trying to create a test Framework that includes some extensions. I am able to import XCTest in the framework by following the suggestions from here: https://stackoverflow.com/a/35102636/3475906
However, whenever I try to use XCTUnwrap I got error: Use of unresolved identifier 'XCTUnwrap'
Basically, I want something like this:
import XCTest

extension Optional {
    func unwrap() -> Wrapped {
        do {
            return try XCTUnwrap(self)
        } catch {
            print("Handle error")
        }
    }
}

Does anybody have any idea?

A: The XCTUnwrap API is only available in primary test bundle targets and not in other libraries or frameworks. There are two ways to fix this issue:

*

*Move your Optional extension to the main bundle which obviously not something you want to do :)

*Modify the following build settings in your test framework target:

SYSTEM_FRAMEWORK_SEARCH_PATHS = (
    "$(inherited)",
    "$(PLATFORM_DIR)/Developer/Library/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
    "$(inherited)",
    "$(PLATFORM_DIR)/Developer/usr/lib",
);
SWIFT_INCLUDE_PATHS = "$(inherited) $(PLATFORM_DIR)/Developer/usr/lib"

A: At least since Xcode 11.4 you may just enable:
ENABLE_TESTING_SEARCH_PATHS = YES
in the "Build Settings" of your project or target.


text:
Q: How to view Unity method implementations in VSCode "Jump To Definition"? I have a friend using JetBrains Rider and when he uses Jump To Definition (F12) he can see the method signature and implementation! I tried installing Rider but it is not yet supported on my ARM64 Mac. Is there anyway I can view Unity method implementations using VSCode or VSCode Insiders?
For example, if I have the following call, I click Translate
transform.Translate(Vector3.forward * Time.deltaTime * zSpeed);

Then I press F12, which opens Transform.cs but only shows the method headers. The implementations are missing
// Summary:
//     Moves the transform by x along the x axis, y along the y axis, and z along the
//     z axis.
//
// Parameters:
//   x:
//
//   y:
//
//   z:
//
//   relativeTo:
public void Translate(float x, float y, float z);

// comments removed for brevity...
public void Translate(float x, float y, float z, [DefaultValue("Space.Self")] Space relativeTo);

// comments removed for brevity...
public void Translate(Vector3 translation);

// comments removed for brevity...
public void Translate(Vector3 translation, [DefaultValue("Space.Self")] Space relativeTo);

// comments removed for brevity...
public void Translate(float x, float y, float z, Transform relativeTo);

// comments removed for brevity...
public void Translate(Vector3 translation, Transform relativeTo);

Any help is greatly appreciated!

Per a comment, I tried Cmd+F12

But then it says "no implementation found"

I'm stuck!

A: I enabled the following options in my C# plugin for VSCode. Thanks for the pointer, Karl-Johan Sjögren.

Now when I press F12 on transform.Rotate(Vector.forward) for example, decompilation support allows me to see

This is very beneficial and helps me understand the how Unity handles rotations in different spaces. Also I can begin to understand complex Quaternion.Euler knowing how the familiar translate.Rotate uses it internally. The same is true for things like transform.Translate

For example, if I didn't know I could directly manipulate position before, now I know transform.Translate is a means of doing just that. Being able to get this information at the click of a single button is a game-changer when you compare it to the alternative of alt-tabbing to your browser and doing a text-based search, spending minutes navigating to a specific section of code.


text:
Q: Can't initialize ngRoute,ngMaterial, getting Angular Js Uncaught Error: [$injector:modulerr] I am having an issue with Angular JS receiving an error : Uncaught Error: [$injector:modulerr]. I couldn't initialize ngRoute and ngMaterial. My app.js file looks like,

var myApp = angular.module("myApp", ['ngRoute','ngMaterial']);

In view I include,

<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css'>
    <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/icon?family=Material+Icons'>
    <script data-require="jquery@*" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-resource.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-animate.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0/angular-route.min.js"></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js'></script>
    <script src="js/app.js"></script>

A: materialize and ngMaterial are two different libraries, you need to refer to the angular-material references.
refer in the following order
 <link rel="stylesheet" href="//rawgit.com/angular/bower-material/master/angular-material.css">
        <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.js"></script>
       <script src="//rawgit.com/angular/bower-material/master/angular-material.min.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.min.js"></script>
       <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.min.js"></script>
 </script>

Here is the working Plunker


text:
Q: 'Cake\View\Exception\MissingTemplateException' with phpunit When I test my REST APIs using an app like Postman, it works fine.
However when I run phpunit I'm getting error
exception 'Cake\View\Exception\MissingTemplateException' with message 'Template file "Addresses/json/add.ctp" is missing.'

In AppController
$this->RequestHandler->renderAs($this, 'json');

Routes
$routes->extensions(['json']);
$routes->resources('Addresses');

ControllerTest simply
$this->post('/addresses/');

Being that it is 100% API, I have no need for any views.

A: FYI I had forgotten to add the serialize
$this->set('_serialize', ['data' => 'data']);


text:
Q: Kerberos Authentication for validating card ID on windows 2012/2016 server I would like to perform windows domain authentication using kerberos (AS request) but all I have is a cardID provided by client. I do have username but no password.
How to validate the card user as kerberos needs username and password.
Any mechanisms to validate card ID using kerberos mechanism on windows 2012/2016 server ?


text:
Q: Divergent Stopping Times I have a question regarding a sequence of stopping times in general.
Consider in the context of gambling where $X_n$ denotes your cumulative wealth after the $n^{th}$ gamble.
I recall the intuitive notion of a stopping time with respect to the stochastic process $X$ is a rule that informs you when to quit.
Now, when I think of a sequence of stopping times, it could be some betting strategy that depends on how my wealth evolves over time. For example, I could quit betting when I hit a total wealth of \$0 or \$100. But I could also have a re-enter-the-casino rule as a function of the stopping time. For example, I could set up a re-join rule where I bet on a roulette after 5 cycles once I hit \$100 (e.g. I feel more confident betting after rounds of wins) .
The notion I am a bit unfamiliar is:
$$\lim_{n\rightarrow\infty} \tau_n=\infty.$$
In my example, does this mean as I bet infinitely many times, I will never seize an opportunity to actually stop? If I go bust, this would be true, right? An example would be the gambler's ruin and her stopping time?
$\textbf{My question is why and where is this used?}$
An example I see is when defining something as an approximation in a continuous set-up. Consider the definition of a local martingale.
$X_t$ is a local martingale if there exists a sequence of stopping times $\lim\limits_{n\rightarrow\infty} \tau_n=\infty$ such that $X_{t\wedge\tau_n}$ is a martingale for all $n$.
Are there more intuitive examples where a sequence of stopping times is used to describe something in a continuous set-up to approximate a process? Is this one of the major roles of the sequence?

A: Your last sentence is basically correct: the sequence of stopping times is often used to approximate a process.  One of the most common applications is to set $\tau_n := \inf_t \{ |X_t| \ge n \}$, i.e. $\tau_n$ is the first time the process $X$ hits $n$.
In the context of betting strategies you discussed, you could consider each $\tau_n$ to be a separate quitting rule that one could follow.  I'm not sure I understand what you mean about "re-entering the casino;" you generally only consider the process stopped at a single $\tau_n$.  In your example, if we consider $X_t$ to be the gambler's wealth at time $t$ (without stopping) and set $\tau_n := \inf_t \{ |X_t| \ge n \}$ then $X^{\tau_n}_t := X_{\tau_n \wedge t}$ is the wealth of a gambler who leaves after reaching a wealth of $n$ dollars (or stays forever if that never happens).  The condition that $\lim_{n \rightarrow \infty} \tau_n = \infty$ basically says that the sequence of stopping times should converge to never stopping, so in this example stopping once your wealth hits $n$ becomes almost the same as never stopping when $n$ is large.


text:
Q: R: Find the character position of where 2 strings differentiate I am looking for a way to find if a concatenated string in one dataframe is the exact same in another - if it is not found or different, then I want to return the position of where the strings differentiate.
Example:
DF 1
Store      Good  Price   concatenated

1          Apple    1.50   1Apple1.50

3          Banana   3.50  3Banana3.50

5          Turkey   6.25  5Turkey6.25

DF 2
Store     Good      Price  concatenated

1         Apple     1.80    1Apple1.80

2         Banana    3.50    2Banana3.50

5         Turkey    6.25    5Turkey6.25

So I want to return:
For Apple, return 9, because "1Apple1.50 and 1Apple1.80" differentiate at the 9th position of the string
For Banana, return 1 because "3Banana3.50 and 2Banana2.50" differentiate at the 1st position of the string
For Turkey, don't return anything because the strings match

A: In base R, we can split the string with strsplit and do a comparison on the corresponding list elements and get the position of the first non-match with which
mapply(function(x, y) which(x != y)[1],
     strsplit(df1$concatenated, ""), strsplit(df2$concatenated, ""))
#[1]  9  1 NA

data
df1 <- structure(list(Store = c(1L, 3L, 5L), Good = c("Apple", "Banana",
"Turkey"), Price = c(1.5, 3.5, 6.25), concatenated = c("1Apple1.50",
"3Banana3.50", "5Turkey6.25")), class = "data.frame", row.names = c(NA,
-3L))

df2 <- structure(list(Store = c(1L, 2L, 5L), Good = c("Apple", "Banana",
"Turkey"), Price = c(1.8, 3.5, 6.25), concatenated = c("1Apple1.80",
"2Banana3.50", "5Turkey6.25")), class = "data.frame", row.names = c(NA,
-3L))

A: A base R solution using bitwXor + utf8ToInt
> mapply(function(x,y) which(bitwXor(utf8ToInt(x),utf8ToInt(y))>0), df1$concatenated,df2$concatenated)
$`1Apple1.50`
[1] 9

$`3Banana3.50`
[1] 1

$`5Turkey6.25`
integer(0)

A: Here are some benchmarks of the various approaches suggested so far on 1000 strings of length 1000.  A variation of Akrun's approach that relies on charToRaw() instead of strsplit() seems to be the quickest.
Unit: milliseconds
     expr         min          lq       mean     median         uq        max neval cld
 strsplit   38.626212   38.868298   42.48461   42.43953   45.87118   46.32892    10  a
 distance 6437.995304 6783.890225 6968.59793 7016.14651 7184.29213 7319.84097    10   b
  bitwXor   12.065822   12.278691   17.32897   18.52006   19.95079   26.90822    10  a
    toRaw    4.572742    4.693785    7.76573    4.87048   10.73064   18.74406    10  a

Code to  reproduce:
set.seed(5)
size <- 1000
cvec <-  replicate(size, paste0(sample(letters, size, replace = TRUE), collapse = ""))
cvec2 <- sapply(cvec, function(x)  `substring<-`(x, {y <- sample(size, 1)}, y, sample(letters, 1)))

microbenchmark::microbenchmark(
  strsplit  = mapply(function(x, y) which(x != y)[1],
                     strsplit(cvec, ""), strsplit(cvec2, "")),
  distance = {res <- mapply(function(x, y)
    grepRaw(diag(attr(adist(x, y, counts = TRUE), "trafos")), pattern = "S|D|I"),
    cvec,
    cvec2, USE.NAMES = FALSE)
  res[lengths(res) == 0] <- NA
  unlist(res)},
  bitwXor = {res <- mapply(function(x,y) which(bitwXor(utf8ToInt(x),utf8ToInt(y))>0), cvec,cvec2, USE.NAMES = FALSE)
  res[lengths(res) == 0] <- NA
  unlist(res)},
  toRaw = mapply(function(x, y) which(charToRaw(x) != charToRaw(y))[1],
                 cvec, cvec2, USE.NAMES = FALSE),
  times = 10, check = "equal")

A: Another base R option could be:
mapply(function(x, y)
      grepRaw(diag(attr(adist(x, y, counts = TRUE), "trafos")), pattern = "S|D|I"),
      df1$concatenated,
      df2$concatenated)

$`1Apple1.50`
[1] 9

$`3Banana3.50`
[1] 1

$`5Turkey6.25`
integer(0)

Here it returns the position of where a character was substituted, deleted or inserted, based on Levenshtein distance.
If there could be multiple changes:
mapply(function(x, y)
 grepRaw(diag(attr(adist(x, y, counts = TRUE), "trafos")), pattern = "S|D|I", all = TRUE),
 df1$concatenated,
 df2$concatenated)

A: You may want to compare two data frames like that directly, i.e. using all.equal()
library(dplyr)

df1 <- structure(list(Store = c(1L, 3L, 5L), Good = c("Apple", "Banana","Turkey"), Price = c(1.5, 3.5, 6.25), concatenated = c("1Apple1.50","3Banana3.50", "5Turkey6.25")), class = "data.frame", row.names = c(NA,-3L))
df2 <- structure(list(Store = c(1L, 2L, 5L), Good = c("Apple", "Banana","Turkey"), Price = c(1.8, 3.5, 6.25), concatenated = c("1Apple1.80", "2Banana3.50", "5Turkey6.25")), class = "data.frame", row.names = c(NA,-3L))

# By default, ordering of rows and columns ignored
# But those can be overridden if desired
# By default all_equal is sensitive to variable differences
# But you can request dplyr convert similar types

all.equal(df1, df2, ignore_col_order = FALSE, ignore_row_order = FALSE)

[1] "Component "Store": Mean relative difference: 0.3333333" "Component "Price": Mean relative difference: 0.2"
[3] "Component "concatenated": 2 string mismatches"


text:
Q: Able to copy folders but not files to directory I am currently using CentOS 6.5 and trying to share files over a samba share. On the other machine is Windows 8 x64. I am able to transfer folders from Windows to CentOS over without issues but however, when I try to copy a single file over to CentOS, I get permission denied error on Windows.
Permissions of the folder is as follows:
drwxrwxrwx.   5 user01 smbusers  4096 Feb 28 23:23 srv

And the smb.conf:
[srv]
        comment = Data
        path = /srv
        browseable = yes
        writable = yes
        read only = no
        valid users = @smbusers
        workgroup = WORKGROUP
        create mask = 0775
        directory mask = 0775

Can I know what is the issue here? I have been troubleshooting for quite some time and can't seem to figure out what the issue is. Any help appreciated. Thanks in advance!

A: As /srv was a system folder, SELinux prevented me from writing directly into the folder. So you need to enter this command before it will work:
setsebool -P samba_export_all_rw on

after this you should be able to write without any issues into any system folders that you have shared through samba.


text:
Q: Open MP integration with BDD [Binary Decision Diagrams] I am currently new to openMP and Buddy 2.4, I have been working on a problem to create parallel BDD's with open MP architecture, when I make parallel BDD's with the following code
    /* open MP code  */
     #pragma omp parallel for shared(z) private(tid) num_threads(4)
     for(tid=0;tid<32;tid++)
       {
           int ti = omp_get_thread_num();
           z[tid]=z[tid]&z[64-tid-1];
           printf("\n z[%d] = z[%d] & z[%d] from thread number : %d, %d \n", tid,tid, 64-tid-1,ti,bdd_nodecount(z[tid]));
}

actually I am anding first 64 bdd's and storing them in first 32 BDD's
and nodecount for first 64 BDD's before anding
Node count for z[0] = 0

Node count for z[1] = 0

Node count for z[2] = 0

Node count for z[3] = 0

Node count for z[4] = 0

Node count for z[5] = 0

Node count for z[6] = 0

Node count for z[7] = 0

Node count for z[8] = 0

Node count for z[9] = 0

Node count for z[10] = 0

Node count for z[11] = 0

Node count for z[12] = 0

Node count for z[13] = 1

Node count for z[14] = 1

Node count for z[15] = 1

Node count for z[16] = 1

Node count for z[17] = 1

Node count for z[18] = 1

Node count for z[19] = 3

Node count for z[20] = 5

Node count for z[21] = 5

Node count for z[22] = 5

Node count for z[23] = 5

Node count for z[24] = 5

Node count for z[25] = 3

Node count for z[26] = 3

Node count for z[27] = 3

Node count for z[28] = 5

Node count for z[29] = 5

Node count for z[30] = 5

Node count for z[31] = 5

Node count for z[32] = 7

Node count for z[33] = 5

Node count for z[34] = 5

Node count for z[35] = 5

Node count for z[36] = 7

Node count for z[37] = 7

Node count for z[38] = 7

Node count for z[39] = 7

Node count for z[40] = 9

Node count for z[41] = 7

Node count for z[42] = 7

Node count for z[43] = 7

Node count for z[44] = 7

Node count for z[45] = 7

Node count for z[46] = 9

Node count for z[47] = 11

Node count for z[48] = 13

Node count for z[49] = 13

Node count for z[50] = 13

Node count for z[51] = 15

Node count for z[52] = 15

Node count for z[53] = 9

Node count for z[54] = 11

Node count for z[55] = 11

Node count for z[56] = 11

Node count for z[57] = 11

Node count for z[58] = 15

Node count for z[59] = 15

Node count for z[60] = 15

Node count for z[61] = 19

Node count for z[62] = 23

Node count for z[63] = 19

the problem is that the code is running perfectly serially (no openMP used), but while using openMP, garbage collection is being initiated because of which the nodes are being deleted.
Garbage collection #2: 10000019 nodes / 10000017 free / 1.3s / 2.1s total
BDD error: Unknown BDD - was not in node table
BDD error: Unknown BDD - was not in node table
BDD error: Unknown BDD - was not in node table
BDD error: Unknown BDD - was not in node table

I am unable to understand why this is happening, here are the possible solution [Not working] I have come up with
Solution 1 [Not working]
Provide possible reference and deference to the nodes.
This part of solution isn't working, because we have to convert bdd to BDD and bddithvar(i) [which I am using in some part of code] is not able to convert to BDD so error conversion error is coming.
Solution 2 [Not working]
Use sections to run the program on Open MP
This part is also not working, throwing same error.
Solution 3 [Not working]
Divide the BDD into two or more parts and transfer some part of content to another BDD, for example creating 2 BDD (z1[32] and z[64]) , transfer half of the z[64] to z1[32] and run the code parallely. But still throwing the same error.
Solution 4 [still trying]
Initiate a garbage collection stop specifically by debugging the code
Still figuring out how to do this, any comments regarding this would help.
Solution 5 [Not working]
Possible give a particular thread a particular task.
For example thread 1 should do anding of 10 BDD's and thread 2 should do anding of next BDD's and so on, but still not working throwing same error.
My program is basically anding of BDD's and there are 6 loops
First anding of 64 BDD's then 32, then 16 and so on..
So if by chance clears off the first 64 BDD's anding, it always get stuck between the 32 BDD's anding, it doesn't get past it.
So my question is : why is the garbage collection occuring, although the 64 BDD contains some node value, why is garbage collection occuring, is there any way that garbage collection should be stopped, any comments regarding this would be appreciated, thanks
EDIT : This program is running perfectly serially, but giving garbage collection parallely


text:
Q: Confused about ios image size on different iphone I have a general question about how images are displayed on iphone
For example iphone 5, 5s support 320x568 points or 640x1136 pixles.
If I want to create 4 images all same size to take the whole screen when rendered in 5s portrait mode, can I say each image should be 160x284 pixels?
Now what if the same app is now rendered in 4s or 6? How the images are displayed? Those 4 160x284 images are still taking the whole screen?
Thanks

A: Yes the images can scale to take up the whole screen but will appear blurry. If you want the images to be crisp you will need to create 3 different versions for the 3 different pixel densities (iPhone 2-3, iPhone 4-5, iPhone 6). The general convention is to name your assets like this:

*

*image.png

*image@2x.png

*image@3x.png

Here's a handy guide I use that explains how things are rendered on the different models.


text:
Q: Is less toner used, if you print only after the last page is spooled?
Reduce Stop/Start Cycles
In addition to waiting to change your toner cartridge, you can also avoid using stop/start cycles to further reduce your usage. During the stop/start cycle, toner will accumulate on the drum even if you are not printing anything. This is a wasteful practice that many people do not even realize their printers are doing. To avoid this, go into your "Printer Properties" tab on your computer and adjust the settings so that your pages will only start printing after the last page is spooled. This will reduce the number of times your printer will stop and start up again, saving you a lot of toner.

Who's correct in this Reddit post?
Many comments there rebuff the quote overhead.
u/unclefisty

The amount of toner that will attach to an uncharged drum is pretty low.
However this may reduce the amount of extra revolutions in the drum unit which will reduce wear.

u/m0j0r0lla

I have worked in printing for 15, and this is just not true.
In a toner based system, there is no toner on a drum surface in a
resting state. In all toner based system, the drum(s) are cleaned
after every page. This cleaning not only uses a blade to to physically
remove the image, but most also use an erase lamp to take the charge
from the drum surface.
If you want to save toner, there should be a toner save feature in the
print driver or in the printer settings.

A: The second comment that you quote, from u/m0j0r0lla, is correct.  Laser printers couldn't even work if the drum had a coating of toner before the image was applied to the surface.  It's the charge on the surface of the clean drum that attracts and holds the toner to create the image.  Everywhere on the drum that isn't part of the page content must be spotlessly clean or it will show up on the paper.  The claim about toner accumulating on the drum during start/stop cycles was written by someone who has no clue how laser printers work (despite the fact that it originated as a helpful hint on a cartridge remanufacturer's web site).
Also, spooling happens way faster than printing.  Once you start sending a print job, the printer doesn't finish a page, shut down, and wait for the spooler to catch up with the data for the next page.  Waiting for the last page to be spooled would have no effect on the printer starting and stopping.


text:
Q: Advice on how to implement std::vector using a circular array? I am to write a C++ program that :
"Implements the vector ADT by means of an extendable array used in a circular fashion, so that insertions and deletions at the beginning and end run in constant time. (So not O(n)).  Print the circular array before and after each insertion and deletion, You cannot use the  STL."
This task seems very confusing to me. A std::vector is implemented using a dynamic array that is based off the concept of a stack, correct? Performing a deletion or insertion at the front seems to me that this should be implemented as a Queue or maybe a Dequeue, not a Vector. Also, a circular array would mean that when data is pushed onto an array that is Full, old data becomes overwritten, right? So when should I know to expand the vector's capacity?
If I'm not making sense here, Basically I need help in understanding how I should go about implementing a dynamic circular array..
Yes, this is a homework assignment. No, I do not expect anyone to provide code for me, I only wish for someone to give me a push in the right direction as to how I should think about implementing this. Thank you.

A: I think you are actually being asked to implement deque. The point of the "circularity" is that in normal vector you cannot add an element at the beginning since there is no free space and you would have to move all other elements to the right. So what you can do is you simulate a circle by putting the element to the end the base array and remember that's where the first element is.
Example: 2, 3, -, -, 1 where 1 is first and 3 is last
So, basically you insert elements circullary, and remember where the first and the last elements are so you can add to beginning/end in O(1). Also when the array is full, you have to move all the elements to a larger one. If you double the size, you still get amortized time of O(1)

A: 1) m_nextIn and m_nextOut - data attributes of class queue;
I find it useful to have two integers, with label m_nextIn and m_nextOut ... these identify where in the circular array you 'insert' the next (i.e. youngest) obj instance into the queue, and where you 'delete' the oldest obj instance from the queue.
These two items also provide constant time insert and delete.
Don't get confused as to where the beginning or end of the queue is.  The array starts at index 0, but this is not the beginning of your queue.
The beginning of your queue is at nextIn (which probably is not 0, but may be).  Technique also known as round-robin (a research term).
2) empty and full - method attributes
Determining queue full / empty can be easily computed from m_nextIn and m_nextOut.
3) extendable
Since you are prohibited from using vector (which itself is extendable) you must implement this functionality yourself.
Note about your comment: The "dynamic memory" concept is not related to stack. (another research term)
Extendable issues occur when your user code invokes the 'insert' AND the array is already full.  (capture this test effort)  You will need to detect this issue, then do 4 things:
3.1) allocate a new array (use new, and simply pick an appropriate size.)
Hint - std::vector() doubles it's capacity each time a push_back() would overflow the current capacity
3.2) transfer the entire contents of the array to the new array, fixing all the index's as you go.  Since the new array is bigger, just insert trivially.
3.3) delete the old array - i.e. you copied from the old array to the new array, so do you 'delete' them? or simply delete the array?
3.4) finish the 'insert' - you were in the middle of inserting another instance, right?
Good luck.


text:
Q: Google Recaptcha fails over tethering I've done research for the last couple days concerning tethering Fedora 28 x64 bit over an android tethering.
The android phone is a non-standard AOSP with functional APN settings. I recently switched from OpenXT hypervisor to a standard Fedora build, and began to experience select issues with tethering over the android platform. The issue was reproduced using a Windows 10 KVM guest, though I'm not how the network stack would change, if at all for underlying delivery of the packet.
Wireshark captures (attached, and available as a pcap) show that the client is unable to reach out specifically, and receive an acknowledgment from the server, resulting in "Cannot contact reCAPTCHA. Check your connection and try again".
Similar specific, isolated occurrences were observed elsewhere as well--routing overall through the android phone is successful.
Pardon missteps in structure, or correcct Exchange. Any help is appreciated.
Recaptcha GUI
Packet Capture


text:
Q: Access specific line Datatable I am defining a Datatable this way:
var dat_one = $('#dat_one').DataTable({
  select: {
    style: 'single'
  },
  responsive: true,
});

I would like to access a specific line of my datatable. I want to color a line that contains a specific string. (Example: Line that contains 'Ashton Cox' as column 1 and 'San Francisco' as column 3
I tried to color a selected line with this code :
$(".selected").css('background-color', '#ccffcc');

But doesn't works if my line is not selected.

A: Try using rowCallback. There you can change row attributes with value checking.
$('#example').dataTable( {
  "rowCallback": function( row, data ) {
    if ( data.grade == "A" ) {
      $('td:eq(4)', row).html( '<b>A</b>' );
    }
  }
} );

This is documentation. Note the function has many other parameters you can use.
rowCallback( row, data, displayNum, displayIndex, dataIndex )

A: Following documentation, this is an alternative to Aruna Perera:
// var table = $('#dat_one').DataTable()  ;
dat_one.rows().eq(0).each( function ( index ) {
    var row = table.row( index );

    var data = row.data();

    var column0value = data[0];
    if(column0value == "Airi Satou"){
      $(row.node()).css("background-color", "yellow")
    }
    // ... do something with data(), or row.node(), etc
} );


text:
Q: Access crashes when looping through a table and changing values Access keeps crashing when I'm looping through a table and changing the value of one of the fields using the following code:
Set db = CurrentDb
Set rs = db.OpenRecordset(prProdTblName)
'PrevDept , PrevOpNo, PrevPartNo
rs.MoveFirst
rs.Edit
rs![Op No] = 10
rs.Update
Do Until rs.EOF
    With rs
        PrevOpNo = ![Op No]
        PrevDept = ![Department Code]
        PrevPartNo = ![Part No]
        .MoveNext
        .Edit
        If (![Department Code] = "SMD" And PrevDept <> "SMD") Then
            ![Op No] = 500
        ElseIf (![Department Code] <> "SMD" And PrevDept = "SMD" And ![Part No] = PrevPartNo) Then
            ![Op No] = 1000
        ElseIf (rs![Part No] <> PrevPartNo) Then
            ![Op No] = 10
        Else
            ![Op No] = PrevOpNo + 10
        End If
        .Update
    End With
Loop
rs.Close
Set rs = Nothing

Also, when I'm trying to use an alternative SQL code, it seems to be an endless query:
SQLcommandStr = "SELECT T1.[ID], (Select IIF((T1.[Department Code]='SMD') AND (T2.[Department Code]<>'SMD'),500,IIF((T1.[Department Code]<>'SMD') AND (T2.[Department Code]='SMD') AND (T1.[Part No] = T2.[Part No]),1000,IIF((T1.[Part No] <> T2.[Part No] OR (T1.[ID] = (SELECT MIN(T4.[ID]) FROM " & prProdTblName & " T4))),10,T2.[Op No] + 10))) From " & prProdTblName & " T2 WHERE T2.[ID] = (SELECT MAX(T3.[ID]) FROM " & prProdTblName & " T3 WHERE T1.[ID] > T3.[ID])) INTO TblTemp FROM " & prProdTblName & " T1"

DoCmd.RunSQL SQLcommandStr

A: You probably bounce at EOF:
Set db = CurrentDb
Set rs = db.OpenRecordset(prProdTblName)
rs.MoveFirst
rs.Edit
rs![Op No] = 10
rs.Update
Do Until rs.EOF
    With rs
        PrevOpNo = ![Op No]
        PrevDept = ![Department Code]
        PrevPartNo = ![Part No]
        .MoveNext
        If .EOF = False Then
            .Edit
            If (![Department Code] = "SMD" And PrevDept <> "SMD") Then
                ![Op No] = 500
            ElseIf (![Department Code] <> "SMD" And PrevDept = "SMD" And ![Part No] = PrevPartNo) Then
                ![Op No] = 1000
            ElseIf (rs![Part No] <> PrevPartNo) Then
                ![Op No] = 10
            Else
                ![Op No] = PrevOpNo + 10
            End If
            .Update
        End If
    End With
Loop
rs.Close
Set rs = Nothing


text:
Q: How to grab system audio to python? I want to process audio being played by the OS before it is played by the sound device.
I am trying to detect audio from files like mp3 and wav.
I do not want to read the binary data of the files using methods like fread() directly.
Is it possible in Python to set up a listener that can grab the audio from OS in real-time?

A: *

*See this for a PyAudio example.

*The Open Sound System is also an option. (Might not work on Windows)


text:
Q: Django telling me the template doesn't exist For some reason, Django is telling me the template I'm trying to load doesn't exist.  When I look at the path, it appears that the first template its trying to load actually repeats the path twice one after the other.  My template dirs only lists the following path once:
'/Users/jonathanschen/python/projects/skeleton/yectime/templates'
But the loader tries to load
'/Users/jonathanschen/python/projects/skeleton/yectime/Users/jonathanschen/Python/projects/skeleton/yectime/templates/base.html'
Any ideas what could be causing this? Thanks in advance.
Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/Users/jonathanschen/python/projects/skeleton/yectime/Users/jonathanschen/Python/projects/skeleton/yectime/templates/base.html (File does not exist)

A: It looks like you have:
TEMPLATE_DIRS = ('Users/jonathanschen/Python/projects/skeleton/yectime/templates',)

where you should have:
TEMPLATE_DIRS = ('/Users/jonathanschen/Python/projects/skeleton/yectime/templates',)

(note the leading slash, "/").
A path that doesn't start with a slash is a "relative" path; it's added to the path of the current directory. Given your manage.py is probably in /Users/jonathanschen/Python/projects/skeleton/, the path Django is trying to look in for templates would end up being the long, wrong path you posted above.


text:
Q: How to access the graphic node of a treecell This screenshot

shows a pretty simple implementation of a treeview where I used a custom treecell made up of a flowpane with 5 labels.  The flowpane extends to the edge of the treeview (highlighted unused flow pane space in red).
What I want to be able to do is resize the labels to take up all available flow pane space.  Ideally each treecell(label in the flowpane) would be able to be independently resized.  I haven't been able to do this in the custom tree cell and/or cell factory because the width of the flowpane isn't known at creation time (at least I haven't been able to determine it).
As far as I have been able to determine the tree cells aren't directly available through the treeview.  I have attempted to save the cells in the cell factory at creation for use at a later time but there are 48 cells created just to show the 5 that are shown in the screenshot and I'm not sure which of those 48 represent those on the screen (presumably the last 5).
So I guess the easiest way to ask the question is, how can I access the flowpane of the tree cells (and by extension the labels)  so that I can calculate and set the label widths?


text:
Q: Get a list of validation rules in Rails 3? I need to get a list of validation rules out of a Model in my Rails application. I have searched around and looked through the source of a few client-side validation gems, but am still scratching my head about how to do this. Is there an easy way to just pull a list of validation rules out of a Rails model?
My specific use case is creating an API where the entry form for new items will be auto-generated from the Model definition, and I need to be able to express which fields are required, max length, etc. I already have fields, types, and length from the columns method, but there does not seem to be any type of similar validations method that returns what I need (mainly, required fields as enforced with validates and validates_presence_of, etc.).

A: Check out the #validators and #validators_on methods:
http://api.rubyonrails.org/classes/ActiveModel/Validations/ClassMethods.html
You will have to write some custom code that operates on the returned objects and determines which attributes are required, i.e. which ones have validates_presence_of.


text:
Q: Why do we need Spring framework? Hi I am new to String and is reading the article by Martin Fowler: http://martinfowler.com/articles/injection.html
He gave an example of MovieLister using a MovieFinder for finding movies. In this example, he first provided the code:
class MovieLister...
    private MovieFinder finder;
    public MovieLister() {
        finder = new ColonDelimitedMovieFinder("movies1.txt");
    }
}

He pointed out that you can't give MovieLister to your friend for reuse, unless your friend uses the same MovieFinder implementation and put the movies in the same txt file.
Yes, of course, this is NOT the way you write a component with a hope that someone can reuse it. Instead, as he progressed, you should write:
class MovieLister...
    public MovieLister(MovieFinder finder) {
        this.finder = finder;
    }
}

Yes, that is better. Now your friend can take over your MovieLister and plug in his own code. To me, the story is complete. I miss the point why you need a Spring framework to inject the dependency. The dependency is injected to MovieLister by your friend's code. Full stop. All the Spring setup is equivalent to simply implement the MovieFinder interface and make such a call:
MovieFinder myMovieFinder = new MyMovieFinderImpl();
MovieLister myMovieLister = new MovieLister(myMovieFinder);

Simple, easy. I know you hard code the creation of the MyMovieFinderImpl instance in your code. But what's the point of moving this to XML but bringing so much other stuff? Since when programmers become so scared of compiling code and prefer changing XML without compiling to get everything done? I am sorry but I think I just miss the point. Every program uses dependency inject, decades ago. But in the old days, dependency is injected by programs using a library, or a DOS command line, or a GUI. Why now we need yet another way as to inject dependency?
Thank you.
Updated:
Well, many of you guys brought annotation up. In my sallow understanding of Spring, I may feel more comfortable using XML rather than annotation. At least there is a central place listing how the dependency is, in a way that is easier to understand. With annotation, no such central place. Instead, just magic happening. Wanna know what is passed in as the parameter? Go figure it out yourself and good luck. Yes, I know there are smart IDE plugins help  navigate the code. But why we make one thing complicated in the first place and celebrate another thing that helps make our life easier? The truth that annotation makes code harder to browse and understand so people create IDE plugins for this is obvious enough that we may create unnecessary things in the first place, isn't it?

A: In the "old days" code was written as in the first example.
Spring is a library, which you say is one of the ways it was done in the "old days".
Implementations were rarely specified on the command line or via a GUI. Multiple implementations of the same functionality weren't needed as often because (a) systems were rarely as complex as they are today, (b) they didn't need to interoperate with other systems the way they do today, and (c) deep testing was implemented far less often.
What's "so much other stuff"? Spring is segregated; you can bring in only what you need.
Why did you ignore configuration via annotations?
The purpose is to use a generic, localized, known, standard mechanism. It is ludicrous to say that "every program used dependency injection, decades ago." I programmed decades ago, across a pretty wide swath of languages, and while we did similar things, we all had our own implementations, with varying levels of sophistication, and wildly varying levels of success.
Is Spring necessary for DI/IoC? No, and a host of other DI frameworks attest to this. Is it a well-known, essentially-standard way of doing it? Yep.

A: Do not confuse the principle (DI) with one implementation (Spring).
If you like DI but prefer doing the wiring in your code: Use Google Guice.
If you like DI but prefer doing the wiring in your code and optionally XML then use CDI (from the Java EE track of things).
If you like DI and love XML (or must change the behaviour of your application by reconfiguring things) then just use Spring.
If you do not like DI then ... ask another question.
It's good to have several implementations of the same principle.

A: Yes, if you have only two classes, it is simpler and easier to do the "dependency injection" manually. But if you have lots of classes, it is easier and more flexible if a framework (such as Spring) finds out for you the correct initialization and injection order.
BTW, in recent Spring versions you don't need to mess (much) with XML, you can declare the dependencies with annotations.


text:
Q: class in Zend Framework isn't findable as soon as i add an Namespace to it im trying to build an little webpage with Zendframework using the "SqlQueue" class. The Files im using are working fine as long as im having them outside ZendFramework. As soon as i get them into zend, replace the Include with an namespace, it won't find an class.
//not working:
namespace Test\Model;
class api{
    public function __construct(){
      $this->shortLimitQueue = new SplQueue();
      $this->longLimitQueue = new SplQueue();
    }
}

//working:
class api{
   public function __construct(){
      $this->shortLimitQueue = new SplQueue();
      $this->longLimitQueue = new SplQueue();
   }
}

if i do it without the namespace the class SqlQueue is findable... i also tried including the "api" file  externally but that won't work (same problem: he can't find the class SqlQueue as soon as i add an namespace to it. If i let the namespace out, i can't call the api class, but the SqlQueue works fine...
Edit: Using Zend Framework 2.6 with PHP 5.6.21 on CentOS 6.3

A: When your namespace is set (i.e. namespace Test\Model), ZendFramework search the class in this namespace.
In your case, you may write :
$this->shortLimitQueue = new \SplQueue();

to force to search the class in Php core.


text:
Q: Using MoveRotation in Unity 3D to turn player towards a certain angle I've been told that Rigidbody.MoveRotation is the best way in Unity 3D to rotate the player between fixed positions while still detecting hits. However, while I can move smoothly from fixed position to position with:
if (Vector3.Distance(player.position, targetPos) > 0.0455f) //FIXES JITTER
            {
                var direction = targetPos - rb.transform.position;
                rb.MovePosition(transform.position + direction.normalized * playerSpeed * Time.fixedDeltaTime);
            }

I can't find out how to rotate smoothly between fixed positions. I can rotate to the angle I want instantly using Rigidbody.MoveRotation(Vector3 target);, but I can't seem to find a way to do the above as a rotation.
Note: Vector3.Distance is the only thing stopping jitter. Has anyone got any ideas?

A: You can go one step further and use a tweeting library to tween between rotations.
DOTween
With that you can call it like this:
rigidbody.DoRotate(target, 1f) to rotate to target in 1 second.
Or even add callbacks.
rigidbody.DoRotate(target, 1f).OnComplete(//any method or lambda you want)
If at some point you want to cancel the tween yuou can save it on a variable and then call tween.Kill();

A: First of all MoveRotation doesn't take a Vector3 but rather a Quaternion.
Then in general your jitter might come from overshooting - you might be moving further than the distance between your player and target actually is.
You can avoid that bit by using Vector3.MoveTowards which prevents any overshooting of the target position like e.g.
Rigidbody rb;
float playerSpeed;
Vector3 targetPos;

// in general ONLY g through the Rigidbody as soon as dealing wit Physics
// do NOT go through transform at all
var currentPosition = rb.position;
// This moves with linear speed towards the target WITHOUT overshooting
// Note: It is recommended to always use "Time.deltaTime". It is correct also during "FixedUpdate"
var newPosition = Vector3.MoveTowards(currentPosition, targetPos, playerSpeed * Time.deltaTime);
rb.MovePosition(newPosition);

// [optionally]
// Note: Vector3 == Vector3 uses approximation with a precision of 1e-5
if(rb.position == targetPos)
{
    Debug.Log("Arrived at target!");
}

Then you can simply apply this same concept also to rotation by going through the equivalent Quaternion.RotateTowards basically just the same approach
Rigidbody rb;
float anglePerSecond;
Quaternion targetRotation;

var currentRotation = rb.rotation;
var newRotation = Quaternion.RotateTowards(currentRotation, targetRotation, anglePerSecond * Time.deltaTime);
rb.MoveRotation(newRotation);

// [optionally]
// tests whether dot product is close to 1
if(rb.rotation == targetRotation)
{
    Debug.Log("Arrived at rotation!");
}

A: So, you want to animate the rotation value over time until it reaches a certain value.
Inside the Update method, you can use the Lerp method to keep rotating the object to a point, but you will never really reach this point if you use Lerp. It will keep rotating forever (always closer to the point).
You can use the following:
private bool rotating = true;
public void Update()
{
    if (rotating)
    {
        Vector3 to = new Vector3(20, 20, 20);
        if (Vector3.Distance(transform.eulerAngles, to) > 0.01f)
        {
            transform.eulerAngles = Vector3.Lerp(transform.rotation.eulerAngles, to, Time.deltaTime);
        }
        else
        {
            transform.eulerAngles = to;
            rotating = false;
        }
    }

}

So, if the distance between the current object angle and the desired angle is greater than 0.01f, it jumps right to the desired position and stop executing the Lerp method.


text:
Q: Device manager does not work (open) after updating Android Studio to 2021.1.1 Android studio's device manager AVD manager works fine in old versions, but in 2021.1.1 version does not open!
Windows 10 and 11 tested
last version flutter
Intel
Sdk manager everything updated
could anyone help?

A: I still have the same problem with the Bumblebee version, but for now you can use the Search Everywhere feature (you can access "Search Everywhere" by pressing double shift) and type in
"Virtual Device Manager"
then it will works.
This is a temporary solution for now.

A: I had the same problem, found the solution to return the icon to the toolbar, where it's easy to use it.
I guess it happans to anyone who upgrades from prvious version.
The idea is just to replace the "old" device manager with the new device manager created in 2021.1.1.

*

*Right click the right side of the top toolbar and click the "Customize Menues and toolbars.

*In the "Menus and Toolbar" window expand "Main Toolbar"

*Expand "Android.MainToolBarActionGroup"

*Press the "+" button in the top and select "Add Action..."

*In the "Choose Action To Add" windows , search for "Virtual Device manager", select it and press OK.

*You will see the the new icon is added.

To make sure it's working you can press OK to close this window and return to Android Studio main screen.
Now, you should have 2 similar icons in the toolbar, only the bubbles will be different.

*

*The old is called "Device manager"

*The new one is called "Virtual Device Manager"

Make sure it really works and opens the new Device Manager.
Once it is working , you can go back to the toolbar manger and delete the old icon.
Folow setps 1-3 above

*Locate the "Android.RunAndroidAvdManager" item, select it and delete it by pressing the "-" button in the top of the screen.

*Close this window and return to main screen.

A: Step 1: Select FILE (on the top left)
Step 2: Select PROJECT STRUCTURE (<Ctrl + Alt + Shift + S> on Windows/Linux).
Step 3: Select MODULES on the left under Project Settings.
Step 4: Hit the plus (+) button.
Step 5: Add ANDROID and hit OK Button.
Now you can open Device Manager

A: I too met this problem temp solution this that which wrote Zaid Salam
My version Android Studio -> Bumblebee 2021.1.1 Patch 1
My OS -> macOS Monterey

A: If you cannot seem to be able to right-click the toolbar as Yahalom mentioned, go to View > Appearance and select Toolbar.
The toolbar will move and a big space will be available on the right to right-click.

A: As pointed out by the answer above, the update from an older version does not replace the button action correctly.
But to fix it for me (Android Studio on Linux), I had to edit the Navigation Bar Toolbar rather than the Main Toolbar. As the IntelliJ docs mention, the main toolbar is hidden by default.
(Could not comment on the original answer yet, so I had to create a separate response)


text:
Q: PDF Unknown signing icon I am signing PDF programmatically. Every new signature is added in an incremental way where I add the signature dictionnary after the %EOF and I update the AcroForm like this (sorry, I'm at work so I can't upload the PDF) :
... // ORIGINAL FILE

trailer
<<
/Size 11
/Root 1 0 R
/Info 10 0 R
>>

startxref
2714
%%EOF
1 0 obj
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [11 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

...

11 0 obj
<</Type /Annot /SubType /Widget /Rect [0 0 0 0 ] /P 4 0 R /F 4 /FT /Sig /T (Signature) /Ff 0 /V <</Type /Sig /Filter /Adobe.PPKLite /SubFilter /adbe.pkcs7.detached /ByteRange [0 3729 15473 422                   ] /Contents <308209...>
/M (D:20170801165520+02'00') >> >>
endobj

...

trailer
<</Size 15 /Root 1 0 R /Info 10 0 R /Prev 2714 >>
startxref
15609
%%EOF
1 0 obj
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [15 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

...

15 0 obj
<</Type /Annot /SubType /Widget /Rect [0 0 0 0 ] /P 4 0 R /F 4 /FT /Sig /T (Signature) /Ff 0 /V <</Type /Sig /Filter /Adobe.PPKLite /SubFilter /adbe.pkcs7.detached /ByteRange [0 16632 28376 387                  ] /Contents <3082062...>
/M (D:20170802094848+02'00') >> >>
endobj
16 0 obj

...

<</Size 18 /Root 1 0 R /Info 10 0 R /Prev 15609 >>
startxref
28476
%%EOF

Maybe the problem is that I have multiple objects having the same ID and that my last AcroForm only refers to the last signature ? I want to be able to sign one file multiple times but I have an issue. The first signing is okay and displays this banner :

And then I try to sign the same file another time with another certificate and this give me this trash can icon next to the signature and says it was removed as you can see here :

I am using Zend_PDF to parse the file and add the signature.
EDIT : Thanks to @mkl the 2 signatures are now recognized by Adobe Reader. My AcroForms now look like this :
2714
%%EOF
1 0 obj
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [11 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

...

15610
%%EOF
1 0 obj
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [11 0 R 15 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

...

And  I have this surprising errors since I didn't modify anything about the ByteRange and I verified by hand that they are correct. Is is about my new modifications ?

A: While adding the first signature you set the AcroForm dictionary to
/AcroForm <</Fields [11 0 R ] /SigFlags 3 >>

For the second one, you set it to
/AcroForm <</Fields [15 0 R ] /SigFlags 3 >>

I.e. you removed 11 0 R from it and added 15 0 R to it. Thus, you indeed deleted the first signature field from the form structure.
You should instead only have added the new signature field:
/AcroForm <</Fields [11 0 R 15 0 R ] /SigFlags 3 >>

Furthermore, both your signature fields have the same name
11 0 obj
<<
    ...
    /T (Signature)
    ...
>>
endobj
...
15 0 obj
<<
    ...
    /T (Signature)
    ...
>>
endobj

Obviously, different form fields must have different names.


text:
Q: IE is telling me I have mixed SSL content when I don't In IE it is giving me the "some items on the page are not secure" message. I have tracked it down to this line:
<script type="text/javascript" src="lightbox/js/prototype.js"></script>

which is a lightbox script I downloaded. I tried making the src relative or absolute with https it happens either way. And only in IE.
Heres the page if you need to see it: Clicky
Thanks!

A: Looking at your page in Fiddler, I see a request to https://www.kranichs.com/images/bottombax_02.jpg, which is a 404.
IE considers the 404 error message as unsafe content, so if you are including that (in an IFRAME or something) then you will see the mixed content error.  Fix that and see what happens.
If nothing changes when that file exists, and you don't see any HTTP requests in Fiddler, it's possibly the removeChild problem - if you remove a DIV with a background image (as a lightbox might) then you will see the mixed content error.