Tuesday, March 20, 2007

Autocomplete features of ASP.NET

Most of us would be very much familiar with "Autocomplete" feature of various browsers. After turning on that feature if you try filling any textboxes the browser provides you with the values which you have already typed in that field before.

What if the "autocomplete" feature is turned ON in the end users browser but you don't want the data to be catched by the browser?

Its quite simple. All we need to do is make use of the attribute "autocomplete" within the pages form tag.

Example 1: Disabling Autocomplete for the whole form

1. Create a sample web form and replace that default form tag with the code snippet below

<form id="form1" runat="server" autocomplete="off">
<asp:TextBox ID="txtOne" runat=server></asp:TextBox>
<asp:TextBox id="txtTwo" runat="server" ></asp:TextBox>
<asp:Button ID="btnGo" runat="server" Text="Submit" />
</form>

2. Now enable autocomplete in the browser. If its Internet Explorer do this: Tools >> Internet Options >> Content >> Autocomplete >> Check "Forms".

3. Run the default page and you could test it for yourself.

Example 2: Disabling autocomplete for a particular textbox in a form

1. Lets add "Autocomplete" feature to second textbox and set it as "off"

<form id="form1" runat="server" autocomplete="off">
<asp:TextBox ID="txtOne" runat=server></asp:TextBox>
<asp:TextBox id="txtTwo" runat="server" Autocomplete="off" ></asp:TextBox>
<asp:Button ID="btnGo" runat="server" Text="Submit" />
</form>


2. Run the page and you should get the autocomplete dropdown values for txtOne and for txtTwo it won't appear.

[I have tested it with ASP.NET 1.1 as well as 2.0]

Hope this helps!

Friday, March 16, 2007

Restarting a remote computer via Remote Desktop ...

If you want to restart a computer which you have connected via Windows Remote Desktop do this.

Start >> Run >> shutdown -r -f

The machine would be restarted after 30 seconds automatically

There are lots of other options available with shutdown command. You can view all the available options by typing "shutdown /?" in the command window.

Sunday, March 11, 2007

Server Application Unavailable

Error Message:

The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the system event log of the web server. Please review this log entry to discover what caused this error to occur.

Error in Event Viewer: aspnet_wp.exe could not be started. The error code for the failure is 80004005. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account.


OR

aspnet_wp.exe could not be launched because the username and/or password supplied in the processModel section of the config file are invalid.

Solution: Check out this microsoft support article >> http://support.microsoft.com/default.aspx?scid=kb;en-us;811320

For me, particularly after running this command line script it started working.

cacls C:\WINDOWS\assembly /e /t /p domain\ASPNET:R

Friday, March 09, 2007

[Non Tech] Want to know the recipe for Omelette :)


Fed up with Bread - Jam and Curd Rice, today i wanted to eat Omelette. Interesting part is I wanted to cook it myself :)

So in the first picture you see all the items which are needed for preparing an Omelette.
When I had a closer look at the eggs I see that almost all the eggs are broken. But believe me when I bought it couple of days back it was in perfect condition!


I was wondering whether the eggs have become rotten or pretty old to consume! I tried taking an egg and break it but couldn't break it at all :)

Since I have kept in the freezer all the eggs have frozen and looked like a iron ball :)

After trying for few minutes of trying i removed the shell of the egg and then kept that iron ball :) into a bowl and placed it within Oven. I heated it for 1 minute and checked. It melted only to a limit. So i just set it for another 2 minutes and checked it later. It has melted but the part of the egg white has become a Omelette :(

I didn't leave it there. I took the bowl out of the oven and beated it as much as possible in that bowl. Then i added a chopped (half) onion and a tomato into that bowl. Then a tablespoon of salt and black pepper was also added into that.

After that, I poured little oil into the omelette maker (blue box which is in the first image) before pouring the egg mixture and placed it inside the Microwave Oven for 4 minutes.
After 4 minutes the final product was ready (see the below image).

Lesson Learned: Don't keep the eggs within the "Freezer" box of the fridge :)

Wednesday, March 07, 2007

Max limit of Varchar, nvarchar, varbinary datatypes ...

As you would be knowing by now in SQL Server 2005 they have enhanced varchar, nvarchar & varbinary as varchar(max), nvarchar(max) & varbinary(max). So now they can hold upto 2^31-1 bytes (it would come to approx 2 GB).

That said, don't think that just because MAX has been introduced you can declare those datatypes for any arbitary number. If you want to specify a limit yourself for those datatype still the maximum is 8000 characters. When you think that you need to store content whose lenght would be more than 8000 characters then you need to declare it as MAX.

For example, Try executing the below code snippet

Create table testVarchar
(
fName varchar(8001)
)
Go

It would throw an error something like this: The size (8001) given to the column 'fName' exceeds the maximum allowed for any data type (8000).