Archive for October, 2003

IIS 6.0 Features … October 22nd, 2003

Vinod Kumar

Windows 2003 come with a amazing set of tools … One of which is IIS 6.0. I was just exploring some of the cool features of IIS 6.0 and here is the list … Maynot be exhaustive in its own way … But can be surely helpful for beginners …

  • Architecture changes – Admin and the Application isolation
  • Worker Process Isolation Vs IIS 5.0 Isolation
  • W3Config Manager and W3 Process Mgr are the administrative processes that sit outside the application pool.
  • HTTP.SYS does the request routing and the caching mechanism. This is in the Kernel mode.
  • We can create multiple Application pool. This can be for reliability / site / functionality.
  • Recycling Possible as in COM+ 1.5
  • Can restart periodically or specified interval of time or when the memory reaches certain value.
  • Self healing architecture
  • Pinging at a specified interval of time and then recycle based on this.
  • Crash detection and recovery
  • We can shutdown application if the W3WP process crashes X times in Y time interval.
  • 503 error is shown under such conditional shutdown
  • Store sessions outside the process. This will reduce cache objects loss during recycling.
  • IIS 5.0 runs under Local System account.
  • IIS 6.0 comes with default lock down feature.
  • We need to run the IIS lockdown tool before upgrade.
  • All extensions are blocked. Enable only known extensions.
  • Can use the MIMEMAP to do all the mappings.
  • IIS_WPG is a new group introduced and to run IIS in a particular account, this has to be a part of this windows group.
  • Sub-Authentication is not installed by default.
  • URL restriction upto 16KB
  • Command line utilities are accessible to administrators ONLY.
  • Caching managed by HTTP.SYS hence its faster as it is in the Kernal mode.
  • Use the OUTPUTCACHE in ASP.NET to use this feature.
  • WebGarden scenario:
    • Application Pool with more than one W3WP.exe’s
    • It’s a connection based routing.
    • Mask based affinity
    • Recycling is all at once.
  • Idle timeout – can set the time before freeing the resource. Application still runs though
  • Easy metabase config (in an XML file)
    • Auto-Versioning and backup happens
    • Can be edited when IIS is running
  • ADSI and WMI give new interfaces.
  • Easily scriptable and portable.
  • We can easily export and import configurations in IIS 6.0
  • IIS 6.0 Resource kit has great tools like:
    • Custom Authentication
    • Log parser
    • Metabase Explorer
    • Self SSL
    • IIS State Analyzer and many more

IIS 6.0 resource Kit Downloads Page:
http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&DisplayLang=en

Happy IIS 6.0 exploring … :) …

Found a link to this write-up at http://bink.nu/BinkPortal/DesktopModules/ArticleDetail.aspx?ArticleID=348 … I think people have liked it …

Continue reading...


 

Optimization SQL Server … October 17th, 2003

Vinod Kumar

Even though I’ve seen numerous documentation that say SQL Server is self optimized, I agree to these words to some extend only. There are tons of optimization that a DBA has to take to make maximum use of their harware setup … The various optimization techniques available are like:

1. Data Optimization : Includes table design, View design etc.

2. Storage Optimization : Including HDD, RAID, File groups etc.

3. Code Optimization : Often developer are keen on the functional approach and not the optimized approach.

4. Server Optimization : Includes various server configurations and settings.

Each of these topics can wrap up our understanding and writing optimized code in SQL Server 2000 … Feel free to ping me and give your inputs on the same anytime … :)

You can catch some of the better coding practices available in my article : http://www.extremeexperts.com/sql/articles/BestPractices.aspx

 

Continue reading...


 

Power of Using XML … October 14th, 2003

Vinod Kumar

XML is the way future is going to be. Taking a preview into some of the XML related tools available with .NET framework are listed in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/XMLToolsUpdate.asp. Surely something that might interest many. Taking this a step further look at how we can bind XML with datagrids on the latest article on our site. http://www.extremeexperts.com/Net/Articles/BindingXMLtoDataGrid.aspx.

What ScottW did with .Text (weblogs.asp.net):  you type HTML into the edit box, and that is posted to the server.  The posted HTML is read into the SgmlReader, which can either be read using the XmlReader pattern or loaded into an XmlDocument. Hence we can see how XML has got into various forms of application …

You cannot escape from XML … :)

Continue reading...


 

Using Varchars … :) … October 10th, 2003

Vinod Kumar

I suppose we understand the difference in using Char and Varchars. Char’s do a padding and Varchars don’t pad the data before storing. Simple isn’t it …

 
Now for the actual interesting part. Look at the tables data I created.
Create table tempTable (v Varchar(10))
insert into tempTable  values (‘a’)
insert into tempTable  values (‘a ‘)
insert into tempTable  values (‘a  ‘)
Now I go ahead and execute the following query.
Select v, Len(v) from tempTable
What do you think is the output we are going to get … Are you disappointed to see the actual output? The mail is intended to target and make you aware of this behavior. Understand that “Len” would trim the trailing blank spaces and then take the length. Understand, we want you to take care of such behavior in your code. Now execute the next code:
Select v, DataLength(v) from tempTable
Now that is more like the output we actually expected … Please, Please be very careful while using “DataLength” function in the code. This actually returns the number of bytes used … So even though the output looked convincing to us the output would be wrong if it were to be NVarchar Columns … It would be double the value you expected.
 
And for others who think that the space is missing while storage also … Take another look. This is NOT the case. If we give an explicit space it is preserved while storing.
Select v + ‘|’ from tempTable
Be very careful in using the Len or DataLength keyword in SQL Server. Never assume the availability of a trailing blank. And this can change in any service pack that might come … 
 
Even the Group by function will eat up the trailing blanks before applying … This is by design …
Select Count(*), v from temptable
group by v

Continue reading...


 

Ten Commandments of .NET … October 6th, 2003

Vinod Kumar

This came in DotNetNuts.com … Interesting and thought its worth having it in my blog … :) …

The Ten Commandments of .NET

1. Thou shall learn XML, now! If .NET is an angel from Microsoft then its wings are woven with XML, and you need to understand the basics of XML before you can fly with .NET. XML is used for configuration files, SOAP,Serialization, and it’s tightly integrated with ADO.NET. You can get away without knowing XML, but you won’t get far.

2. Thou shall become an object-oriented programmer! To understand .NET and build successful applications you must understand OOP. VB programmers now have new object-oriented capabilities, but may not know how or when to use them. You should understand interfaces and abstract classes (there’s a difference between the two in .NET), implementation inheritance, function overriding, and shared members. If your not familiar with OOP at all, start learning ASAP. If your established with OOP as it applies to VB6 then dig deeper into OOP methodology, it will certainly make .NET more enjoyable.

3. Thou shall concentrate on the .Net framework, not the language being used. No matter what .NET language you use, your still using the same framework, so it’s very important to focus on the framework, not a particular language. Keep in mind that most of the functions you’ll use while programming are from the framework, so using a new language is easy, simply adjust to the syntax. Plus, having C#, C++, VB, Perl, Pascal, COBOL, Fortran, and Eiffel on your resume is more impressive than having just one.

4. Thou shall not go it alone. Get involved in the .NET community. This is the best way to dive into .NET. Message boards are a great resource because you can read problems and questions posted by beginners, and examine the solutions they received. After all, it’s better to learn from others mistakes than to learn by repeating them. DotNetNut.com is a great place to start. You’ll find message boards, original articles, constantly updated FAQ, and an enormous amount of links to other great resources. We ‘ll help you spend more time learning and less time digging for answers.

5. Thou shall adapt to new development environment. For VB programmers the VS.NET IDE is a big change, and it’s going to take some effort to adjust. Not only is there much better support for debugging than in VB6, but there is also the ability to record and playback macros. Get intimate with the IDE, missing out on great new features is shameful.

6. Thou shall abandon DCOM and use remoting. DCOM was a big step in Microsoft distributed computing, but it’s time has passed. Remoting is the .NET model for distributed computing. It’s more flexable, featuring plugable channels and protocols, and it generally out performs DCOM. Administration is done easily through application configuration files which elevate the headache of DCOM administration. Althought it takes a little more coding than DCOM the benefits are well worth it.

7. Thou shall not use VS.NETs code generators without understanding the code they generate. VS.NET has some great code generators that can save you time, but only use them if you understand the code they generate. Create a sample application, use the code generators, and be come very familiar with the results. It’s impossible to support code ou don’t understand.

8. Thou shall use structure error handling in VB. VB developers have a choice, either learn how to use structured error handling, or use the old On Error method. Using structured error handling brings flexibility and maintainability to VB and is one of the best new features. There are two reasons On Error should be left behind. One is because Try Catch Finally will be used in all .NET languages, On Error is VB specific. Two, because structured error handling is much more powerful, giving you the ability to nest Try Catch statements and layer exceptions.

9. Thou shall avoid using COM+ for single phase transactions. COM+ is great for two phase commits because of the DTC, but there is extra overhead for database locks due to the nature of the transaction. It’s a waste of database resources to indiscriminately use COM+ when a less intensive lock can be used. Transactions through the Data namespaces are lighter and should be used for single phase transactions. It is possible to get the same automatic transaction enrollment available in COM+ by using the SinglePhaseTransactionContext component available for download (complete with source files) at DotNetNut.

10. Thou shall not underestimate the complexity of .NET. Is .NET going to make development easier? Yes, but (there’s always a but) the .NET framework is so vast, and there are so many new concepts involved that NET will be difficult at first. If your new to the .NET runtime, than you may not know what value types and boxed types are, how the garbage collector works, or what application domains are. All these concepts are new to microsoft developers and important, to ignore them is sinful.

 

Continue reading...