I am Not able to fetch all the correct order details in ListOrderSample.php File ..in some orders date is wrong or in some orders address is missing .Please suggest me a solution. I have attached the code which i am using
$i=0;
$prevclr="";
if(is_object($x3)){
foreach ($x3->childNodes AS $item) {
$x4 = $x3->childNodes->item(0);
$i++;
$OrdID = $item->childNodes->item(0)->nodeValue;
$Purchase_dt = $item->childNodes->item(1)->nodeValue;
$Purchase_dtt = $Purchase_dt;
$Purchase_dtt_display = "";
if($Purchase_dtt!=NULL){
$timestamp = strtotime($Purchase_dtt);
$Purchase_dtt_display = date('m/d/Y',$timestamp);
}
$Ord_status = $item->childNodes->item(3)->nodeValue;
if($Ord_status == "Canceled" || $Ord_status == "Pending"){
$ship_add_str = "-";
$Ord_tot_str = "-";
$Ord_typp = $item->childNodes->item(12)->nodeValue;
$pay_mthod = "-";
$buyerstr="-";
}
else{
$Shipp_add = $item->childNodes->item(7);
$ship_add_str="";
if(is_object($Shipp_add->childNodes->item(0))){
$ship_add_str = $Shipp_add->childNodes->item(0)->nodeValue;
}
if(is_object($Shipp_add->childNodes->item(1))){
$ship_add_str = $ship_add_str ."<br>".$Shipp_add->childNodes->item(1)->nodeValue;
}
if(is_object($Shipp_add->childNodes->item(2))){
if($Shipp_add->childNodes->item(2)->nodeName == "City"){
$ship_add_str = $ship_add_str ."<br>City: ".$Shipp_add->childNodes->item(2)->nodeValue;
}
else{
$ship_add_str = $ship_add_str ."<br>".$Shipp_add->childNodes->item(2)->nodeValue;
}
}
if(is_object($Shipp_add->childNodes->item(3))){
if($Shipp_add->childNodes->item(3)->nodeName == "StateOrRegion"){
$ship_add_str = $ship_add_str ."<br>State/Region: ".$Shipp_add->childNodes->item(3)->nodeValue;
}
else if($Shipp_add->childNodes->item(3)->nodeName == "City"){
$ship_add_str = $ship_add_str ."<br>City: ".$Shipp_add->childNodes->item(3)->nodeValue;
}
}
}
Related
void updateList(void) {
numCam = get_noofcameras_connected();
if (numCam != 0) {
CameraSelect->Text = ("Please select Camera");
CameraSelect->Items->Add("ALL");
for (int i = 1; i < numCam + 1; i++) {
CameraSelect->Items->Add(string::format("Camera {0}", i));
}
}
else {
CameraSelect->Text = ("NO CAMERA CONNECTED");
}
}
it is giving the error string is ambiguous .
for c# you can call .Format
here an example from the
doc
Decimal pricePerOunce = 17.36m;
String s = String.Format("The current price is {0} per ounce.",
pricePerOunce);
Console.WriteLine(s);
I have tried to run the code below but got a error when using mesh.delete_face(*it, false);
vector<TriMesh::FaceHandle> terminalFaces;
OpenMesh::FPropHandleT<int> faceType;
OpenMesh::FPropHandleT<bool> faceChecked;
mesh.add_property(faceType, "face-type");
mesh.add_property(faceChecked, "face-checked");
tFillFacesProperty(mesh, faceChecked, false);
tClassifyFaces(mesh, faceType);
terminalFaces = tSplitJointFaces(mesh, faceType);
tClassifyFaces(mesh, faceType);
tAdjustAllVertices(mesh);
for (int i = 0; i < terminalFaces.size(); i++)
{
if (mesh.property(faceType, terminalFaces[i]) != FT_TERMINAL)
continue;
if (mesh.property(faceChecked, terminalFaces[i]))
continue;
vector<TriMesh::VertexHandle> collectedVs;
vector<TriMesh::FaceHandle> collectedFs;
for (TriMesh::FaceVertexIter fvi = mesh.fv_begin(terminalFaces[i]);
fvi != mesh.fv_end(terminalFaces[i]);
++fvi)
{
if (mesh.valence(*fvi) == 2) {
collectedVs.push_back(*fvi);
break;
}
}
assert(collectedVs.size() == 1);
while(1){
bool mustStop = false;
if (collectedFs.empty())
collectedFs.push_back(terminalFaces[i]);
else {
TriMesh::FaceHandle nextFh;
for (TriMesh::FaceFaceIter ffi = mesh.ff_begin(collectedFs.back());
ffi != mesh.ff_end(collectedFs.back());
++ffi)
{
if ((find(collectedFs.begin(), collectedFs.end(), *ffi) == collectedFs.end())
&& mesh.is_valid_handle(*ffi)
&& mesh.property(faceType, *ffi) != FT_NEW)
{
nextFh = *ffi;
break;
}
}
if (mesh.is_valid_handle(nextFh))
collectedFs.push_back(nextFh);
else
mustStop = true;
}
TriMesh::FaceHandle curfh = collectedFs.back();
mesh.property(faceChecked, curfh) = true;
int t = mesh.property(faceType, curfh);
if (t == FT_SLEEVE || t == FT_TERMINAL) {
TriMesh::HalfedgeHandle hh2check;
for (TriMesh::FaceHalfedgeIter fhi = mesh.fh_begin(curfh);
fhi != mesh.fh_end(curfh);
++fhi)
{
TriMesh::FaceHandle oppof = mesh.opposite_face_handle(*fhi);
if (mesh.is_valid_handle(oppof)
&& (find(collectedFs.begin(), collectedFs.end(),oppof) == collectedFs.end()))
{
hh2check = *fhi;
break;
}
}
assert(mesh.is_valid_handle(hh2check) && !mesh.is_boundary(hh2check));
// add new vertices
TriMesh::VertexHandle right, left;
right = mesh.from_vertex_handle(hh2check);
left = mesh.to_vertex_handle(hh2check);
assert(mesh.is_valid_handle(left) && mesh.is_valid_handle(right));
if ((find(collectedVs.begin(), collectedVs.end(), left) == collectedVs.end())
&& mesh.is_valid_handle(left))
collectedVs.insert(collectedVs.begin(), left);
if ((find(collectedVs.begin(), collectedVs.end(), right) == collectedVs.end())
&& mesh.is_valid_handle(right))
collectedVs.push_back(right);
bool inCircle = true;
TriMesh::Point center = (mesh.point(right) + mesh.point(left)) / 2.0;
double diamSq = tSqDist(mesh.point(right), mesh.point(left));
for (int i = 1; i < collectedVs.size() - 1; i++)
{
TriMesh::VertexHandle vh = collectedVs[i];
if (tSqDist(mesh.point(vh), center) * 4 > diamSq) {
inCircle = false;
break;
}
}
if (inCircle && !mustStop) {
continue;
}
else {
OpenMesh::IO::write_mesh(mesh, "outputtr.off");
for (vector<TriMesh::FaceHandle>::iterator it = collectedFs.begin(); it != collectedFs.end(); ++it){
mesh.delete_face(*it, false);
}
I used delete_face() in openmesh to remove one of the faces in mesh.
However, debugging always shows abort() and the error panel just like:
R6010 -abort() has been called
and the breakpoint was triggered by _CrtDbgBreak():
case 1: _CrtDbgBreak(); msgshown = 1;
Maybe the error is caused by a dangling reference/pointer, or an invalidated iterator. How could I fix it?
Just add "mesh.request_face_status();" and solved.
I use the JID3 library which works fine for IDv2_3 but when it is asked to update a tracks tags which are V2_4, it simply wipes the Id3v2_4 tags. How can I test which version of tagging a track has.
Example of setting the ratings and times played in the POPULARIMETER tag
public String setmp3RatingTag(Context context, File SourceFile, String email, int rating, int timesPlayed) throws Exception {
String error = null;
if (timesPlayed < 0) {
timesPlayed = 0;
}
try {
MediaFile MediaFile = new MP3File(SourceFile);
ID3V2_3_0Tag ID3V2_3_0Tag = (org.blinkenlights.jid3.v2.ID3V2_3_0Tag) MediaFile.getID3V2Tag();
POPMID3V2Frame popmid3V2Frame = new POPMID3V2Frame(email, rating, timesPlayed);
popmid3V2Frame.setPopularity(email, rating, timesPlayed);
if (ID3V2_3_0Tag != null) {
frames = ID3V2_3_0Tag.getPOPMFrames();
if (frames != null) {
if (frames.length > 0) {
String emailtouser[]=getmp3Email(SourceFile);
for (int i = 0; i < frames.length; i++) {
if (frames[i] != null) {
ID3V2_3_0Tag.removePOPMFrame(emailtouser[i]);
}
}
}
}
} else {
ID3V2_3_0Tag = new ID3V2_3_0Tag();
}
ID3V2_3_0Tag.addPOPMFrame(popmid3V2Frame);
MediaFile.setID3Tag(ID3V2_3_0Tag);
MediaFile.sync();
} catch (ID3Exception | OutOfMemoryError e) {
e.printStackTrace();
error = e.getMessage();
}
error = finish(context, SourceFile);
return error;
}
For anyone using the jid3 library, I added another method to the class MP3File.java
#Override
public int testforVerion() {
int iMinorVersion=0;
try {
InputStream oSourceIS = new BufferedInputStream(m_oFileSource.getInputStream());
ID3DataInputStream oID3DIS = new ID3DataInputStream(oSourceIS);
try
{
// check if v2 tag is present
byte[] abyCheckTag = new byte[3];
oID3DIS.readFully(abyCheckTag);
if ((abyCheckTag[0] == 'I') && (abyCheckTag[1] == 'D') && (abyCheckTag[2] == '3'))
{
// check which version of v2 tags we have
iMinorVersion = oID3DIS.readUnsignedByte();
}
else
{
return iMinorVersion;
}
}
finally
{
oID3DIS.close();
}
} catch (IOException e) {
e.printStackTrace();
}
return iMinorVersion;
}
simply check for value 3 for ID3V2_3 and 4 for ID3V2_4
I have been working on a menu that is injected with a dll into call of duty modern warfare 3. As I added options to the menu, I wanted to create a void that allows me to swap a bool value.
I have tried that:
void swapBool(bool& xbool)
{
if (xbool)
!xbool;
else if (!xbool)
xbool;
}
However, it isn't working.
This is what I want it to achieve:
if (displayInfoBox)
displayInfoBox = false;
else if (!displayInfoBox)
displayInfoBox = true;
Because of that many bools and many more coming i wanted to create a void...
if (offHostScroll == 0)
{
if (rgbEffects)
rgbEffects = false;
else if (!rgbEffects)
rgbEffects = true;
}
else if (offHostScroll == 1)
{
if (rgbMenu)
rgbMenu = false;
else if (!rgbMenu)
rgbMenu = true;
}
else if (offHostScroll == 2)
{
if (rgbBakcground)
rgbBakcground = false;
else if (!rgbBakcground)
rgbBakcground = true;
}
else if (offHostScroll == 3)
{
if (rgbMaps)
rgbMaps = false;
else if (!rgbMaps)
rgbMaps = true;
}
else if (offHostScroll == 4)
{
if (rgbInGameIcons)
rgbInGameIcons = false;
else if (!rgbInGameIcons)
rgbInGameIcons = true;
}
else if (offHostScroll == 5)
{
swapBool(displayInfoBox);
/*if (displayInfoBox)
displayInfoBox = false;
else if (!displayInfoBox)
displayInfoBox = true;*/
}
Simply:
displayInfoBox = !displayInfoBox;
or
xbool = !xbool;
! by itself does not change the value of the variable, it just creates a new value by negating it, so you have to reassign it.
You also will have to make swapBool pass xbool by reference.
void swapBool(bool& xbool);
As in my picture I have DateTime of SLA and Finish Date, and Finish Date is the same value of SLA but it allows user to add or change the DateTime. When I change the DateTime on Finish Date, it got the default value of Time was 12:00 PM or 12:00 AM. Is there any way to change the default time to current time? and will there be any impact if user changes the user locale format?
This is my UsrFinishDate default value:
UsrFinishDate (New Field)
[PXDBDate(PreserveTime = true)]
[PXUIField(DisplayName="Finish Date")]
protected void CRCase_UsrFinishDate_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
{
CRCase row = e.Row as CRCase;
CRCaseExt rowExt = PXCache<CRCase>.GetExtension<CRCaseExt>(row);
if (row == null || row.AssignDate == null) return;
if (row.ClassID != null && row.Severity != null)
{
var severity = (CRClassSeverityTime)PXSelect<CRClassSeverityTime,
Where<CRClassSeverityTime.caseClassID, Equal<Required<CRClassSeverityTime.caseClassID>>,
And<CRClassSeverityTime.severity, Equal<Required<CRClassSeverityTime.severity>>>>>
.Select(Base, row.ClassID, row.Severity);
if (severity != null && severity.TimeReaction != null)
{
e.NewValue = row.SLAETA;
e.Cancel = true;
}
}
if (row.Severity != null && row.ContractID != null)
{
var template = (Contract)PXSelect<Contract, Where<Contract.contractID, Equal<Required<CRCase.contractID>>>>.Select(Base, row.ContractID);
if (template == null) return;
var sla = (ContractSLAMapping)PXSelect<ContractSLAMapping,
Where<ContractSLAMapping.severity, Equal<Required<CRCase.severity>>,
And<ContractSLAMapping.contractID, Equal<Required<CRCase.contractID>>>>>
.Select(Base, row.Severity, template.TemplateID);
if (sla != null && sla.Period != null)
{
e.NewValue = row.SLAETA;
e.Cancel = true;
}
}
}
and this is my other event rowSelected:
protected void CRCase_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
{
var row = e.Row as CRCase;
var oldRow = e.OldRow as CRCase;
CRCaseExt rowExt = PXCache<CRCase>.GetExtension<CRCaseExt>(row);
if (row == null || oldRow == null) return;
if (row.OwnerID == null)
{
row.AssignDate = null;
row.SLAETA = null;
rowExt.UsrFinishDate = null;
}
else if (oldRow.OwnerID == null)
{
row.AssignDate = PXTimeZoneInfo.Now;
if (row == null || row.AssignDate == null) return;
if (row.ClassID != null && row.Severity != null)
{
var severity = (CRClassSeverityTime)PXSelect<CRClassSeverityTime,
Where<CRClassSeverityTime.caseClassID, Equal<Required<CRClassSeverityTime.caseClassID>>,
And<CRClassSeverityTime.severity, Equal<Required<CRClassSeverityTime.severity>>>>>.
Select(Base, row.ClassID, row.Severity);
if (severity != null && severity.TimeReaction != null)
{
row.SLAETA = ((DateTime)row.AssignDate).AddMinutes((int)severity.TimeReaction);
rowExt.UsrFinishDate = ((DateTime)row.AssignDate).AddMinutes((int)severity.TimeReaction);
}
}
if (row.Severity != null && row.ContractID != null)
{
var template = (Contract)PXSelect<Contract, Where<Contract.contractID, Equal<Required<CRCase.contractID>>>>.Select(Base, row.ContractID);
if (template == null) return;
var sla = (ContractSLAMapping)PXSelect<ContractSLAMapping,
Where<ContractSLAMapping.severity, Equal<Required<CRCase.severity>>,
And<ContractSLAMapping.contractID, Equal<Required<CRCase.contractID>>>>>.
Select(Base, row.Severity, template.TemplateID);
if (sla != null && sla.Period != null)
{
row.SLAETA = ((DateTime)row.AssignDate).AddMinutes((int)sla.Period);
rowExt.UsrFinishDate = ((DateTime)row.AssignDate).AddMinutes((int)sla.Period);
}
}
}
}
Here is the definition of the field I added to the Case screen, note the PreserveTime = true which I think might be what you are missing.
public class CRCaseExt : PXCacheExtension<PX.Objects.CR.CRCase>
{
#region UsrFinishDate
[PXDBDate(PreserveTime = true)]
[PXUIField(DisplayName = "Finish Date")]
public virtual DateTime? UsrFinishDate { get; set; }
public abstract class usrFinishDate : IBqlField { }
#endregion
}
And here is an easy way to set the current time when the UsrFinishDate value is changed. Don't forget to set the CommitChanges for that field.
protected virtual void CRCase_UsrFinishDate_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
{
CRCase currentCase = (CRCase)e.Row;
var caseExt = PXCache<CRCase>.GetExtension<CRCaseExt>(currentCase);
if (caseExt == null)
{
return;
}
e.NewValue = new DateTime(caseExt.UsrFinishDate.Value.Year,
caseExt.UsrFinishDate.Value.Month,
caseExt.UsrFinishDate.Value.Day,
DateTime.Now.Hour,
DateTime.Now.Minute,
DateTime.Now.Second);
}