Tag Archives: XML

Why do dumb F%&K! Programmers not document their changes in this Alfresco XML Hell?

Why do dumb F%&K! Programmers not document their changes in this Alfresco XML Hell?
You know it is a sad day when you have to look through the thousands of files some dumb FU*K so called programmer cannot document their changes in Alfresco XML Hell. God I hate this combination. F*CK I should be paid $500 per hour doing this crap. I would love to reveal the name of this stupid hack. Better yet, how does some top consulting allow this crap to happen? Stupid management!

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Easiest and best XML parser in C++ or C tutorial with source code

Easiest and best XML parser in C++ or C tutorial with source code

Under Windows, when I have to debug a software that is using the XMLParser Library, it’s usually a nightmare because the library is sooOOOoooo slow in debug mode. To solve this problem, during all the debugging session, I use a very fast DLL version of the XMLParser Library (the DLL is compiled in release mode). Using the DLL version of the XMLParser Library allows me to have lightening XML parsing speed, even in debug mode! Other than that, the DLL version is useless: In the release version of my tool, I always use the normal, “.cpp”-based, XMLParser Library.
• V2.21: Mars 1, 2007: 1 minor change, 1 bug fix
• V2.22: Mars 6, 2007: 1 bug fix
• V2.23: Mars 13, 2007: 1 bug fix
• V2.24: April 24, 2007: 1 bug fix, 1 addition
• V2.25: May 18, 2007: 1 bug fix
• V2.26: May 22, 2007: 1 bug fix
• V2.27: May 28, 2007: 2 additions, 1 minor change, 2 bug fixes
• V2.28: June 27, 2007: 2 additions, 2 minor changes
• v2.29: July 3,2007: 1 bug fix
• v2.30: July 31,2007: 2 bug fixes, 1 addition
• v2.31: August 29,2007: 1 fix
• v2.32: October 4,2007: 1 addition
• v2.33: October 11, 2007: 1 addition
• v2.34: January 25, 2008, 2 additions
• v2.35: February 2, 2008: 1 minor change
• v2.36: March 9, 2008: 2 bug fixes, 2 additions, 4 minor changes
• v2.37: March 24, 2008: 1 bux fix
• v2.38: June 2, 2008: 3 additions
• v2.39: August 9, 2008: 4 additions, 2 bug fixes
• v2.40: December 19, 2008: 1 minor change
• v2.41: June 25, 2009: 1 minor change
o modified the functions ToXMLStringTool::toXML() and XMLParserBase64Tool::decode() to accept null string as input
A small tutorial
Let’s assume that you want to parse the XML file “PMMLModel.xml” that contains:

Hello World!
















Let’s analyse line by line the following small example program:
#include // to get “printf” function
#include // to get “free” function
#include “xmlParser.h”

int main(int argc, char **argv)
{
// this open and parse the XML file:
XMLNode xMainNode=XMLNode::openFileHelper(“PMMLModel.xml”,”PMML”);

// this prints ““:
XMLNode xNode=xMainNode.getChildNode(“Header”);
printf(“Application Name is: ‘%s’\n”, xNode.getChildNode(“Application”).getAttribute(“name”));

// this prints “Hello world!”:
printf(“Text inside Header tag is :’%s’\n”, xNode.getText());

// this gets the number of “NumericPredictor” tags:
xNode=xMainNode.getChildNode(“RegressionModel”).getChildNode(“RegressionTable”);
int n=xNode.nChildNode(“NumericPredictor”);

// this prints the “coefficient” value for all the “NumericPredictor” tags:
for (int i=0; i” (note that the “<” character entity has been replaced by “<"): printf("Application Name is: '%S'\n", xNode.getChildNode("Application").getAttribute("name")); The following command prints on the screen "Hello World!": printf("Text inside Header tag is :'%s'\n", xNode.getText()); Let's assume you want to "go to" the tag named "RegressionTable": xNode=xMainNode.getChildNode("RegressionModel").getChildNode("RegressionTable"); Note that the previous value of the object named xNode has been "garbage collected" so that no memory leak occurs. If you want to know how many tags named "NumericPredictor" are contained inside the tag named "RegressionTable": int n=xNode.nChildNode("NumericPredictor"); The variable n now contains the value 3. If you want to print the value of the coefficient attribute for all the NumericPredictor tags: for (int i=0; i


You can use:
char *t=xMainNode.getChildNode(“Extension”).createXMLString(true);
printf(“%s\n”,t);
free(t);
Note that you must free the memory yourself (using the “free(t);” function) : only the XMLNode objects
and their contents are “garbage collected”. The parameter true to the function createXMLString means that we want formatted output.

The XML Parser library contains many more other small usefull methods that are not described here (The zip file contains some additional examples to explain other functionalities). These methods allows you to:
• navigate easily inside the structure of the XML document
• create, update & save your own XML structure of XMLNode’s.
That’s all folks! With this basic knowledge, you should be able to retreive easily any data from any XML file!

http://www.applied-mathematics.net/tools/xmlParser.html

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

c++ interview questions on XML, quant, and multithreading

XML
You have to manually parse HTTP call whereas SOAP library parses the XML for you and provides methods to get the header and body information.
Quant based:
Describe a CDS to a layman.

What is Z spread?

Difference between a forward and a future?”
Find the error code sample:
Find the error and fill in the blanks, what is the output?
i=0;
i++ || ++i || i–;
printf(“%d\n”,i);
by Scofield:
i++ and I — negate each other, so ++i
i =1
i == 2

i++ is post-increment, when the first operator || gets the value it will still be zero.
++i is pre-increment, so the second operator || will get 2
The || operator will shortcut with:
0 || 2

so the final ++i will not be executed.
Multithreading:
How can you lock a portion of a file and how to use it ?
man -S 2 fcntl

The lockf() function shall lock sections of a file with advisory-mode locks. Calls to lockf() from other threads which attempt to lock the locked file section shall either return an error value or block until the section becomes unlocked.

Say you have a multithreaded network I/O bound server that is single-threaded, under a load of tens of thousands of connections. What is the most expensive operation encountered in processing data, and how would you minimize the impact of the operation?
The most expensive operation is the read from the network socket. You would minimize its impact by using non-blocking sockets and reading as much as you could in one go; this would allow a minimal number of read operations to obtain the contents of the stream.

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!