Thursday, March 20, 2008

ICloneable, IEquatable , IComparable

ICloneable:

A nice read on on deep , shallow copy and the interface implementation

IEquatable

IEquatable.Equals vs. System.Object.Equals

The IEquatable.Equals method is very similar to Object.Equals. However, IEquatable.Equals is type-safe and generic—requiring no boxing and unboxing.


IEquatable vs. IComparable

At first glance, the IEquatable interface appears very similar to the IComparable interface. But, whereas IEquatable returns a bool representing only whether the instances are equal or not, IComparable returns an inthow the instances differ—whether smaller, equal or larger. indicating

Via - CSharp-Online

ASP.NET
3/20/2008 7:29:40 PM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Monday, July 02, 2007

SQL Server Interesting Links

Interesting piece on SQL server Myths- Jason Haley

talk abt SQL server myths on truncate commands, where a sql table variable is stored, etc

SQL server error handling, and a must read

 


ASP.NET | SQL
7/2/2007 1:57:02 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 

.Net 2.0 IsStringNullOrEmpty Bug

Beware using IsStringNullOrEmpty in .Net 2.0. This bug could easily slip out of the developers hands, as we use IDEs almost always.


ASP.NET
7/2/2007 1:10:52 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Tuesday, March 13, 2007

WPF/E
There is a lot of buzz about WPF. Though it is in its nascent stages, there are some cool applications that are available online.
Micrsoft projects that WPF will change the way developers write applications.

Check these out

http://www.simplegeek.com/mharsh/wpfepad/

http://www.notescraps.com/

http://weblogs.asp.net/scottgu/archive/2007/01/07/next-generation-yahoo-messenger-built-with-wpf-and-net.aspx


ASP.NET | General
3/13/2007 12:12:44 PM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Thursday, February 15, 2007

ASP.NET 2.0 Override debug=true in web.config by machine.config

Deploying web applications can become a painful task if you have to check for a number of settings that you have to modify your code to make it work in production environment. There are chances that developers might miss something if there are a lot of deployment pushes. Features like debugging, tracing, error message display could be a big performance issue if they are turned "on"  the production environment.

ASP.NEt 2.0 has a solution for this...and that is by adding on key to your machine.config

<configuration>
   <system.web>
      <deployment retail="true"/>
   </system.web>
</configuration>

Also, you can block download of specific file(for example.xps) types by registering those file extensions to HttpForbiddenHandler

<add path="*.asmx" verb="*" type=
    "System.Web.HttpForbiddenHandler" />


 

Continue reading here


ASP.NET
2/15/2007 1:47:12 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Wednesday, December 13, 2006

Asp.Net FTP

This is why I love .Net.2.0. You can create a web application that can incorporate the FTP functionality. The base classes are

You can pretty much do almost all the functionalities that you normally do with a FTP client. Follow this link for an excellent artice explaining this

This article explains a windows application that something similar


ASP.NET
12/13/2006 5:29:27 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Monday, December 11, 2006

Asp.Net 2.0 IntegerParse - Int32.TryParse()

We always encounter having to convert a string to an integer. Most of us just unconsciously type in the following

int myNewInteger = Int32.Parse(string)

The problem with this approach is what if the value of notInteger is null or something not an "integer". So there comes the problem of handling the exceptions etc etc

So here comes the Int32.TryParse() method from our .Net Framework 2.0. It converts the string to an integer(32 bit signed) and also a return value indicating if the operation succeeded. This is pretty cool.

Check out the performance profiling of all the three parser methods Convert, parse and tryParse


ASP.NET
12/11/2006 3:15:37 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Thursday, December 07, 2006
 Thursday, November 30, 2006
 Sunday, November 26, 2006

GuidanceExplorer rocks

GuidanceExplorer is a great reference 

 


ASP.NET | SQL | XML
11/26/2006 6:55:52 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Saturday, November 18, 2006

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

Please visit Kris's blog for detalied explanantion.

The brief summary 

First you'll need to open up SQL Server Configuration Manager. Navigate to that in the menu like Microsoft SQL Server 2005 > Configuration tools > SQL Server Configuration Manager.

Double click, or right click and choose Properties, of the selected line and you'll get the properties window

You'll need to make sure that the Local system is selected.

The second part of the solution's to delete the following folder on your hard drive: c:\Documents and Settings\[user]\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS(1). This folder's used to store information and apparently it messes up the proper working of SQL Express.


ASP.NET | General | SQL
11/18/2006 8:19:19 PM (GMT Standard Time, UTC+00:00)  #  Comments [1] 

Windows authentication in Firefox

Eric Wise has posted this cool tip on accessing windows authenticated sites in firefox

To enable windows authentication on your domain.

1. Open Firefox

2. Navigate to the url about:config

3. Locate the following preference names and put as the value the comma separated values of the address roots.

network.automatic-ntlm-auth.trusted-uris

network.negotiate-auth.delegation-uris

network.negotiate-auth.trusted-uris

Your value should look something like this: localhost,server1,server2,serverX


ASP.NET
11/18/2006 3:26:48 PM (GMT Standard Time, UTC+00:00)  #  Comments [10] 
 Monday, November 13, 2006

.Net 2.0 - XslCompiledTransform ToString

System.Xml.XSL.XslTransform is deprecated(obsolete) in .Net 2.0  framework. What this means is the old method of applying  the transform method(XSL.Transform) is not going to work in the future versions of the framework. Instead, you need to apply the transform method of System.Xml.Xsl.XslCompiledTransform class.

I  literally spent hours trying to figure out how to do this. all the online samples were pretty "useless", until i found this. Thanks to everyone. It made me feel better, that i was not alone with this problem.

This is the helper class, Many thanks to Willis

public static class XslHelper
{
   public static String TransformInMemory(XslCompiledTransform transform, String input)
   {
      StringBuilder sb = new StringBuilder();
      XmlReader xReader = XmlReader.Create(new StringReader(input));
      XmlWriter xWriter = XmlWriter.Create(sb);
      transform.Transform(xReader, xWriter);
      return sb.ToString();
   }

   public static String TransformInMemory(String transform, String input)
   {
      XslCompiledTransform xsl = new XslCompiledTransform();
      xsl.Load(XmlReader.Create(new StringReader(transform)));
      return TransformInMemory(xsl, input);
   }
}

Happy Programming!!

 

 


ASP.NET | XML
11/13/2006 1:36:33 AM (GMT Standard Time, UTC+00:00)  #  Comments [0] 
 Friday, October 27, 2006

ASP.Net Site Configuration, SQL 2005

one would assume that it is easy to use ASP.Net Site Configuration tool. i had to spend around 2 hrs to get this straight. I apparently had every problem you could encounter..

ASP.Net Site Configuration on a server

Steps to follow

Extablish mixed authentication mode


ASP.NET | General | SQL
10/27/2006 5:17:30 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Tuesday, October 10, 2006

Cool Page Transition Effects

I have implemented some cool page transition effects. These tags eliminate the flashing when the page loads (when you click on a link etc). Thanks to Nikhil for giving this excellent piece of code.

<meta http-equiv="Page-Exit"
    content="progid:DXImageTransform.Microsoft.Fade(duration=.5)" />


ASP.NET
10/10/2006 2:06:40 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Monday, October 09, 2006

Yahoo Developer Network Opens Up for .Net Programmers

Yahoo is warming up to .Net programmers. Now any one can access yahoo resources through their API's upon authetication through a browser. This is an awesome move in so many ways. this would help the users in accessing all their resources at yahoo,etc(standalone or through API's)  through a common single application. Talking about single point access, Netvibes and pageflakes are creating a lot of buzz these days.


ASP.NET | General
10/9/2006 5:10:12 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Thursday, October 05, 2006

Free Microsoft E-learning Courses

Microsoft is offering free E-learning courses This should be a pretty cool deal for all the newbies.


ASP.NET | General
10/5/2006 2:29:42 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Tuesday, September 12, 2006

ASP.Net: Atlas is coming soon

Scott Guthrie has posted in his blog that a full featured RC of Atlas would be coming by the end of this year. Also, the naming game for code name "ATLAS" seems to be over.

Some of the popular names were:-
Rich Web Programming Foundation - RWPF
Web Technology Framework - WTF (!)
AJAXX (aka let's just add an 'X' to the existing name to make it sound cooler)
Rich Language ASP Framework
Big ASP Rich Foundation - BARF
Active Client Pages - ACP

The client-side “Atlas” javascript library is going to be called the Microsoft AJAX Library.   
The server-side “Atlas” functionality that nicely integrates with ASP.NET will be called the ASP.NET 2.0 AJAX Extensions.
The toolkit has become ASP.Net Ajax Control Toolkit.

Lots of promises are being made by the "Atlas" team, hopefully they walk the talk.

 


ASP.NET
9/12/2006 4:45:17 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Monday, August 21, 2006

ASP.Net 2.0 WebPart Error -(SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

when you try to use webparts in your application for the first time, and if you are not using SQL 2005 express chances are that you would be getting an error saying, SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified.

The reason is WebPart Manager looks for SQL2005 express as its db in the personalization provider.

Kudos to Pete Orologas for pointing the solution. I am just reprinting his solution here. All credits to Pete.

The Issue:

   The webpartmanager is looking for SQL Express 2005 which, by default, is the personalization provider.  We can work around this but if you are really eager to see your page displayed you can set the Personalization-Enabled="false" in the webpartmanager.  This will render your page but it will also defeat any purpose of using webparts.  For the real solution read on.

The Solution: (3 simple steps)

1) Open your visual studio command prompt located in "Start Menu\Programs\Microsoft Visual Studio 2005\Visual Studio Tools\Visual Stuido 2005 Command Prompt" and type in aspnet_regsql.exe.  This will launch a wizard so that you can either create a DB or add tables to an existing database for storing personalization infromation. Click Next, Next, then enter in your DBServer Name. Lets leave the DB as "default" for now, click next, next, finish.  By leaving the db as default the tool will create a database named aspnetdb

2) Now we have a database so we will need a connection string to access it from our  Personalization Provider in Step 3.  The connection string will go into your web.config and it will be similar to the one show below:

<connectionStrings>

  <remove name="LocalSqlServer" />

 <add name="DBConn" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=aspnetdb;Data Source=DBServer" providerName="System.Data.SqlClient" />

</connectionStrings>

Note: The "remove" tag is used to inform Visual Studio that we will not be using SQL Express

3) The final step is to add our own personalization provider in the <system.web> section of the webConfig.  The personalization provider will point to the store we created by using the connection string we provide (Dbconn).

<webParts>

    <personalization  defaultProvider="AspNetSqlPersonalizationProvider">

        <providers>

             <remove name="AspNetSqlPersonalizationProvider" />

             <add name="AspNetSqlPersonalizationProvider"

             type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider"

             connectionStringName="DBConn"

             applicationName="/" />

        </providers>

    </personalization>

</webParts>


ASP.NET
8/21/2006 3:59:42 AM (GMT Daylight Time, UTC+01:00)  #  Comments [2] 
 Wednesday, August 09, 2006

WI.Net UserGroup: ASP.Net Pipeline + I won the prize

There was a seminar organized by the The Wisconsin .NET Users Group. Daniel Egan gave a good presentation on the http modules and handlers.

The best part about is that I won this book on the lucky draw. I hope this puts an end to whatever streak I was going thru.


[Pic Src = MS Press]


ASP.NET
8/9/2006 4:10:33 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Friday, July 14, 2006

Microsoft.Net Security Articles

Our man Scott Guthrie has come up(actually a long time back) with the list of articles on Security. Check it out.


ASP.NET
7/14/2006 4:19:50 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 

Microsoft .Net 2.0 Mail

There are two new namespaces in .Net for handling/sending mails.

You have to be using MailMessage and SmtpClient classes.

There are properties to set the mail server, pass user credentials for the SMTP server(thru NetworkCredential class).
You can also send email through SSL, send emails asynchronous, send emails with alternate views( text emails for email clients that block HTML email display), email with linked image resources

Please refer here for more information


ASP.NET
7/14/2006 3:52:53 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Monday, June 26, 2006

WinFX is .Net 3.0 and WinFS is Dead

WinFX becomes .Net 3.0. I am not sure if they are going to have all the LINQ features with this release.

The much hyped WinFS is DEAD?

 


ASP.NET | General
6/26/2006 2:23:17 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Thursday, June 22, 2006

Atlas Resources

Scott Guthrie just seems relentless on posting information on Atlas and everything that is happening on .Net platform. Here is the list of resources he has compiled for ATLAS. I am very excited about it. Going forward, i guess Microsoft just wants to get away with Ajax.Net.

 


ASP.NET
6/22/2006 4:02:36 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Monday, June 19, 2006

How Do I? Video Series

if you are interested in learning cool features of ASP.Net 2.0. Do not look further, How Do I?Video series. the videos are short and very understandable. Virtual Labs are cool too, if you want to have on hands experience


ASP.NET
6/19/2006 3:32:19 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Thursday, June 15, 2006

ASP.net Captcha Control

As input validation is gaining importance day by day, usage of Captcha is getting very prevalent. Here are some examples of CAPTCHA used in ASP.Net pages.

http://www.codeproject.com/aspnet/CaptchaControl.asp

Usage of LoginControl with the above Captcha server control in .Net 2.0

Also, if you have a connection string ending with an apostraphe, check this out.


ASP.NET
6/15/2006 4:27:44 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0] 
 Tuesday, June 06, 2006

SQL DataSource+DataKeys+SQL2005

Couple of the issues i had faced recently

DataKeys sent automatically to storedprocedure

if you are using SQL Datasource in any of your data bindings, and if you are trying to do any db operations- the datakey field is automatically sent to the stored procedure you are using to do the db operations. this means, whether you want or not the  (first) parameter in your stored procedure should be your datakey.

This is pretty cool if you already knew this or pretty awful if you had to try to figure it out for atleast an hour.

SQLDatasource Controlparameter and the table Null Value problem

if you are basing your query on a user entry in a textbox, you might sometimes want to display all the records if there is no entry in the textbox.(if there is no validation). This simple things did give me and probably many more developers a tough time. What complicates the issue is there is an option to set the default value to be null, which does not seem to take care of the problem. Hannes Preishuber offers a neat solution.(thru Doug Reilly)

Also i found/experienced/heard about this weird sql2005 bug. SQL2005 server cannot be started/connected through remote desktop in a windows xp machine


ASP.NET
6/6/2006 3:32:33 AM (GMT Daylight Time, UTC+01:00)  #  Comments [0]