Thursday, August 27, 2009

Undo framework in C#

There are two pages for a good undo framework.

http://blogs.msdn.com/kirillosenkov/archive/2009/07/02/samples-for-the-undo-framework.aspx
http://blogs.msdn.com/kirillosenkov/archive/2009/06/29/new-codeplex-project-a-simple-undo-redo-framework.aspx

Wednesday, August 26, 2009

Inserting a picture into an Excel Spreadsheet using C#

sheet1.Shapes.AddPicture(
path,
true, // this is to copy the picture into the sheet and not link the picture.
true,
##, // how far right you want the picture (in pixels)
##, // how far down you want the picture (in pixels)
##, // width of the picture
## // height of the picture
)

Saturday, August 22, 2009

MySql Server ERROR 1045

I had Error 1045 with installing MySQL server on an XP machine. I, also, have Visual Studio with Sql server installed. I had to stop that SQL server for MySQL to install correctly.

Friday, August 21, 2009

Angle Formula for a circle.

On a circle, if the absolute value of the difference of the angles is greater than 180, you may want to find an average angle that is no always in the clockwise direction. For instance...

angle a = 47
angle b = 326

To find the average angle in the counterclockwise direction

(((360 + a + b) / 2 ) % 360)

This will give you the correct angle between the two, in the CCW direction.

Thursday, August 13, 2009

Dictionary ordering C#

I just found out that Dictionary for C# has no order. So, you can add them any way you want, but you can't get them back the way you expect, because there is no "index" order to them.