Friday, December 6, 2013

Sort DateTime List c#

    
    var sortedDates = dates.OrderByDescending(x => x);

or else Don't want to use, or don't know Linq then you can go for following..

    static List SortAscending(List list)
    {
    list.Sort((a, b) => a.CompareTo(b));
    return list;
    }

    static List SortDescending(List list)
    {
    list.Sort((a, b) => b.CompareTo(a));
    return list;
    }

Wednesday, December 4, 2013

Directory does not exist. Parameter name: directoryVirtualPath

I had the same problem and found out that I had some bundles that pointed to non-exisiting files using {version} and * wildcards such as
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
    "~/Scripts/jquery-{version}.js"));
I removed all of those and the error went away.

Code to Randomize data in a list

Random rand = new Random();
latestdata = latestdata.OrderBy(c => rand.Next()).ToList();

Structure data for Movie & review

<div itemtype="http://schema.org/Movie">
    <ul>
    <li>Title : <a itemprop="name" style="color: black;" title=""></a></li>
    <li>Star Cast :<a itemprop="actor" itemscope="" itemtype="http://schema.org/Person" title=""><span itemprop="name">Sundeep Kishan</span></a>
<a itemprop="actor" itemscope="" itemtype="http://schema.org/Person" title=""><span itemprop="name">Rakul Preet Singh</span></a>
    </li>
    <li>Director : <a itemprop="director" itemscope="" itemtype="http://schema.org/Person" title=""><span itemprop="name"></span></a></li>
    <li>Producer : <a itemprop="producer" itemscope="" itemtype="http://schema.org/Person" title=""><span itemprop="name"></span></a></li>
    <li>Music : </li>
    <li>Released on : Nov 29, 2013.</li>
    </ul>

    <a itemprop="author" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name"></span></a>
    <a itemprop="creator" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name"></span></a>
    <a itemprop="publisher"></a>
    <span itemprop="description"></span>
    <span itemprop="keywords"></span>

    <div itemprop="review" itemscope itemtype="http://schema.org/Review">
        <span itemprop="name"></span>
        <span itemprop="author"></span>
        <meta itemprop="datePublished" content="" />
        <span itemprop="description"</span>
        <span itemprop="keywords"></span>
    </div>
</div>