How can one register a Direct2D custom effect that has variable numbers of inputs? - directx

I am making custom effects with Direct2D, based on Microsoft Learn page. The problem is that, I wanted to make a Direct2D effect which support a variable input count, like Direct2D Composite Effect, while the XML registration string used for ID2D1Factory1::RegisterEffectFromString seemed to take fixed <Input> properties. What should be done in XML registration string?
My XML is almost the same as one from Microsoft Learn page. Still I will provide mine.
auto xml_AxisRotation = XML(
<?xml version='1.0'?>
<Effect>
<!--System Properties-->
<Property name='DisplayName' type='string' value='MultiInput Effect'/>
<Property name='Author' type='string' value='Nan_ok'/>
<Property name='Category' type='string' value='None'/>
<Property name='Description' type='string' value='asdfasdfasdf'/>
<Inputs>
<Input name='Source1'/>
<Input name='Source2'/>
//...?
</Inputs>
<!--Custom Properties go here-->
<Property name='Mode' type='int32'>
<Property name='DisplayName' type='string' value='Mode'/>
<Property name='Default' type='int32' value='1'/>
</Property>
</Effect>
);
I once deliberately omitted the whole <Input> part, but it failed to perform; E_INVALIDARG has been returned.

The XML registration and actual Direct2D effect's input taking worked differently. By proper implementing ID2D1EffectImpl::SetGraph and calling ID2D1Effect::SetInputCount, I was able to set variable numbers of target.
It seemed ok to leave <Inputs> with no <Input> property. here is my XML example.
auto xml_AxisRotation = XML(
<?xml version='1.0'?>
<Effect>
<!--System Properties-->
<Property name='DisplayName' type='string' value='MultiInput Effect'/>
<Property name='Author' type='string' value='Nan_o'/>
<Property name='Category' type='string' value='None'/>
<Property name='Description' type='string' value='asdfasdfasdf'/>
<Inputs> </Inputs> <!--Leaving like this is ok-->
<!--Custom Properties go here-->
<Property name='Mode' type='int32'>
<Property name='DisplayName' type='string' value='Mode'/>
<Property name='Default' type='int32' value='1'/>
</Property>
</Effect>
);

Related

how to get attribute xml bean in spring context

<bean id="ABC" someAttribute="DEF">
<property name="A" value="A"/>
<property name="B" ref="a"/>
</bean>
in this xml bean file,
How do I get someAttribute?
plz
I searched things about that on the internet, But I couldn't find answer

How to configure Spring-sesssion Custom Cookie by xml

sorry for my poor english, my current config like this:
<bean class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="test_sessionid"></property>
<property name="cookiePath" value="/"></property>
<!-- <property name="domainName" value="example.com"></property> -->
<property name="domainNamePattern" value="^.+?\\.(\\w+\\.[a-z]+)$"></property>
</bean>
i want to custom a domain,it is working well while i configured the domainName property.but when i configure the domainNamePattern as above,it just working on localhost and ip address,but no
www.example.com
test.example.com
tks.
It looks like you are not using a valid Regular Expression (the expression is escaped for Java String but you are using XML). The expression will not match any of the domains so it will always use the current domain. Try the following instead:
<bean class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="test_sessionid"></property>
<property name="cookiePath" value="/"></property>
<!-- <property name="domainName" value="example.com"></property> -->
<property name="domainNamePattern" value="^.+?\.(\w+\.[a-z]+)$"></property>
</bean>

Spring webflow using a lot of memory

Our Webflow (2.3.1) application is claiming a lot of memory for each new flow that we open through the browser.
The screenshot below shows our application's memory use. When the application starts it takes an initial 400 Mb. After that we open 4 individual, identical Webflow TEST pages in the browser which each claim about 90Mb of extra memory..
Each test page is started from its own simple flow definition:
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/webflow"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd" start-state="start">
<view-state id="start" view="test/test1">
</view-state>
<end-state id="end"/>
<bean-import resource="../flow-beans.xml"/>
</flow>
The JSP test pages are also very simple, just empty with one line of text.
When we currently set the JVM memory to 1.5Gb the application eventually crashes on the server with OutOfMemoryExceptions after opening about 15 different flows. 1.5 Gb seems a bit much, regarding the low complexity of our screens..
We are wondering if the amount of memory Webflow seems to claim for these simple flows/pages is expected and if we should therefore just assign more memory to the server JVM. If not, we would like to know how we can decrease this memory usage.
Below is our entire webflow configuration.
We have tried adding a flow-execution-repository tag and played around with the max-executions-snapshots and max-executions values, but even the most conservative settings don't change the memory usage we are seeing.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- Launches new flow executions and resumes existing executions. -->
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
</webflow:flow-executor>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:our.properties" />
<property name="placeholderPrefix" value="$xxxx"></property>
</bean>
<tx:annotation-driven transaction-manager="$xxxx{txManager}" />
<!-- Creates the registry of flow definitions for this application -->
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
<webflow:flow-location-pattern value="classpath:flows/**/*-flow.xml" />
</webflow:flow-registry>
<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers" ref="viewResolver" />
</bean>
<bean id="expressionParser" class="org.springframework.expression.spel.standard.SpelExpressionParser">
<constructor-arg name="configuration">
<bean class="org.springframework.expression.spel.SpelParserConfiguration">
<constructor-arg name="autoGrowCollections" value="true" />
<constructor-arg name="autoGrowNullReferences" value="false" />
</bean>
</constructor-arg>
</bean>
<bean id="webflowExpressionParser" class="org.springframework.webflow.expression.spel.WebFlowSpringELExpressionParser">
<constructor-arg name="expressionParser" ref="expressionParser" />
</bean>
<webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" validator="validator" expression-parser="webflowExpressionParser"/>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
<bean id="projectVersion" class="our.company.versions.ProjectVersionUtil">
<property name="xxxxVersion" value="$xxxx{xxxx.version}" />
<property name="systemConfigurationDao">
<ref bean="SystemConfigurationDao"/>
</property>
</bean>
</beans>
When Spring Web Flow starts a new flow it basically constructs a new BeanFactory which loads the xml file and imports any additional xml files. The newly constructed BeanFactory has the context of the DispatcherServlet as its parent.
Now the problem with this is that a the bean factory constructs instances of all the beans even those defined in imported XML files.
<bean-import resource="../flow-beans.xml"/>
If there are a lot of beans in there those will be duplicated for each flow instance. In general you don't want your all of your beans duplicated and stored in the users sessions.
Remove the singleton beans from the flow-beans.xml and put them in the normal application context, they are still referable from within the flow definition. Or you could simply add the flow-beans.xml to the list of files loaded at startup of your application.

Orbeon 4.5 - How to pass request parameters?

We are upgrading from Orbeon 3.9 to 4.5.
In Orbeon 3.9, we were passing request parameters to the send success URI (oxf.fr.detail.send.success.uri) when the user clicks on a custom submit button. We have done this by modifying persistence-model.xml.
Following is the code part which we used in 3.9:
<xforms:model id="fr-persistence-model"
<xforms:instance id="x3params">
<data xmlns="">
<customerid/>
</data>
</xforms:instance>
<xforms:action ev:event="xforms-model-construct-done" if="$app != '*' and $form != '*'">
<xforms:setvalue ref="instance('g3params')/customerid" value="xxforms:get-request-parameter('customerid')" />
<xxforms:variable name="g3customerId" as="xs:string" select="instance('g3params')/customerid"/>
<xforms:submission id="fr-workflow-send-submission"
resource="{$workflow-success-uri}?fr-app={$app}&form={$form}&docid={$document}&customerid={$g3customerId}"
relevant="{xxforms:property(string-join(('oxf.fr.detail.send.success.prune', $app, $form), '.'))}"
validate="false" method="{$workflow-success-method}"
serialization="{if ($workflow-success-method = 'get') then 'none' else 'application/xml'}"
ref="if (instance('fr-workflow-send-instance') != '') then instance('fr-workflow-send-instance') else xxforms:instance('fr-form-instance')"
replace="all"/>
In Orbeon 4.5, I used the save-final process for a custom submit.
Since fr-workflow-send-submission is removed in 4.5, how can I pass the request parameters to the send success URI?
Following is my properties-local.xml:
<property as="xs:boolean" name="oxf.fr.detail.send.pdf" value="false"/>
<property as="xs:boolean" name="oxf.fr.email.attach-pdf" value="false"/>
<property as="xs:anyURI" name="oxf.fr.detail.send.success.uri.Preconstruction.*" value="http://localhost:8080/webapp/new"/>
<property as="xs:string" name="oxf.fr.detail.send.success.method.*.*" value="post"/>
<property as="xs:boolean" name="oxf.fr.detail.send.success.prune.*.*" value="false"/>
You can use XPath value templates in the service URL:
<property
as="xs:string"
name="oxf.fr.detail.send.success.uri.Preconstruction.*"
value="http://localhost:8080/webapp/new?customerid={xxf:get-request-parameter('customerid')}"/>
Orbeon Forms passes app, form and document by default now. The only thing is that I notice that in your code you use fr-app, form, and docid. It is probably better to switch to using the standard names used by Orbeon Forms now (so app, form and document).

Spring ws XSD validation

Currently i am implementing web services using Spring-ws . Here i am struck with xsd validation . For xsd validation i am using the following configruation
<bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="xsdSchema" ref="schema" />
<property name="validateRequest" value="true" />
<property name="validateResponse" value="true" />
</bean>
<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
<property name="xsd" value="/WEB-INF/ProductSchema.xsd" />
</bean>
Here i am passing the xsd file during bean initialization . Is there any way for me to send this(ProductSchema.xsd) xsd file dynamically. Because I will comes to know which xsd file needs to send based on the input payload.
Please help me. Thanks in advance
I don't know how many XSD's you have, but perhaps you can define imports in ProductSchema.xsd to include the others. That's at least how I've got it set up.
For example:
<import namespace="http://namespace" schemaLocation="data.xsd" />
I'm not quite sure of what you are trying to do.
But you can make different endpoints/methods that matches different payloads by annotating the handler method with a localPart that matches the name of an element i the payload:
#Endpoint
public class MyEndpoint {
#PayloadRoot(namespace = NAMESPACE_URI, localPart = "NameOfMyXmlRequestElement")
#ResponsePayload
public MyResponse handleMyRequest(#RequestPayload MyRequest MyRequest) throws Exception {
...
A recived request can then be unmarshalled/validated using a specific schema:
<bean id="myJaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>mydomain.model.oxm.MyRequest</value>
<value>mydomain.model.oxm.MyResponse</value>
</list>
</property>
<property name="schema" ref="MyServiceSchema" />
</bean>
<bean id="MyServiceSchema" class="org.springframework.core.io.ClassPathResource">
<constructor-arg value="WEB-INF/schemas/MyService.xsd" />
</bean>
The MyRequest class must be annotated to work with the Jaxb2marshaller, #XmlRootElement(name="MyRequest") etc...

Resources