Android Data Binding two way binding with array - arrays

I want to achieve two-way binding on a array with Data Binding in Android.
This is a simplified version of the code I have:
<data>
<variable
name="values"
type="Integer[]" />
</data>
<EditText
...
android:text="#={Converter.toString(values[0])} />
But when I try to build this code I get a message as follows:
cannot find method setTo(java.lang.Integer[], int, java.lang.Integer) in class android.databinding.ViewDataBinding
How can I achieve two-way binding with an array, if at all possible?

How about trying the following way by using ArrayList.
<data>
<import type="java.util.ArrayList"/>
<variable
name="values"
type="ArrayList<Integer>"/>
</data>
<EditText
...
android:text="#={Converter.toString(values.get(0))} />

Related

load xml file into snowflake : external stage

i need to load XML file into snowflake which is nested in many ways ,sample as below, i have loaded it in table with VARIANT datatype which comes as a XML format.
how to convert XML into table format and load .
<Request>
<PRODUCT>
<Address>true</Address>
<Age>true</Age>
<ChildDOB>true</ChildDOB>
<ChildName>true</ChildName>
<ClaimNumber>true</ClaimNumber>
<DOB>true</DOB>
<GroupNumber>true</GroupNumber>
</PRODUCT>
<Attachments>
<DocID>823E087C-45CD-8659</DocID>
<DocName>DC Batch Number</DocName>
</Attachments>
<Index>
<Date>20220728T164027.000 GMT</Date>
<Code>1</Code>
<DCReceivedDate>20220728T164027.000 GMT</DCReceivedDate>
<RouteTo>ROUTE ENGINE</RouteTo>
<XMLDocument>
<document>
<templateID>X999998</templateID>
<docID>01WBP0T2L806WBMB1........20220616</docID>
<guid>6AF0FE72-6328-4EBB-92CC-B27870E454F2</guid>
<docclass>WEES</docclass>
<form>
<date>06/15/2022</date>
<call>WEESS</call>
<sheetNumber></sheetNumber>
</form>
<detail>
<rejectDesc />
<rejectStatus>100</rejectStatus>
<claimant>
<firstName>LO</firstName>
<middleInitial></middleInitial>
<lastName>BA</lastName>
<birthDate>03/27/1968</birthDate>
<male></male>
<female>1</female>
<primaryPolicyHolder>1</primaryPolicyHolder>
<spouse />
<dependant />
<fullTimeStudent />
<signature>Y</signature>
</claimant>
<patient>
<firstName>LO</firstName>
<middleInitial></middleInitial>
<lastName>BA</lastName>
<birthDate>03/27/1968</birthDate>
<male></male>
<female>1</female>
<primaryPolicyHolder>1</primaryPolicyHolder>
<spouse></spouse>
<dependant></dependant>
<fullTimeStudent></fullTimeStudent>
<signature>Y</signature>
</patient>
<workMissed days="0" />
</detail>`enter code here`
</document>
</XMLDocument>
</Index>
</Request>
please advise how to use select statement in snowflake to get this code into table.

Change xtype dynamically according to the bind value in extjs

I am having a UI page which contains a table which shows the information and we are using extjs to ftech and show the values.
My code is below.
The component looks like below:
<item name="value1" xtype="link" bind="{value}">
<position>22</position>
<default>1</default>
<displayable>1</displayable>
<enabled>1</enabled>
<exportable>1</exportable>
<alwaysAvailable>1</alwaysAvailable>
<editors>
<editor name="filter" xtype="textfield"/>
</editors>
<events>
<event name="click" jsFunction="onClickOpenScreen">
<config>{"url":"......}}</config>
</event>
</events>
<config>{"width": 100}</config>
</item>
and the model is :
<field name="value" tableAlias="table1" column="value" datatype="string">
<required>0</required>
<formula>if some value then value else 0</formula>
</field>
Here in the formula we are fetching the value from db, if value is there then value otherwise display 0.
So my requirement is if any value is there then that will come as hyperlink otherwise it will come as simple value. But from this code even 0 is coming as link.

How to publish additional postgis raster layer attributes in geoserver?

i was wondering if any of You can help me with my problem. I'm storing some rasters in Postgis database. Each raster is in its own table and besides 'rid' and 'rast' columns, I manualy added other columns to store raster attributes such as 'metadata'...
I have successfully imported rasters in geoserver using ImageMosaic JDBC and in Layers Preview (OpenLayers) I can see rasters and use getFeatureInfo function, but the problem is that function getFeatureInfo returns table with correct pixel value , 'rid' field is empty (only table header apears) and no other attribute is shown (not even attribute header in table). I'm using default geoserver method for layer preview function.
mapping.postgis.xml.inc file
<!-- possible values: universal,postgis,db2,mysql,oracle -->
<spatialExtension name="pgraster"/>
<mapping>
<masterTable name="mosaic" >
<coverageNameAttribute name="name"/>
<maxXAttribute name="maxx"/>
<maxYAttribute name="maxy"/>
<minXAttribute name="minx"/>
<minYAttribute name="miny"/>
<resXAttribute name="resx"/>
<resYAttribute name="resy"/>
<tileTableNameAtribute name="tiletable" />
</masterTable>
<tileTable>
<blobAttributeName name="rast" />
<keyAttributeName name="rid" />
<textAttributeName name="metadata" />
</tileTable>
</mapping>
connect.postgis.xml.inc
<connect>
<!-- value DBCP or JNDI -->
<dstype value="DBCP"/>
<!-- <jndiReferenceName value=""/> -->
<username value="postgres" />
<password value="postgres" />
<jdbcUrl value="jdbc:postgresql://localhost:5432/web_kartografija" />
<driverClassName value="org.postgresql.Driver"/>
<maxActive value="10"/>
<maxIdle value="0"/>
</connect>
layer.postgis.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ImageMosaicJDBCConfig [
<!ENTITY mapping PUBLIC "mapping" "mapping.postgis.xml.inc">
<!ENTITY connect PUBLIC "connect" "connect.postgis.xml.inc">]>
<config version="1.0">
<coverageName name="jan"/> <!-- Name of the table in database -->
<coordsys name="EPSG:4326"/>
<!-- interpolation 1 = nearest neighbour, 2 = bilinear, 3 = bicubic -->
<scaleop interpolation="1"/>
<verify cardinality="false"/>
&mapping;
&connect;
</config>
I tried to include <textAttributeName name="metadata" /> as a column name where aditional data is stored, but still no effect. Can anobudy help me with this problem ? Thanks in advance !

JAXB Example in camel

Can any one provide me simple example in camel with JAXB using spring XML? I searched on net but did not find anything.
I just want to create simple Student class with fields name, id and convert it into xml.
Not sure what in particular you're struggling with, but here are some snippets:
<util:map id="jaxbNamespacePrefixMap">
<!-- In my case, we dont want a prefix for our namespace; YMMV -->
<entry key="http://www.nmcourts.gov" value=""/>
</util:map>
<marshal>
<jaxb prettyPrint="true" contextPath="generated.gov.nmcourts.ecitation.shared.odyssey"
partClass="generated.gov.nmcourts.ecitation.shared.odyssey.NMCitationEFileBatch" partNamespace="EFileBatch"
namespacePrefixRef="jaxbNamespacePrefixMap"/>
</marshal>
<unmarshal>
<jaxb prettyPrint="true" contextPath="generated.gov.nmcourts.ecitation.shared.odyssey"
partClass="generated.gov.nmcourts.ecitation.shared.odyssey.NMCitationEFileBatch"
partNamespace="EFileBatch" namespacePrefixRef="jaxbNamespacePrefixMap" />
</unmarshal>
What do you need exactly?
http://camel.apache.org/jaxb shows perfectly well how to marshal to xml via spring.

Ant: Find the path of a file in a directory

I want to find the path of a file in a directory (similar to unix 'find' command or the 'which' command, but I need it to work platform-independent) and save it as a property.
Tried to use the whichresource ant task, but it doesn't do the trick (I think it's only good for looking inside jar files).
I would prefer if it would be pure ant and not to write my own task or use a 3rd-party extension.
Notice that there might be several instances of a file by that name in the path - I want it to only return the first instance (or at least I want to be able to choose only one).
Any suggestions?
One possibility is to use the first resource selector. For example to find a file called a.jar somewhere under directory jars:
<first id="first">
<fileset dir="jars" includes="**/a.jar" />
</first>
<echo message="${toString:first}" />
If there are no matching files nothing will be echoed, otherwise you'll get the path to the first match.
Here is an example which selects the first matching file. The logic is as follows:
find all matches using a fileset.
using pathconvert, store the result in a property, separating each matching file with line separator.
use a head filter to match the first matching file.
The functionality is encapsulated in a macrodef for reusability.
<project default="test">
<target name="test">
<find dir="test" name="*" property="match.1"/>
<echo message="found: ${match.1}"/>
<find dir="test" name="*.html" property="match.2"/>
<echo message="found: ${match.2}"/>
</target>
<macrodef name="find">
<attribute name="dir"/>
<attribute name="name"/>
<attribute name="property"/>
<sequential>
<pathconvert property="#{property}.matches" pathsep="${line.separator}">
<fileset dir="#{dir}">
<include name="#{name}"/>
</fileset>
</pathconvert>
<loadresource property="#{property}">
<string value="${#{property}.matches}"/>
<filterchain>
<headfilter lines="1"/>
</filterchain>
</loadresource>
</sequential>
</macrodef>
</project>
I created a macro based on martin-clayton's answer.
sample project with macro and a property file that is read from the found file
<?xml version="1.0" encoding="utf-8"?>
<project name="test properties file read" default="info">
<macrodef name="searchfile">
<attribute name="file" />
<attribute name="path" default="custom,." />
<attribute name="name" />
<sequential>
<first id="#{name}">
<multirootfileset basedirs="#{path}" includes="#{file}" erroronmissingdir="false" />
</first>
<property name="#{name}" value="${toString:#{name}}" />
</sequential>
</macrodef>
<searchfile name="custom.properties.file" file="config.properties" />
<property file="${custom.properties.file}" />
<target name="info" >
<echo>
origin ${config.origin}
</echo>
</target>

Resources