Friday, December 07, 2007

Graphs on Web

Google came up with yet another cool service - graphs!
Here's kind of SDK and there's also very nice article about it (in czech though).

There's also a paid site here - i believe it's $69 or so. Pretty cool!

Wednesday, November 28, 2007

UserControls based on abstract classes in designer

I really hate the fact, that VS doesn't allow to display design of user controls (of forms) based on abstract classes.
Here i found solution to the problem - basically "fooling" the designer with substitute artificial instance. It's just a little messy (especially when you have abstract classes in different assemblies), but it seems to work. Mentioned example is done for forms, but works equally well with user controls.

Tuesday, November 27, 2007

Extending indexer on collection in C#

I was looking for a way to implement alternative way to access members of List (or any other collection) through index. By default i could use only:

myCol[0].Value

What i'd like to use is:

myCol[strKey].Value

The way to implement it is through property (code-fragment only):

public MyColItem this[string strKey]
{
get { return #code to get the item#; }
set { #your code#; }
}

ASP.Net 2.0 Precompilation

Since i never remeber the command-line for precompilation, i found AspNetCompiler very handy...

Thursday, October 11, 2007

Debugging in VS2005 using NUnit

As I'm using NUnit more and more (i really started to fall in love with the whole unit-test concept), i find it sometimes useful to be able to debug while running the unit-test. Turns out to be quite easy. This is how it's done:
1) Put your unit-tests into separate project (I do that anyway to keep the NUnit out of "live" references) and compile it (make it either exe or dll, no difference).
2) Start NUnit, browse the compiled dll/exe (from step 1), select "File -> Save as" and save the nunit project. I typically save it in the project's root as "myproject.nunit".
3) Open the project's properties, "Debug" tab.
4) Set "Start Action" to "Start external program:" and browse the "nunit.exe" (e.g. c:\program files\nunit 2.4.1\bin\nunit.exe)
5) Set in the "Start Options" the "Command line arguments" to point to the nunit project you created in step 2. If you did the same as me, i.e. saved it in the project's root, the path should be something like "..\..\myproject.nunit"

And that's it! Just run the debug with F5 as usuall and it'll open NUNIT environment. Set break-points wherever you need in the code and run the appropriate test...

Monday, October 08, 2007

VS 2005 - error while loading form into designer

I get this error quite frequently:
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. TypeLoad failure. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.


Aparently, it's a problem in VS and there's a hotfix available for it. Restarting studio works as well, which is what I do.

Friday, October 05, 2007

Backup data using ROBOCOPY

Need to set up some way of making backups of data from my drive. There's a ROBOCOPY utility in the Win2003 Resource Kit which should do the trick. I found even Robocopy GUI, which generates the script for you. Once you have the CMD file, just put it into scheduler.