Posts

Showing posts from 2014

Validate Mobile Number with 10 Digits in ASP.Net

Here is the code for validating textbox for 10 digit mobile number. .ASPX File: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br\>     <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"        ControlToValidate="TextBox1" ErrorMessage="RegularExpressionValidator"      ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>

Introducing JSON

Image
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language , Standard ECMA-262 3rd Edition - December 1999 . JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. JSON is built on two structures: A collection of name/value pairs. In various languages, this is realized as an object , record, struct, dictionary, hash table, keyed list, or associative array. An ordered list of values. In most languages, this is realized as an array , vector, list, or sequence. These are universal data structures. Virtually all modern programming languages support them in one form...

Dijkstra's Algorithm

D ijkstra's algorithm solves the single-source shortest-path problem when all edges have non-negative weights. It is a greedy algorithm and similar to Prim's algorithm. Algorithm starts at the source vertex, s, it grows a tree, T, that ultimately spans all vertices reachable from S. Vertices are added to T in order of distance i.e., first S, then the vertex closest to S, then the next closest, and so on. Following implementation assumes that graph G is represented by adjacency lists. DIJKSTRA (G, w, s) 1.    INITIALIZE SINGLE-SOURCE (G, s) 2.    S ← { }     // S will ultimately contains vertices of final shortest-path weights from s 3.    Initialize priority queue Q i.e., Q  ←  V[G] 4.    while priority queue Q  is not empty do 5.        u   ←  EXTRACT_MIN(Q)    // Pull out new vertex 6.        S  ←  S È { u...

Advantages & Disadvantages of Using Ajax

Advantages Everything has its own merits and demerits, Ajax included. ·            The application seems to become more responsive and interactive as the user gets the response without clicking any buttons. ·            In classic web application, when the web server responds to the web browser with a new page, it may make use of multiple connection threads in order to speed up the process, but this happens for the content only (which is between <body> tags). The CSS as well as the script files present in the head section are transferred using only one connection thread which results in performance degradation. With Ajax, it is required to load only the basic script and CSS files. Rests are requested as content using multiple connections. ·            A big advantage is that the user is not required to keep on waiting and waiting. · ...

Generate Link In Dynamicaly in Literal Control asp.net c#

 Literal.Text="<a href='"+ConfigurationManager.AppSettings["WebSiteBasePath"] + "Find/" + ViewState["CityName"] + "/" + DataBinder.Eval(e.Item.DataItem, "Name").ToString()+"' >"+DataBinder.Eval(e.Item.DataItem, "Name").ToString()+"</a>"; 

Showing Top Repeater items with More link

  < asp : Repeater ID = " rpt " runat = " server " DataSourceID = " sql " OnItemDataBound = " rpt_ItemDataBound " > < HeaderTemplate > < ul id = " list " > </ HeaderTemplate > < ItemTemplate > < li id = " listItem " runat = " server " > <%# Eval("au_lname") %> </ li > </ ItemTemplate > < FooterTemplate > </ ul > < a id = " show " href = " javascript:show(); " > Show All </ a > < a id = " hide " href = " javascript:hide(); " style = " display:none; " > Hide </ a > </ FooterTemplate > </ asp : Repeater > < asp : SqlDataSource ID = " sql " runat = " server " ConnectionString = " <%$ ConnectionStrings:Pubs %> ...

Dynamic Link in Javascript in asp.net

window.location.href=" <%=ConfigurationManager.AppSettings["WebSiteBasePath"]%>View/" + CityName + "/Doctor/" + FirstName + "-" + MiddleName + "" +LastName+"/"+ID;

Opening For New Window in Browser in Javascript

            var obj=window.parent.document.getElementById('DoctorListing.aspx');              if(obj!=null)              {               obj.disabled=true;                            }              else              {              alert('Close Window');              } window.open(url,'PopupWindow','left=50,top=50,height=400,width=800,toolbar=no,menubar=no,location=no,scrollbars=no,unadorned=...

Image Compression and Watermark Text In Asp.Net C#

   public void CreatePicture(Stream Fs,string uploadFilename, bool BinaryWrite)             {                string WorkingDirectory = HttpContext.Current.Server.MapPath("Images/DoctorImg/");                        /*  Bitmap bmpUpload = new Bitmap(Fs, false);                 Graphics graphicsObj = Graphics.FromImage(bmpUpload);                 Brush brush = new SolidBrush(Color.Gray);                 Point postionWaterMark = new Point((bmpUpload.Width /10), (bmpUpload.Height/10));        ...

Java OOPs Concepts

Image
In this page, we will learn about basics of OOPs. Object Oriented Programming is a paradigm that provides many concepts such as inheritance , data binding , polymorphism etc. Simula is considered as the first object-oriented programming language. The programming paradigm where everything is represented as an object, is known as truly object-oriented programming language. Smalltalk is considered as the first truly object-oriented programming language. OOPs (Object Oriented Programming System) Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts: Object Class Inheritance Polymorphism Abstraction Encapsulation Object Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical. C...

Set Daynamic layout in Android

  Xml File    <LinearLayout                         android:id="@+id/Someonelese"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                              android:layout_below="@+id/viewStub1"                         android:layout_marginLeft="17dp"         ...

Import Data in Database From Excel Using asp.net c#

.aspx file   < div >         < table >             < tr >                 < td >                     < span style =" color : Red"> * </ span > Attach Excel file                 </ td >                 < td >                     < asp : FileUpload ID ="fuexcelupload" runat ="server" />                 </ td >   ...