Wednesday, October 31, 2012

Tuesday, October 30, 2012

How to disable copy/cut/paste for html textbox by jQuery

<script type="text/javascript">
   $(document).ready(function(){
        $('#txtInput').live("cut copy paste",function(e) {
                e.preventDefault();
            });
        });
  </script>

Monday, October 29, 2012

Web design trends

http://weavora.com/blog/2012/10/21/web-design-trends-we-love/

Single page websites

Once frowned upon by both clients and designers, long pages which require a lot of scrolling are now all over the web. One explanation is that users are so accustomed to vertical scrolling (assisted by mouse wheel) that it’s actually worse to split the content on separate pages – it requires more effort from users to find it and reach it.
 
Single page websites

Google Architecture

Update 2: Sorting 1 PB with MapReduce. PB is not peanut-butter-and-jelly misspelled. It's 1 petabyte or 1000 terabytes or 1,000,000 gigabytes. It took six hours and two minutes to sort 1PB (10 trillion 100-byte records) on 4,000 computers and the results were replicated thrice on 48,000 disks.
Update: Greg Linden points to a new Google article MapReduce: simplified data processing on large clusters. Some interesting stats: 100k MapReduce jobs are executed each day; more than 20 petabytes of data are processed per day; more than 10k MapReduce programs have been implemented; machines are dual processor with gigabit ethernet and 4-8 GB of memory.

http://highscalability.com/google-architecture

Introdduce to Razor

http://www.dotnetfunda.com/articles/article1937-introduction-to-razor.aspx

Friday, October 26, 2012

How to parse html table by HTML agility pack?

http://www.codeplex.com/htmlagilitypack

HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(@"<html><body><p><table id=""foo""><tr><th>hello</th></tr><tr><td>world</td></tr></table></body></html>");

foreach (HtmlNode table in doc.DocumentNode.SelectNodes("//table")) {
    Console.WriteLine("Found: " + table.Id);
    foreach (HtmlNode row in table.SelectNodes("tr")) {
        Console.WriteLine("row");
        foreach (HtmlNode cell in row.SelectNodes("th|td")) {
            Console.WriteLine("cell: " + cell.InnerText);
        }
    }
}

Test Drive PHP 5.5: A Sneak Peek

PHP 5.5
http://sheriframadan.com/2012/10/test-drive-php-5-5-a-sneak-peek/

Tuesday, October 23, 2012

How to define anynomouse function in C# like Javascript?

In Javascript you can define an anynomous function like:
var InJavasript = (
function(){
             return "some value";
})()

In C#: (need specifiy a function type)
var InCSharp = (
(Func<string>)delegate(){
                return "some value";
            })();

http://msdn.microsoft.com/en-us/library/bb549151.aspx

Monday, October 22, 2012

Closure in C#

http://diditwith.net/PermaLink,guid,235646ae-3476-4893-899d-105e4d48c25b.aspx

static List<string> GetNamesStartingWith(string startingText)
{
  return g_Names.FindAll(
    delegate(string name)
    {
      return name.StartsWith(startingText);
    });
}

Monday, October 15, 2012

How to solve: "HTTP could not register URL http://. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."


How to solve: "HTTP could not register URL http://. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)."


This is AddressAccessDeniedException
- Run command prompt as administrator
- Run netsh http add urlacl url=your_URL user=DOMAIN\UserName

Reference
http://blogs.msdn.com/b/amitlale/archive/2007/01/29/addressaccessdeniedexception-cause-and-solution.aspx

Render Email Templates Using Razor Engine

http://blog.mirajavora.com/render-email-templates-using-razor-engine

Systems Thinking Iceberg

http://escalatedthinking.com/tools_systems_thinking_iceberg.html

The Container Level

The last or lowest level is the Container Level. A container is the framework of thought that shapes and constrains our mental models. At its foundation are a set of beliefs, goals, and values that are so “core” to the individual or society in question that they are seldom brought to the surface or challenged. These values and beliefs are instilled in us by traditions, teachings, training, images, and stories. They are promoted and defended by our scientific, social, religious, economic, educational, or governmental institutions.

Friday, October 12, 2012

How to solve problem: Can't add a reference into console project


Change Target Framework from ".NET Framework 4 Client Profile" to ".NET Framework 4".

HTTP Made Really Easy

http://www.jmarshall.com/easy/http/#whatis

Using HTTP 1.0
What is HTTP?
What are "Resources"?
Structure of HTTP Transactions
Initial Request Line
Initial Response Line (Status Line)
Header Lines
The Message Body
Sample HTTP Exchange
Other HTTP Methods, Like HEAD and POST
The HEAD Method
The POST Method
HTTP Proxies
Being Tolerant of Others
Conclusion

Real-Time Chart using HTML5 Push Notification (SSE) and ASP.NET Web API

http://techbrij.com/1029/real-time-chart-html5-push-sse-asp-net-web-api

Transforming Data Source objects into XML using LINQ

http://www.itorian.com/2012/09/transforming-data-source-objects-into_7545.html

var studentsToXML = new XElement("School",
from student in students
let x = String.Format("{0},{1},{2},{3}", student.Marks[0], student.Marks[1], student.Marks[2], student.Marks[3])
select new XElement("Student",
            new XElement("ID", student.ID),
            new XElement("Name", student.Name),
            new XElement("Address", student.Address),
            new XElement("Marks", x)
        ) //end of "student"
    ); //end of "Root

Thursday, October 11, 2012

How to solve problem, "The operation has timed out at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)"

Need to dispose HttpWebResponse

            using (HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse())
            {
                using (var str = new StreamReader(webresponse.GetResponseStream()))
                    {
                        result = str.ReadToEnd();
                    }
                webresponse.Close();
            }

How to deal with "Content-Length or Chunked Encoding cannot be set for an operation that does not write data"

Server send 303 redirection for the request.  Check your request data if anything wrong .

http://en.wikipedia.org/wiki/HTTP_303

Tuesday, October 9, 2012

29 New Tools to Develop Your Site

http://www.practicalecommerce.com/articles/3762-29-New-Tools-to-Develop-Your-Site
Codeanywhere Code Editor.

CalendarExtender CSS Class Style And Themes Asp.Net Ajax

Ajax Calendar Extender CSSClass Style Theme http://csharpdotnetfreak.blogspot.com/2012/06/calendarextender-css-style-theme.html

A Beginner's guide for Cookies in ASP.NET

http://www.codeproject.com/Articles/422249/A-Beginners-guide-for-Understanding-and-Implementi

Type of Cookies

Cookies can be classified into various types based on their lifetime behavior and the domain they are stored for. Major type of cookies are:
  1. Session Cookies
  2. Persistent Cookies
  3. Secure Cookies
  4. Third Party Cookies
Session Cookies: This cookie lives in memory of the client computer and its lifetime depends on the current browser session. If the user closes the browser these cookies are deleted from the client machine. If the user visits the website again after closing the browser these cookies will not be available.
Persistent Cookies: Persistent cookies are the cookies that are stored on the secondary storage of the client machine. These cookies do not depend on the browser session. If the user closes the browser and then access the website again then these cookies will still be available. The lifetime of these cookies are specified in cookies itself (as expiration time). The maximum age of such cookies could be 1 year.
Secure Cookies: These cookies have an attribute for security. there cookies can only be accessed by the HTTPS connections and not HTTP connections. The reason for having this type of cookie is that it lessen the chances of cookie stealing/eavesdropping(more on this later in the article)
HttpOnly Cookies: This mode will allow the cookie to be accessed using HTTP or HTTPS requests. Such cookies will not be accessible by any other methods(JavaScript APIs for instance)
Third Party Cookies: First party cookies are the cookies which set the domain of the cookie same as the domain or sub-domain of the website that is being browsed. Third Party Cookies on the other hand are the cookies with domain set to different domain then the website being browsed. These cookies are mainly used for tracking user browsing patterns and/or finding the Advertisement recommendations for the user.

Use of Cookies

The main use of Cookies are:

State Management (Session Management)

The state management can be done using cookies. The cookies themselves are very good way to have client side state management that requires the state to e remembered between website visits.
Along with being client side state management, the cookies are also very useful in maintaining the sessions on servers. Session being a server side state management technique stores all the state related data on the server. But the server still need to uniquely identify the client to associate the correct session data with it. This is facilitated by Cookies.
ASP.NET Roles and Membership and Custom forms authentication also uses cookies for authentication and authorization. Please see the the following articles for details on these [3], [2]topics. There is a section at the end of this article which discusses the use of cookies in session management in details.

Web Page Personalization

Web page personalization can also be achieved using cookies. User can set there personalization preferences and these preferences can be saved on server. Using cookies we can identify the same user and then load the personalized version for him.
The User Profiles in ASP.NET, if tracking the anonymous users also uses cookies to track the anonymous users. More on user personalization can be found here [4]

Tracking User

Cookies are also user to track the user browsing patterns. This is mainly done to identify whether the user is visiting the site for the first time or is he a returning user. Also This is being done to find the Ad recommendations for the user.

Thursday, October 4, 2012