I wanna share…

Archive for the ‘.Net’ Category

Good Reference–Chart Control in .Net.

Hi,
Nice article on Chart control..
Never miss to read..

Chart control in .Net

Thanks Scott Mitchell for sharing this…

MySQL :: Could not start the service MySQL. Error:0

At the time of Mysql installation we’re facing this bug..What’s the solution?.

Follow three steps:

1. Start-> Settings–> Control Panel–> Add/Remove programs: remove all the programs of Mysql
2. Go to this directory C:/Program Files/MySQL and delete the Mysql folder
3. Give this C:/Documents and Settings/All Users/Application Data/MySQL path in Run –> Open: Then delete the info of Mysql

Now start the fresh installation…….

hope it works……

To get number of online visitors(current) to your website(ASP NET).

Showing Current number of user in online is common in the part of developing a web site.

How to achieve that??? very simple.

1. Add Global.asax file to your application(web)

2. Add this code…

void Application_Start(object sender, EventArgs e)
{
Application[“Users”] = 0;
}

void Session_Start(object sender, EventArgs e)
{
Application.Lock();
Application[“Users”] = (int)Application[“Users”] + 1;
Application.UnLock();
}

void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application[“Users”] = (int)Application[“Users”] – 1;
Application.UnLock();
}

3. In the web.config file write this code…

<system.web>
<sessionState mode=”InProc” cookieless=”false” timeout=”15″ />
</system.web>

 

4. Use this code in your Home Page

No. of users in online ::::: <%= Application[“Users”].ToString() %>

 

5. Build and Run the application.

Hope it help you….

 

 

 

How Do I: Create a Silverlight Website Using Expression Design

document.write(“”);

Solution to this error:The Silverlight managed debugging package isn’t installed.

When I was installed the Silverlight Template to VS IDE, everything is went fine. But the problem is happened when I run the Silverlight application.

I faced error like this Unable to start debugging. The Silverlight managed debugging package isn’t installed. So what’s the solution?

The Solution is

  1. You might already have lower version Silverlight chainer. So uninstall everything related to Silverlight from Control panel Add and Remove programs.
  2. Download and install the Silverlight Developer runtime (any version you want) EX: 3.0
  3. Download and install Silverlight 3.0 Tools
  4. Create and Run the application. The application will run successfully.

.NET Framework 2.0, 3.0 and 3.5 Components

.NET Framework 2.0, 3.0 and 3.5

.Net Framework is a common environment for building, deploying and running web services and applications like web applications, window applications, mobile applications etc.

You can see the .NET Framework 2.0 diagram below.

  1. Windows Forms
  2. Active server pages
  3. .Net Framework base classes
  4. Common Language Runtime

Now, I will tell you some important points regarding Framework.

Common Language Infrastructure (CLI):

Common Language Infrastructure allows software components to:

  1. Pass data between each other without regard to the Programming languages.
  2. Execute on Different Operating Systems and Different Hardware platforms without having to compile a High-Level source code.

An Implementation of Common Language Infrastructure is known as Common Language Runtime.

Common Language Runtime (CLR):

Common Language Runtime is a very important one in .Net Framework. It manages building, deploying and running .Net applications. It is known as Virtual Execution System (VES). The code which is run by Virtual Execution System is known as Managed Code.

Common Language Runtime responsibilities are:

  1. Garbage Collection: CLR manages memory leaks automatically.
  2. Code Access Security: Manages privileges like Read-only, write-only etc
  3. Code verification: Type safety

Common Type System (CTS):

Common Language Runtime facilitates the Common Type System (CTS). A Number of types are supported by CLR and described by CTS. Both Value types are supported:

  • Primitive data types (int etc)
  • Reference types. (Arrays, strings etc)

In order that two languages communicate in a smooth way. Ex: Vb.Net uses Integer and vc++ uses long data types. Communication between these two is complicated. So two languages use CTS to communicate with each other. CTS will change those data types into System.Int32 to communicate easily.

Common Language Specification (CLS):

Common Language Specification is a subset of Common Type System (CTS).

It facilitates all .Net languages into an umbrella; in other words, communication among .Net languages in a seamless manner.

Microsoft Intermediate Language (MSIL):

.Net Source code is compiled into Intermediate Language (IL), also called Common Intermediate Language (CIL). CLR runs the IL code into machine code. (Occurred at the time of application is installed).

.NET 2.0 to .NET 3.5

If we can observe .Net Framework from 2.0 version to 3.5 Version

These are the changes that happened:

  • WCF-Windows Communication Foundation
  • WPF-Windows Presentation Foundation
  •  WWF-Windows Workflow Foundation

Windows communication foundation:

WCF is a programming Platform and run time system for building, running and deploying the network distributed services. It is the latest Service oriented technology.

Interoperability is the fundamental characteristics of WCF. It has web service, .Net remoting, MSMQ and COM+. It combines all these things into a single umbrella.

Means it provides a common platform for all .Net communication.


Windows Presentation Foundation (WPF):

Windows Presentation Foundation is a Microsoft’s Next generation UI Framework to create applications like rich user experience. It is the part of .Net Framework 3.0 and higher.

You can see the below picture that shows the features of Windows Presentation Foundation (WPF).


We can use these tools to get rich applications called Microsoft Expression. It consists of the four products:

Expression Blend is built to create user interfaces in WPF and Silverlight. It builds the bridge between designer and developers. It can open VisualStudio solutions

Expression Design is a lightweight version of Adobe Illustrator to create and edit vector graphics.

Expression Media is built to encode, cut and enrich video files and optimize them for silverlight streaming

Expression Web is Microsoft’s next generation of HTML and Javascript editor. Its the replacement for Frontpage.

String and String Builder classes

String and String Builder classes

DownLoad link: Click Here

Strings are plays a major role in our programming world. To deal with these Strings we are using String and StringBuilder classes.

String:

A string is a sequential collection of Unicode characters that is used to represent text. String is a class which belongs to the namespace System. String.

String Concatenation can be done using ‘+’ opearator or String.Concat method.

String.Concat method concatenates one or more instances of String.

Sample code:

string string1 = “Today is ” + DateTime.Now.ToString (“D”) + “.”;

Console.WriteLine (string1);

string string2 = “Hi ” + “This is Jitendra “;

string2 += “SampathiRao.”;

Console.WriteLine(string2);

StringBuilder:  StringBuilder is a class which belongs to the namespace System.Text. This class cannot be inherited.

In StringBuilder we are using Append () method.

Sample code:

StringBuilder number = new StringBuilder (10000);

for (int i = 0; i<1000; i++)

{

returnNumber.Append (i.ToString ());

}

 So where we can use these classes?

The answer is for simple String manipulations we can use String class. But the string manipulations are more it is better to use StringBuilder class.

Why the StringBuilder class is better for more string manipulations instead of String class?

The String object is immutable. Every time you use one of the methods in the System. String class, you create a new string object in memory, which requires a new allocation of space for that new object. In situations where you need to perform repeated modifications to a string, the overhead associated with creating a new String object can be costly. It’s nothing but performance of the application might be decreased. So we are using StringBuilder in such cases.

StringBuilder object is mutable. The System.Text.StringBuilder class can be used when you want to modify a string without creating a new object. For example, using the StringBuilder class can boost performance when concatenating many strings together in a loop.”

Differences between String and StringBuilder:

It belongs to String namespace It belongs to String. Text namespace
String object is immutable StringBuilder object is mutable
Assigning:

String s= ”something important”;

Assigning:

StringBuilder sbuild= new StringBuilder(“something important”);

We can use ‘+’ operator or Concat method to concatenate the strings. Here we are using Append method.
When string concatenation happens, additional memory will be allocated. Here additional memory will be allocated when the string buffer capacity exceeds only.