dubscore.pl - my new project

January 3rd, 2010

I would like to present you my new project - http://dubscore.pl It is a database of polish dubbing in computer games. Reviews, comparisons and samples - all you have got there. Enjoy!

Testing code snippets for Visual Studio

October 30th, 2009

If you create many test classes and test methods you probably repeat some code many times.
Here are some code snippets that I use every day at work, feel free to modify them if you want.

Read the rest of this entry »

Podcast

August 23rd, 2009

I have been busy for the last few weeks so no interesting posts had appeared. Sorry for that :( But there there is something for my polish readers - two podcasts (polish only) which I have recorded with my friends recently. Podcasts are about games of course and are strongly related to Polygamia forum users :)

Here’s the official forum topic:

And official news at polygamia.pl:

Podcasts are ready to download at: http://www.sirmike.org/files/forumogadka/

log4net - Exception renderer

June 12th, 2009

If you use log4net you have probably noticed that this logger does not write information from exception's "Data" property. Here is the renderer which does:

C#:
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using log4net.ObjectRenderer;
  6.  
  7. namespace SomeNamespace
  8. {
  9.     public class ExceptionRenderer : IObjectRenderer
  10.     {
  11.         #region IObjectRenderer Members
  12.  
  13.         public void RenderObject(RendererMap rendererMap, object obj, TextWriter writer)
  14.         {
  15.             if (rendererMap == null)
  16.             {
  17.                 throw new ArgumentNullException("rendererMap");
  18.             }
  19.  
  20.             if (obj == null)
  21.             {
  22.                 throw new ArgumentNullException("obj");
  23.             }
  24.  
  25.             if (writer == null)
  26.             {
  27.                 throw new ArgumentNullException("writer");
  28.             }
  29.  
  30.             if (obj is Exception)
  31.             {
  32.                 Exception ex = (Exception)obj;
  33.                 writer.WriteLine(ex.ToString());
  34.  
  35.                 if (ex.Data.Count> 0)
  36.                 {
  37.                     writer.WriteLine("Exception Data:");
  38.                 }
  39.                 foreach (string key in ex.Data.Keys)
  40.                 {
  41.                     writer.WriteLine("\t {0} = {1}", key, rendererMap.FindAndRender(ex.Data[key]));
  42.                 }
  43.             }
  44.             else
  45.             {
  46.                 throw new InvalidOperationException(string.Format("Object of type {0} cannot be rendered with ExceptionRenderer", obj.GetType()));
  47.             }
  48.         }
  49.  
  50.         #endregion
  51.     }
  52. }

and the configuration needed for this to work is:

XML:
  1. <log4net>
  2. ...
  3.     <renderer renderingClass="SomeNamespace.ExceptionRenderer" renderedClass="System.Exception" />
  4. ...
  5. </log4net>

Sample output for NullReferenceException with Data["configPath"] = "myconfig.config":

2009-06-12 22:22:04,038 INFO  [LoggerTest.Program] - Exception during init
System.NullReferenceException: Something was null
   at LoggerTest.Program.Main(String[] args) in G:\C#\Temp\LoggerTest\Program.cs:line 26
Exception Data:
         configPath = myconfig.config

Feel free to use and modify it.

Playing with physics

May 11th, 2009

Several hours of playing with nVidia PhysX engine ended with this small video. Rendered in real time of course (DirectX, GeForce 8600GT)

Designed by SirMike © All rights reserved

Valid XHTML 1.0! Valid CSS!

Powered by Rootnode