Wednesday, November 26, 2008

Infragistics.Documents versus ActiveReports

PDF document had to be rendered from an application. We used to use ActiveReports for PDF reports, but have experienced difficulties when maintaining them. I gave a try to Infragistics.Documents library. It looked nice, but a lot of coding would be required. I think one could prepare some set of classes that would allow fast creation of documents, but it would take some time we did not have. I had to admit, that it is much faster to create the document in ActiveReports, using the visual designer.
Perhaps this is just another prove of the rule "the less code you write the better".

Thursday, November 13, 2008

Good bye floppy disks

I did a big tidy up at home recently and found a bunch of floppy disks. My wife were interested in two of them. I coppied their content to an USB disk (yes, I still can access the computer having a floppy drive) and I guess I will never use floppy disks again.

Rest in peace, floppy disks!

Thursday, November 6, 2008

VisualStudio 2008 dead and alive

My VisualStudio 2008 stopped from runnning. After started, it reported several problems with loading of its parts and then crashed. Well, I wanted to repair the installation, but the installation program did not start, even. Because of that, I could neither uninstall the VisualStudio. Fortunately, I found the article on stackoverflow that helped me uninstall the VisualStudio.

I guess the problem was caused by uninstall of DataDynamics ActiveReports. Did anyone out there experience similar problem?

Wednesday, October 1, 2008

Boxing and arrays

There is one more catch with boxing (see also my former post Boxing and explicit conversions). Consider the code

public struct X
{
   public string Value { get; set; }
}

public void Fun()
{
   X x1 = new X { Value="original string 1" };
   X x2 = new X { Value="original string 2" };
   X[] array = new X[] { x1, x2 };

   array[0].Value = "modified string";
   //! x1 is not changed
}


I am occasionally amazed that x1 has "original string 1" on the line marked '!' although array[0] reads "modified string". Hell yes, that is because of boxing again. If X was classx1 would be changed, too.

Boxing and explicit conversions

Imagine you are writing a method that will process a number. You need to accept object as an argument.*) You know that you will accept integers. You have considered the usage of int and long, and you have chosen long since int can be safely converted to long. So you prepare something like

void ProcessNumber(object o)
{
   long number = (long)o; //!
   //do something with number
}


You test your method, and — surprise — you receive System.InvalidCastException on the line marked '!' when calling ProcessNumber(1). The problem is that boxing is involved, and the argument is not longer just int.

You can cast a boxed value only if it is of the very same type!

If it is not certain that you will receive single type in all calls, you had better use the appropriate method of the System.Convert class.

*) Consider accessing of properties via reflection.

Thursday, April 10, 2008

Quotation of the Day

"If you do serious Oracle Development, you will be clueless sooner or later." source

Tuesday, April 1, 2008

Edit .csproj file in Visual Studio

I bet everyone had the need to view or edit the content of .csproj file. I used to use notepad to do that. Accidentally I've discovered that it is possible to do so directly in Visual Studio. First you have to unload the project. You can use the context menu on the project in Solution Explorer to do so. Then this context menu changes so that it contains the item "Edit .csproj", by clicking which you can access and edit the content of .csproj file. Don't forget to "Reload Project" after you are finished.