How do you log to the Windows event log from C# .NET?

This seems to do the trick if you want to log to the Windows event log:

private void logError(string message, string source)
{
	System.Diagnostics.EventLog log = new System.Diagnostics.EventLog();
	log.Source = source;
	log.WriteEntry(message, System.Diagnostics.EventLogEntryType.Error);
	log.Close();
}

private void logError(Exception exception, string source)
{
	logError(exception.ToString(), source);
}

Put it in your class, or in a special logging class.

Read more:

Internt/Egna SharePoint – Miniprojekt Utveckling/Design Lookup fält programmagiskt… / ContentTypes

Mindfulness at the dentists and other “problematic” places

I had a dentists appointment this morning, and I thought it would be a nice place to try some mindfulness.

I figure you’ve basically two main strategies here. Either use mindfulness to distract yourself by focusing on some place other than your teeth (e.g. Your feet), or focus on what’s happening with your teeth here and now.

I should mention that there was no drilling involved in this visit, but I usually has a lot of tartar that needs to be scraped off, and I have very sensitive dental necks, so it’s usually not a walk in the park.

I started to focus on what the dentist (or actually hygienist) was doing with my teeth, and I very quickly noticed that it seemed to hurt more if I lost that focus. When I really experienced the things she did to the teeth with a kind of curious interest the pain became much more tolerable.

I think for two reasons: I was really there, feeling what was happening, not what I anticipated would happen, and I accepted what was happening – it was almost as if I was involved in the actual “poking around.”

So, the link to Asperger and ADHD?

Some experiences and situations might feel a bit like a dental exam to an aspie, and if using mindfulness on those situations, I think they would become much more tolerable..