Archive for July, 2007

Escaping

I’ve always felt that networking problems and concepts are useful in application programming as well, as the problems will appear again at a higher level. Escaping is just another one of them.

In networking, signals/packets have special sequences to indicate special conditions such as the end of a frame. However the same special sequence may appear in data. By escaping and the sequence in the data, the receiver will be able to interpret the packet and the data correctly.

At the application programming level, the simplest example is with a quoted String: “This String has “some” quotes.” The some is being quoted in a quoted String. Escaping typically defines an escape character, such as a backslash (\). Therefore when the quote is prefixed by a backslash, it is interpreted as a data quote. All other special characters can now be prefixed with a backslash to indicate it is a special character.

Using an escape character causes another problem: the backslash now cannot be represented, and requires escaping as well. Using yet another escape character may solve the current problem, but it causes the same problem again. The usual solution to this is to use the escape character itself to escape itself. Therefore a backslash is represented as a double backslash (\\).

Other common escaping examples include VB quotes (” becomes “”) and HTML entities (< becomes &lt;). Thus the next time you encounter problems with data containing control sequences, think of this solution! 1. Escape all control sequences using an escape sequence. 2. Escape the escape sequence using itself.

Comments

The geek is alive

There’s a lack of new posts here. On the contrary, it doesn’t mean I’m not hitting nice problems to post, but its overwhelming that I’ve no time to post all of ’em. In the meantime here’s a few links to keep you occupied (if there were really any visitors to this site…)

http://ask-leo.com/what_is_thumbsdb_and_can_i_delete_it.html

Explains layman tech stuff to layman in layman terms. Great when you have laymen asking you tech questions.

http://www.computerworld.com/action/article.do?command=viewArticleTOC&specialReportId=9000342&articleId=9024364

Computerworld’s “100 Best Places to Work in IT 2007”. I happen to be in one of them, but I’ve yet to feel that its a good place yet. Maybe a few more years.

Comments