How to lowercase text between two string - lowercase

I have this code:
<Layer Idx="2" Name="scr FILI FISSI SOLAIO">
<Layer Idx="2" Name="scr FILI ALTRO">
<Layer Idx="2" Name="scr PIPPO">
I want to convert in lowercase the text between (") or other string:
<Layer Idx="2" Name="scr fili fissi solaio">
<Layer Idx="2" Name="scr fili altro">
<Layer Idx="2" Name="scr pippo">

Related

How do I extract my long regex to multiline String in Swift?

I simply have regex like this:
let email = "^(?:(?:(?:(?: )*(?:(?:(?:\\t| )*\\r\\n)?(?:\\t| )+))+(?: )*)|(?: )+)?(?:(?:(?:[-A-Za-z0-9!#$%&’*+/=?^_'{|}~]+(?:\\.[-A-Za-z0-9!#$%&’*+/=?^_'{|}~]+)*)|(?:\"(?:(?:(?:(?: )*(?:(?:[!#-Z^-~]|\\[|\\])|(?:\\\\(?:\\t|[ -~]))))+(?: )*)|(?: )+)\"))(?:#)(?:(?:(?:[A-Za-z0-9](?:[-A-Za-z0-9]{0,61}[A-Za-z0-9])?)(?:\\.[A-Za-z0-9](?:[-A-Za-z0-9]{0,61}[A-Za-z0-9])?)*)|(?:\\[(?:(?:(?:(?:(?:[0-9]|(?:[1-9][0-9])|(?:1[0-9][0-9])|(?:2[0-4][0-9])|(?:25[0-5]))\\.){3}(?:[0-9]|(?:[1-9][0-9])|(?:1[0-9][0-9])|(?:2[0-4][0-9])|(?:25[0-5]))))|(?:(?:(?: )*[!-Z^-~])*(?: )*)|(?:[Vv][0-9A-Fa-f]+\\.[-A-Za-z0-9._~!$&'()*+,;=:]+))\\])))(?:(?:(?:(?: )*(?:(?:(?:\\t| )*\\r\\n)?(?:\\t| )+))+(?: )*)|(?: )+)?$"
let url = "https?:\\/\\/(www\\.)?[-a-zA-Z0-9#:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()#:%_\\+.~#?&//=]*)"
Is there a way to write it using multiline string in Swift?

how to add graph generated by highscript to pdf?

I am trying to generate svg file of graph generated by highcharts-export-server after generation i want to add it to pdf which is generated by pdfkit with the help of svg-to-pdfkit.
I works when when we mannually copies the data from svg file and stores it to some variable but it does not work when we read same data from svg file
const fs = require("fs");
const chartExporter = require("highcharts-export-server");
const SVGtoPDF=require("svg-to-pdfkit")
const readline = require('readline');
const PDFDocument=require('pdfkit')
const doc = new PDFDocument({size: 'A4'});
doc.pipe(fs.createWriteStream('output.pdf'));
//svg contains data which is manually copied from svg file
const svg = `<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" class="highcharts-root" style="font-family:"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif;font-size:12px;" xmlns="http://www.w3.org/2000/svg" width="600" height="400"><desc>Created with Highcharts 8.2.2</desc><defs><clipPath id="highcharts-xyyrba3-9-"><rect x="0" y="0" width="518" height="276" fill="none"></rect></clipPath><clipPath id="highcharts-xyyrba3-13-"><rect x="0" y="0" width="518" height="276" fill="none"></rect></clipPath></defs><rect fill="#ffffff" class="highcharts-background" x="0" y="0" width="600" height="400" rx="0" ry="0"></rect><rect fill="none" class="highcharts-plot-background" x="72" y="47" width="518" height="276"></rect><g class="highcharts-pane-group" data-z-index="0"></g><g class="highcharts-grid highcharts-xaxis-grid" data-z-index="1"><path fill="none" data-z-index="1" class="highcharts-grid-line" d="M 160.5 47 L 160.5 323" opacity="1"></path><path fill="none" data-z-index="1" class="highcharts-grid-line" d="M 330.5 47 L 330.5 323" opacity="1"></path><path fill="none" data-z-index="1" class="highcharts-grid-line" d="M 500.5 47 L 500.5 323" opacity="1"></path></g><g class="highcharts-grid highcharts-yaxis-grid" data-z-index="1"><path fill="none" stroke="#e6e6e6" stroke-width="1" data-z-index="1" class="highcharts-grid-line" d="M 72 323.5 L 590 323.5" opacity="1"></path><path fill="none" stroke="#e6e6e6" stroke-width="1" data-z-index="1" class="highcharts-grid-line" d="M 72 268.5 L 590 268.5" opacity="1"></path><path fill="none" stroke="#e6e6e6" stroke-width="1" data-z-index="1" class="highcharts-grid-line" d="M 72 213.5 L 590 213.5" opacity="1"></path><path fill="none" stroke="#e6e6e6" stroke-width="1" data-z-index="1" class="highcharts-grid-line" d="M 72 157.5 L 590 157.5" opacity="1"></path><path fill="none" stroke="#e6e6e6" stroke-width="1" data-z-index="1" class="highcharts-grid-line" d="M 72 102.5 L 590 102.5" opacity="1"></path><path fill="none" stroke="#e6e6e6" stroke-width="1" data-z-index="1" class="highcharts-grid-line" d="M 72 46.5 L 590 46.5" opacity="1"></path></g><rect fill="none" class="highcharts-plot-border" data-z-index="1" x="72" y="47" width="518" height="276"></rect><g class="highcharts-axis highcharts-xaxis" data-z-index="2"><path fill="none" class="highcharts-tick" stroke="#ccd6eb" stroke-width="1" d="M 160.5 323 L 160.5 333" opacity="1"></path><path fill="none" class="highcharts-tick" stroke="#ccd6eb" stroke-width="1" d="M 330.5 323 L 330.5 333" opacity="1"></path><path fill="none" class="highcharts-tick" stroke="#ccd6eb" stroke-width="1" d="M 500.5 323 L 500.5 333" opacity="1"></path><path fill="none" class="highcharts-axis-line" stroke="#ccd6eb" stroke-width="1" data-z-index="7" d="M 72 323.5 L 590 323.5"></path></g><g class="highcharts-axis highcharts-yaxis" data-z-index="2"><text x="26" data-z-index="7" text-anchor="middle" transform="translate(0,0) rotate(270 26 185)" class="highcharts-axis-title" style="color:#666666;fill:#666666;" y="185"><tspan>Values</tspan></text><path fill="none" class="highcharts-axis-line" data-z-index="7" d="M 72 47 L 72 323"></path></g><g class="highcharts-series-group" data-z-index="3"><g class="highcharts-series highcharts-series-0 highcharts-column-series highcharts-color-0" data-z-index="0.1" opacity="1" transform="translate(72,47) scale(1 1)" clip-path="url(#highcharts-xyyrba3-13-)"><rect x="47.5" y="55.5" width="82" height="221" fill="#7cb5ec" stroke="#ffffff" stroke-width="1" opacity="1" class="highcharts-point highcharts-color-0"></rect><rect x="217.5" y="232.5" width="82" height="44" fill="#7cb5ec" stroke="#ffffff" stroke-width="1" opacity="1" class="highcharts-point highcharts-color-0"></rect><rect x="388.5" y="166.5" width="82" height="110" fill="#7cb5ec" stroke="#ffffff" stroke-width="1" opacity="1" class="highcharts-point highcharts-color-0"></rect></g><g class="highcharts-markers highcharts-series-0 highcharts-column-series highcharts-color-0" data-z-index="0.1" opacity="1" transform="translate(72,47) scale(1 1)" clip-path="none"></g></g><text x="300" text-anchor="middle" class="highcharts-title" data-z-index="4" style="color:#333333;font-size:18px;fill:#333333;" y="24"><tspan>Heading of Chart</tspan></text><text x="300" text-anchor="middle" class="highcharts-subtitle" data-z-index="4" style="color:#666666;fill:#666666;" y="46"></text><text x="10" text-anchor="start" class="highcharts-caption" data-z-index="4" style="color:#666666;fill:#666666;" y="397"></text><g class="highcharts-legend" data-z-index="7" transform="translate(255,358)"><rect fill="none" class="highcharts-legend-box" rx="0" ry="0" x="0" y="0" width="91" height="27" visibility="visible"></rect><g data-z-index="1"><g><g class="highcharts-legend-item highcharts-column-series highcharts-color-0 highcharts-series-0" data-z-index="1" transform="translate(8,3)"><text x="21" style="color:#333333;cursor:pointer;font-size:12px;font-weight:bold;fill:#333333;" text-anchor="start" data-z-index="2" y="15"><tspan>Series 1</tspan></text><rect x="2" y="4" width="12" height="12" fill="#7cb5ec" rx="6" ry="6" class="highcharts-point" data-z-index="3"></rect></g></g></g></g><g class="highcharts-axis-labels highcharts-xaxis-labels" data-z-index="7"><text x="160.60526315789" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="middle" transform="translate(0,0)" y="342" opacity="1">0</text><text x="331" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="middle" transform="translate(0,0)" y="342" opacity="1">1</text><text x="501.39473684211" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="middle" transform="translate(0,0)" y="342" opacity="1">2</text></g><g class="highcharts-axis-labels highcharts-yaxis-labels" data-z-index="7"><text x="57" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="end" transform="translate(0,0)" y="327" opacity="1">0</text><text x="57" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="end" transform="translate(0,0)" y="271" opacity="1">25</text><text x="57" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="end" transform="translate(0,0)" y="216" opacity="1">50</text><text x="57" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="end" transform="translate(0,0)" y="161" opacity="1">75</text><text x="57" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="end" transform="translate(0,0)" y="106" opacity="1">100</text><text x="57" style="color:#666666;cursor:default;font-size:11px;fill:#666666;" text-anchor="end" transform="translate(0,0)" y="51" opacity="1">125</text></g><text x="590" class="highcharts-credits" text-anchor="end" data-z-index="8" style="cursor:pointer;color:#999999;font-size:9px;fill:#999999;" y="395">Highcharts.com</text></svg>`;
// Initialize the exporter
chartExporter.initPool();
// Chart details object specifies chart type and data to plot
const chartDetails = {
type: "image/svg+xml",
options: {
chart: {
type: "column"
},
title: {
text: "Heading of Chart"
},
plotOptions: {
pie: {
dataLabels: {
enabled: true,
format: "<b>{point.name}</b>: {point.y}"
}
}
},
series: [
{
data: [
{
name: "a",
y: 100
},
{
name: "b",
y: 20
},
{
name: "c",
y: 50
}
]
}
]
}
};
chartExporter.export(chartDetails, (err, res) => {
if (res.filename) {
let svgString = fs.readFileSync(res.filename, 'utf8');
console.log(svgString);
SVGtoPDF(doc,``+svgString, 0,0);
// Remove the file optionally
fs.unlinkSync(res.filename);
}
chartExporter.killPool();
});
doc.end();
i want to create an api which will return pdf document for that i have created a function which contains code for different pages of pdf
const pdf=()=>{
first();
generateGraph(); //this will contain highchart export server which will export graph as svg and again by reading it it will saved in pdf;
... code for other pages of pdf
return doc;
}
i am using hapijs for developement and all the installation is local and for now i am running code on localhost
i think document is returning before execution of chartExporter.export function

urdf model (depth data is being shown in the wrong place in Rviz and non fixed joint not published)

I am a beginner in ROS and related issues. I create a URDF model of my desired robot that has a depth camera. I have 2 questions:
Robot simulated correctly in gazebo but when I add some interest object in gazebo environment, I found that my camera sensor frame is wrong and it view direction is z axis of the robot. I read some related problem but I could fix it.
I use of plugin for skid driver, but my robot wheels' not published in rviz, when I checked robot model or rqt_garph I could see the wheels.
Could you please help me regarding them?
It is my urdf:
<?xml version="1.0"?>
<robot name="bluebot" xmlns:xacro="http://ros.org/wiki/xacro">
<!-- base information-->
<xacro:property name="base_length" value="0.50" />
<xacro:property name="base_width" value="0.40" />
<xacro:property name="base_height" value="0.10" />
<xacro:property name="base_mass" value="14" />
<!-- wheel information-->
<xacro:property name="wheel_length" value="0.08" />
<xacro:property name="wheel_radius" value="0.10" />
<xacro:property name="wheel_mass" value="4.70" />
<!-- camera_stand information-->
<xacro:property name="camera_stand_length" value="0.10" />
<xacro:property name="camera_stand_radius" value="0.05" />
<xacro:property name="camera_stand_mass" value="2.50" />
<!-- camera information-->
<xacro:property name="camera_length" value="0.15" />
<xacro:property name="camera_width" value="0.03" />
<xacro:property name="camera_height" value="0.02" />
<xacro:property name="camera_mass" value="1" />
<xacro:property name="Pi" value="3.1415" />
<!--inertial-->
<xacro:macro name="solid_cuboid_inertial" params="length width height mass">
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value="${mass}"/>
<inertia
ixx="${(mass / 12) * ((base_height * base_height) + (base_length * base_length))}" ixy="0.0" ixz="0.0"
iyy="${(mass / 12) * ((base_width * base_width) + (base_length * base_length))}" iyz="0.0"
izz="${(mass / 12) * ((base_width * base_width) + (base_height * base_height))}"/>
</inertial>
</xacro:macro>
<xacro:macro name="cylinder_inertial" params="mass radius height">
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value="${mass}"/>
<inertia
ixx="${(mass / 12) * ((3 * (radius * radius)) + ( height * height))}" ixy="0.0" ixz="0.0"
iyy="${(mass / 12) * ((3 * ( radius* radius)) + ( height * height))}" iyz="0.0"
izz="${(mass / 12) * (radius * radius)}"/>
</inertial>
</xacro:macro>
<!--base_link-->
<link name="base_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 ${base_height / 2}"/>
<geometry>
<box size="${base_length} ${base_width} ${base_height}"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="${base_length} ${base_width} ${base_height}"/>
</geometry>
</collision>
<xacro:solid_cuboid_inertial length="${base_length}" width="${base_width}" height="${base_height}" mass="${base_mass}"/>
</link>
<gazebo reference="base_link">
<material>Gazebo/Blue</material>
</gazebo>
<!--wheel-->
<xacro:macro name="wheel" params="name reflect1 reflect2">
<link name="${name}_wheel_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length ="${wheel_length}" radius="${wheel_radius}"/>
</geometry>
</visual>
<collision>
<geometry>
<cylinder length="${wheel_length}" radius="${wheel_radius}"/>
</geometry>
</collision>
<xacro:cylinder_inertial mass="${wheel_mass}" radius="${wheel_radius}" height="${wheel_length}" />
</link>
<gazebo reference="${name}_wheel_link">
<material>Gazebo/Gray</material>
<mu1 value="10.0"/>
<mu2 value="20.0"/>
</gazebo>
<joint name="${name}_wheel_joint" type="continuous">
<parent link="base_link"/>
<child link="${name}_wheel_link"/>
<origin rpy="${Pi / 2} 0 0" xyz="${reflect2 * ((base_width / 2) + (wheel_length / 2))} ${reflect1 * base_length / 2} 0"/>
<axis xyz="0 0 -1"/>
</joint>
<transmission name="${name}_wheel_transmission">
<type>transmission_interface/SimpleTransmission</type>
<actuator name="${name}_wheel_motor">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
<joint name="${name}_wheel_joint">
<!-- <hardwareInterface>VelocityJointInterface</hardwareInterface> -->
<hardwareInterface>EffortJointInterface</hardwareInterface>
</joint>
</transmission>
</xacro:macro>
<xacro:wheel name="right_front" reflect1="1" reflect2="1" />
<xacro:wheel name="left_front" reflect1="-1" reflect2="1" />
<xacro:wheel name="right_back" reflect1="1" reflect2="-1" />
<xacro:wheel name="left_back" reflect1="-1" reflect2="-1" />
<!--camera_stand-->
<link name="camera_stand_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<cylinder length="${camera_stand_length}" radius="${camera_stand_radius}"/>
</geometry>
</visual>
<collision>
<geometry>
<cylinder length="${camera_stand_length}" radius="${camera_stand_radius}"/>
</geometry>
</collision>
<xacro:cylinder_inertial mass="${camera_stand_mass}" radius="${camera_stand_radius}" height="${camera_stand_length}" />
</link>
<gazebo reference="camera_stand_link">
<material>Gazebo/Blue</material>
</gazebo>
<joint name="camera_stand_joint" type="fixed">
<parent link="base_link"/>
<child link="camera_stand_link"/>
<origin rpy="0 0 0" xyz="${base_width / 2} 0 ${(base_length / 2) - 0.10}"/>
</joint>
<!--camera-->
<link name="camera_link">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="${camera_length} ${camera_width} ${camera_height}"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="${camera_length} ${camera_width} ${camera_height}"/>
</geometry>
</collision>
<xacro:solid_cuboid_inertial length="${camera_length}" width="${camera_width}" height="${camera_height}" mass="${camera_mass}"/>
</link>
<gazebo reference="camera_link">
<material>Gazebo/Yellow</material>
</gazebo>
<joint name="camera_joint" type="fixed">
<parent link="base_link"/>
<child link="camera_link"/>
<origin rpy="0 0 ${Pi / 2}" xyz="${base_width / 2} 0 ${base_length / 2}"/>
</joint>
<link name="camera_sensor_link"/>
<joint name="camera_sensor_joint" type="fixed">
<parent link="camera_link"/>
<child link="camera_sensor_link"/>
<origin rpy="${-3 * Pi/2} ${Pi/2} ${Pi/2}" xyz="0 0 0"/>
<!-- <origin rpy="${3*Pi/2} 0 ${Pi}" xyz="0 0 0"/> -->
</joint>
<gazebo reference="camera_sensor_link">
<sensor type="depth" name="xtion_pro">
<always_on>true</always_on>
<visualize>true</visualize>
<camera>
<horizontal_fov>1.047</horizontal_fov>
<image>
<width>640</width>===
<height>480</height>
<format>R8G8B8</format>
</image>
<depth_camera>
</depth_camera>
<clip>
<near>0.1</near>
<far>10</far>
</clip>
</camera>
<plugin name="camera_plugin" filename="libgazebo_ros_openni_kinect.so">
<baseline>0.2</baseline>
<alwaysOn>true</alwaysOn>
<!-- Keep this zero, update_rate in the parent <sensor> tag
will control the frame rate. -->
<updateRate>0.0</updateRate>
<cameraName>camera_ir</cameraName>
<imageTopicName>/camera/color/image_raw</imageTopicName>
<cameraInfoTopicName>/camera/color/camera_info</cameraInfoTopicName>
<depthImageTopicName>/camera/depth/image_raw</depthImageTopicName>
<depthImageCameraInfoTopicName>/camera/depth/camera_info</depthImageCameraInfoTopicName>
<pointCloudTopicName>/camera/depth/points</pointCloudTopicName>
<frameName>camera_sensor_link</frameName>
<pointCloudCutoff>0.5</pointCloudCutoff>
<pointCloudCutoffMax>3.0</pointCloudCutoffMax>
<distortionK1>0</distortionK1>
<distortionK2>0</distortionK2>
<distortionK3>0</distortionK3>
<distortionT1>0</distortionT1>
<distortionT2>0</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0</Cx>
<Cy>0</Cy>
<focalLength>0</focalLength>
<hackBaseline>0</hackBaseline>
</plugin>
</sensor>
</gazebo>
<gazebo>
<plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
<updateRate>100.0</updateRate>
<robotNamespace>/</robotNamespace>
<leftFrontJoint>left_front_wheel_joint</leftFrontJoint>
<rightFrontJoint>right_front_wheel_joint</rightFrontJoint>
<leftRearJoint>left_back_wheel_joint</leftRearJoint>
<rightRearJoint>right_back_wheel_joint</rightRearJoint>
<wheelSeparation>0.4</wheelSeparation>
<wheelDiameter>${wheel_radius * 2}</wheelDiameter>
<robotBaseFrame>base_link</robotBaseFrame>
<torque>20</torque>
<topicName>cmd_vel</topicName>
<broadcastTF>false</broadcastTF>
</plugin>
</gazebo>
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/</robotNamespace>
</plugin>
</gazebo>
</robot>
and it is my launch file:
<?xml version="1.0"?>
<launch>
<!-- these are the arguments you can pass this launch file, for example paused:=true -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="extra_gazebo_args" default=""/>
<arg name="gui" default="true"/>
<arg name="recording" default="false"/>
<!-- Note that 'headless' is currently non-functional. See gazebo_ros_pkgs issue #491 (-r arg does not disable
rendering, but instead enables recording). The arg definition has been left here to prevent breaking downstream
launch files, but it does nothing. -->
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="physics" default="ode"/>
<arg name="verbose" default="false"/>
<arg name="output" default="screen"/>
<arg name="world_name" default="empty.world"/> <!-- Note: the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable -->
<arg name="respawn_gazebo" default="false"/>
<arg name="use_clock_frequency" default="false"/>
<arg name="pub_clock_frequency" default="100"/>
<arg name="enable_ros_network" default="true" />
<!-- set use_sim_time flag -->
<param name="/use_sim_time" value="$(arg use_sim_time)"/>
<!-- set command arguments -->
<arg unless="$(arg paused)" name="command_arg1" value=""/>
<arg if="$(arg paused)" name="command_arg1" value="-u"/>
<arg unless="$(arg recording)" name="command_arg2" value=""/>
<arg if="$(arg recording)" name="command_arg2" value="-r"/>
<arg unless="$(arg verbose)" name="command_arg3" value=""/>
<arg if="$(arg verbose)" name="command_arg3" value="--verbose"/>
<arg unless="$(arg debug)" name="script_type" value="gzserver"/>
<arg if="$(arg debug)" name="script_type" value="debug"/>
<!-- start gazebo server-->
<group if="$(arg use_clock_frequency)">
<param name="gazebo/pub_clock_frequency" value="$(arg pub_clock_frequency)" />
</group>
<group>
<param name="gazebo/enable_ros_network" value="$(arg enable_ros_network)" />
</group>
<node name="gazebo" pkg="gazebo_ros" type="$(arg script_type)" respawn="$(arg respawn_gazebo)" output="$(arg output)"
args="$(arg command_arg1) $(arg command_arg2) $(arg command_arg3) -e $(arg physics) $(arg extra_gazebo_args) $(find bluebot)/worlds/$(arg world_name)" />
<!-- start gazebo client -->
<group if="$(arg gui)">
<node name="gazebo_gui" pkg="gazebo_ros" type="gzclient" respawn="false" output="$(arg output)" args="$(arg command_arg3)"/>
</group>
<!-- Convert an xacro and put on parameter server -->
<param name="robot_description" command="xacro $(find bluebot)/urdf/bluebot.xacro" />
<!-- Spawn a robot into Gazebo -->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model bluebot" />
<!-- <node name="joint_state_publisher" type="joint_state_publisher" pkg="joint_state_publisher" output="screen"/> -->
<!-- load the controllers -->
<!-- <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/" args="left_front_wheel_joint_position_controller right_front_wheel_joint_position_controller
left_back_wheel_joint_position_controller right_back_wheel_joint_position_controller joint_state_controller"/> -->
<!-- convert joint states to TF transforms for rviz, etc -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
respawn="false" output="screen">
<remap from="/joint_states" to="/bluebot/joint_states" />
</node>
</launch>

Validator expression doesn't work for me in Struts2

I wanted to configure a validation expression type to verify that the sum of the four fields does not exceed 100
<validator type="expression" short-circuit="true">
<param name="expression">
(employee.analysis + employee.development + employee.test + employee.maintenance) gt 100
</param>
<message key="validations.error.total"/>
</validator>
but the above solution doesn't work
I have also tried this:
<validator type="expression" short-circuit="true">
<param name="expression">
<![CDATA[(employee.analysis + employee.development + employee.test + employee.maintenance) > 100 ]]>
</param>
<message key="validations.error.total"/>
</validator>
A solution is this:
<validator type="expression" short-circuit="true">
<param name="expression">
<![CDATA[(employee.analysis + employee.development + employee.test + employee.maintenance) <= 100 ]]>
</param>
<message key="validations.error.total"/>
</validator>

QlikView "field not found" workaround for adding a new field

I am trying to get my script to reload in QlikView without success. I have added a new field (named Litres) to my most recently generated QVD files. However, my older QVD files do not have this Litres field which therefore causes the script to error out with the "Field not found" error.
I am trying to do the following:
Search for all the fields in the QVD
If the Litres field exists, then load the data into QlikView.
If not, create the field with a value of zero and continue.
The above should not result in an error.
My current script is below:
/* get all sales csvs */
sales:
load 2014 as Year
AutoGenerate 0;
set FilePath = ..\..\SourceData\qv-sales*.csv;
for each File in filelist('$(FilePath)')
/* load qvd file if it is newer than csv file */
temptable1:
first 1 LOAD
*
FROM $(File)
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
IF FieldNumber('Litres' , 'temptable1') <> null then
SET "Litres";
SET "Litres LY" ;
SET dyncode2 = P-Value;
SET dyncode3 = O-P-Value;
SET dyncode4 = P-Value LY;
SET dyncode5 = O-P-Value LY;
SET dyncode6 = P-Qty;
SET dyncode7 = P-O-Qty;
SET dyncode8 = P-Qty LY;
SET dyncode9 = P-O-Qty LY;
ENDIF;
DROP TABLE temptable1;
let qvdFile = replace('$(File)','csv','qvd');
if (QvdCreateTime('$(qvdFile)') >= FileTime('$(File)')) then
/* load qvd file if it is newer than csv file */
sales:
Concatenate (sales) load
"GP",
"O-GP",
"Litres",
"Litres LY",
"GP LY",
"O-GP LY",
$(dyncode2) as "P-Value",
$(dyncode3) as "O-P-Value",
$(dyncode4) as "P-Value LY",
$(dyncode5) as "O-P-Value LY",
$(dyncode6) as "P-Qty",
$(dyncode7) as "P-O-Qty",
$(dyncode8) as "P-Qty LY",
$(dyncode9) as "P-O-Qty LY" from $(qvdFile) (qvd);
else
/* create temp store key1 & key2 are manually handled synthetic keys */
/* Dummy field is to prevent autoconcatenation problems. */
temptable:
noconcatenate Load
"GP",
"O-GP",
"Litres" ,
"Litres LY",
"GP LY",
"O-GP LY",
$(dyncode2) as "P-Value",
$(dyncode3) as "O-P-Value",
$(dyncode4) as "P-Value LY",
$(dyncode5) as "O-P-Value LY",
$(dyncode6) as "P-Qty",
$(dyncode7) as "P-O-Qty",
$(dyncode8) as "P-Qty LY",
$(dyncode9) as "P-O-Qty LY",
autonumber(1) as dummy1
FROM $(File) (ansi, txt, delimiter is ',', embedded labels);
/* create qvd file from temp table */
if (ScriptErrorCount = 0) then
Store temptable into $(qvdFile);
endif
sales:
concatenate("sales") load
"Litres",
"Litres LY",
"GP LY",
"O-GP LY"
"P-Value",
"O-P-Value",
"P-Value LY",
"O-P-Value LY",
"P-Qty",
"P-O-Qty",
"P-Qty LY",
"P-O-Qty LY"
resident temptable;
/* drop temp table */
DROP TABLE temptable;
endif
next File
Thanks in advance!
You can use the FieldNumber function to determine whether a field exists in a table. For example FieldNumber('MyField', 'MyTable') returns the position of MyField within MyTable. If MyField does not exist in MyTable the function returns zero.
You can adapt this to your advantage by loading all fields from your QVD into a temporary table and then checking to see if this table contains the field. If it does, you can continue loading. If not, you can simply set the field to zero.
I have adapted your script and inserted an IF for this purpose:
/* get all sales csvs */
sales:
load 2014 as Year
AutoGenerate 0;
set FilePath = ..\..\SourceData\qv-sales*.csv;
for each File in filelist('$(FilePath)')
/* load qvd file if it is newer than csv file */
temptable1:
first 1 LOAD
*
FROM $(File)
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
IF FieldNumber('Litres' , 'temptable1') <> null then
SET "Litres";
SET "Litres LY" ;
SET dyncode2 = P-Value;
SET dyncode3 = O-P-Value;
SET dyncode4 = P-Value LY;
SET dyncode5 = O-P-Value LY;
SET dyncode6 = P-Qty;
SET dyncode7 = P-O-Qty;
SET dyncode8 = P-Qty LY;
SET dyncode9 = P-O-Qty LY;
ENDIF
DROP TABLE temptable1;
let qvdFile = replace('$(File)','csv','qvd');
if (QvdCreateTime('$(qvdFile)') >= FileTime('$(File)')) then
/* load qvd file if it is newer than csv file */
fieldcheck:
FIRST 1
NOCONCATENATE
LOAD
*
FROM $(qvdFile) (qvd);
if FieldNumber('Litres','fieldcheck') = 0 then
drop table fieldcheck;
sales:
Concatenate (sales) load
"GP",
"O-GP",
0 as "Litres",
0 as "Litres LY",
"GP LY",
"O-GP LY",
$(dyncode2) as "P-Value",
$(dyncode3) as "O-P-Value",
$(dyncode4) as "P-Value LY",
$(dyncode5) as "O-P-Value LY",
$(dyncode6) as "P-Qty",
$(dyncode7) as "P-O-Qty",
$(dyncode8) as "P-Qty LY",
$(dyncode9) as "P-O-Qty LY" from $(qvdFile) (qvd);
else
drop table fieldcheck;
sales:
Concatenate (sales) load
"GP",
"O-GP",
"Litres",
"Litres LY",
"GP LY",
"O-GP LY",
$(dyncode2) as "P-Value",
$(dyncode3) as "O-P-Value",
$(dyncode4) as "P-Value LY",
$(dyncode5) as "O-P-Value LY",
$(dyncode6) as "P-Qty",
$(dyncode7) as "P-O-Qty",
$(dyncode8) as "P-Qty LY",
$(dyncode9) as "P-O-Qty LY" from $(qvdFile) (qvd);
endif
else
/* create temp store key1 & key2 are manually handled synthetic keys */
/* Dummy field is to prevent autoconcatenation problems. */
temptable:
noconcatenate Load
"GP",
"O-GP",
"Litres" ,
"Litres LY",
"GP LY",
"O-GP LY",
$(dyncode2) as "P-Value",
$(dyncode3) as "O-P-Value",
$(dyncode4) as "P-Value LY",
$(dyncode5) as "O-P-Value LY",
$(dyncode6) as "P-Qty",
$(dyncode7) as "P-O-Qty",
$(dyncode8) as "P-Qty LY",
$(dyncode9) as "P-O-Qty LY",
autonumber(1) as dummy1
FROM $(File) (ansi, txt, delimiter is ',', embedded labels);
/* create qvd file from temp table */
if (ScriptErrorCount = 0) then
Store temptable into $(qvdFile);
endif
sales:
concatenate("sales") load
"Litres",
"Litres LY",
"GP LY",
"O-GP LY"
"P-Value",
"O-P-Value",
"P-Value LY",
"O-P-Value LY",
"P-Qty",
"P-O-Qty",
"P-Qty LY",
"P-O-Qty LY"
resident temptable;
/* drop temp table */
DROP TABLE temptable;
endif
next File
If my understanding is correct you need to regenerate your QVDs because you added a new field which doesn't exists in the previous ones, so you recreate them from the source (txt) and store them.
A simpler way to achieve this is to take advantage of the fact that when you do a forced concatenate with a table the missing fields will be generated with null, which we can use with the function alt to transform the null into 0.
so taking your example:
/* get all sales csvs */
sales:
load 2014 as Year
AutoGenerate 0;
set FilePath = ..\..\SourceData\qv-sales*.csv;
for each File in filelist('$(FilePath)')
let qvdFile = replace('$(File)','csv','qvd');
//this generate the field Litres, exists or not
tmp: noconcatenate load null() as Litres autogenerate(0);
if (QvdCreateTime('$(qvdFile)') >= FileTime('$(File)')) then
/* load qvd file if it is newer than csv file */
concatenate(tmp) LOAD * FROM $(qvdFile) (qvd);
else
concatenate(tmp) LOAD * FROM $(File)
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
endif;
tmp_sales:
noconcatenate
load
alt(Litres,0) as Litres,
"Litres LY",
"GP LY",
"O-GP LY"
"P-Value",
"O-P-Value",
"P-Value LY",
"O-P-Value LY",
"P-Qty",
"P-O-Qty",
"P-Qty LY",
"P-O-Qty LY"
resident tmp;
drop table tmp;
//if it was newer that the csv we store it
if (QvdCreateTime('$(qvdFile)') >= FileTime('$(File)')) then
Store tmp_sales into $(qvdFile);
endif
concatenate(sales) load * resident tmp_sales;
drop table tmp_sales;
next File

Resources