Friday, February 18, 2011

SOAP UI : Fastest way to test web services....Awesome tool


--Kiran Bheemarti

Wednesday, January 26, 2011

My C# Quine

 

I saw a java quine in HackerNews today, felt like writing my first quine in C#, here is an attempt of it.

Quine(){var s="Quine(){var s='''';Console.WriteLine(s.Insert(16,s));}";Console.WriteLine(s.Insert(16,s));}
It’s about 106 chars long Smile of course with anonymous methods, delegates, lambda expressions, new var types C# writes a whole lot of code behind the scenes, Thanks to C# I totally love coding in C#
--Kiran Bheemarti

Wednesday, January 19, 2011

Automapper sample

 

Automapper is really awesome tool to map similar objects, especially useful when you want to copy the EF entities to WCF Serializable entities to avoid exposing the loaded EF entities. Here is a sample I worked out to try it out.

You can download Automapper from codeplex, it’s a simple single dll, which you can add to your project, set up few Mappers and you are done, you can copy entities to and from.

http://automapper.codeplex.com/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;

namespace AutoMapperSample
{
    class Program
    {
        static void Main(string[] args)
        {
            SetMapping();

            var class1Obj = new Class1()
                                {
                                    Male = true,
                                    Name = "Name",
                                    Number = 3,
                                    Cls3 = new Class3() {CurrentDate = DateTime.Now.AddDays(10)}
                                };

            var class2Obj = Mapper.Map<Class1, Class2>(class1Obj);

        }

        private static void SetMapping()
        {
            Mapper.CreateMap<Class1, Class2>()
                .ForMember(cl2 => cl2.FullName, cl1 => cl1.MapFrom(n => n.Name + " " + n.Name))
                .ForMember(cl2 => cl2.Male, m => m.ResolveUsing<MaleResolver>().FromMember(cl1 => cl1.Male))
                .ForMember(cl2 => cl2.Cls3CurrentDate, m => m.AddFormatter<DateFormatter>());
        }
    }


    public class Class1
    {
        public Class3 Cls3 { get; set; }

        public int Number { get; set; }
        public String Name { get; set; }
        public Boolean Male { get; set; }
    }

    public class Class2
    {
        public String Cls3CurrentDate { get; set; }
       
        public int Number { get; set; }
        public String Name { get; set; }
        public String Male { get; set; }
        public String FullName { get; set; }
    }

    public class Class3
    {
        public DateTime CurrentDate { get; set; }
    }

    public class MaleResolver : ValueResolver<bool, string>
    {
        protected override string ResolveCore(bool source)
        {
            return source ? "Y" : "N";
        }
    }

    public class DateFormatter : IValueFormatter
    {
        public string FormatValue(ResolutionContext context)
        {
            return ((DateTime)context.SourceValue).ToLongDateString();
        }
    }

}

--Kiran Bheemarti

Tuesday, October 12, 2010

Cherohala Skyway.......

Thursday, October 7, 2010

JQuery Fundamentals Book

 

Found this JQuery Fundamentals book free online http://jqfundamentals.com/book/book.html it’s all on a single page so you can use http://www.web2pdfconvert.com/ to convert the page as pdf (e-book) and download for free.

-- Kiran Bheemarti

Whole bunch of new releases from Microsoft

 

Check out Scott’s posting on new releases http://weblogs.asp.net/scottgu/archive/2010/10/06/announcing-nupack-asp-net-mvc-3-beta-and-webmatrix-beta-2.aspx, most interesting is NuPack, more info on NuPack here http://devlicio.us/blogs/rob_reynolds/archive/2010/10/06/the-evolution-of-package-management-for-net.aspx

--Kiran Bheemarti

Wednesday, October 6, 2010

Facebook is down

 

Wondering where will you share with your friends that Facebook is down Confused smile 

--Kiran Bheemarti