Month: September 2007

Javascript’s parseInt

Javascript is a loosely typed language, which means it is possible to define a variable without specifying what type of data it holds (string, integer, floating point, etc.). This can cause problems if you think a particular value is a number when in fact it is a string. A string must be converted to a number to use it in calculations.

For example, when working with SCORM elearning software, scoring and performance data is stored in a Learning Management System as strings. If you need to do calculations with the data after retrieving it, the string data must be converted to integers or floating point type.

The parseInt() function can be used for this purpose. It parses a string and returns an integer. However use of the function without understanding the details can lead to unexpected results. If your string begins with a zero, the number will be evaluated in octal instead of decimal system. In Octal, 08, 09 are not valid numbers, and 010, 011, etc. will not represent the same values as they would in decimal system.

Continue reading

Interesting DNA, RNA research you might have missed

There is much happening in genetics it’s hard to know where to start listing the highlights. Here are some of the more interesting items I’ve come across recently:

Did DNA replication evolve twice independently?
by Leipe DD, Aravind L, Koonin EV. in
Nucleic Acids Res. 1999 Sep 1;27(17):3389-401.

DNA replication is central to all extant cellular organisms.
principal proteins involved in transcription and translation, which are highly conserved in all divisions of life.
We performed detailed sequence comparisons of the proteins that fulfill indispensable functions in DNA replication and classified them.

Continue reading

Including HTML data in an xml document

When developing an xml-based application, you may come across the need to include HTML data in xml nodes. The problem is that unless this data is escaped in some way, it is interpreted as xml and will cause a malformed structure. The easiest way I’ve found so far to use a CDATA attribute to escape the code automatically. Then, when you are creating an xsl fragment to edit or display the data, use

Continue reading