Is there a way to make fusion chart's funnel display zero values? - fusioncharts

I'm using fusion charts' funnel mode to display some sums which may or may not be 0, grouped into different cathegories. I'm also displaying the number of terms that goes into each sum (for example: $1000, 3 accounts). I want the funnel to display a slice even if its value is 0 and have it displayed like $0, x accounts to give the user information on how many accounts there are in every cathegory even if the final sum is 0.
Xml for the fusioncharts object:
$strXML = "
<chart showhovercap='1' showNames='1' showValues='1' numberSuffix=' lei' decimalPrecision='0' decimalSeparator=',' thousandSeparator='.' formatNumber='1' isSliced='1' slicingDistance='5' bgColor='f5f5f5'>
<set link='".$url1."' name='Negociere' value='".$negociere."' color='FD0006' hoverText='".$nr_negociere.$text_negociere."' />
<set link='".$url2."' name='Ofertare' value='".$oferta."' color='FF4100' hoverText='".$nr_oferta.$text_oferta."' />
<set link='".$url3."' name='Analiza' value='".$analiza."' color='FF8900' hoverText='".$nr_analiza.$text_analiza."' />
<set link='".$url4."' name='Abordare' value='".$abordare."' color='086FA1' hoverText='".$nr_abordare.$text_abordare."' />
<set link='".$url5."' name='Prospectare' value='".$prospectare."' color='00B25C' hoverText='".$nr_prospectare.$text_prospectare."' />
</chart>
";

Could you please try by setting "streamlinedData" attribute to "0" in the element of your XML data?
Ref. Code:
<chart showhovercap='1' showNames='1' showValues='1' numberSuffix='$' decimalPrecision='0' decimalSeparator=',' thousandSeparator='.' formatNumber='1' isSliced='1' slicingDistance='5' bgColor='f5f5f5' streamlinedData='0'>
<set label="Negociere,3 accounts" value="0"/>
<set label="Ofertare, 5 accounts" value="0"/>
<set label="Analiza, 2 accounts" value="1"/>
<set label="Abordare, 1 accounts" value="0"/>
<set label="Prospectare, 2 accounts" value="0"/>
</chart>

Related

BIML Nested For loop Container

I'm trying to nest a forloop container within another. I keep getting error that child element is not allowed.
How do I nest for loop?
<ForLoop Name="For loop for Year">
<PrecedenceConstraints>
<Inputs>
<Input OutputPathName="Find count of rows.Output" SsisName="No data exist" PathAnnotation="ConstraintName" EvaluationOperation="Expression" EvaluationValue="Success" Expression="#[User::CountRows]==0" />
</Inputs>
</PrecedenceConstraints>
<InitializerExpression>#StartYear</InitializerExpression>
<LoopTestExpression><![CDATA[#StartYear <= #EndYear]]></LoopTestExpression>
<CountingExpression><![CDATA[#StartYear = #StartYear + 1]]></CountingExpression>
<ForLoop Name="For loop for Month">
<InitializerExpression>#StartMonth</InitializerExpression>
<LoopTestExpression><![CDATA[#StartMonth <= #EndMonth]]></LoopTestExpression>
<CountingExpression>#StartMonth = #StartMonth + 1</CountingExpression>
</ForLoop>
</ForLoop>
A ForLoop is a member of the Tasks collection. You have specified that your inner ForLoop is a member of the outer ForLoop. Instead, it should be a member of the outer ForLoop's Task collection.
Thus
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="so_46415142">
<Variables>
<Variable Name="StartYear" DataType="Int32">2014</Variable>
<Variable Name="EndYear" DataType="Int32">2014</Variable>
<Variable Name="StartMonth" DataType="Int32">1</Variable>
<Variable Name="EndMonth" DataType="Int32">6</Variable>
</Variables>
<Tasks>
<ForLoop Name="For loop for Year">
<!--
<PrecedenceConstraints>
<Inputs>
<Input OutputPathName="Find count of rows.Output" SsisName="No data exist" PathAnnotation="ConstraintName" EvaluationOperation="Expression" EvaluationValue="Success" Expression="#[User::CountRows]==0" />
</Inputs>
</PrecedenceConstraints>
-->
<InitializerExpression>#StartYear</InitializerExpression>
<LoopTestExpression><![CDATA[#StartYear <= #EndYear]]></LoopTestExpression>
<CountingExpression><![CDATA[#StartYear = #StartYear + 1]]></CountingExpression>
<Tasks>
<ForLoop Name="For loop for Month">
<InitializerExpression>#StartMonth</InitializerExpression>
<LoopTestExpression><![CDATA[#StartMonth <= #EndMonth]]></LoopTestExpression>
<CountingExpression>#StartMonth = #StartMonth + 1</CountingExpression>
</ForLoop>
</Tasks>
</ForLoop>
</Tasks>
</Package>
</Packages>
</Biml>

Extending Modx modResource schema errors

I'm trying to extend the modx modresource object, but keep getting errors & I can't seem to figure out why. It is related to the schema (I think) but everything looks correct.
Schema:
<?xml version="1.0" encoding="UTF-8"?>
<model package="extresource" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" tablePrefix="modx_" version="1.0.0">
<object class="extResource" extends="modResource">
<composite alias="ResourceData" class="ResourceData" local="id" foreign="internalKey" cardinality="one" owner="local"/>
</object>
<object class="ResourceData" table="resource_data" extends="xPDOSimpleObject">
<field key="internalKey" dbtype="int" precision="11" phptype="integer" null="false" attributes="unsigned"/>
<field key="views" dbtype="int" precision="11" phptype="integer" null="true" />
<field key="starred" dbtype="int" precision="10" phptype="integer" null="false" />
<index alias="internalKey" name="internalKey" primary="false" unique="true" type="BTREE" >
<column key="internalKey" length="" collation="A" null="false" />
</index>
<aggregate alias="Resource" class="modResource" local="internalKey" foreign="id" cardinality="one" owner="foreign"/>
</object>
</model>
I'm testing it using:
$resource = $modx->getObject('modResource', 11112);
echo $resource->get('pagetitle'); //test I have the resource
$data = $resource->getOne('ResourceData');
The errors I get are:
Could not getOne: foreign key definition for alias ResourceData not
found. No foreign key definition for parentClass: modDocument using
relation alias: ResourceData
The table exists & has data, the package is registered in the modx extension packages. I've been over the schema many times & it looks right.
What is causing these errors?
You have to use the right object class in $modx->getObject. Otherwise you will get a modResource object, that does not know the extended object data and relationship.
$resource = $modx->getObject('extResource', 11112);
Does the resource you are loading have its class_key field set to extResource? That's needed for it to load the right resource object class.

Alfresco API to run faceted search

I'm using Alfresco community 5.x version and I'm wondering if There are REST or any other remote alfresco apis to be able to run Faceted search.
I've seen some Restful apis to administer/manage some aspects of Faceted search viz : http://docs.alfresco.com/community5.0/references/RESTful-Facet.html
However no public APIs to run a faceted search.
I did notice that alfresco share fires the following against the core alfresco service to run its faceted search; but could not find any notes/docs related to that -
http://alfresco.mycompany.com/alfresco/s/slingshot/search
?facetFields={http://www.alfresco.org/model/content/1.0}creator,
{http://www.alfresco.org/model/content/1.0}content.mimetype,
{http://www.alfresco.org/model/content/1.0}created,
{http://www.alfresco.org/model/content/1.0}content.size,
{http://www.alfresco.org/model/content/1.0}modifier,
{http://www.alfresco.org/model/content/1.0}modified
&filters=
&term=wal
&tag=
&startIndex=0
&sort=
&site=
&rootNode=alfresco://company/home
&repo=false
&query=
&pageSize=25
&maxResults=0
&noCache=1455504682131
&spellcheck=true&
We have API based integration with Alfresco in our custom internal applications and don't use Alfresco Share.
I'm not sure if I should be using the above url or not.
Any suggestions on this?
Thanks!
Alfresco Version: 5.0.d
You can use the default search webscript:
webscripts\org\alfresco\slingshot\search\search.get.js
If you look at the code:
var params =
{
siteId: args.site,
containerId: args.container,
repo: (args.repo !== null) ? (args.repo == "true") : false,
term: args.term,
tag: args.tag,
query: args.query,
rootNode: args.rootNode,
sort: args.sort,
maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS,
pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE,
startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0,
facetFields: args.facetFields,
filters: args.filters,
spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false
};
So if you present the right arguments with the facets to look for, then Alfresco will return the right faceted results.
I finally figured out how to implement and integrate the faceted search into a custom UI. the same also works with share.
create model in model manager (no hyphens)
Indexing attribute:
String: list of values whole match
Date, Number: enhanced search
For each type define the layout design - w/o this you wont be able to change type in share at least.
In share/search manager create filters/facets for fields you're interested in
Add a custom *context.xml to define a bean with your custom FacetQueryProvider implementation. inject that into the facet.solrFacetHelper bean
The custom FacetQueryProvider e.g. DollarAmountDisplayHandler basically provides facet queries based on the dollar amount buckets bean in the *context.xml, those will then be passed to solr.
Jar up the FacetQueryProvider implementation and copy to tomcat/lib directory.
Custom-solr-facets-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="facet.dateFacetFields" class="org.springframework.beans.factory.config.SetFactoryBean">
<property name="sourceSet">
<set>
<value>#{http://www.alfresco.org/model/content/1.0}created</value>
<value>#{http://www.alfresco.org/model/content/1.0}modified</value>
<value>#{http://www.mycomp.com/model/hono/1.0}invoiceDate</value>
</set>
</property>
</bean>
<bean id="facet.dollarAmountBuckets" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="[0 TO 1000]" value="$0-$1K" />
<entry key="[1000 TO 10000]" value="$1K-$10K" />
<entry key="[10000 TO 100000]" value="$10K-$100K" />
<entry key="[100000 TO MAX]" value="Above.$100K" />
</map>
</property>
</bean>
<bean id="facet.dollarAmountDisplayHandler" class="com.mycomp.edm.alfresco.extensions.search.solr.facets.handlers.DollarAmountDisplayHandler" parent="baseFacetLabelDisplayHandler" >
<constructor-arg index="0">
<set>
<value>#{http://www.mycomp.com/model/hono/1.0}invoiceAmount</value>
</set>
</constructor-arg>
<constructor-arg index="1">
<ref bean="facet.dollarAmountBuckets" />
</constructor-arg>
</bean>
<bean id="facet.solrFacetHelper" class="org.alfresco.repo.search.impl.solr.facet.SolrFacetHelper" >
<constructor-arg>
<list>
<ref bean="facet.contentSizeBucketsDisplayHandler" />
<ref bean="facet.dateBucketsDisplayHandler" />
<ref bean="facet.dollarAmountDisplayHandler" />
</list>
</constructor-arg>
<property name="specialFacetIds">
<set>
<value>SITE</value>
<value>TAG</value>
<value>ANCESTOR</value>
<value>PARENT</value>
<value>ASPECT</value>
<value>TYPE</value>
<value>OWNER</value>
</set>
</property>
</bean>
</beans>
The model:
<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.alfresco.org/model/dictionary/1.0" name="hon:hono">
<description>hono model</description>
<author>amit</author>
<imports>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
</imports>
<namespaces>
<namespace uri="http://www.mycomp.com/model/hono/1.0" prefix="hon"/>
</namespaces>
<data-types/>
<constraints/>
<types>
<type name="hon:invoice">
<title>Invoice</title>
<description>invoice model</description>
<parent>cm:content</parent>
<properties>
<property name="hon:invoiceNumber">
<title>Invoice Number</title>
<type>d:int</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>TRUE</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="hon:invoiceAmount">
<title>Invoice Amount</title>
<type>d:int</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>TRUE</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="hon:invoiceDate">
<title>Invoice Date</title>
<type>d:date</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>TRUE</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="hon:organizationName">
<title>Organization Name</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>FALSE</tokenised>
<facetable>true</facetable>
</index>
</property>
<property name="hon:customerName">
<title>Customer Name</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<tokenised>FALSE</tokenised>
<facetable>true</facetable>
</index>
</property>
</properties>
<associations/>
<overrides/>
<mandatory-aspects/>
</type>
</types>
<aspects/>
</model>
Facet Query Provider
package com.mycomp.edm.alfresco.extensions.search.solr.facets.handlers;
import org.alfresco.repo.search.impl.solr.facet.FacetQueryProvider;
import org.alfresco.repo.search.impl.solr.facet.SolrFacetConfigException;
import org.alfresco.repo.search.impl.solr.facet.handler.AbstractFacetLabelDisplayHandler;
import org.alfresco.repo.search.impl.solr.facet.handler.FacetLabel;
import org.springframework.extensions.surf.util.ParameterCheck;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Amit on 2/24/16.
*/
public class DollarAmountDisplayHandler extends AbstractFacetLabelDisplayHandler implements FacetQueryProvider {
private static final Pattern SIZE_RANGE_PATTERN = Pattern.compile("(\\[\\d+\\sTO\\s(\\d+|MAX)\\])");
private final Map<String, FacetLabel> facetLabelMap;
private final Map<String, List<String>> facetQueriesMap;
public DollarAmountDisplayHandler(Set<String> facetQueryFields, LinkedHashMap<String, String> dollarValueBucketMap)
{
System.out.println("instantiating bean DollarAmountDisplayHandler");
ParameterCheck.mandatory("facetQueryFields", facetQueryFields);
ParameterCheck.mandatory("dollarValueBucketMap", dollarValueBucketMap);
this.supportedFieldFacets = Collections.unmodifiableSet(facetQueryFields);
facetLabelMap = new HashMap<>(dollarValueBucketMap.size());
Map<String, List<String>> facetQueries = new LinkedHashMap<>(facetQueryFields.size());
for (String facetQueryField : facetQueryFields)
{
List<String> queries = new ArrayList<>();
int index = 0;
for (Map.Entry<String, String> bucket : dollarValueBucketMap.entrySet())
{
String sizeRange = bucket.getKey().trim();
Matcher matcher = SIZE_RANGE_PATTERN.matcher(sizeRange);
if (!matcher.find())
{
throw new SolrFacetConfigException(
"Invalid dollar value range. Example of a valid size range is: [0 TO 1000]");
}
// build the facet query. e.g. {http://www.mycomp.com/model/hono/1.0}invoiceAmount:[0 TO 1000]
String facetQuery = facetQueryField + ':' + sizeRange;
queries.add(facetQuery);
// indexOf('[') => 1
String sizeRangeQuery = sizeRange.substring(1, sizeRange.length() - 1);
sizeRangeQuery = sizeRangeQuery.replaceFirst("\\sTO\\s", "\"..\"");
facetLabelMap.put(facetQuery, new FacetLabel(sizeRangeQuery, bucket.getValue(), index++));
}
facetQueries.put(facetQueryField, queries);
}
this.facetQueriesMap = Collections.unmodifiableMap(facetQueries);
System.out.println("Bean DollarAmountDisplayHandler instantiated");
}
#Override
public FacetLabel getDisplayLabel(String value)
{
FacetLabel facetLabel = facetLabelMap.get(value);
return (facetLabel == null) ? new FacetLabel(value, value, -1) : facetLabel;
}
#Override
public Map<String, List<String>> getFacetQueries()
{
return this.facetQueriesMap;
}
}

How to run jetty with https using sbt 0.7.7

I am using jetty 2.1.6 and sbt 0.7.7.
Currently my app is running on http, but I want to run with https
I tried following approach to run it with https :
http://wiki.eclipse.org/Jetty/Howto/Configure_SSL#Configuring_Jetty_for_SSL
Then i set below code in build.scala file.
override lazy val jettyInstance = new JettyRunner(customJettyConfiguration)
def customJettyConfiguration = {
val myLog = log
val myJettyClasspath = jettyClasspath
new CustomJettyConfiguration {
def war = "target/scala_2.8.0/tos.war"
def scanDirectories = Nil
def scanInterval = 0
def jettyClasspath = myJettyClasspath
def classpath = jettyRunClasspath
def classpathName = "test"
def log = myLog
override def jettyConfigurationXML =
<Configure id="Server" class="org.mortbay.jetty.Server">
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.security.SslSocketConnector">
<Set name="Port">443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="handshakeTimeout">2000</Set>
<Set name="keystore"><SystemProperty name="jetty.home" default=""/>/etc/xinetd.d/keystore</Set>
<Set name="password">password</Set>
<Set name="keyPassword">password</Set>
<Set name="truststore"><SystemProperty name="jetty.home" default=""/>/etc/xinetd.d/keystore</Set>
<Set name="trustPassword">password</Set>
<Set name="handshakeTimeout">2000</Set>
</New>
</Arg>
</Call>
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host"/></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
</Configure>
}
}
But I did not get my work done.
Please let me know , if i am doing anything wrong.
EDIT
I am using 6.1.26 version of jetty.
Sorry, i mentioned it wrong earlier.
EDIT
Now I have successfully upgraded my jetty server to jetty-8.0.0.M3
Now i am getting below error when I am writing above code in my build.scala file :
java.lang.NoSuchMethodError: org.eclipse.jetty.xml.XmlConfiguration.configure(Ljava/lang/Object;)V
at sbt.jetty.LazyJettyRun7$$anonfun$3.apply(LazyJettyRun7.scala:96)
at sbt.jetty.LazyJettyRun7$$anonfun$3.apply(LazyJettyRun7.scala:95)
at scala.Iterator$class.foreach(Iterator.scala:414)
at scala.List$$anon$2.foreach(List.scala:598)
at scala.Iterable$class.foreach(Iterable.scala:256)
at scala.xml.NodeSeq.foreach(NodeSeq.scala:34)
at sbt.jetty.LazyJettyRun7$.apply(LazyJettyRun7.scala:95)
at sbt.JettyRunner.runJetty$1(WebApp.scala:49)
at sbt.JettyRunner.apply(WebApp.scala:58)
at sbt.WebScalaProject$$anonfun$jettyRunTask$1.apply(ScalaProject.scala:383)
at sbt.WebScalaProject$$anonfun$jettyRunTask$1.apply(ScalaProject.scala:383)
at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
at sbt.impl.RunTask.doRun$1(RunTask.scala:77)
at sbt.impl.RunTask.runTask(RunTask.scala:85)
at sbt.impl.RunTask.run(RunTask.scala:32)
at sbt.impl.RunTask$.apply(RunTask.scala:17)
at sbt.impl.RunTask$.apply(RunTask.scala:16)
at sbt.Project$class.run(Project.scala:98)
at sbt.Project$class.act(Project.scala:129)
at sbt.BasicScalaProject.act(DefaultProject.scala:21)
at sbt.xMain$$anonfun$8.apply(Main.scala:530)
at sbt.xMain$$anonfun$8.apply(Main.scala:530)
at sbt.xMain.withAction(Main.scala:563)
at sbt.xMain.sbt$xMain$$handleAction(Main.scala:530)
at sbt.xMain.handleCommand(Main.scala:520)
at sbt.xMain.processAction(Main.scala:459)
at sbt.xMain.process$1(Main.scala:257)
at sbt.xMain$Continue$1.apply(Main.scala:132)
at sbt.xMain.run$1(Main.scala:136)
at sbt.xMain.processArguments(Main.scala:266)
at sbt.xMain.startProject(Main.scala:107)
at sbt.xMain.run(Main.scala:84)
at sbt.xMain.run0$1(Main.scala:35)
at sbt.xMain.run(Main.scala:42)
at xsbt.boot.Launch$.run(Launch.scala:55)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:69)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:31)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
[info] == jetty-run ==
[error] Error running jetty-run: Error running Jetty: java.lang.NoSuchMethodError: org.eclipse.jetty.xml.XmlConfiguration.configure(Ljava/lang/Object;)V
0.7.7 is a a pretty old version of SBT. I understand you may have reasons not to upgrade, but if you can there is the xsbt-web-plugin SBT plugin that makes configuring SSL in Jetty super easy.

does phing support arrays with keys and values?

In phing i can set this:
<property name="build.myArray" value="something1, something2, something3" />
And then retrieve each value like this:
<foreach list="${build.myArray}" param="replace.me" target="build:create-vhost" />
<target name="build:create-vhost">
<filterchain>
<replacetokens begintoken="#" endtoken="#">
<token key="REPLACE_ME" value="${replace.me}" />
</replacetokens>
</filterchain>
</target>
My question is can i do the same this but using array with keys and values?
Something like that:
<property name="build.myArray" value="myKey = something1, myKey2 => something2, myKey3 => something3" />
and use that key names later
Is is possible to do it?
No, you cannot use properties as array in phing.