Breaking News

Monday, 16 February 2015

Working with Arrays in PHP

Array is a function, which stores one or more data at a time.


Example:

<?php
$game=array("chess","cricket","Kabadi");
echo "I like " . $game[0] . "game" ;
?>


Array using loop
<?php
$game=array("chess","cricket","Kabadi");
$alen=count($game);

for($i=0;$i<$alen;$i++)
  {
  echo $game[$i];
echo "<br>"; // if u want next line use this
}
?>
Output:
chess
cricket
Kabadi

Sorting

Example:

<?php
$int=array(2,6,9,7,1,4);
sort($int . " ");
?>

Output:

1 2 4 6 7 9

Find Count

Example:

<?php
$int=array(2,6,9,7,1,4);
count($int");
?>

output:

6


How to search data in array

Example:
<?php     
$find = array("java", "dotnet", "php");      
if (in_array("dotnet", $find))         
{          
echo "MS dotnet";        
}      
else         
{          
echo "Not Found";        
}      
?>  
Output:
    MS dotnet

How to find string length

Example:
<?php     
echo "GK DevelopmentS";   
?>  
Output:
 15
Read more ...

How to Change The Colors Dynamically

Button : It is used for to submit the values.


for change the colors we are using one type of namespace i.e System.Drawing.color and we are using one property i.e forecolor.

Example :

Design: Apply color using Asp.net with C#.net Language

<form id="form1" runat="server">
<div>

<h1>
<asp:Label ID="Label1" runat="server" Text="GK developmentS"></asp:Label>
</h1>

</div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click1" Text="Red" />
&nbsp;<asp:Button ID="Button2" runat="server" onclick="Button2_Click1"
Text="Green" />
&nbsp;<asp:Button ID="Button3" runat="server" onclick="Button3_Click" Text="Blue" />
&nbsp;<asp:Button ID="Button4" runat="server" onclick="Button4_Click"
Text="Yellow" />
</form>

Read more ...

State Management Techniques

Why Microsoft introduce state management techniques?


Generally, every system uses HTTP protocol it is stateless protocol.It does not maintaining the status to client.But,we are maintaining some status to client .HTTP protocol does not retain any information about user requests.it is difficult way to create communication between server and client, page is created each time the page is requested.  For example, if a user enters any information into a text box, that information would be lost in the round trip from the browser or client device to the server.So,Microsoft introduced state management techniques.


What is state management techniques?

State management techniques means to maintaining the status either client side or serverside.These are 2 types

1) Client-side State management techniques

2) Server-side State management techniques


Client side State management

It means,to maintaining the client information in client side.These are different types

Cookie

View State:

Query strings:

Hidden fields:


Cookie: A cookie is a small piece of data stored on user's computer. Usually,these information is stored either web browser or hard disk. Cookies are used by websites to keep track of visitors. Every time a user visits a website, cookies are retrieved from user machine and help identify the user. So,it does not provide any security to user information.

Example:
if (Request.Cookies["id"] != null)

Lable1.Text = "Hello" + Request.Cookies["id"].Value +";  

else      

Lable1.Text = "hi";

View State: View State can be used to stores information in client side.

Example:

ViewState["id"]  = "welcome";    
Response.Write(ViewState["id"]);


Query strings: Query strings are usually used to send information from one page to another page. 

http://www.bestsavings.in/gk/java.html?id=2&page=1

Hidden fields: Hidden fields are used to store data at the page level. As its name says, these fields are not rendered by the browser. It's just like a standard control for which you can set its properties. Whenever a page is submitted to server, hidden fields values are also posted to server along with other controls on the page.

Example:

Hidden1.Value="welcome";
string str=Hidden1.Value;


Server Side State management


It means,to maintaining the client information in server side.These are different types

Sessions
Application Status

Session: Session state is similar to application state, except that it is scoped to the current browser session. If different users are using your application, each user session will have a different session state. In addition, if a user leaves your application and then returns later, the second user session will have a different session state from the first.Session state is structured as a key/value dictionary for storing session-specific information that needs to be maintained between server round trips and between requests for pages.

Example:

Session["id"]=TextBox1.Text;

Lable1.Text=session["id"].ToString();


Application status: Application object is used to store data which is visible across entire application and shared across multiple user sessions. Data which needs to be persisted for entire life of application should be stored in application object.

Example:
Application.Lock();
Application["id"]="welcome";
Application.UnLock();
Read more ...

Language Fundamentals in VisualBasic.Net

What is Visual Basic?


Visual Basic is a programming language is introduced by microsoft.. It is simple ,modern, object-oriented programming language.It is vary much based on DOS version called BASIC. BASIC means Beginners All-purposeSymbolic Instruction Code. It is a relatively easy programming language to learn and it is different from c#.net.It als have vb.net 2005 , vb.net 2008 , vb.net 2010 and latest is vb.net 2012.
Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET Framework. Although it is an evolution of classic Visual Basic language, it is not backwards-compatible with VB6, and any code written in the old version does not compile under VB.NET.
Like all other .NET languages, VB.NET has complete support for object-oriented concepts. Everything in VB.NET is an object, including all of the primitive types (Short, Integer, Long, String, Boolean, etc.) and user-defined types, events, and even assemblies. All objects inherits from the base class Object.

The following reasons make VB.Net language:

  • Modern, general purpose.
  • Object oriented.
  • Easy to learn.
  • Structured language.
  • It produces efficient programs.
  • It can be compiled on a variety of computer platforms.
  • Part of .Net Framework.
Strong Programming Features VB.Net

VB.Net has strong programming features:

  • Boolean Conditions
  • Automatic Garbage Collection
  • Standard Library
  • Assembly Versioning
  • Properties and Events
  • Delegates and Events Management
  • Easy-to-use Generics
  • Indexers
  • Conditional Compilation
  • Simple Multithreading
Example:

if you want to create any variable in vb.net

Dim i As Integer


creating class

Dim con as SqlConnection=new SqlConnection();


Programm:


Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Response.Write("welcome")

End Sub
End Class
Read more ...

Common Language Runtime


CLR is the heart of the .NET framework. .NET applications are compiled to a common language known as Microsoft Intermediate Language or “IL”. The CLR, then, handles the compiling the IL to machine language, at which point the program is executed. The CLR environment is also referred to as a managed environment, in which common services, such as garbage collection and security, are automatically provided.

The CLR allows objects created in one language be treated as equal citizens by code written in a completely different language. To make this possible, Microsoft has defined a Common Language Specification (CLS) that details for compiler vendors the minimum set of features that their compilers must support if they are to target the runtime. Any language that conforms to the CLS can run on the CLR. In the .NET framework, Microsoft provides Visual Basic, Visual C++, Visual C#, and JScript support.
The CLR simplifies application development, provides a robust and secure execution environment, supports multiple languages and simplifies application deployment and management.

Common Type System

The Common Type System defines how data types are declared, used, and managed in the runtime, and is also an important part of the runtime’s support for the Cross- Language Integration. The common type system performs the following functions:
• Establishes a framework that enables cross-language integration, type safety, and high performance code execution.
• Provides an object-oriented model that supports the complete implementation of many programming languages.
• Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.

The Common Type System can be divided into two general categories of types, Reference type and Value type each of which is further divided into subcategories. 


Garbage Collector
Now let us discuss about an important feature of the CLR called Automatic Memory Management. A major feature of .NET framework CLR is that the runtime automatically handles the allocation and release of an object’s memory resources. Automatic memory management enhances code quality and developer productivity without negatively impacting expressiveness or performance.

The Garbage Collector (GC) is responsible for collecting the objects no longer referenced by the application. The GC may automatically be invoked by the CLR or the application may explicitly invoke the GC by calling GC.Collect. Objects are not released from memory until the GC is invoked and setting an object reference to Nothing does not invoke the GC, a period of time often elapses between when the object is no longer referenced by the application and when the GC collects it.

Just-In-Time Compilation (JIT)

The MSIL is the language that all of the .NET languages compile down to. After they are in this intermediate language, a process called Just-In-Time (JIT) compilation occurs when resources are used from your application at runtime. JIT allows “parts” of your application to execute when they are needed, which means that if something
is never needed, it will never compile down to the native code. By using the JIT, the CLR can cache code that is used more than once and reuse it for subsequent calls, without going through the compilation process again.

JIT Compilation Process

The JIT process enables a secure environment by making certain assumptions:
• Type references are compatible with the type being referenced.
• Operations are invoked on an object only if they are within the execution
parameters for that object.
• Identities within the application are accurate.
Read more ...

Introduction to the DotNet

The Microsoft .NET initiative is a very wide initiative and it spans multiple Microsoft Products ranging from the Windows OS to the Developer Tools to the Enterprise Servers. The definition of .NET differs from context to context, and it becomes very difficult for you to interpret the .NET strategy. This section aims at demystifying the various terminologies behind .NET from a developer’s perspective. It will also highlight the need for using this new .NET Platform in your applications and how .NET improves over its previous technologies..


The .NET Framework is a new computing platform that simplifies application development in the highly distributed environment of the Internet. The .NET Framework is designed to fulfill the following objectives:

  • To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely.
  • To provide a code-execution environment that minimizes software deployment and versioning conflicts.
  • To provide a code-execution environment that guarantees safe execution of code, including code created by an unknown or semi-trusted third party.
  • To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments.
  • To make the developer experience consistent across widely varying types of applications, such as Windows-based applications and Web-based applications.
  • To build all communication on industry standards to ensure that code based on the .NET Framework can integrate with any other code.
  • .
The .NET Framework has two main components: the common language runtime and the .NET Framework class library. The common language runtime is the foundation of the .NET Framework. You can think of the runtime as an agent that manages code at execution time, providing core services such as memory management, thread management, and Remoting, while also enforcing strict type safety and other forms of code accuracy that ensure security and robustness. In fact, the concept of code management is a fundamental principle of the runtime. Code that targets the runtime is known as managed code, while code that does not target the runtime is known as unmanaged code. The class library, the other main component of the .NET Framework, is a comprehensive, object-oriented collection of reusable types that you can use to develop applications ranging from traditional command-line or graphical user interface (GUI) applications to applications based on the latest innovations provided by ASP.NET, such as Web Forms and XML Web services.
Read more ...

Tuesday, 30 December 2014

How to Display Google Maps Using C#.Net


How to Display Google Maps Using C#.Net

Design:

Open->VS2008/10->FileàNewàprojectàselect Window form Applicationàok

Create design using controls like Textboxes, Button, Labels and webBrowser1

Coding
In search Button Click

private void button1_Click(object sender, EventArgs e)
        {            StringBuilder url = new StringBuilder();            url.Append("https://maps.google.com/maps?q=");            if (textBox1.Text == "")            {                MessageBox.Show("Enter the Location");            }            else if (textBox2.Text == "")            {                MessageBox.Show("Enter the Criteria");            }            else            {                url.Append(textBox1.Text + "," + "+");                url.Append(textBox2.Text + "," + "+");                webBrowser1.Navigate(url.ToString());            }        }



Read more ...
Designed By Blogger Templates