Monday, March 26, 2007
Printing Documents
There are times when a program needs a printing function. However, the PrintDocument class provided in .NET seems to raw, requiring one to measure of each word in a string, and lay it out on the page. There must be a better way, and after some searches, I found the gem below.
How to print the content of a RichTextBox control by using Visual C# .NET or Visual C# 2005
http://support.microsoft.com/kb/812425
And the Rich Text Format specification
http://www.biblioscape.com/rtf15_spec.htm
With this, Windows will layout the text for you. Say goodbye to MeasureString!
Sunday, March 18, 2007
Unpaid to Learn
I am currently working as a freelance programmer. My employer has this policy that he will not pay me for the time taken for me to learn. This might sound reasonable at first, however, as days into the project, I felt an eerie connection with the programmer who is paid per-line-of-code. I could not rationalise such a connection until now.
Programming is a very vast skill set by nature. No matter how experienced a programmer is, he is bound to face situations where he has no knowledge about. Hence continuous learning is a must and cannot be avoided.
Not being paid for the time to learn means incentive for me to just code and hack my way though the project, rather than learning the proper way to do things. This is not too different from the paid per-line-of-code programmer who writes the following
as opposed to
13 versus 1 line.
I believe that people should be paid to learn. This will help bring up the quality of work.
string[] s = new string[2];
for (int i = 0; i < 2; ++i)
{
switch (i)
{
case 0:
s[0] = "Hello ";
break;
case 1:
s[1] = "World";
break;
}
}
string[] s = new string[2] { "Hello ", "World" };
Subscribe to:
Posts (Atom)