WPF notify helper – C# 5.0

So after looking at the documentation on what’s new in C# 5.0, I read about the feature that you can get a function’s caller information that looks like the following.

public void DoProcessing()
{
    TraceMessage("Something happened.");
}
 
public void TraceMessage(string message,
        [CallerMemberName] string memberName = "",
        [CallerFilePath] string sourceFilePath = "",
        [CallerLineNumber] int sourceLineNumber = 0)
{
    Trace.WriteLine("message: " + message);
    Trace.WriteLine("member name: " + memberName);
    Trace.WriteLine("source file path: " + sourceFilePath);
    Trace.WriteLine("source line number: " + sourceLineNumber);
}

This snippet is stolen straight from msdn.
http://msdn.microsoft.com/en-us/library/hh534540(v=vs.110).aspx

I also saw another example of where this would be used for WPF classes that implement INotifyPropertyChanged. The example looked liked the following

protected void RaisePropertyChanged([CallerMemberName] string memberName = "")
{
    RaisePropertyChanged(memberName);
}

This actually reminded me of what I did in some of my WCF services to get the calling method name displayed when invoked, so that I could print out who called it(using WindowsIdentity) and what method they called. However, I accomplished it using the StackTrace class and StackFrame. So I quickly came with a way to get similar functionality until 5.0 is ready for my eager hands.

The result looks like the following

protected void RaisePropertyChanged()
{
    var frame = new StackTrace().GetFrame(1);
    string name = frame.GetMethod().Name.Substring(4);
    RaisePropertyChanged(name);
}

So when you create your Bindable properties you could simplify code that would look like

public const straing ProgressValuePropertyName = "ProgressValue";
private double _progressValue;
public double ProgressValue
{
    get { return _progressValue; }
    set { _progressValue = value; RaisePropertyChanged(ProgressValuePropertyName); }
}

into

private double _progressValue;
public double ProgressValue
{
    get { return _progressValue; }
    set { _progressValue = value; RaisePropertyChanged(); }
}

So while this is a small step forward, it’s still nowhere nearly as clean as using PostSharp and AOP to look like

[RaisePropertyChanged]
public double ProgressValue { get; set; }

Thinking about my brain dump right now, I’m going to play with the Roslyn services to see if that is going to generally offer the same capabilities as PostSharp.

Game scripting engine

So I’m starting to get back into the groove of coding my game and I’m at somewhat of a roadblock on how much I should make scriptable.

So for a brain dump, I’ll state what am I looking for right now?

Dialog sequencing
Entity administration(adding/removing/altering)
Triggering other sequences
I’m wanting at least these features so at any given level I can do the following.

Tell a story as the level begins
Add stuff to kill
Do something if you die
Do something when the boss dies
Perhaps this is too much and should be hard coded in the game for a unique kind of boss mob. Not sure, but I feel that’s restrictive. I’ll start with the goal of these things now using some sort of xml scripting syntax.

I thought about using Lua or JS, but I just can’t imagine that it would be easier using that than some fixed rule system. So homegrown ScriptML it is.

Suggestions welcome!

Enterprise Library Logger

After a monumental hiatus, I will provide this nerdy snippet and an update on my life.

Sadly, after writing a bit of code for my logging toolkit, I’m going to modify it from using Enterprise Library to Log4Net. Apparently there was some change in Enterprise Library 4.0 that does not make it directly backwards compatible with 3.1 and I can’t find the documentation for what makes it different.

All of a sudden my formatters no longer work and neither does the mailer. As a good friend of mine said. “It’s a freaking logger!” Why is it not backwards compatible? What kind of crazy magically awesome changes could they have made to make me want to update a vital library used in all my applications?
Thus, if I have to make a change, I’m moving to Log4Net. For anyone curious, I’ll be happy to keep a copy of my current logger with the Enterprise library implementation so that they can see the tragedy that it is. Change a reference library from the 3.1 EntLib Dlls to the 4.0 and formatting goes down the pooper.
As for my life in general. I’m engaged!!! So, the engagement didn’t go exactly how I planned it. There were several chaotic factors to disrupt my master plan and the proposal being on a certain date and actually being a surprise were high on my priority list. Regardless, I’m a little sad that it wasn’t some super magically awesome proposal at a swanky restaurant and all the things that I had in my mind came to fruition… Luckily, however, she said yes and I have our entire lives together to do sneaky little special things for her.
I now leave you with this awesomeness!

I Cried!!!

OMGEES!!!!

Ok seriously, I found this on youtube while searching for the evolution of dance. This has no programming food for the brain, but I cried from laughter while watching this video. OMG, I remember forcing myself to cry before too, and it is hilarious watching this guy do it. Drooling in the middle part of the video is icing on the cake.

LOLLERSKATES!!!!! ROFLCOPTER!!!!!

Insanity can occur

And it did… sorry schnookums!!!

On a side note, I’m going to change my web hosting provider for Ninjacrab, it will still be ninjacrab.com but with a MUCH cheaper host for what I use Ninjacrab for. If I ever decide to go hardcore Microsoft web development, I’ll consider another host. Regardless, $118.80 for 3.5 years compared to $78 for 6 months is kind of a no brainer.

Todo:
Get all old crap off of brinkster.
Put all old crap on WebHostingPad
Do Something nice for my Snuggly Bear

Data Access Layer

Welp, I’ve created what I consider to be a pretty framework for a data access layer and I’m pretty excited to put in all the bells and whistles on it.

Haha, on a miscellaneous note. I figured out that some DMG have easier installers and some are as obvious as the following.

Picture 1

A tad bit more user friendly, but there is still a bunch more to explore. More downsides, some applications require an external mouse with two buttons!!! Apparently Monodevelop doesn’t consider+ click a right click.

On a sad note… I learned more about this Mac… and found something that I can’t seem to erase. Why on earth did I look at it?

Very impressed!

I am super dooper impressed! I created a project in Visual Studio 2008, built a simple MDI application as a mock up example, saved it and put it in my repository.

Well, I wanted to mess around with the Mac today and possibly create the testing framework on it. So I got the files from the repository, and tried to create a blank solution in MonoDevelop so that I could just import the files from the project. Well I messed around for a little bit trying to add files to the solution…. and I still can’t seem to find what would be a “right click” function… So after messing around a bit more, I just opened the solution file straight from Visual Studio!

Then for giggles, I clicked build. It worked! I clicked run!!!!

OMGEES!!!

Picture 1

The widgets don’t render 100% properly but the fact that it compiles without a single change at all is incredible! The fact that it loads VS2K8 solutions and projects!!! Wow-wow-zoo-wee!!!!

Now I did some research and made sure that the project was using .Net 2.0 but I really thought I would have to do more than two clicks on my project for compatibility.

Now I’m off to more work! I want to get the NUnit framework loaded on the Mac, Windows and Ubuntu box. After that the Nant build files and finally I’ll feel nice and confident that I’ll have built a cross platformable framework for some potential application ideas.

P.S. I’m choosing NUnit as opposed using Microsoft build in testing framework for the whole cross platform compatibility

P.P.S. People reading this on facebook or just grabbing the RSS feed. You guys are missing out on the images that I’m attaching here. So make sure to check the original feed!

Systems updating like whoa!

Well, Vista Service Pack 1 is finally available for machines that have installed the Korean language pack and Ubuntu has just informed me that it wanted to update a whopping 115 packages. So I’ll let those occur as I drift off to la-la land.

It’s 85 degrees right now in NY and it’s night time. My AC is kicking on and off like a fat ninja in a kicking marathon. I think I need a fan to circulate the air so that the AC can regulate the temp across the entire 375 sqft instead of the tiny section by the unit.

I just got back from Wheeling again where I met a Cardiovascular surgeon. We had an interesting conversation about his software needs and I’m interested in starting a project for that request. It doesn’t seem to be that intense or involved. I’m going to work on a few Proof of concepts do some research to really see if the competition just flat out sucks.

Regardless, all is well and I’m excited!

On final notes, I’m going to respec my priest to the following for Oscar and my crazy wicked PVP group.

http://www.wowhead.com/?talent=bxMGzhgtrcopfVth

Ok we suck, but we only play 1-2 hours a week if that.