How could include javascript libraries on a wirecloud operator - fiware-wirecloud

I am trying to develop a wirecloud operator but I don't know how to include a javascript library (i.e. jquery) on the config.xml except the main.js file. I tried to include the jquery library on the config.xml just like the main.js way, using different wire:index, but it did not work.
Is there any way to include a second JS library?

Yes, you can have more than one javascript file in operators. I think your problem is related to the RDF syntax that is a bit weird. Anyway, the following snippet is an example of how to include jquery and a main.js file using RDF/XML:
<usdl:utilizedResource>
<usdl:Resource rdf:about="js/jquery.min.js">
<wire:index>0</wire:index>
</usdl:Resource>
</usdl:utilizedResource>
<usdl:utilizedResource>
<usdl:Resource rdf:about="js/main.js">
<wire:index>1</wire:index>
</usdl:Resource>
</usdl:utilizedResource>
Alternatively, if you are using the Mashup portal at FIWARE Lab, you can make use of the new XML format that is going to be available on WireCloud 0.7.0 (currently the Mashup portal is running release candidate of that version). This is an example of the new format:
<?xml version='1.0' encoding='UTF-8'?>
<operator xmlns="http://wirecloud.conwet.fi.upm.es/ns/macdescription/1" vendor="CoNWeT" name="ngsi-source" version="3.0">
<details>
<title>NGSI source</title>
<homepage>https://github.com/wirecloud-fiware/ngsi-source</homepage>
<authors>Álvaro Arranz García <aarranz#conwet.com></authors>
<email>aarranz#conwet.com</email>
<image>images/catalogue.png</image>
<description>Retrieve Orion Context Broker entities and their updates in real time.</description>
<longdescription>DESCRIPTION.md</longdescription>
<license>AGPLv3+ w/linking exception</license>
<licenseurl>http://www.gnu.org/licenses/agpl-3.0.html</licenseurl>
<doc>doc/userguide.md</doc>
<changelog>doc/changelog.md</changelog>
</details>
<requirements>
<feature name="NGSI"/>
</requirements>
<preferences>
<preference name="ngsi_server" type="text" label="NGSI server URL" description="URL of the Orion Context Broker to use for retrieving entity information" default="http://orion.lab.fi-ware.org:10026/"/>
<preference name="ngsi_proxy" type="text" label="NGSI proxy URL" description="URL of the Orion Context Broker proxy to use for receiving notifications about changes" default="http://mashup.lab.fi-ware.org:3000/"/>
<preference name="ngsi_entities" type="text" label="NGSI entity types" description="A comma separated list of entity types to use for filtering entities from the Orion Context broker. Thies field cannot be empty." default="Node, AMMS, Regulator"/>
<preference name="ngsi_id_filter" type="text" label="Id pattern" description="Id pattern for filtering entities. This preference can be empty, in that case, entities won't be filtered by id." default=""/>
<preference name="ngsi_update_attributes" type="text" label="Monitored NGSI Attributes" description="Attributes to monitor for updates. Currently, the Orion Context Broker requires a list of attributes to monitor for changes, so this field cannot be empty." default="Latitud, Longitud, presence, batteryCharge, illuminance, ActivePower, ReactivePower, electricPotential, electricalCurrent"/>
</preferences>
<wiring>
<outputendpoint name="entityOutput" type="text" label="Provide entity" description="Every change over each entity fires an event" friendcode="entity"/>
</wiring>
<scripts>
<script src="js/other.dependency.js"/>
<script src="js/main.js"/>
</scripts>
</operator>
You can found more documentation about this new format at this link.

Finally, I came off to include other JS files using RDF/XML on a wirecloud operator. Firstly, I use the following code on the config.xml file:
<usdl-core:utilizedResource rdf:about="js/jquery-1.10.2.min.js">
<wire:index>0</wire:index>
</usdl-core:utilizedResource>
<usdl-core:utilizedResource rdf:about="js/main.js">
<wire:index>1</wire:index>
</usdl-core:utilizedResource>
Also, the included JS files have to be declared as follows:
<wire:Operator rdf:about="http://wirecloud.conwet.fi.upm.es/ns/widget#Operator">
...
<usdl-core:utilizedResource rdf:resource="js/jquery-1.10.2.min.js"/>
<usdl-core:utilizedResource rdf:resource="js/main.js"/>
....
</wire:Operator>

Related

How can I use pagemap with google custom search refinements?

I'm trying to add refinements to my google custom search.
I have meta tags on just about every page of the site, such as
<meta name="type-id" content="241" />
Where there are many different types, and I want to have one refinement for each type.
In the docs, it says
You can also use these more:pagemap: operators with refinement labels
But I have been unable to do that.
Note that I have had success using more:pagemap:metatags-type-id:241 in the search input, or as a webSearchQueryAddition - but despite googles docs, I haven't been able to get it to work with a refinement.
Here's a sample from my cse.xml (removing some attributes from the CustomSearchEngine tag):
<?xml version="1.0" encoding="UTF-8"?>
<CustomSearchEngine>
<Title>Test</Title>
<Context>
<Facet>
<FacetItem>
<Label name="videos" mode="FILTER">
<Rewrite>more:p:metatags-article-keyword:121</Rewrite>
</Label>
<Title>Videos</Title>
</FacetItem>
</Facet>
</Context>
</CustomSearchEngine>
Is this supposed to work? Am I using wrong syntax in the rewrite rule? Has anyone else done something like this?
Your label in the facet should be mode="BOOST" if you want to restrict to a structured data field within the scope of your engine.
<Facet>
<FacetItem>
<Label name="videos" mode="BOOST">
<Rewrite>more:p:metatags-article-keyword:121</Rewrite>
</Label>
<Title>Videos</Title>
</FacetItem>
</Facet>

RTI DDS creating own data types

I am working on a .Net example where I define my own data type using RTI Connext DDS.
Instead of creating the application from the beginning, I got help from the source code of the hello_world_xml_dynamic example in rti_workspace directory. I have made several changes to the USER_QOS_PROFILES.xml file to create my own data type and changes its name to MY_PROFILES.xml
But when I compile the application and run it from the command line, I get the following error:
DDS_DomainParticipantFactory_create_participant_from_config_w_paramsI:ERROR: Profile library 'MyParticipantLibrary::PublicationParticipant' not found
! Unable to create DDS domain participant
The line of code that catching the error:
if (this.participant == null)
{
this.participant = DDS.DomainParticipantFactory.get_instance().
create_participant_from_config(
"MyParticipantLibrary::PublicationParticipant");
if (this.participant == null)
{
Console.Error.WriteLine("! Unable to create DDS domain participant");
return;
}
}
this is the configuration file MY_PROFILES.xml :
<!--
RTI Data Distribution Service Deployment
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.1/rti_dds_profiles.xsd">
<!-- Qos Library -->
<qos_library name="qosLibrary">
<qos_profile name="DefaultProfile">
</qos_profile>
</qos_library>
<!-- types -->
<types>
<struct name="FlightData">
<member name="Latitude" type="double"/>
<member name="Longitude" type="double"/>
<member name="Altitude" type="double"/>
</struct>
</types>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary" >
<domain name="FlightDataDomain" domain_id="0">
<register_type name="FlightDataType"
type_ref="FlightData" />
<topic name="FlightDataTopic"
register_type_ref="FlightDataType">
<topic_qos name="FlightData_qos"
base_name="qosLibrary::DefaultProfile"/>
</topic>
</domain>
</domain_library>
<!-- Participant library -->
<domain_participant_library name="MyParticipantLibrary">
<domain_participant name="PublicationParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<publisher name="MyPublisher">
<data_writer name="FlightDataWriter"
topic_ref="FlightDataTopic"/>
</publisher>
</domain_participant>
<domain_participant name="SubscriptionParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<subscriber name="MySubscriber">
<data_reader name="FlightDataReader"
topic_ref="FlightDataTopic">
<datareader_qos name="FlightData_reader_qos"
base_name="qosLibrary::DefaultProfile"/>
</data_reader>
</subscriber>
</domain_participant>
</domain_participant_library>
</dds>
where am i making a mistake?
Your XML file looks correct. From the 'not found' error message, it seems that you may not have taken the right steps to instruct your application to load that profiles-file MY_PROFILES.xml to actually learn about your desired Participant. You can easily verify that this is the case by introducing an error in your XML file (for example by incorrectly renaming one tag) and rerun your application. If it does not complain about the syntax or schema of the XML, then your file did not get loaded and this hypothesis is correct.
If that turns out to be your problem indeed, then you have several options to fix that. They are listed in the User's Manual section 18.5 How to Load XML-Specified QoS Settings.

Why this dash manifest keeps the player stuck until streams are downloaded?

I have this manifest file below . The issue is that the player waits for the streams to download completely before to start playing which is bad for the user experience. Any idea how to fix it? I expected the player to start range requests and feed media source with partial requests instead to wait for the streams to completely download.
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT30M67.6S" minBufferTime="PT2S">
<ProgramInformation></ProgramInformation>
<Period id="0" start="PT0.0S">
<AdaptationSet id="0" contentType="video" segmentAlignment="true" bitstreamSwitching="true" lang="und">
<Representation id="0" mimeType="video/webm" codecs="vp9" bandwidth="770153" width="854" height="480" frameRate="23421/1000">
<BaseURL>https://liveradio.s3.eu-central-1.amazonaws.com/video.webm</BaseURL>
<SegmentList duration="1840613" startNumber="1">
<Initialization range="0-219"/>
<SegmentURL indexRange="220-6592"/>
</SegmentList>
</Representation>
</AdaptationSet>
<AdaptationSet id="1" contentType="audio" segmentAlignment="true" bitstreamSwitching="true" lang="und">
<Representation id="1" mimeType="audio/webm" codecs="opus" bandwidth="115412" audioSamplingRate="48000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>https://liveradio.s3.eu-central-1.amazonaws.com/audio.webm</BaseURL>
<SegmentList duration="1840641" startNumber="1">
<Initialization range="0-258"/>
<SegmentURL indexRange="259-3444"/>
</SegmentList>
</Representation>
</AdaptationSet>
</Period>
</MPD>
You seem to be using a mix of the DASH 'live' profile approach and the 'on-demand' profile one - you can see the profile in the profiles="urn:mpeg:dash:profile:isoff-live:2011" at the top of your manifest.
At a very high level the difference is:
'live' profile manifests contain a list of urls for each segment to be downloaded.
'on-demand' profile manifests contain a URL to a file and an index to where the segments can be found in the file, so the client can download chunks as it wants.
DASH is a complex specification and it may be that some players will accept some mixes of profiles and others not, and not all players support all features - for example Shaka player claims not to support 'indexRange' (or did in 2017: https://github.com/google/shaka-player/issues/765)

Apache Tiles set html tag attribute using <put-attribute> value

I am using Apache Tiles 2.1 as my templating framework (along with Spring MVC).
I want to know how best to be able to set HTML attribute values from within my Tiles definitions file. For example I have a text box and want to be able to set the maxlength attribute from within my definition. I expected the following to work -
<input id="nameField" type="text"
maxlength="<tiles:insertAttribute name='maxlength' />" />
using this definition -
<definition name="sprint-goal" >
<put-attribute name="maxlength" value="100" />
</definition>
But it seems that Tiles ignores the <insertAttribute/> tag if placed within a HTML tag. It works fine otherwise.
Note: I have tried using a ViewPreparer to set request-scoped values. This will work but is not exactly what I am looking for. I would like to easily set HTML attribute values from within a Tiles definition.
To set the value of html element attributes, your best bet is to use Expression Language. First, expose the tile attribute as a java variable using the tiles useAttribute tag. Then use '${}' to print the variable.
Example:
<tiles:useAttribute name="myMaxLength" id="maxLength" />
<input id="nameField" type="text" maxlength="${myMaxLength}" />
More info:
- updated June 2014: https://tiles.apache.org/2.2/framework/tiles-jsp/tlddoc/tiles/useAttribute.html
- http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPIntro7.html
<put-attribute name="maxlength" value="100" type="string" />
I type isn't defined as "string" it would be taken as a URL to include...

Problem with DisplayPattern in SharePoint 2010?

I am adding a new field to a list using the AddFieldAsXML method of SPFieldCollection. The method executes fine with no problem. And the column header shows up when I view the list; however the value never displays in the column. Here is what the field looks like after it has been added to the list. This xml is a snipped from the list schema derived using http://tw-s1-m4400-007:4016/_vti_bin/owssvr.dll?Cmd=ExportList&List={1F87433F-50E1-46C5-A138-00E1CF7E5801}
This code works great in 2007 but does not work in 2010. Any help would be appreciated.
<Field ID="{e24ccb96-35fd-44e5-b7d1-4150dbbc9a64}" Type="Computed" ReadOnly="TRUE"
Name="My_x0020_Status" DisplayName="MyStatus" ShowInEditForm="TRUE" ClassInfo="Icon"
AuthoringInfo="(My status)" SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="MyStatus" FromBaseType="TRUE">
<FieldRefs>
<FieldRef Name="ID" />
<FieldRef Name="Title" />
</FieldRefs>
<DisplayPattern>
<HTML>
<![CDATA[ <a href="form.htm?ID="
]]>
</HTML>
<Column Name="ID" />
<HTML>
<![CDATA[ ">
]]>
</HTML>
<Column Name="Title" />
<HTML>
<![CDATA[ </a>
]]>
</HTML>
</DisplayPattern>
</Field>
This link provided a lot of help in solving this issue:
http://social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/ef0d1d22-47ff-416c-becd-13d48de80e4d
Basically, display patterns fields are defined in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL\fldtypes.xsl file.
There is a file called fldtypes_ratings.xsl that you can use as an example of defining your custom field display.
You can create your own xsl file (i.e. fldtypes_myfile.xsl) to define your own custom display.
Here's a sample of my content:
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-
prefixes="xsl msxsl ddwrt" ns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:template match="FieldRef[#Name='MyCustomField']" mode="Computed_body">
<xsl:param name="thisNode" select="."/>
<SPAN class="mystuff-content-item" style="Width:100%;text-align:center">
<SPAN class='mystuff-socialized-status mystuff-socialized-status-unknown'></SPAN>
<SPAN class="mystuff-content-object-type" style="display:none">
MyContent
</SPAN>
<SPAN class="mystuff-content-followed" style="display:none">0</SPAN>
<SPAN class="mystuff-content-name" style="display:none"></SPAN>
<SPAN class="mystuff-content-id" style="display:none">
<xsl:value-of select="$List" />
<xsl:text>|</xsl:text>
<xsl:value-of select="$thisNode/#ID" />
</SPAN>
</SPAN>
</xsl:template>
</xsl:stylesheet>
Hope that helps!
I'm confused as to the point of referencing these articles -- both of them state "Two legacy field types that ship with SharePoint Foundation do not have a DisplayPattern type of RenderPattern in FLDTYPES.XML: (1) ContentTypeId fields are never visible. (2) Computed fields are rendered on list views and in Display mode by a DisplayPattern element in their Field elements within the schema.xml of each list on which they appear."
The original question is clearly defined as a "Computed" field, that according to the linked articles do not use the fldttypes.xml for their renderpattern, but intstead use the DisplayPattern element just as the original question posted. It would help to post references to how the DisplayPattern works in 2010 -- since the documentation clearly states that it Does work, but never says how.
See my blog on this here: http://www.threewill.com/2012/07/computed-fields-in-sp-2010/. Hopefully this makes it clear on how to do computed fields in SP2010.
This method of customization from 2007 is made obselete by changes in 2010's rendering of fields. Read the note from the SDK entry on RenderPattern for more detail:
Important!
This topic describes markup that was used in a now obsolete method of rendering custom fields types on list views and on the Display, Edit, and New forms. It is provided solely to assist persons who are debugging a custom field type that was originally developed against an earlier version of SharePoint Foundation. For information about the recommended methods, see How to: Create Field Rendering Templates and How to: Create a Custom Field Type.
Custom fields whose rendering is defined with RenderPattern markup still render properly on forms. However, SharePoint Foundation, by default, uses XSLT stylesheets to render fields on list views, even for legacy custom fields whose list view rendering is defined with a RenderPattern. To enable the rendering of such a field, a TRUE element must be added to the containing FieldTypes element in the field type definition file (fldtype*.xml).