Sunday, April 15, 2012

.NET Data Annotations...Integer?


Problem
As I was developing my C# classes I ran into a problem, I couldn't find Integer in the datatype for data annotations.  Hey Microsoft...why not?

Solution
I came across a a library that provided more than I needed, but hey sometimes that 's a great thing and in this case it was.  Data Annotation Extensions to the rescue!  The library can be found here.  Turns out to solve my problem I now can use Integer using this library!

Conclusion
Hopefully finding this gem will help others as it did me.  I am very happy with the library.  If you have a better suggestion or easier way to do other types of data annotations in C#, please comment.

Client-Side Prototyping Using jsFiddle


Problem
I have been spending a lot of sleepless hours working on my web projects and man am I exhausted.  Lately my focus has been on the client side of web applications.  My problem is that it takes a lot of pieces of code, HTML, CSS, jQuery, jQuery UI, AJAX and graphics to bring life to the client side.  How can I prototype quickly and see results fast?

Solution
I have discovered jsFiddle.  jsFiddle allows me to provide HTML, JavaScript and CSS all in one place to mess with quickly.  It also allows you to plug in external resources and hookup client side frameworks like jQuery and jQuery UI.  jsFiddle to the rescue!  You can find it here.

Give it a whirl for yourself and trust me it's worth the time to figure it our and use it when you need to get up and running with prototyping.  Hey, and maybe someday you will be sharing the site with your friends like I have.

Conclusion
I am impressed.  The developer community today is amazing!  I have to hand it to my fellow developers for creating such a fantastic tool online.  I did see another tool, jsBin, but liked jsFiddler better.  If you have a better suggestion or easier way to do the prototype client side development, please comment.


My Public jsFiddles!



Tuesday, January 17, 2012

Syntax Highlighting with Blogger Engine

Problem
So I have just started using the Blogger Engine for my code archive blog.  The first challenge I face when creating new posts is how will I be able to provide code markup within my posts that makes it easy for others to copy from?

Solution
I began my search online and stumbled upon another Blogger user who has solved the same problem.  You can find his post here on his blog.
After performing the steps.  Here is the result:

using System;

/// 
/// Summary description for Class1
/// 
public class Class1
{
 public Class1()
 {
  //
  // TODO: Add constructor logic here
  //
 }


    // Comment
    public class Testing
    {
        public Testing()
        {
        }

public void Method()
{
   /* Another Comment
        on multiple lines */
 int x = 9;
   }
}
}

You can use other brushes if you need to.  This brush I used was for C#.

I soon realized after posting the example that the code I pasted wasn't indented correctly.  So I began another search to find out how I can auto format the code.  I found nothing that worked as good as sticking with Visual Studio.  So I found this guy's blog post which explains how to force Visual Studio to auto format your code.

After performing the steps.  Here is the result:

using System;

/// 
/// Summary description for Class1
/// 
public class Class1
{
    public Class1()
    {
        //
        // TODO: Add constructor logic here
        //
    }


    // Comment
    public class Testing
    {
        public Testing()
        {
        }

        public void Method()
        {
            /* Another Comment
                 on multiple lines */
            int x = 9;
        }
    }
}

I did find other syntax highlighters such as this one.  But it seems to me that its too much HTML markup.

Conclusion
Well, I wish it was a bit easier, but this will have to do.  I am satisfied with doing it this way until better tools are available.  If you have a better suggestion or easier way to do the formatting and syntax highlighting, please comment.