Saturday, April 2, 2011

Object Oriented Programming is Dead

Robert Harper, a professor at Carnegie Mellon University, says:
"because it is both anti-modular and anti-parallel by its very nature, and hence unsuitable for a modern CS curriculum."

http://blogs.msdn.com/b/alfredth/archive/2011/03/22/object-oriented-programming-is-dead.aspx

Quick-and-Dirty, Paypal Buy-Now Buttons in ASP.NET

Update on [Best ASP.NET websites/blogs]

How to prevent cross site image reference by HTTP Handler in ASP.NET

http://www.blackbeltcoder.com/Articles/asp/writing-a-custom-http-handler-in-asp-net


This is a very simple handler that starts by seeing if the request came from the current domain. If not, HTML markup for an "Access Denied" message is constructed and returned.
Custom HTTP Handler
using System;
using System.Globalization;
using System.Web;

public class JpgHttpHandler : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        HttpRequest request = context.Request;
        HttpResponse response = context.Response;

        // Try and prevent request from a different domain
        if (request.Url != null && request.UrlReferrer != null)
        {
            if (String.Compare(request.Url.Host, request.UrlReferrer.Host,
                true, CultureInfo.InvariantCulture) != 0)
            {
                response.Write("<html>\r\n");
                response.Write("<head><title>JPG HTTP Handler</title></head>\r\n");
                response.Write("<body>\r\n");
                response.Write("<h1>Access Denied</h1>\r\n");
                response.Write("</body>\r\n");
                response.Write("</html>");
                return;
            }
        }

        // Otherwise transfer requested file
        try
        {
            response.ContentType = "application/jpg";
            response.WriteFile(request.PhysicalPath);
        }
        catch
        {
            response.Write("<html>\r\n");
            response.Write("<head><title>JPG HTTP Handler</title></head>\r\n");
            response.Write("<body>\r\n");
            response.Write("<h1>Access Granted but file was not found</h1>\r\n");
            response.Write("</body>\r\n");
            response.Write("</html>");
        }
    }

    public bool IsReusable
    {
        get { return true; }
    }
}


Web.config File
<?xml version="1.0"?>
<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0"/>
    </system.web>
    <system.webServer>
        <handlers>
            <add verb="*" path="*.jpg" name="JpgHttpHandler" type="JpgHttpHandler"/>
        </handlers>
    </system.webServer>
</configuration>


Add IE 9 Pinned Sites in ASP.NET MVC Razor Views

http://rachelappel.com/add-ie-9-pinned-sites-dynamic-jump-lists-notifications-to-mvc-razor-views

What is Common Look and Feel (CLF)

This standard governs branding, usability & accessibility standards for government departments on the internet


This standard comprises the following four elements
  • Part 1: Standard on Web Addresses - i.e. tbs-sct.gc.ca
  • Part 2: Standard on the Accessibility, Interoperability and Usability of Web sites 
  • Part 3: Standard on Common Web Page Formats
  • Part 4: Standard on Email


Reference: