I need to assign cost of OSPF according to queueLength of routers. So how to access this statistic form C++ code? This statistic has defined in PacketQueue.ned that is used in ppp in router. According to OMNeT++ manual documentation I should use
cPar& queueLengthPar = par("queueLength");
but I don't know is this true?
The code that OSPF uses for cost calculation in OspfConfigReader.cc in inet framework is :
Ospfv2Interface *intf = new Ospfv2Interface;
Metric cost = getIntAttrOrPar(ifConfig, "interfaceOutputCost");
if(cost == 0)
intf->setOutputCost(round(par("referenceBandwidth").intValue() / ie.getDatarate()));
else
intf->setOutputCost(cost);
I should modify the code according to queueLength statistic like this:
Ospfv2Interface *intf = new Ospfv2Interface;
Metric cost = getIntAttrOrPar(ifConfig, "interfaceOutputCost");
if(cost == 0)
intf->setOutputCost(par("queueLength"));
else
intf->setOutputCost(cost);
but the error is unknown parameter "queueLength". Where should i a should add this statistic correctly?
`myNet.ned file is:
package secondproject.simulations;
import inet.common.misc.ThruputMeteringChannel;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.networklayer.ipv4.Ipv4RoutingTable;
import inet.networklayer.ipv4.RoutingTableRecorder;
import inet.node.inet.StandardHost;
import inet.node.ospfv2.OspfRouter;
import inet.visualizer.integrated.IntegratedVisualizer;
import inet.visualizer.linklayer.InterfaceTableVisualizer;
network myNet
{
parameters:
#display("p=10,10;b=712,152;bgb=1051.64,508.58002");
types:
channel C extends ThruputMeteringChannel
{
datarate = 10Gbps;
delay = 1ns;
thruputDisplayFormat = "#N";
}
channel Channel extends ThruputMeteringChannel
{
datarate = 10Gbps;
delay = 1ns;
thruputDisplayFormat = "#N";
}
submodules:
rtr: RoutingTableRecorder {
parameters:
#display("p=40.945,475.1775;is=s");
}
H1: StandardHost {
parameters:
#display("p=107.75,31.2475");
gates:
ethg[1];
}
R1: OspfRouter {
parameters:
#display("p=248.9025,103.44");
gates:
ethg[3];
}
R2: OspfRouter {
parameters:
#display("p=466.5575,103.44");
gates:
ethg[4];
}
R3: OspfRouter {
parameters:
#display("p=668.05,103.44");
gates:
ethg[4];
}
R4: OspfRouter {
parameters:
#display("p=886.78253,103.44");
gates:
ethg[3];
}
H4: StandardHost {
parameters:
#display("p=1029.0125,22.6275");
gates:
ethg[1];
}
R5 OspfRouter {
parameters:
#display("p=248.9025,187.485");
gates:
ethg[4];
}
R6: OspfRouter {
parameters:
#display("p=466.5575,191.795");
gates:
ethg[4];
}
R7: OspfRouter {
parameters:
#display("p=668.05,187.485");
gates:
ethg[4];
}
R8: OspfRouter {
parameters:
#display("p=886.78253,187.485");
gates:
ethg[4];
}
R9: OspfRouter {
parameters:
#display("p=248.9025,277.995");
gates:
ethg[4];
}
R10: OspfRouter {
parameters:
#display("p=466.5575,277.995");
gates:
ethg[4];
}
R11: OspfRouter {
parameters:
#display("p=668.05,277.995");
gates:
ethg[4];
}
R12: OspfRouter {
parameters:
#display("p=886.78253,277.995");
gates:
ethg[4];
}
R13: OspfRouter {
parameters:
#display("p=248.9025,372.815");
gates:
ethg[3];
}
R14: OspfRouter {
parameters:
#display("p=466.5575,372.815");
gates:
ethg[4];
}
R15: OspfRouter {
parameters:
#display("p=668.05,372.815");
gates:
ethg[4];
}
R16: OspfRouter {
parameters:
#display("p=886.78253,372.815");
gates:
ethg[3];
}
H9: StandardHost {
parameters:
#display("p=82.9675,277.995");
gates:
ethg[1];
}
H13: StandardHost {
parameters:
#display("p=159.47,466.5575");
gates:
ethg[1];
}
H2: StandardHost {
parameters:
#display("p=466.5575,22.6275");
gates:
ethg[1];
}
H12: StandardHost {
parameters:
#display("p=1027.935,277.995");
gates:
ethg[1];
}
H16: StandardHost {
parameters:
#display("p=1027.935,483.79752");
gates:
ethg[1];
}
H15: StandardHost {
parameters:
#display("p=668.05,461.17");
gates:
ethg[1];
}
H14: StandardHost {
parameters:
#display("p=466.5575,461.17");
gates:
ethg[1];
}
H3: StandardHost {
parameters:
#display("p=668.05,22.6275");
gates:
ethg[1];
}
H5: StandardHost {
parameters:
#display("p=82.9675,187.485");
gates:
ethg[1];
}
H8: StandardHost {
parameters:
#display("p=1027.935,187.485");
gates:
ethg[1];
}
configurator: Ipv4NetworkConfigurator {
parameters:
#display("p=40.945,103.44;is=s");
config = xml("<config>"
+ "<interface among='H1 R1' address='192.168.1.x' netmask='255.255.255.x' />"
+ "<interface among='H2 R2' address='192.168.2.x' netmask='255.255.255.x' />"
+ "<interface among='H3 R3' address='192.168.3.x' netmask='255.255.255.x' />"
+ "<interface among='H4 R4' address='192.168.4.x' netmask='255.255.255.x' />"
+ "<interface among='H5 R5' address='192.168.5.x' netmask='255.255.255.x' />"
+ "<interface among='H8 R8' address='192.168.8.x' netmask='255.255.255.x' />"
+ "<interface among='H9 R9' address='192.168.9.x' netmask='255.255.255.x' />"
+ "<interface among='H12 R12' address='192.168.12.x' netmask='255.255.255.x' />"
+ "<interface among='H13 R13' address='192.168.13.x' netmask='255.255.255.x' />"
+ "<interface among='H14 R14' address='192.168.14.x' netmask='255.255.255.x' />"
+ "<interface among='H15 R15' address='192.168.15.x' netmask='255.255.255.x' />"
+ "<interface among='H16 R16' address='192.168.16.x' netmask='255.255.255.x' />"
+ "<interface among='R*' address='10.0.0.x' netmask='255.255.255.x' />"
+ "<multicast-group hosts='R*' address='224.0.0.5 224.0.0.6' />"
+ "<route hosts='H1' destination='*' gateway='R1'/>"
+ "<route hosts='H2' destination='*' gateway='R2'/>"
+ "<route hosts='H3' destination='*' gateway='R3'/>"
+ "<route hosts='H4' destination='*' gateway='R4'/>"
+ "<route hosts='H5' destination='*' gateway='R5'/>"
+ "<route hosts='H8' destination='*' gateway='R8'/>"
+ "<route hosts='H9' destination='*' gateway='R9'/>"
+ "<route hosts='H12' destination='*' gateway='R12'/>"
+ "<route hosts='H13' destination='*' gateway='R13'/>"
+ "<route hosts='H14' destination='*' gateway='R14'/>"
+ "<route hosts='H15' destination='*' gateway='R15'/>"
+ "<route hosts='H16' destination='*' gateway='R16'/>"
+ "<route hosts='R*' destination='224.0.0.0' netmask='240.0.0.0' interface='eth0'/>"
+ "<route hosts='R*' destination='224.0.0.0' netmask='240.0.0.0' interface='eth1'/>"
+ "<route hosts='R*' destination='224.0.0.0' netmask='240.0.0.0' interface='eth2'/>"
+ "<route hosts='R2 R3 R5 R6 R7 R8 R9 R10 R11 R12 R14 R15' destination='224.0.0.0' netmask='240.0.0.0' interface='eth3'/>"
+ "</config>");
}
connections:
R1.ethg[0] <--> C <--> R2.ethg[0];
R1.ethg[1] <--> C <--> R5.ethg[0];
R1.ethg[2] <--> Channel <--> H1.ethg[0];
R2.ethg[1] <--> C <--> R3.ethg[0];
R2.ethg[2] <--> C <--> R6.ethg[0];
R2.ethg[3] <--> Channel <--> H2.ethg[0];
R3.ethg[1] <--> C <--> R4.ethg[0];
R3.ethg[2] <--> C <--> R7.ethg[0];
R3.ethg[3] <--> Channel <--> H3.ethg[0];
R4.ethg[1] <--> C <--> R8.ethg[0];
R4.ethg[2] <--> Channel <--> H4.ethg[0];
R5.ethg[1] <--> C <--> R6.ethg[1];
R5.ethg[2] <--> C <--> R9.ethg[0];
R5.ethg[3] <--> Channel <--> H5.ethg[0];
R6.ethg[2] <--> C <--> R7.ethg[1];
R6.ethg[3] <--> C <--> R10.ethg[0];
R7.ethg[2] <--> C <--> R8.ethg[1];
R7.ethg[3] <--> C <--> R11.ethg[0];
R8.ethg[2] <--> C <--> R12.ethg[0];
R8.ethg[3] <--> Channel <--> H8.ethg[0];
R9.ethg[1] <--> C <--> R10.ethg[1];
R9.ethg[2] <--> C <--> R13.ethg[0];
R9.ethg[3] <--> Channel <--> H9.ethg[0];
R10.ethg[2] <--> C <--> R11.ethg[1];
R10.ethg[3] <--> C <--> R14.ethg[0];
R11.ethg[2] <--> C <--> R12.ethg[1];
R11.ethg[3] <--> C <--> R15.ethg[0];
R12.ethg[2] <--> C <--> R16.ethg[0];
R12.ethg[3] <--> Channel <--> H12.ethg[0];
R13.ethg[1] <--> C <--> R14.ethg[1];
R13.ethg[2] <--> Channel <--> H13.ethg[0];
R14.ethg[2] <--> C <--> R15.ethg[1];
R14.ethg[3] <--> Channel <--> H14.ethg[0];
R15.ethg[2] <--> C <--> R16.ethg[1];
R15.ethg[3] <--> Channel <--> H15.ethg[0];
R16.ethg[2] <--> Channel <--> H16.ethg[0];
}
omnetpp.ini is:
[General]
network = myNet
eventlog-file = ${resultdir}/${configname}-${iterationvarsf}#${repetition}.elog
record-eventlog = true
sim-time-limit = 10s
**.ospf.ospfConfig = xmldoc("ASConfig.xml")
**.ospf.helloInterval = 1s
**.ospf.retransmissionInterval = 1s
**.H*.numApps = 2
**.app[0].typename = "UdpBasicApp"
**.app[0].destPort = 1234
**.app[0].messageLength = 1000 bytes
**.app[0].sendInterval = 1us
**.app[0].startTime = 2s
**.app[0].stopTime = this.startTime + 90s
**.H1.app[0].destAddresses = "H2 H3 H4 H5 H8 H9 H12 H13 H14 H15 H16"
**.H2.app[0].destAddresses = "H1 H3 H4 H5 H8 H9 H12 H13 H14 H15 H16"
**.H3.app[0].destAddresses = "H1 H2 H4 H5 H8 H9 H12 H13 H14 H15 H16"
**.H4.app[0].destAddresses = "H1 H2 H3 H5 H8 H9 H12 H13 H14 H15 H16"
**.H5.app[0].destAddresses = "H1 H2 H3 H4 H8 H9 H12 H13 H14 H15 H16"
**.H8.app[0].destAddresses = "H1 H2 H3 H4 H5 H9 H12 H13 H14 H15 H16"
**.H9.app[0].destAddresses = "H1 H2 H3 H4 H5 H8 H12 H13 H14 H15 H16"
**.H12.app[0].destAddresses = "H1 H2 H3 H4 H5 H8 H9 H13 H14 H15 H16"
**.H13.app[0].destAddresses = "H1 H2 H3 H4 H5 H8 H9 H12 H14 H15 H16"
**.H14.app[0].destAddresses = "H1 H2 H3 H4 H5 H8 H9 H12 H13 H15 H16"
**.H15.app[0].destAddresses = "H1 H2 H3 H4 H5 H8 H9 H12 H13 H14 H16"
**.H16.app[0].destAddresses = "H1 H2 H3 H4 H5 H8 H9 H12 H13 H14 H15"
**.app[1].typename = "UdpSink"
**.app[1].localPort = 1234
**.configurator.addStaticRoutes = false
**.configurator.addSubnetRoutes = false
**.configurator.addDefaultRoutes = false
**.configurator.dumpRoutes = true
my ASConfig.xml is:
<?xml version="1.0"?>
<OSPFASConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="OSPF.xsd">
<!-- Areas -->
<Area id="0.0.0.0">
<AddressRange address="R1>R2" mask="R1>R2" />
<AddressRange address="R1>R5" mask="R1>R5" />
<AddressRange address="R2>R1" mask="R2>R1" />
<AddressRange address="R2>R3" mask="R2>R3" />
<AddressRange address="R2>R6" mask="R2>R6" />
<AddressRange address="R3>R2" mask="R3>R2" />
<AddressRange address="R3>R4" mask="R3>R4" />
<AddressRange address="R3>R7" mask="R3>R7" />
<AddressRange address="R4>R3" mask="R4>R3" />
<AddressRange address="R4>R8" mask="R4>R8" />
<AddressRange address="R5>R1" mask="R5>R1" />
<AddressRange address="R5>R6" mask="R5>R6" />
<AddressRange address="R5>R9" mask="R5>R9" />
<AddressRange address="R6>R2" mask="R6>R2" />
<AddressRange address="R6>R5" mask="R6>R5" />
<AddressRange address="R6>R7" mask="R6>R7" />
<AddressRange address="R6>R10" mask="R6>R10" />
<AddressRange address="R7>R3" mask="R7>R3" />
<AddressRange address="R7>R6" mask="R7>R6" />
<AddressRange address="R7>R8" mask="R7>R8" />
<AddressRange address="R7>R11" mask="R7>R11" />
<AddressRange address="R8>R4" mask="R8>R4" />
<AddressRange address="R8>R7" mask="R8>R7" />
<AddressRange address="R8>R12" mask="R8>R12" />
<AddressRange address="R9>R5" mask="R9>R5" />
<AddressRange address="R9>R10" mask="R9>R10" />
<AddressRange address="R9>R13" mask="R9>R13" />
<AddressRange address="R10>R6" mask="R10>R6" />
<AddressRange address="R10>R9" mask="R10>R9" />
<AddressRange address="R10>R11" mask="R10>R11" />
<AddressRange address="R10>R14" mask="R10>R14" />
<AddressRange address="R11>R7" mask="R11>R7" />
<AddressRange address="R11>R10" mask="R11>R10" />
<AddressRange address="R11>R12" mask="R11>R12" />
<AddressRange address="R11>R15" mask="R11>R15" />
<AddressRange address="R12>R8" mask="R12>R8" />
<AddressRange address="R12>R11" mask="R12>R11" />
<AddressRange address="R12>R16" mask="R12>R16" />
<AddressRange address="R13>R9" mask="R13>R9" />
<AddressRange address="R13>R14" mask="R13>R14" />
<AddressRange address="R14>R10" mask="R14>R10" />
<AddressRange address="R14>R13" mask="R14>R13" />
<AddressRange address="R14>R15" mask="R14>R15" />
<AddressRange address="R15>R11" mask="R15>R11" />
<AddressRange address="R15>R14" mask="R15>R14" />
<AddressRange address="R15>R16" mask="R15>R16" />
<AddressRange address="R16>R12" mask="R16>R12" />
<AddressRange address="R16>R15" mask="R16>R15" />
</Area>
<Area id="0.0.0.1">
<AddressRange address="H1" mask="H1" />
</Area>
<Area id="0.0.0.2">
<AddressRange address="H2" mask="H2" />
</Area>
<Area id="0.0.0.3">
<AddressRange address="H3" mask="H3" />
</Area>
<Area id="0.0.0.4">
<AddressRange address="H4" mask="H4" />
</Area>
<Area id="0.0.0.5">
<AddressRange address="H5" mask="H5" />
</Area>
<Area id="0.0.0.8">
<AddressRange address="H8" mask="H8" />
</Area>
<Area id="0.0.0.9">
<AddressRange address="H9" mask="H9" />
</Area>
<Area id="0.0.0.12">
<AddressRange address="H12" mask="H12" />
</Area>
<Area id="0.0.0.13">
<AddressRange address="H13" mask="H13" />
</Area>
<Area id="0.0.0.14">
<AddressRange address="H14" mask="H14" />
</Area>
<Area id="0.0.0.15">
<AddressRange address="H15" mask="H15" />
</Area>
<Area id="0.0.0.16">
<AddressRange address="H16" mask="H16" />
</Area>
<!-- Routers -->
<Router name="R1" RFC1583Compatible="true">
<BroadcastInterface ifName="eth2" areaID="0.0.0.1" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
</Router>
<Router name="R2" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.2" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R3" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.3" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R4" RFC1583Compatible="true">
<BroadcastInterface ifName="eth2" areaID="0.0.0.4" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
</Router>
<Router name="R5" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.5" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R6" RFC1583Compatible="true">
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth3" areaID="0.0.0.0" />
</Router>
<Router name="R7" RFC1583Compatible="true">
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth3" areaID="0.0.0.0" />
</Router>
<Router name="R8" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.8" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R9" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.9" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R10" RFC1583Compatible="true">
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth3" areaID="0.0.0.0" />
</Router>
<Router name="R11" RFC1583Compatible="true">
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth3" areaID="0.0.0.0" />
</Router>
<Router name="R12" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.12" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R13" RFC1583Compatible="true">
<BroadcastInterface ifName="eth2" areaID="0.0.0.13" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
</Router>
<Router name="R14" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.14" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R15" RFC1583Compatible="true">
<BroadcastInterface ifName="eth3" areaID="0.0.0.15" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R16" RFC1583Compatible="true">
<BroadcastInterface ifName="eth2" areaID="0.0.0.16" />
<PointToPointInterface ifName="eth0" areaID="0.0.0.0" />
<PointToPointInterface ifName="eth1" areaID="0.0.0.0" />
</Router>
</OSPFASConfig>
To read the value of a parameter write:
int len = par("queueLength");
Related
I need to delete all the line items <LineItem> from the file which does not suffice with this requirements:
elements in Line Item : <LineItemNumber V="00000000000000000010" /> and <PurchaseOrderNumber V="0100230946|00010" /> have to be matched, another words in integer Line Item Number would be 10 and Purchase order number after pipe line | would be 10. we need to have only one those line Items which are matching this requirement. Sorry, i'm really bad at describing.
<Transmission>
<InterchangeUsageIndicator V="T" />
<Groups>
<Group>
<GroupSenderID V="CCC" />
<TotalNumberOfShipmentsInGroup V="000005" />
<Documents>
<Document>
<DocumentHeader>
<InvoiceChargeType V="T" />
<DocumentType V="ORDER" />
<DocumentProcessingCode C="00" />
<BOLNumber V="BOL2309460180582136" />
<AlternateQuantities>
<AlternateQuantity Quantity="12.0" UOM="PK" UOMType="SQ" Characteristic="" />
</AlternateQuantities>
<Buyer Name="" Q="ZP" ID="COUSPO001">
<AlternateIDs />
</Buyer>
<Seller Name="" Q="2" ID="CNTR">
<AlternateIDs />
</Seller>
<Parties>
<Party PartyType="SF">
<Name V="SHA" />
<LocationID Q="" ID="" />
<AlternateLocationIDs>
<LocationID Q="" ID="SHA" />
</AlternateLocationIDs>
<City V="Shanghai" />
<Country V="CN" />
<LocationPurpose V="" />
</Party>
<Party PartyType="ST">
<Name V="LEB" />
<LocationID Q="" ID="" />
<AlternateLocationIDs>
<LocationID Q="" ID="LEB" />
</AlternateLocationIDs>
<City V="Lebanon" />
<Country V="TN" />
<LocationPurpose V="" />
</Party>
<Party PartyType="VN">
<Name V="YANGZHOU BAOYI SHOES" />
<LocationID Q="" ID="4100000423" />
<AlternateLocationIDs />
<City V="JIANGSU" />
<Country V="CN" />
<LocationPurpose V="" />
</Party>
</Parties>
<DateReferences>
<DR Type="D" Q="ETA" Date="2019-12-19" />
<DR Type="D" Q="EST" Date="2019-11-28" />
</DateReferences>
<ReservedReferences>
<RR Type="R" Q="K6" V="86|SEAL230946" />
<RR Type="R" Q="V3" V="VYG230946|BKG230946" />
</ReservedReferences>
</DocumentHeader>
<Vessel VesselName="VSL230946" VesselNumber="" VesselCountryOfRegistration="" VesselRegistrationNumber="" />
<Equipments>
<Equipment Initial="CNTR" Number="230946" Length="0" Type="" TotalContainerVolume="52.06" />
</Equipments>
<LineItems>
<LineItem>
<LineItemNumber V="00000000000000000010" />
<LineItemType C="LI" />
<TransportationServiceCode Code="" />
<PurchaseOrderNumber V="0100230946|00010" />
<AdditionalReferenceNumber V="" />
<DescriptionMarksAndNumbers>
<CommodityCode Q="" C="M9160" />
<BuyerProductID V="" />
</DescriptionMarksAndNumbers>
<BilledRatedAsQuantity V="0.0" UOM="PA" />
<LadingQuantity V="0.0" UOM="PA" />
<LineItemTotalAmount V="0.0" />
<LineItemWeight V="0.00" />
<LineItemVolume V="0.00" />
</LineItem>
<LineItem>
<LineItemNumber V="00000000000000900001" /> //this one would not work,because it is 900001
<LineItemType C="LI" />
<LineItemSubType C="SCH" />
<TransportationServiceCode Code="" />
<PurchaseOrderNumber V="0100230946|00010" />
<AdditionalReferenceNumber V="" />
<DescriptionMarksAndNumbers>
<CommodityCode Q="" C="M9160" />
<BuyerProductID V="" />
</DescriptionMarksAndNumbers>
<BilledRatedAsQuantity V="24.0" UOM="PA" />
<LadingQuantity V="24.0" UOM="PA" />
<LineItemTotalAmount V="0.0" />
<UserDefinedReferences>
<UDR Type="U" Q="CR" V="22859470896|001|0001" Description="" />
<UDR Type="U" Q="S6" V="|3|20" Description="" />
<UDR Type="U" Q="19" V="M9160|USDS|0001" Description="" />
</UserDefinedReferences>
<LineItemWeight V="2959.54" />
<LineItemVolume V="104.12" />
</LineItem>
<LineItem>
<LineItemNumber V="00000000000000900002" />
<LineItemType C="LI" />
<LineItemSubType C="SCH" />
<TransportationServiceCode Code="" />
<PurchaseOrderNumber V="0100230946|00010" />
<AdditionalReferenceNumber V="" />
<DescriptionMarksAndNumbers>
<CommodityCode Q="" C="M9160" />
<BuyerProductID V="" />
</DescriptionMarksAndNumbers>
<BilledRatedAsQuantity V="24.0" UOM="PA" />
<LadingQuantity V="24.0" UOM="PA" />
<LineItemTotalAmount V="0.0" />
<UserDefinedReferences>
<UDR Type="U" Q="CR" V="22859470902|001|0002" Description="" />
<UDR Type="U" Q="S6" V="|3.5|20" Description="" />
<UDR Type="U" Q="19" V="M9160|USDS|0001" Description="" />
</UserDefinedReferences>
<LineItemWeight V="2959.54" />
<LineItemVolume V="104.12" />
</LineItem>
I tried to start on LINQ: this is where I got so far:
try {
var xDoc = XDocument.Parse(msg.Body);
var xDocument = xDoc.Root.XPathSelectElement("Groups/Group/Documents/Document");
var xLineItems = xDocument.XPathSelectElements("LineItems/LineItem");
var poNumbers = xLineItems.Select(e => (string)e.Element("PurchaseOrderNumber").Attribute("V")).Distinct();
foreach (var poNumber in poNumbers) {
}
msg.Body = xDoc.ToString();
I believe you would like to Delete all LineItem where LineItemNumber!=10 and PurchaseOrderNumber after the Pipe NOT equals 10. You could use Linq to filter the elements that match the purpose and use the Remove method to deletes the selected nodes.
var xDoc = XDocument.Parse(xml);
xDoc.Descendants("LineItem")
.Where(x=> Convert.ToInt32(x.Element("LineItemNumber").Attribute("V").Value)!=10
&& Convert.ToInt32(x.Element("PurchaseOrderNumber").Attribute("V").Value.Split('|')[1])!=10
).Remove();
var result = xDoc.ToString();
Code:
<BarSeries v-tkCartesianSeries
categoryProperty="Country"
valueProperty="Amount"
:items="items1" />
<CategoricalAxis v-tkCartesianVerticalAxis />
<LinearAxis v-tkCartesianHorizontalAxis />
You have to define Palette with same series name
<BarSeries v-tkCartesianSeries :items="items1"
categoryProperty="Country" valueProperty="Amount"
seriesName="myLine" />
<Palette v-tkCartesianPalette seriesName="myLine">
<PaletteEntry v-tkCartesianPaletteEntry strokeWidth="5"
strokeColor="red" fillColor="red"></PaletteEntry>
</Palette>
<CategoricalAxis v-tkCartesianHorizontalAxis />
<LinearAxis v-tkCartesianVerticalAxis />
Just use fillColor and strokeColor in the BarSeries
<RadCartesianChart>
<CategoricalAxis v-tkCartesianHorizontalAxis />
<LinearAxis v-tkCartesianVerticalAxis />
<BarSeries v-tkCartesianSeries :items="items" categoryProperty="" valueProperty="" fillColor="red" />
</RadCartesianChart>
I am working with Spring Security & JSF . When ever login is submitted , page is getting reloaded nothing happens, action="${pageContext.request.contextPath}/j_spring_security_check" is not getting called.
Please help. Thank You in advance.
Below are my pages and configuration's:
login.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:cls="http://emia.com/emia/ui"
xmlns:cat360="http://java.sun.com/jsf/composite/components">
<ui:composition template="/templates/login/loginTemplate.xhtml">
<ui:define name="body">
<h:outputStylesheet>
.panelGridValign td { vertical-align: top !important; }
.rf-p-hdr{
height: 15 px !important;
display: block !important;
border: none !important;
background: url("${facesContext.externalContext.requestContextPath}/images/menuBg.jpg") repeat-x 0 0 !important;
padding:5px 5px 5px 5px !important;
color : #ffffff !important
}
.topalgn {
vertical-align: top;
}
#menu-nav {
background: #fff url("${facesContext.externalContext.requestContextPath}/images/menuBg.jpg") repeat-x 0 0;
height: 30px;
padding: 0;
display: block;
border: none
}
.content {
padding: 0px !important;
min-height: 0px !important;
}
</h:outputStylesheet>
<f:event listener="#{loginBean.updateMessages}" type="preRenderView" />
<div class="contentBg">
<div id="menu-nav"></div>
<div class="wrapper">
<div class="content">
<div class="logInSection">
<div class="leftBlock">
<h2>Welcome to Nomad</h2>
<h:graphicImage library="images" url="#{loginBean.loginPageImage}"/>
<div class="rightBlock">
<h3>Login</h3>
<div class="rightLoginBlock">
<h:form id="loginForm" prependId="false"
action="${pageContext.request.contextPath}/j_spring_security_check">
<table cellpadding="0" cellspacing="0" width="99%">
<tbody>
<tr>
<td class="labelClass1">User Name</td>
<td class="fieldClass"><h:inputText id="j_username"
required="true" requiredMessage="Username is mandatory"
style=" width :150px;">
</h:inputText></td>
</tr>
<tr>
<td class="labelClass1">Password</td>
<td class="fieldClass"><h:inputSecret id="j_password"
required="true" requiredMessage="Password is mandatory"
styleClass="form_input" style=" width :150px;">
</h:inputSecret></td>
</tr>
<tr>
<td class="labelClass1">Company</td>
<td class="fieldClass"><h:selectOneMenu
id="loginCompany" value="#{loginBean.selectedCompany}"
disabled="#{!loginBean.multiHosted}" required="true"
requiredMessage="Company is mandatory"
styleClass="form_select" style=" width :50px;">
<f:selectItems value="#{loginBean.companyCodeList}"></f:selectItems>
<f:ajax listener="#{loginBean.companySelected}"
render="loginSite" event="change" execute="#this" />
</h:selectOneMenu> <h:inputHidden value="#{loginBean.selectedCompany}"
id="loginCompanyHidden" /></td>
</tr>
<tr>
<td class="labelClass1">Site</td>
<td class="fieldClass"><h:selectOneMenu id="loginSite"
value="#{loginBean.selectedSite}" required="true"
requiredMessage="Site is mandatory"
styleClass="form_select" style=" width :50px;">
<f:selectItems value="#{loginBean.siteCodeList}"></f:selectItems>
</h:selectOneMenu></td>
</tr>
<tr>
<td class="labelClass1"></td>
<td align="right" class="fieldClass"><span
style="text-align: right; float: right;"> <h:commandButton
type="submit" id="login"
onclick="loginTest(); return false;" value="login"
styleClass="submitButton" /> <br /> <br />
<a4j:commandLink
styleClass="forgetPass" value="Forgot Password?">
<rich:componentControl target="forgotPasswordPopup"
operation="show" event="click" />
</a4j:commandLink>
</span></td>
</tr>
<tr>
<td colspan="2" class="labelClass1"><a4j:outputPanel
id="loginErrorOutPanel" ajaxRendered="true"
styleClass="error" width="250px">
<h:panelGrid id="loginErrorPanel" width="250px">
<h:messages errorClass="error" infoClass="info" />
</h:panelGrid>
</a4j:outputPanel></td>
</tr>
</tbody>
</table>
</h:form>
</div>
<div class="shadow"></div>
</div>
</div>
</div>
</div>
</div>
<a4j:jsFunction name="clearSessionContext"
action="#{loginBean.clearSessionContext}">
</a4j:jsFunction>
<a4j:jsFunction name="loginTest" action="#{loginBean.validateLogin}"
oncomplete="submitForm(); return false;"
render="loginErrorOutPanel,loginErrorPanel">
</a4j:jsFunction>
<script>
// To focus on page startup
jQuery(document).ready(function(){
clearSessionContext();
jQuery("#j_username").focus();
});
// Submitting the form on press enter
jQuery(document).ready(jQuery('html').bind('keypress', function(e)
{
if(e.keyCode == 13)
{
clearSessionContext();
loginTest();
//submitForm();
}
}));
// does the validation and submits the form
function submitForm() {
var validationMsg = '';
if(jQuery("#j_username").val().length == 0) {
validationMsg = "Please enter the User Name";
}
if(jQuery("#j_password").val().length == 0) {
validationMsg += "\nPlease enter the Password";
}
if(jQuery("#loginCompany").val().length == 0) {
validationMsg += "\nPlease enter the Company";
}
if(jQuery("#loginSite").val().length == 0) {
validationMsg += "\nPlease enter the Site";
}
if (validationMsg.length == 0) {
document.loginForm.action = "${facesContext.externalContext.requestContextPath}/j_spring_security_check";
document.loginForm.submit();
}
}
function resetForm() {
document.loginFormId.reset();
}
</script>
</ui:define>
</ui:composition>
</ui:composition>
sso-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd">
<!-- TODO: Import META-INF/spring/spring-security-mandatory.xml. Copy this
entry from the solution -->
<beans:import resource="web-security-context.xml" />
<http pattern="/login/**" security="none" />
<http pattern="/pages/login/**" security="none" />
<http pattern="/css/**" security="none" />
<http pattern="/images/**" security="none" />
<http pattern="/rfRes/**" security="none" />
<http pattern="/resources/**" security="none" />
<http pattern="/javax.faces.resource/**" security="none" />
<http pattern="/js/*" security="none" />
<http pattern="/pages/login/login.jsf" security="none" />
<http pattern="/logout.xhtml" security="none" />
<!-- <http pattern="/newlogin.jsp" security="none" /> -->
<http pattern="/logout.jsp" security="none" />
<http pattern="/error.jsp" security="none" />
<http pattern="/favicon.ico" security="none" />
<!-- <http pattern="/templates/**" security="none" /> -->
<!-- <http pattern="/index.html" security="none" /> <http pattern="/index.xhtml"
security="none" /> -->
<http use-expressions="false" auto-config="false" entry-point-ref="authenticationEntryPoint">
<intercept-url pattern="/j_spring_security_check"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/j_spring_security_logout"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/pages/login/login.jsf" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/help/**" access="IS_AUTHENTICATED_FULLY" />
<intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" />
<custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
<!-- <custom-filter ref="hdivValidationFilter" before="SECURITY_CONTEXT_FILTER" /> -->
<custom-filter ref="sessionManagementFilter" before="SESSION_MANAGEMENT_FILTER" />
<custom-filter ref="basicAuthenticationFilter" after="BASIC_AUTH_FILTER" />
<custom-filter ref="applicationSessionFilter" before="FORM_LOGIN_FILTER" />
<custom-filter ref="applicationUsernamePasswordAuthProcessingFilter"
position="FORM_LOGIN_FILTER" />
<logout logout-url="/j_spring_security_logout"
invalidate-session="true" success-handler-ref="logoutSuccessHandler" />
</http>
<!-- <beans:bean id="hdivValidationFilter"
class="org.hdiv.filter.ValidatorFilter">
</beans:bean> -->
<beans:bean id="authenticationEntryPoint"
class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
<beans:constructor-arg name="loginFormUrl" value="/pages/login/login.jsf" />
</beans:bean>
<beans:bean id="sessionManagementFilter"
class="org.springframework.security.web.session.SessionManagementFilter">
<beans:constructor-arg name="securityContextRepository"
ref="httpSessionSecurityContextRepository" />
<!-- this permits redirection to session timeout page from javascript/ajax
or http -->
<beans:property name="invalidSessionStrategy" ref="jsfRedirectStrategy" />
</beans:bean>
<beans:bean id="jsfRedirectStrategy"
class=".admin.security.JsfSessionTimeoutStrategy">
<beans:constructor-arg name="invalidSessionUrl"
value="/pages/login/login.jsf" />
</beans:bean>
<beans:bean id="httpSessionSecurityContextRepository"
class="org.springframework.security.web.context.HttpSessionSecurityContextRepository" />
<beans:bean id="basicAuthenticationFilter"
class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter">
<beans:constructor-arg name="authenticationManager" ref="authenticationManager" />
<beans:constructor-arg name="authenticationEntryPoint" ref="authenticationEntryPoint" />
</beans:bean>
<beans:bean id="applicationUsernamePasswordAuthProcessingFilter"
class=".admin.security.applicationUserNamePasswordFilter">
<beans:property name="authenticationManager" ref="authenticationManager" />
<beans:property name="filterProcessesUrl" value="/j_spring_security_check" />
<beans:property name="authenticationSuccessHandler"
ref="defauthenticationSuccessHandler" />
<beans:property name="authenticationFailureHandler"
ref="defauthenticationFailureHandler" />
</beans:bean>
<beans:bean id="defauthenticationSuccessHandler"
class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"
p:alwaysUseDefaultTargetUrl="false" p:defaultTargetUrl="/index.jsp" />
<!-- <beans:bean id="defauthenticationSuccessHandler" class=".admin.security.applicationAuthenticationSuccessHandler"
p:alwaysUseDefaultTargetUrl="false" > <beans:property name="defaultTargetUrl"
value="/index.jsp" /> </beans:bean> -->
<!-- <beans:bean id="defauthenticationFailureHandler" class=".admin.security.applicationAuthenticationFailureHandler"
p:defaultFailureUrl="/newlogin.jsp?login_error=1"> <beans:property name="redirectPage"
value="/newlogin.jsp" /> <beans:property name="contextRelative" value="true"
/> </beans:bean> -->
<beans:bean id="defauthenticationFailureHandler"
class=".admin.security.applicationAuthenticationFailureHandler"
p:defaultFailureUrl="/pages/login/login.jsf?login_error=1">
</beans:bean>
<authentication-manager alias="authenticationManager">
<!-- <authentication-provider ref="cmsAuthenticationProvider" /> -->
<authentication-provider user-service-ref="applicationLoginService" /> <!-- for form-login -->
<!-- <authentication-provider ref="kerberosServiceAuthenticationProvider"
/> -->
<authentication-provider ref="rememberMeAuthenticationProvider" />
</authentication-manager>
<!-- This ensures that remember-me is added as an authentication provider -->
<!-- <beans:bean id="rememberMeAuthenticationProvider" class=".admin.security.applicationAuthenticationProvider">
</beans:bean> -->
<beans:bean id="rememberMeAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<beans:property name="userDetailsService" ref="applicationLoginService" />
</beans:bean>
<beans:bean id="logoutSuccessHandler"
class="org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler">
<beans:property name="defaultTargetUrl" value="/pages/login/login.jsf?login_error=2" />
</beans:bean>
<beans:bean class=".admin.security.applicationSessionFilter"
id="applicationSessionFilter">
<beans:constructor-arg name="securityContextRepository"
ref="httpSessionSecurityContextRepository" />
<beans:constructor-arg name="invalidSessionStrategy"
ref="jsfRedirectStrategy" />
</beans:bean>
</beans:beans>
LoginBean.java:
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.event.ComponentSystemEvent;
import javax.faces.model.SelectItem;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.LockedException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.authentication.AccountExpiredException;
import org.springframework.security.web.WebAttributes;
#ManagedBean(name = "loginBean")
#SessionScoped
public class LoginBean implements Serializable {
private Logger LOGGER = LoggerFactory.getLogger(getClass());
private String username = "";
private String password = "";
private String company = "";
private String login;
public String login() {
try {
LOGGER.debug("Login initiated....");
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest) context.getRequest();
if (validateLoginRequest(request)) {
RequestDispatcher dispatcher = ((ServletRequest) context.getRequest())
.getRequestDispatcher("/j_spring_security_check");
dispatcher.forward((ServletRequest) context.getRequest(), (ServletResponse) context.getResponse());
FacesContext.getCurrentInstance().responseComplete();
}
}
catch (Exception ex) {
CommonUtil.addFacesMessage("Login Failed . Bad Credentials", FacesMessage.SEVERITY_ERROR);
}
return null;
}
public boolean validateLogin() {
LOGGER.debug("Login initiated....");
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request = (HttpServletRequest) context.getRequest();
if (validateLoginRequest(request)) {
return true;
}
else {
return false;
}
}
public void clearSessionContext() {
LOGGER.debug("Clearing.....SessionContext.....");
if (SecurityContextHolder.getContext() != null) {
SecurityContextHolder.createEmptyContext();
SecurityContextHolder.getContext().setAuthentication(null);
((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession(true);
}
}
private boolean validateLoginRequest(HttpServletRequest request) {
clearExceptions();
String userName = request.getParameter("j_username");
String password = request.getParameter("j_password");
String company = request.getParameter("loginCompany");
String site = request.getParameter("loginSite");
if (userName == null || (userName != null && userName.isEmpty())) {
CommonUtil.addFacesMessage("Username is mandatory", FacesMessage.SEVERITY_ERROR);
return false;
}
if (password == null || (password != null && password.isEmpty())) {
CommonUtil.addFacesMessage("Password is mandatory", FacesMessage.SEVERITY_ERROR);
return false;
}
if (serverConfigService.getServerHostingType().equalsIgnoreCase(ServerHostingType.MULTIHOSTING.toString())) {
if (company == null || (company != null && company.isEmpty())) {
CommonUtil.addFacesMessage("Company is mandatory", FacesMessage.SEVERITY_ERROR);
return false;
}
}
if (site == null || (site != null && site.isEmpty())) {
CommonUtil.addFacesMessage("Site is mandatory", FacesMessage.SEVERITY_ERROR);
return false;
}
return true;
}
}
I'm using PhoneGap Build with OneSignal but it is not working. It shows only the first alert message.
Here is the code:
https://github.com/claudiosw/ZumitApp/
And you can download the app here:
https://build.phonegap.com/apps/2193000/builds
Also pasting the code here:
File config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.zumitapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>ZumitApp</name>
<description>Tenha Mais Resultados</description>
<author email="claudiosw#" href="http://zumitapp.com/App">Claudio Shigueo Watanabe</author>
<preference name="phonegap-version" value="cli-6.3.0" />
<feature name="http://api.phonegap.com/1.0/device" />
<preference name="orientation" value="portrait" /> <!-- all: default means both landscape and portrait are enabled -->
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.media-capture" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.file-transfer" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.contacts" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.vibration" />
<gap:plugin name="org.apache.cordova.network-information" />
<!--gap:plugin name="com.simplec.plugins.localnotification" /-->
<!--plugin name="com.onesignal.plugins.onesignal" spec="1.5.0" source="pgb" /-->
<!--plugin name="com.onesignal.plugins.onesignal" spec="1.9.0" source="pgb" /-->
<gap:plugin name="onesignal-cordova-plugin-pgb-compat" source="npm" />
<gap:plugin name="cordova-plugin-googleplayservices" source="npm" />
<gap:plugin name="cordova-plugin-android-support-v4" source="npm" />
<!--gap:plugin name="onesignal-cordova-plugin" source="npm" /-->
<!-- Recommend the newest cli but requires cli-5.1.1+ and gradle for Android. -->
<!-- If the below settings are not compatible with your project set the "PGB ANT" version above. -->
<!--preference name="android-build-tool" value="gradle" /-->
<icon src="icon.png" />
<icon src="res/icons/ios/Icon.png" gap:platform="ios" width="57" height="57" />
<icon src="res/icons/ios/Icon#2x.png" gap:platform="ios" width="114" height="114" />
<icon src="res/icons/ios/Icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="res/icons/ios/Icon-72#2x.png" gap:platform="ios" width="144" height="144" />
<icon src="res/icons/android/drawable-ldpi/Icon.png" gap:platform="android" gap:density="ldpi" />
<icon src="res/icons/android/drawable-mdpi/Icon.png" gap:platform="android" gap:density="mdpi" />
<icon src="res/icons/android/drawable-hdpi/Icon.png" gap:platform="android" gap:density="hdpi" />
<icon src="res/icons/android/drawable-xdpi/Icon.png" gap:platform="android" gap:density="xhdpi" />
<gap:splash src="ZumitApp_grande.jpg" />
<gap:splash src="res/screen/android/drawable-ldpi/splash.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="res/screen/android/drawable-mdpi/splash.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="res/screen/android/drawable-hdpi/splash.png" gap:platform="android" gap:density="hdpi" />
<gap:splash src="res/screen/android/drawable-xdpi/splash.png" gap:platform="android" gap:density="xhdpi" />
<gap:splash src="res/screen/ios/Default.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="res/screen/ios/Default#2x.png" gap:platform="ios" width="680" height="960" />
<gap:splash src="res/screen/ios/Deafult-568h-2x.png" gap:platform="ios" width="640" height="1136" />
<preference name="stay-in-webview" value="true" />
<content src="index.html" />
<access origin="*" subdomains="true" />
<allow-navigation href="*" />
</widget>
File index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ZumitApp</title>
<script src="phonegap.js"></script>
<script src="jquery.min.js"></script>
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the Codova API
// Enable to debug issues.
alert("teste0");
window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
alert("teste1");
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
alert("teste2");
window.plugins.OneSignal.init("22a70849-091e-4eca-8b5b-e7fc5821f95b",
{googleProjectNumber: "428050097085"},
notificationOpenedCallback);
alert("teste3");
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.enableInAppAlertNotification(true);
//alert("teste4");
window.location="http://zumitapp.com/App";
//alert("teste5");
}
</script>
</head>
<body>
<header class="bar bar-nav">
<h1 class="title">Boas-vindas ao ZumitApp</h1>
</header>
<h2>Aguarde. Carregando...</h2>
</body>
</html>
I have tried to debug but it didn't worked out. Maybe it is because my smartphone is old (LG-P705) or the desktop (Windows Vista).
Thanks you very much!
I have a webbrowser in my winphone 7 app to display a few webpages that contains 2 buttons left and right with a title in the middle, below that a gridview and a few pictures below the gridview.
I tried just about every combination of the following:
<!--meta name="viewport" content="target-densitydpi=device-dpi; width=device-width; initial-scale=0.35; user-scalable=yes" /-->
<!--meta name="mobileoptimized" content="0" /-->
<!--meta name="viewport" content="width=480; initial-scale=5.0; user-scalable=yes;" id="ViewPort" runat="server" />
<!--meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" /-->
<!--meta name="HandheldFriendly" content="true" /-->
<!--meta name="apple-mobile-web-app-capable" content="yes" /-->
If I use device-width the last few columns in my gridview is off screen, trying to scale it properly with initial-scale does nothing.
If I use a set width, for instance 320 or 640, the gridview becomes to small (smaller then the width of the screen), and initial-scale again does nothing.
Any idea's ?
aspx source added :
<%# Page Language="C#" AutoEventWireup="true" CodeFile="iDetailled.aspx.cs" Inherits="iDetailled" Title="test" EnableEventValidation="false" %>
<%# Register assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<!--meta name="viewport" content="target-densitydpi=device-dpi; width=device-width; initial-scale=0.35; user-scalable=yes" /-->
<!--meta name="mobileoptimized" content="0" /-->
<meta name="viewport" content="width=device-width, initial-scale=0.9,user-scalable=yes" id="ViewPort" runat="server" />
<!--meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" /-->
<!--meta name="HandheldFriendly" content="true" /-->
<!--meta name="apple-mobile-web-app-capable" content="yes" /-->
<title></title>
<script type="text/javascript">
function CallMe() { javascript: history.go(-1); }
</script>
</head>
<link rel="stylesheet" type="text/css" href="stylesheet.css"
media="screen"/>
<body class="GradientBackground3" bgcolor="#CFD1D2">
<form id="form1" runat="server" >
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableHistory="True"
onnavigate="ScriptManager1_Navigate">
</asp:ScriptManager>
<div align="center">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:MultiView ID="MultiView1" runat="server"
onactiveviewchanged="MultiView1_ActiveViewChanged" >
<asp:View ID="View1" runat="server">
<br />
<asp:Panel ID="Panel2" runat="server" Width="90%" >
<table align="center" width="100%">
<tr>
<td align="left" >
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Images/min2.png" Height="48px" onclick="ImageButton1_Click"
Width="48px" />
</td>
<td>
<table align="center" >
<tr align="center">
<td>
<asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Size="Large" Text="Turnover by day"></asp:Label>
</td>
</tr>
<tr align="center">
<td>
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</td>
<td align="right">
<asp:ImageButton ID="ImageButton2" runat="server" Height="48px"
ImageUrl="~/Images/plus2.png" onclick="ImageButton2_Click" Width="48px" />
</td>
</tr>
</table>
</asp:Panel>
<br />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="SqlDataSourceDag" ForeColor="#333333"
GridLines="Vertical" onrowcreated="GridView2_RowCreated"
onselectedindexchanged="GridView2_SelectedIndexChanged"
onrowdatabound="GridView2_RowDataBound"
EmptyDataText="No data to display" >
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="TYBusinessDate" DataFormatString="{0:dd/MM}"
HeaderText="This Year" ReadOnly="True"
SortExpression="TYBusinessDate">
<HeaderStyle VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
</asp:BoundField>
<asp:BoundField DataField="LYBusinessDate" DataFormatString="{0:dd/MM}"
HeaderText="Last Year" ReadOnly="True"
SortExpression="LYBusinessDate">
<HeaderStyle VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
</asp:BoundField>
<asp:BoundField DataField="Day" HeaderText="Day" ReadOnly="True"
SortExpression="Day">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="TYTurnoverAmt" DataFormatString="{0:F0}"
HeaderText="This Year" ReadOnly="True" SortExpression="TYTurnoverAmt">
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="LYTurnoverAmt" DataFormatString="{0:F0}"
HeaderText="Last Year" ReadOnly="True" SortExpression="LYTurnoverAmt">
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:TemplateField HeaderText="%">
<ItemTemplate>
<asp:Label ID="Label55" runat="server" Text="Label"></asp:Label>
</ItemTemplate>
<HeaderStyle VerticalAlign="Bottom" HorizontalAlign="Right" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:BoundField DataField="TYClients" HeaderText="This Year" ReadOnly="True"
SortExpression="TYClients" >
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="LYClients" HeaderText="Last Year" ReadOnly="True"
SortExpression="LYClients" >
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="~/Images/arrow.png"
onclick="ImageButton5_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<br />
<asp:Chart ID="Chart2" runat="server" DataSourceID="SqlDataSourceDag" BackColor="#CFD1D2" >
<Titles>
<asp:Title Name="Title1" Text="Turnover">
</asp:Title>
</Titles>
<series>
<asp:Series Name="ThisYear" XValueMember="Day" YValueMembers="TYTurnoverAmt" LegendText="Turnover this year">
</asp:Series>
<asp:Series Name="LastYear" XValueMember="Day" YValueMembers="LYTurnoverAmt" LegendText="Turnover last year">
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true" Area3DStyle-IsClustered="true" BackColor="White" >
<AxisY IntervalAutoMode="VariableCount" IntervalType="Number" IntervalOffsetType="Number">
</AxisY>
<Area3DStyle Enable3D="True" IsClustered="True" />
</asp:ChartArea>
</chartareas>
<Legends>
<asp:Legend Docking="Bottom" Name="Legend1" BackColor="#CFD1D2" >
</asp:Legend>
</Legends>
</asp:Chart>
<asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSourceDag" BackColor="#CFD1D2">
<Titles>
<asp:Title Name="Title1" Text="Clients">
</asp:Title>
</Titles>
<series>
<asp:Series ChartType="Line" Legend="Legend1"
Name="ClientTY" XValueMember="Day" YValueMembers="TYClients" BorderWidth="3" LegendText="Clients this year">
</asp:Series>
<asp:Series ChartType="Line" Legend="Legend1"
Name="ClientLY" XValueMember="Day" YValueMembers="LYClients" BorderWidth="3" LegendText="Clients last year">
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" >
<AxisY IntervalAutoMode="VariableCount" IntervalType="Number" IntervalOffsetType="Number">
</AxisY>
<AxisX IsLabelAutoFit="False">
<LabelStyle Angle="-90" />
</AxisX>
</asp:ChartArea>
</chartareas>
<Legends>
<asp:Legend Docking="Bottom" Name="Legend1" BackColor="#CFD1D2">
</asp:Legend>
</Legends>
</asp:Chart>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Back"
Visible="False" />
<br />
<asp:SqlDataSource ID="SqlDataSourceDag" runat="server"
ConnectionString="<%$ ConnectionStrings:OSCConnectionString %>"
SelectCommand="WWWiPhoneAllStoresPerDay" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
</asp:View>
....second view stripped
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
The attributes initial-scale, minimum-scale, and maximum-scale are unsupported in WP7. For now, you can only use height, width, and user-scalable. I've found that the blog post Matt linked to has some incorrect/misleading info. See the following for more accurate information: http://msdn.microsoft.com/en-us/library/ff462082%28VS.92%29.aspx
Also, from what I've seen, WP7 needs the separators between attributes to be commas, not semi-colons.
Without being able to see the page you're trying to display it's hard to say for sure but it sounds like you may have something else on the page affecting the display of the grid.
For reference, the viewport options are documented at http://blogs.msdn.com/b/iemobile/archive/2010/11/22/the-ie-mobile-viewport-on-windows-phone-7.aspx
I found the most suitable viewport for mobile windows 7 is:
<meta id="viewport" name="viewport" content="width=${wurfl.getProperty('max_image_width')}; initial-scale=1.0; maximum-scale=1.0"/>