DOT NET – Difference between string and string builder

In Dot Net there will be many cases where in we need to operate on strings and first thing we remember is using system.String but there are certainly many points we need to remember and consider before we operate on strings.

1) Performance.

2)how many times we need to concatenate.

Lets take an example for concatenate five strings.

EX 1. Using System.String

System.String str =“My Name is dilip”;

str += “and i am”; str += “working on “;

str += “Post of “;

str += “difference between string and string builder”;

Response.Write(str);

and the expected output well you probably guessed it right

“My Name is dilipand i amworking on Post of difference between string and string builder”

Now what has happed? yes the important question now how many times we have appended the str variable those number of times string was created in memory location and abandoned when a new string is created and later waiting for garbage collection.

This leads to memory wastage and degradation of performance because string are immutable(that means any change to string causes a runtime to create a new string and abandon old one).

Think about the situation where in u need to work on 100 or more strings????

Dot Net has answer for it in the form of System.Text.StringBuilder class

EX2. Same Example using StringBuilder

StringBuilder sb = new StringBuilder();

sb.Append( “My Name is dilip”);

sb.Append( “and i am”);

sb.Append( “working on “);

sb.Append( “Post of “);

sb.Append( “difference between string and string builder”);

and the output is same as previous

“My Name is dilipand i amworking on Post of difference between string and string builder”

But this time there was only one string created in memory dynamically and modified as we append the new string, by this there is not much garbage collection and also helps improve performance. Append is taken only for example there are a lot of other functions which are just waiting for you to invoke.Happy coding.

Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )

What is HTTPS and Advantages of it

HTTPS – Secure HTTP

The HyperText Transport Protocol (Secure), the standard encrypted communication mechanism on the World Wide Web and this is actually just HTTP over SSL.

Advantages of HTTPS

  1. Same as HTTP, only encrypted for security purposes. HTTPS (Hypertext Transfer Protocol over Secure Socket Layer, or HTTP over SSL) is a Web protocol built into its browser that encrypts and decrypts user page requests as well as the pages that are returned by the Web server and developed by Netscape. HTTPS is really just the use of the Netscape’s Secure Socket Layer (SSL) as a sublayer under its regular HTTP application layering.
  1. The Hypertext Transport Protocol, Secure, the standard SSL communication mechanism of World Wide Web.(1) (HyperText Transport Protocol Secure) The protocol for accessing a secure Web server and using HTTPS in the URL instead of HTTP directs the message to a secure port address rather than the default Web port address of 80. The session is then managed by the security protocol.

    (2) (HyperText Transport Protocol Secure) The protocol for accessing a secure Web server and using HTTPS in the URL instead of HTTP directs the message to a secure port number rather than the default Web port number of 80. The session is then managed by a security protocol.

    (3) (HyperText Transport Protocol Server) A Web server that runs under Windows NT, developed by the European Microsoft Windows Academic Centre.

  1. HTTP layered over the SSL protocol.
  1. Secure Hypertext Transfer Protocol.
  1. Secure HyperText Transfer Protocol
  1. Same as HTTP but provides secure Internet communication using SSL.
    A type of server software which provides the ability for “secure” transactions to take place on the World Wide Web. If a Web site is running off a HTTPS server you can type in HTTPS instead of HTTP in the URL section of your browser to enter into the “secured mode”. Windows NT HTTPS and Netscape Commerce server software support this protocol. SEE ALSO: proxy server, secure server and commerce server.
  1. https is ordinary http exchanged over an SSL-encrypted session.A new implementation of the HTTP protocol that provides for more secure web communications by including encryption methods.
  2. A variant of HTTP that encrypts messages for security.(HyperText Transfer Protocol Secure) A secure protocol for sending information forth and back over the Internet and the HTTPS protocol most frequently relies on the SSL (Secure Socket Layer) encryption system but others such as TLS (Transport layer security) are also available. Every attempt has been made to provide you with the correct acronym for HTTPS and if we missed the mark, we would greatly appreciate your help by entering the correct or alternate meaning in the box below. Definitions have been compiled multiple results provided for your review and popular search engine.

Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )

What are HTTP full headers

The use of full headers is preferred for several reasons which are as follows:

  • The first line of a server header includes a response code indicating that the success or failure of the operation
  • One of the server header fields will be Content-type:, which specifies that a MIME type to describe how the document should be interpreted.
  • If the document has moved, the server can specify its new location with a Location: field and allowing the client to transparently retry the request using the new URL.
  • WWW-Authenticate: and the Authorization: fields allow access controls to be placed on Web documents.
  • The Referer: field allows the client to tell the server the URL of the document that triggered this request and permitting savvy servers to trace clients through a series of requests.
Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )

What is HTTP

HTTP Stands for Hypertext Transfer Protocol.

It is basically used to communicate web pages to web browsers,(HTTP) is used by web servers.When your browser connects to a web server, requests a web page from the server, and downloads the page,HTTP is used. It is a common standard that enables any browser to connect to any server, anywhere in the world.

HTTP was originally designed by Tim Berners-Lee to support the special demands of web communications and with an emphasis on efficiency, and a target page load time of under a tenth of a second. Modern Internet networks can support this type of response provided the page isn’t too large and the server is too far away.

To download different parts of a web page, downloading the text, graphics, and other objects on the page in different orders,your browser can open more than one HTTP connection at once. That is why you may see the status messages in the bottom of your browser window switch between a message like “downloading 38% of 47K” to “downloading 62% of 15K” on the same page — there are different HTTP connections.

To specify the download priorities,some browsers enable you so that, for example, graphics are not loaded, text is loaded before graphics, everything is loaded at once, etc and check your individual browser preferences

Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )

DOT NET – Maintaining user information for Security & other requirements

– Create login.aspx in the root directory and design the page according to requirement. Code for this should be written after completing preperation of Entities, DL, BL and others…..

– Goto DB that the project is configured and create tables for storing user information. In general userinformation will have multiple tables, many columns but in our example
we will create users table with username(pk),password,role.

– Add some sample data in the created table and optionally write procedures for accessing the created tables.[In real time highly recommended is access tables with procedures]

– Once db is prepared we have to prepare front-end layers and as usual we will use EDM(O-R) for preparing our objects. prepare edm objects.

– once EDM objects are prepared we have create BL for users where we have to provide all functionality.
……………………..

– Now we can write code for login button of login page. In this button we have to pass userdetails to bl and on successfull evaluation i.e when it returns true we must create forms identity.

class prjuser
{
string _uname,_password;

public
….
….

….
}

c1 obj=new c1();
obj.a=10

class c2 : c1

Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )

JQuery Accordion

Accordion Functionality can be achieved by many ways one of the way is using jquery.

Name the above file as accordion.html and in the same folder jquery.js file.

you can download same for free from here.

and then have your custom according just waiting for you to use.

the output looks like this :

Reference : Dilip Kumar Jena ( https://mstechexplore.wordpress.com )