Chris Martin's Blog

A Developer and so on...

  Home  |   Contact  |   Syndication    |   Login
  7 Posts | 0 Stories | 22 Comments | 20 Trackbacks

News

Tag Cloud


Archives

Post Categories

Blogs I check out

Friday, January 05, 2007 #

Duration

Cold symptoms usually appear 2 or 3 days after exposure to a source of infection. Most colds clear up within 1 week, but some last for as long as 2 weeks.

Source: Common Cold

Hah. I should be so lucky!

 

[TestFixture]
public class Program
{
    static void Main(string[] args){}

    [Test]
    public void ChrisDoesntWriteCodeWhenSick()
    {
        IDeveloper chris = new Chris(new InsaneCommonColdThatLastsForAMonth());
        Assert.IsFalse(chris.CanWriteCode());
    }
}

public interface IDeveloper
{
    bool CanWriteCode();
}

public class Chris : IDeveloper
{
    private IHealth currentHealth;

    public Chris(IHealth currentHealth)
    {
        this.currentHealth = currentHealth;
        currentHealth.AnnounceHealth();
    }

    public bool CanWriteCode()
    {
        return currentHealth.CanWorkToday;
    }
}

public interface IHealth
{
    bool CanWorkToday { get; }

    void AnnounceHealth();
}

public class InsaneCommonColdThatLastsForAMonth : IHealth
{
    public bool CanWorkToday
    {
        get { return false; }
    }

    public void AnnounceHealth()
    {
        Console.WriteLine("CoughCoughCough...");
        Console.WriteLine("Ouch! My head!");
    }
}

Thursday, January 04, 2007 #

 

tagged me today. Well. I guess I'm it.

  1. Drag Racing: One thing that I really enjoy besides .NET is drag racing. Last year I fell in love with the new Dodge Magnum and the whole Chrysler LX platform. These cars promised to bring back the muscle car wars that were happening in the late 60's. So, I had to buy one. And it had to have a Boy was I in for a treat with this ride. It ran a 14.0 second 1/4 mile bone stock! Which is nothing to sneeze at coming from a 4300 pound station wagon. :) I've since put some more money into the car and am turning mid 13-second passes. This spring the car will see a beefed-up bottom end and a big turbo.12-07-06 001
  2. Music: Straight out of high school, I spent a large part of my life playing, touring, and recording music with various hardcore bands. I've seen the country many times for virtually free and got to meet a bunch of different types of people. While I still play with bands, most people aren't able to pick up and take a 2-3 month vacation to go on tour. So, the bands stay local, for the most part. Out of anything I've ever done in my life, I truly miss this the most.
  3. Business. I own a small aftermarket parts online store. It's something that I need to put a bit more time into.  Factory DAnother thing I'm constantly thinking of, is buying absentee owned businesses and rental properties.
  4. Skateboarding. I've been a skateboarder since I was 10. Not as much now. But, I still enjoy to go skate every once in awhile.
  5. Change. Coding is one of my favorite things to do. There are few things better than the feeling of seeing a bunch code that your wrote do something useful or cool. That being said, I'm getting really tired of sitting behind of a computer all day long. I, badly, need a career change and make coding a hobby again.

Well. That's not it! There is a lot more to me than those five things. I just couldn't think of anything more interesting. :)

And since I don't really follow many blogs anymore, I taking my ball and going home. I don't have anyone in mind to tag. ;)


Friday, March 10, 2006 #

My friend Scott Cate just told me about this.

From the article:

"Rather then keep a whole room full of XBOX 360's, we think a better idea is to give them to childrens charities. We'll start with the Child Crisis Center and the Phoenix Childrens Hospital."

If you haven't signed up with textpayme yet please do so if only for this cause.

Sign up with this link.


Wednesday, November 30, 2005 #

Apparently .NET 2.0 does this out of the box but, I don’t get to play with it for awhile so….

Today I had the need to serialize some error messages in CDATA elements. Quickly, I realized that XmlSerializer doesn’t support this out of the box. After a really quick googlin’ session, I had my solution. And since I’m nice, I’ll share it with y’all.

Say you have a class called ErrorMessage that has a string to be serialized:

[Serializable]

public class ErrorMessage

{

private string message

….

[XmlElement("message")]

public string Message

{

get { return message; }

set { message = value; }

}

….

}

If you want to inject the message into a CDATA element do the following:

Create a class to hold your CDATA string and implement IXmlSerializable.

public class CDATA : IXmlSerializable

{

private string text;

public CDATA()

{}

public CDATA(string text)

{

this.text = text;

}

public string Text

{

get { return text; }

}

XmlSchema IXmlSerializable.GetSchema()

{

return null;

}

void IXmlSerializable.ReadXml(XmlReader reader)

{

this.text = reader.ReadString();

}

void IXmlSerializable.WriteXml(XmlWriter writer)

{

writer.WriteCData(this.text);

}

}

And change your original ErrorMessage class to

[Serializable]

public class ErrorMessage

{

private CDATA message

….

[XmlElement("message", Type=typeof(CDATA))]

public CDATA Message

{

get { return message; }

set { message = value; }

}

….

}

Nice and simple.


Tuesday, November 29, 2005 #

If you could decode my last post without your head throbbing, well...I'm real happy for ya ;) That post was from w.bloggar 4.0 and I hated it. What desktop software are .TEXT bloggers using to post from the desktop? Are you able to choose categories? What about code formatting? Cheers...

So Visual Studio is finally catching up to the tools that I've been using for years. I can't really blame MS for only coming out with these features now. This is a huge company that doesn't release their products every 3 months. What I can do is be a little angry that while they did us a favor by integrating some things into the IDE, they just did it a little sub-par. Now, if anything I'm about to write is wrong, I'm sure some gracious soul will correct me and I'll give my appologies. Onto the meat... OK. Visual Studio 5005 gives us a great, nifty little feature called "Code Snippets". Basically they are code templates that can generate a bunch of boring code with the least amount of work. Cool. But, the technology doesn't seem to want to give me any control of said code. Take the following very simplistic and reasonable example: I want the snippet to create this code (I'm serious ;))
private string title;

public string Title
{
get { return title; }
set { title = value; }
}

So I took the plunge and created this snippet (I'm just showing the CDATA part not the whole XML file.): public $type$ $variableName$; public $type$ $variableName$ { get { return $variableName$; } set { $variableName$ = value; } } My problem with this is that I can't find a way to capitalize the property name. I can't find a way to do it! With QuickCode (RIP for me) or ReSharper this a very easy task. I've got to be missing something here. Who's gonna show me the MS light? Cheers...

Saturday, December 20, 2003 #

To LLBLGen or not?

I guess this is my introduction post. My name is Chris Martin (as you can see :)) and I'm a .NET developer with about 6 years experience in mostly Windows technology. I used to dabble in the *nix world a little bit. But, found it too exhausting.


This is also my first attempt at blogging. I look forward to being a part of this comunity and hope that I can provide some help to you guys sometimes.


Now...Onto the meat of this post.


I'm going to use the new LLBLGen Pro on our next project. So far, I can't see any downsides to this at all.


Does anyone have any positive or negative LLBLGen Pro experiences for a web application that they would like to share?