What are the differences between .NET 2.0,3.0 & 3.5?

Answer :-

Good Links:
http://dufoli.wordpress.com/2007/09/11/net-framework-11-20-30-35-21/
http://24x7aspnet.blogspot.com/2009/05/difference-between-net-203035-framework.html
In short:
2.0 => framework that shipped with VS 2005 VB 8.0 / C# 2.0
3.0 => same framework as 2.0 + WCF + WPF + WF
3.5 => all the above + LINQ technologies and will ship with the next VS including VB 9.0 and C#
Updated as per Gaurav’s comment.

PolyglotSkype : A MultiLingual Skype

Challenge

One of my friend Vishwas tried to send message in Skype and at that time he came to know  that skype dosen’t supports Unicode Characters — Which is required stuff for sending multilingual message. He asked me to develop something. I was also knowing this and in back of my mind I was thinking to create some application using which skype can support Unicode Characters.

Solution

First, I started looking on web that how can i communicate with Skype using my C# Code and I found[someone truly said : A will will find a way] Skype4COM– “Skype4COM is an ActiveX component that represents the Skype API as objects, with properties, commands, events and notifications. Use Skype4COM in any ActiveX environment, such as Visual Studio or Delphi, and with a standard scripting language, such as Visual Basic, PHP, or Javascript. [Src : http://developer.skype.com/accessories]”
Secondly, I thought to use Google’s Translate feature in my application directly. So, user no need to go to Google Translate page do translation and copy-paste message.  Then I found Google-API-for-dot-net
Now, the raw and basic material is ready with me. Now i need to write windows application and some hand crafted code to create my own Skype. But before starting i also thought a lot for name I wanted to give unique name and i found it — “PolyglotSkype” [polyglot — linguist: a person who speaks more than one language].
Finally, I am glad to share this tool with you. Below are few details of it:

Introduction

PolyglotSkype supports unicode characters, using which you can chat with your buddies in any language.

Main features

  • Unicode support.
  • Loads all your online skype friends.
  • In-built Google Translate support — Supports so many languages!.

Screen shots



System requirements

Skype
.NET 3.5 SP1

How to use?

1. Install “PolyglotSkypeInstaller”.
2. Once installed it will create shortcut on your desktop “PolyglotSkype”.
3. Now, to use PolyglotSkype you need to be logged in to Skype.
4. When you run PolyglotSkype application skype will ask you for access. Please select “Allow access”.
5. That’s it! Enjoy 🙂

I would like to hear from you

If your feedback is positive tell to your peers else tell to me at : klpatil@hotmail.com. Feel free to post your suggestions/comments/bugs at provided email id.

Technical links

For Google Translate : http://code.google.com/p/google-api-for-dotnet/
For Skype API : http://developer.skype.com/accessories
Windows Installer : http://www.simple-talk.com/dotnet/visual-studio/getting-started-with-setup-projects/

Would like to Download? Click here

Eager to have your feedback!
Sourcecode : Coming Soon…

Skype4COM

WebBrowserControl Scroll to Bottom

Challenge

I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display the messages between the user and the recipient. How do I get the control to automatically scroll to the bottom every time I update the DocumentText of the control?

Solution

I tried to Google it and found below stuff which doesn’t work as expected.

ctlWebBrowser.Document.Body.ScrollIntoView(false);

// http://stackoverflow.com/questions/990651/system-windows-forms-webbrowser-scroll-to-end

webCtrl.Document.Window.ScrollTo(0, int.MaxValue);

// http://stackoverflow.com/questions/46454/webbrowsercontrol-scroll-to-bottom
Finally, I did it using following way:
[sourcecode language=”csharp”]
private void ScrollMessageIntoView()
{
// MOST IMP : processes all windows messages queue
System.Windows.Forms.Application.DoEvents();
if (webBrowserControlRcdMsg.Document != null)
{
webBrowserControlRcdMsg.Document.Window.ScrollTo(0,
webBrowserControlRcdMsg.Document.Body.ScrollRectangle.Height);
}
}
[/sourcecode]
Thanks to this Link : http://social.msdn.microsoft.com/forums/en-US/winforms/thread/74694382-dc0d-4824-ac8f-3a4046f45111/

Adding Assembly in to GAC-Progrmmatically

How To Add Assembly in GAC(Global Assembly Cache) Programmatically?

In my last project I need to ad Assembly to GAC…you will tell go to Microsoft .Net Configuration tool and Add Assembly to GAC….i also know this i am not that much dump…But i need to add it programmatically….now you also have to think na???? But i have its solution so don’t worry just follow this Post..
First i think u know that what it requires to add an assembly to GAC..What??????You don’t…….no worries yaar Main Hoon na…
For Adding an Assembly to GAC…your assembly should have strong name…what???you don’t know how to make an assembly which contains strong name….i am going to be a Mad now you don’t know anything… anyways i will guide you to do that so no worries.
Just Have to follow 3 Steps:
Step 1: Open .NET Framework SDK Command Prompt. and Type sn- k <keyname>.snk
Strong NAme01
This will generate a Key at current path. In Above’s examples(C:\).
Step 2. Now Add this Strong name to your solution by right click on solution and Add an Existing Item and locate Key File.
Strng Name 02
Step 3: Now Open AssemblyInfo.CS/Vb file and add [assembly: AssemblyKeyFile(“key.snk”)] this line.
Strong name03
That’s it now your Assembly have a Strong name and it is ready to be add in GAC..
Its easy na????
Now my main Aim comes tht how to add assembly to GAC programmatically.
It is also easy.Just follow me.
1. Add Reference to System.Enterpriseservices.
2. It has Publish Class make its object:
Publish publish = new Publish();
3. And now you can Install it into using this:
publish.GacInstall(<Path of your Assembly to Add in GAC>);
you can show a openFileDialog to user from it user can select an Assembly and based on FilePath Property you can add it into GAC..and Magic it is going to be added in GAC..user will Be happy!!![and that’s what a developer wants..am i right?].
Just by following 3 Steps your assembly is in to GAC..is it good na???
But there is one problem in it..can you guess what???No na..ok let me tell you.
See if Assembly dosen’t contains Strong Name than it will not show any error and not add it in to GAC Also..end user will not come in to know about it any time…so now what to do??? I have developed one Helper Class which will check that Assembly has strong name or not, user has permission to Add Assembly in to GAC etc.
So here is my Helper Class:
[sourcecode language=”csharp”]
<em><strong>public class Helper
{
public enum ErrorMessage
{
None, //NO ERROR
Unknown, //NOT IDENTIFIED ERROR OCCURED
AssemblyNotFound, //Assembly can’t be found
AssemblyLoadError, //Error during loading assembly
NotCLRAssembly, //Specified Assembly is Not a CLR Assembly
NotSignedAssembly, //NOT ASSIGNED STRONG NAME
NotAuthorized //Security Exception</strong></em>
<em><strong> } </strong></em>
<em><strong> public static ErrorMessage InstallAssembly(String assemblyPath)
{
if (String.IsNullOrEmpty(assemblyPath))
return ErrorMessage.AssemblyNotFound;
try
{</strong></em>
<em><strong>Assembly assembly = Assembly.ReflectionOnlyLoadFrom(assemblyPath);
byte[] pkey = assembly.GetName().GetPublicKeyToken();
if (pkey.Length == 0) return ErrorMessage.NotSignedAssembly;</strong></em>
<em><strong>}
catch (BadImageFormatException)
{
return ErrorMessage.NotCLRAssembly;
}
catch (FileLoadException)
{
return ErrorMessage.AssemblyLoadError;
}
catch (FileNotFoundException)
{
return ErrorMessage.AssemblyNotFound;
}
catch (SecurityException)
{
return ErrorMessage.NotAuthorized;
}
Publish publish = new Publish();</strong></em>
<em><strong>try
{
publish.GacInstall(assemblyPath.Trim());
return ErrorMessage.None;
}
catch (SecurityException)
{
return ErrorMessage.NotAuthorized;
}
} </strong></em>
<span style="color: #ff00ff;"> }</span>
[/sourcecode]
To use it:
[sourcecode language=”csharp”]
<em><strong> private bool InstallAssembly()
{
String AssemblyPath = assemblyofd.FileName;</strong></em>
<em><strong> OpenFileDialog assemblyofd = new OpenFileDialog();
bool installed = false;
if (!string.IsNullOrEmpty(AssemblyPath))
{
Helper.ErrorMessage ErrMsg = Helper.InstallAssembly(AssemblyPath);
switch(ErrMsg)
{
case Helper.ErrorMessage.None:
//MessageBox.Show("The assembly you specify is successfully installed into the GAC", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
installed = true;
break;</strong></em>
<em><strong> case Helper.ErrorMessage.AssemblyLoadError:
MessageBox.Show("Some problem occured During Loading an Assembly,Please Try Later", "Cannot Add Assembly", MessageBoxButtons.OK, MessageBoxIcon.Error);
installed = false;
break;
case Helper.ErrorMessage.AssemblyNotFound:
MessageBox.Show("Sorry, Unable to Find Assembly", "Cannot Add Assembly", MessageBoxButtons.OK, MessageBoxIcon.Error);
installed = false;
break;
case Helper.ErrorMessage.NotAuthorized:
MessageBox.Show("You are not authorized to install Assembly, please Contact your Administrator", "Cannot Add Assembly", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
installed = false;
break;
case Helper.ErrorMessage.NotCLRAssembly:
MessageBox.Show("The assembly you specify is not a managed assembly", "Cannot Add Assembly", MessageBoxButtons.OK, MessageBoxIcon.Error);
installed = false;
break;
case Helper.ErrorMessage.NotSignedAssembly:
MessageBox.Show("Unable to add the selcted assembly. The assembly must have a strong name (name,versioan and public key).", "Cannot Add Assembly", MessageBoxButtons.OK, MessageBoxIcon.Error);
installed = false;
break;
case Helper.ErrorMessage.Unknown:
MessageBox.Show("Some problem occured during Installing Assembly", "Cannot Add Assembly", MessageBoxButtons.OK, MessageBoxIcon.Error);
installed = false;
break;
}
}
return installed;
}</strong></em>
[/sourcecode]
That’s it.
This will serve the Purpose.
Try it and let me know it works for you or not.
“If you do your best whatever happens will be for the best”.

Awesome DataAccess Tutorials

Hello All, Today while looking at my some old data i found very good ASP.NET DataAccess Tutorials. Which i was using a lot when i was totally newbie[Even today also I’m newbie only :)]  in ASP.NET this tutorials contains everything and the content and the way tutorial teaches is really awesome. You must be thinking this guy is prasing and just keep talking about tutorials but where are the tutorials? Here you go : http://www.asp.net/data-access/tutorials And all tuorials are available in PDF Format for Download 🙂
I hope this tutorials help the same way it helped me. Thanks to the Author for writing such a nice tutorials!

Would like to set Session Timeout?

Challenge:

Before so many months back i have been assigned for a task where we need to set a session timeout for our whole application. Some enthu guys will tell it is 2 mins. job just go in web.config and do the configuration and it’s done. But let me tell you it’s not that much easy :(. Because there are two things which affects on session timeout Forms Authentication Timeout and Session Timeout
Forms Authentication Timeout Configuration
[sourcecode language=”xml”]
<system.web>
<authentication mode="Forms">
<forms timeout="50000000"/>
</authentication>
</system.web>
[/sourcecode]
Session Timeout Configuration
[sourcecode language=”xml”]
<pre><configuration>
<system.web>
<sessionState mode="InProc"
cookieless="true"
timeout="20"/>
</sessionState>
</system.web>
</configuration></pre>
[/sourcecode]

Solution

Unfortunately at tha time i haven’t written blog on it[I’m sorry for that]. But Here is the link where someone else did that already[Thanks to him!]:
http://dotnethitman.spaces.live.com/Blog/cns!E149A8B1E1C25B14!210.entry
http://weblogs.asp.net/scottgu/archive/2005/11/08/430011.aspx
http://aspalliance.com/520_Detecting_ASPNET_Session_Timeouts.all

Good To Know on ASP.NET Application Restarts

You all may heard about ASP.NET Application restart. If no then it’s really good to know. Today i got few good links which i would like to share with you guys as well:
http://fuchangmiao.blogspot.com/2007/11/aspnet-application-restarts.html
http://blogs.msdn.com/b/johan/archive/2007/05/16/common-reasons-why-your-application-pool-may-unexpectedly-recycle.aspx
http://blogs.msdn.com/b/johan/archive/2008/02/18/monitoring-application-pool-and-application-restarts.aspx
Hope this articles clear all your questions on ASP.NET application restart. If not feel free to drop a comment here.

Generic List Sorting

Generic List has powerful sorting method which too less .Netters are aware of. Today, I would like to show it’s power to you guys!
Here we go..
Suppose, you have a Class called Employee and created collection of employees using Generic List as shown below:
[sourcecode language=”csharp”]
public class Employee
{
public int EmployeeID { get; set; }
public string EmployeeName { get; set; }
public Employee(int employeeId, string employeeName)
{
EmployeeID = employeeId;
EmployeeName = employeeName;
}
public override string ToString()
{
return EmployeeID + " :- " + EmployeeName;
}
}
List<Employee> employeeList = new List<Employee>();
employeeList.Add(new Employee(2, "Sachin T"));
employeeList.Add(new Employee(1, "Anil K"));
[/sourcecode]
Now, if you need to sort your employees collection by EmployeeID how will you do it? – I know i know you will write your logic and do so many things..But hold on how it will be if we can do it in just one line? sounds cool na? Here you go:
[sourcecode language=”csharp”]
Console.WriteLine(">>>>>>>>>>Before Sorting<<<<<<<<<<");
foreach (Employee employee in employeeList)
{
Console.WriteLine(employee.ToString());
}
// Sorting – Anonymous method
employeeList.Sort(delegate(Employee employee1, Employee employee2)
{ return employee1.EmployeeID.CompareTo(employee2.EmployeeID); });
Console.WriteLine(">>>>>>>>>>After Sorting<<<<<<<<<<");
foreach (Employee employee in employeeList)
{
Console.WriteLine(employee.ToString());
}
/* Output
>>>>>>>>>>Before Sorting<<<<<<<<<<
2 :- Sachin T
1 :- Anil K
>>>>>>>>>>After Sorting<<<<<<<<<<
1 :- Anil K
2 :- Sachin T
Press any key to continue . . .
*/
[/sourcecode]

Links

http://weblogs.asp.net/dwahlin/archive/2007/04/23/The-Power-of-Anonymous-Methods-in-C_2300_.aspx

Embed Almost any Document on Your Website

Challenge:

one of my friend asked me that how can i embed any document on a webpage? gotcha? Nope? okay let me elaborate functionality in a brief.

1. User can post/upload articles on portal in any format. e.g. .PPT,.PPTX,.DOC,.XLS,.XLSX, PDF.

2. Once uploaded after that user can preview his/her uploaded articles in read only format and in same format on Webpage only. No download required.

This is the big challenge! After searching a bit we found a good site and implemented it. I know you guys are eager to know. how? Okay here you go..

Solution:

There is a nice site called http://embedit.in which supports all our requirements – really great stuff by site developers!

It supports embedding document using three ways:

1. Uploading document manually :- Visit http://embedit.in/ and upload your document.

2. using embedit API :- Visit http://embedit.in/api and you can do all operations programmatically. Wow!! And you can sign in using any of the below option. No new form you need to fill up 🙂

image

3. SiteWide :-  Use Sitewide to automatically convert all the links to documents in your website to embeds. You just need to put Javascript reference in your HTML content and rest will be managed by Embedit guys! isn’t is great? So, hurry visit : http://embedit.in/sitewide and have fun!

Our Main Hero is SiteWide – which helped us in fulfilling our requirement.

I know you are eager to see it in action before using it.here you go..

image

image

Looks great na? would like to see within your browser? see this example page : http://embedit.in/sitewide/example

Thanks to my friend for throwing this challenge to me and thanks to Google for searching out embedit.in for me and thanks to embedit.in for developing such a nice functionality!

Happy embedding! 🙂

Webliography

http://go4webapps.com/2010/04/29/embedit-in-embed-any-document-file-or-webpage-in-your-blog-profile-or-website/

http://www.blogsolute.com/embed-documents-word-ppt-pdf-psd-xls/2838/

VS 2008/2010 Certification Path

Hello All, After getting loads of FAQ’s on my blog entries Milestone MCPD Exam Cleared and New Milestone MCTS Web 70-528. Today i got few diagrams from MS Site. Which contains great piece of information and answers so many questions of newbie – who would like to give certification exams. So, here we go..

VS 2008 Certifications Path

VS2008_Certification_Path

Source Link: http://download.microsoft.com/download/B/6/6/B66B006F-50AB-493E-BEBE-FD3B1BF548F6/VisualStudio2008_CertPath.pdf

VS 2010 Certifications Path

VS2010_Certification_Path

Source Link: http://download.microsoft.com/download/B/D/D/BDD81000-E7E6-4B7A-A213-8579369FB0AF/VisualStudio2010_CertPath.pdf

If you still have any question feel free to drop me a comment here!

Happy Certificating! 🙂

Resources

http://www.microsoft.com/learning/en/us/certification/view-by-technology.aspx

http://www.microsoft.com/learning/en/us/certification/cert-vstudio.aspx#tab3