Sunday, December 28, 2008

./configure picks up wrong packages

To set the correct package set PKG_CONFIG_PATH so that it picks up right files
Example:
PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure

Monday, December 15, 2008

creating bash variable which has newline

Normally bash does not process \n the way c does.
myVar="Hi there.\n Me Here";
echo "$myVar";

above will just print
Hi there.\n Me Here

Use for c type of interpretation
so changing above script to
myVar="Hi there."$'\n'" Me Here";
echo "$myVar";

This will print
Hi there.
Me Here

Wednesday, October 8, 2008

Click to validate XML

XML Attributes

Avoid XML Attributes?

Some of the problems with using attributes are:

  • attributes cannot contain multiple values (elements can)
  • attributes cannot contain tree structures (elements can)
  • attributes are not easily expandable (for future changes)

Attributes are difficult to read and maintain. Use elements for data. Use attributes for information that is not relevant to the data.

Don't end up like this:

to="Tove" from="Jani" heading="Reminder"
body="Don't forget me this weekend!">

XML Notes

Entity References

Some characters have a special meaning in XML.

If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element.

This will generate an XML error:

if salary <>

To avoid this error, replace the "<" character with an entity reference:

if salary < 1000 then

There are 5 predefined entity references in XML:

< < less than
> > greater than
& & ampersand
' ' apostrophe
" " quotation mark

Note: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.