GridPulse

as stimulating as black coffee and just as hard to sleep after.

Archive for the ‘.NET’ Category

Get all the types contained in all the assemblies loaded, filtered by namespace

leave a comment

This quick snippet will give you all the types declared in all the assemblies loaded, filtered by namespace.

List types = new List();
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();

foreach (Assembly asm in assemblies)
{
        IEnumerable asmTypes = from t in asm.GetTypes()
              where t.IsClass
                && (t.Namespace != null && t.Namespace.StartsWith(targetNamespace))
              select t;
        types.AddRange(asmTypes);
}

I actually got to this point because of the way NUnit wraps an assembly in another AppDomain.

The snippet need Linq so it’s for 3.5 or newer.

Written by Bogdan

October 29th, 2009 at 9:05 am

NanoDI, a small .NET Dependency Injection container

leave a comment

Some time ago I worked on some projects using ASP.NET that were mostly ASPX with some specialized ASHX’s (c# behind the scenes).
The handlers just generated some graphs or exported Excel files, regular code monkey style, no architecture, no plan, just write it fast – quick dirty hack, quick buck – and I always thought that these guys that accept .NET inferior stuff deserve what they get.

As time flew by, I started to get a taste of what .NET is all about, luring me to the dark side.

engine1

Photo by B-tal

At the beginning I felt like “this is what evil must taste like”, but I quickly got accustomed to all the new things and now, I’m playing with .NET stuff again, mostly C#, trying to level my skills and having a lot of fun in the process. I built things like the quick and dirty multi font viewer, buggy and poor, mostly because nobody uses it.

Now, I wanted to start something bigger, and nicer (I won’t say what) and I felt that I needed to do it the right way, you know, MAINTAINABLE.
I started looking for a DI container and I started with Spring and Pico. I’m pretty accustomed to pico and I’ve been using Spring since version 1 so I though I’d give them a try. Wrong, strange, alien, weird, huge, EVIL.

For what I wanted to do it really seemed this way. How’s about something that is 10 megs big because spring and dependencies is 7 megs big. And I’m not even going to use most of it, I just want some plain dependency injection and maybe some tooling , like fast i18n.

Problem solved, evil destroyed
I found the solution! Why not have some fun AND learn the inner workings of C# and .Net? Why not build my own? So I did!

NanoDI is a small dependency injection container and tooling for .NET C# projects that are small or that do not need the complexity of bigger IoC solutions.

NanoDI‘s goal is to be small, fast and clean.

Links:
Nano Dependency Injection home
NanoDI Ohloh.net project page
NanoDI Google Code project

The code is junky by my standards but I’m slowly refactoring as my c# skills get better. Next week I’m going to finish scoping and start working on proxies and interceptors. You can help too!

Have a taste, have fun!

Written by Bogdan

September 10th, 2009 at 11:50 pm

Multi Font Viewer on xandertools.com

one comment

Being a software developer sometimes involves more than just coding.
This time it was a logo and a splash screen I did a while ago and I had a problem – I couldn’t remember what font I used.

Of course, having a lot of fonts installed made it a nightmare.


twittshot

I googled a bit and found a lot of shareware that allowed me to view multiple fonts and compare. I didn’t use any of it. Instead I used a nice piece of software called Opcion.

It solved my problem, although it acted a little strange plus, it was Java. I can handle it because I’m a Java developer.. but can anybody else?

After finishing the work I decided I could do something about it. So I did.

It’s called Multi Font Viewer and it’s free.

You can download it from: the Multi Font Viewer page at xandertools.com.

If you want to take a look at the code or contribute visit the Multi Font Viewer Google Code project.

Best of luck and happy fonting!

Written by Bogdan

August 13th, 2009 at 7:04 pm