Thursday, January 31, 2008

XML-DB Mapping Project Is Done

Exception:
  1. the address tags verification.
  2. the address parsing and elements verification.
  3. incorporate results to dashboard.
I will visit these left-overs once the higher up approves the time for testing the other originators.

Wednesday, January 30, 2008

Edwards Ends Second Run for White House

According to NPR: Edwards ends his campaign for the White House.

So depressing... the Dem's horse race is not going to be exciting anymore.

Tuesday, January 29, 2008

What Did I Do Today?

Everything went so fast, I didn't have time to remember them.

Monday, January 28, 2008

Back To SoCal

Arriving at ONT at 10AM, show up at the office around 11:30AM.

While finishing the NGS Policy XML - database verification, I uncorked nasty application behavior. Consider:
<party>
<name>Acme</name>
<address>Address1</address>
<address>Address2</address>
</party>

Normally this XML is transformed into:

Party table
PartyIDName
1Acme

Address table
AddressIDPartyIDAddress
11Address1
21Address2

But nooooooo, the wise developer did this instead:

Party table
PartyIDNameAddr1Addr2
1AcmeAddress1Address2

Now I have to think about catching the wrench before it hits the wheels.

Anyway, mum bought a big painting on Sunday. Since it didn't fit into Lisa's car, I was volunteered to transport the items.

I managed to get some rest around 10PM.

Long day - it is.

Friday, January 25, 2008

Flying To San Jose

Thank god the flight is not delayed, make it to SJ only half an hour late.

Thursday, January 24, 2008

I Am Swimming Through Haze

It was cold this morning .... I had severe headache from waiting in the platform for only 5 minutes, and napped through the trip.

Work was all about broken logic and fighting viral influences.

Wednesday, January 23, 2008

Laziness Has It's Virtue

Yesterday, I blogged OCTA's scheduling mishap and boing2 just posted this: Mathematics of waiting for the bus.

The Zorg ZF1 Commercial

Thanks to io9:



Why Convert XML Data To Hash Structure Using XML::SAX?

Instead of using XML::Simple? The structure, generated by XML::Simple, is not consistent since it recognizes an empty tag as empty hash structure, instead of null string.
  1. Consider this XML data:
    <Order>
    <Number>01234</Number>
    <Status />
    </Order>
  2. Using XML::Simple produces:
    $VAR1 = {
    'Order' => {
    'Status' => {},
    'Number' => '01234'
    }
    };
  3. Utilizing XML::SAX, we could insert a null string instead of an empty hash structure:
    $VAR1 = {
    'Order' => {
    'Status' => '',
    'Number' => '01234'
    }
    };
Remember: it is simpler to assume that all end of hash structure branch is represented by ref($hash) eq "".

Tuesday, January 22, 2008

How To Slow Cook A Piglet

This is how the pieces are glued together:
  1. Consider the original XML data:
    <Order>
    <Number>01234</Number>
    <Status>OPEN</Status>
    </Order>
  2. The XML data is translated into Perl data structure, utilizing XML::SAX(why?):
    $VAR1 = {
    'Order' => {
    'Status' => 'OPEN',
    'Number' => '01234'
    }
    };
    The unordered hash index will not mangle the report anymore since:

  3. Along the way (of parsing XML data using XML::SAX), a report template is created with references at the right places.

    StatusNotes
    <Order>
    <Number>01234</Number>${$REPORT[0]}{'RESULT'}${$REPORT[0]}{'NOTES'}
    <Status>OPEN</Status>${$REPORT[1]}{'RESULT'}${$REPORT[1]}{'NOTES'}
    </Order>

  4. To the bridge the result of comparison and the report template, another data structure is created (will be called: bridge) and it has an exact hash structure as the XML data, but it is holding references to the report template.
    $BRIDGE1 = {
    'Order' => {
    'Status' => '$REPORT[1]',
    'Number' => '$REPORT[0]'
    }
    };
  5. Consider the check data for the XML data above:
    <Order>
    <Number><SQL>'SELECT Status FROM Order WHERE ORDER_ID = <value>'</SQL></Number>
    <Status><SQL>'SELECT OrdNum FROM Order WHERE ORDER_ID = <value>'</SQL></Status>
    </Order>
    Readability is the main reason the check/validation is written in XML format.

  6. Converted to Perl data structure using XML::Simple
    $CHECK1 = {
    'Order' => {
    'Status' => { SQL => 'SELECT Status FROM Order WHERE ORDER_ID = <value>'},
    'Number' => { SQL => 'SELECT OrdNum FROM Order WHERE ORDER_ID = <value>'},
    }
    };
  7. Iterating through the XML hash structure, while maintaining same path of traversal with the bridge and check hash structure:
    $XML{'Order'} 
    -> $BRIDGE1{'Order'}
    -> $CHECK1{'Order'}

    $XML{'Order'}{'Status'}
    -> $BRIDGE1{'Order'}{'Status'}
    -> $CHECK1{'Order'}{'Status'}
  8. Find the end of XML hash structure branch to extract the value.
    if (ref($XML{'Order'}{'Status'}) eq "") {
    $XMLValue = $XML{'Order'}{'Status'};
    }
  9. Get the SQL syntax from check hash and get the content from database.
    if (exists $CHECK1{'Order'}{'Status'}{'SQL'}) {
    $SQL = $CHECK1{'Order'}{'Status'}{'SQL'};
    }
    else {
    # bitch later: no SQL defined.
    }
    $DBVALUE = getValue($SQL);
  10. Compare the content from XML hash structure and database and write the result out to $REPORT[$index], which provided by bridge hash.
    if ($XMLValue eq $DBVALUE) {
    eval "\${".$BRIDGE1{'Order'}{'Status'}."}{'RESULT'} = 'PASSED';";
    eval "\${".$BRIDGE1{'Order'}{'Status'}."}{'NOTES'} = '$NOTE';";
    }
    else {
    eval "\${".$BRIDGE1{'Order'}{'Status'}."}{'RESULT'} = 'FAILED';";
    eval "\${".$BRIDGE1{'Order'}{'Status'}."}{'NOTES'} = '$NOTE';";
    }
  11. After traversing all of the branches of XML hash structure, open the report template and evaluate template, producing:

    StatusNotes
    <Order>
    <Number>01234</Number>PASSED 
    <Status>OPEN</Status>PASSED 
    </Order>


Scheduling Mishap

Oh boy...

Stepping out of Metrolink #682 only to find the buses were gone. The train was only 5 minutes late! I was wondering, these buses were supposed to be there for us (the Metrolink riders), if they decided to depart without us, we needed to wait for another 1 hour for the next one.

What were those people thinking?

Luckily, the next OCTA 471 SB arrived early and the driver decided to send us to work immediately, rather than waiting for another 40 minutes. Others were not so lucky: one of our developer decided to walk and the bus passed him. Tried to help, but the bus couldn't make safe stop for boarding. The others (470) were still waiting when we departed.

Monday, January 21, 2008

Need To Glue All of The Pieces Together

These items are created:
  1. Data - contentRef.conf (PDS)
  2. Report.Template.html (HTML)
  3. Bridge - reportRef.conf (PDS)
  4. Report.html (HTML)
Need to glue them all together to generate report, may take several days to work through the exceptions.

Sunday, January 20, 2008

Bernancke Refuses To Say R....

From The Economist:

Weekend In Simi Valley

I have to go and spend the weekend in Simi Valley after AWOL for 2 weeks.

Breakfast: hash, sausage, eggs and other non-photogenic leftovers.

As usual, dinner at Little Tokyo, and it was cold!!

And this is odd: several Target stores don't have thermal undies.

Saturday, January 19, 2008

Work Work Work

Alright, someone is replacing a network card on production system. Conducting test to see if there is any interruption of service.

Testing is done at 11:30 and the systems is good.