Thursday, October 28, 2010

How Application Pools Works ? (IIS 6.0)

What are Application pools? How it actually Works? The concept of Application Pools has from IIS 6.0. Application pools are used to separate sets of IIS worker processes that share the same configuration and application boundaries. Application pools used to isolate our web application for better security, reliability, and availability and performance and keep running with out impacting each other . The worker process serves as the process boundary that separates each application pool so that when one worker process or application is having an issue or recycles, other applications or worker processes are not affected. One Application Pool can have multiple worker process.

When you run IIS 6.0 in worker process isolation mode, you can separate different Web applications and Web sites into groups known as Application pools. An Application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Any Web directory or virtual directory can be assigned to an application pool. Each application pool is given its own set of server resources. That way, if a Web site crashes, it won’t effect sites in other application pools.

A classic example of this is a Web site with a memory leak. If all of the Web sites hosted on a particular server were to share system resources, and one of the Web sites had a memory leak, it could potentially take memory away from the other hosted sites. If the leaky site were in its own application pool though, the memory leak would not effect any other site because each application pool has its own server resources (including memory).

Main idea behind application pools are
1. Isolation of Different Web Application
2. Individual worker process for different web application
3. More reliably web application
4. Better Performance

For more information check this URL from MSDN.

Hope this is useful Smile

Under standing Local Service, Local System and Network Service?

The main difference between these Local Service, Local System and Network Service mainly relay on the security principals. I have website I need to configure remote connections. When we use SQL Server, so when allowing remote connections and you might think which Service account you should use to run SQL Server.

You should use Local non-system or Service account. If this SQL Server service require to access the network resources you can use a ordinary Domain account.

  • Domain User Account
    If the service must interact with network services, access domain resources like file shares or if it uses linked server connections to other computers running SQL Server, you might use a minimally-privileged domain account. Many server-to-server activities can be performed only with a domain user account. This account should be pre-created by domain administration in your environment.
  • Local User Account
    If the computer is not part of a domain, a local user account without Windows administrator permissions is recommended.

Following are NOT advised as it grant more privileges than required for running SQL Server Services

  • Local System is a very high-privileged built-in account. It has extensive privileges on the local system and acts as the computer on the network. The actual name of the account is "NT AUTHORITY\SYSTEM".
  • The Local Service account is a built-in account that has the same level of access to resources and objects as members of the Users group. This limited access helps safeguard the system if individual services or processes are compromised. Services that run as the Local Service account access network resources as a null session without credentials. Be aware that the Local Service account is not supported for the SQL Server or SQL Server Agent services. The actual name of the account is "NT AUTHORITY\LOCAL SERVICE".
  • The Network Service account is a built-in account that has more access to resources and objects than members of the Users group. Services that run as the Network Service account access network resources by using the credentials of the computer account. The actual name of the account is "NT AUTHORITY\NETWORK SERVICE"

Please consider the below recommendations:

  • Always run SQL Server services by using the lowest possible user rights.
  • Use a specific low-privilege user account or domain account instead of a shared account for SQL Server services.
  • Use separate accounts for different SQL Server services.
  • Do not grant additional permissions to the SQL Server service account or the service groups

Saturday, October 16, 2010

Date Formatting in C#

Date formatting in C# using string object

Specifier Description Output
d Short Date 20/10/1983
D Long Date 20 October 1983
t Short Time 21:20
T Long Time 21:20:59
f Full date and time 20 October 1983 21:20
F Full date and time (long) 20 October 1983 21:20:59
g Default date and time 20/10/1983 21:20
G Default date and time (long) 20/10/1983 21:20:59
M Day / Month 20 October
r RFC1123 date Thu, 20 Apr 1983 21:20:59 GMT
s Sortable date/time 1983-10-20T21:20:59
u Universal time, local timezone 1983-10-20 21:20:59Z
Y Month / Year October 1983
dd Day 20
ddd Short Day Name Thu
dddd Full Day Name Thursday
hh 2 digit hour 09
HH 2 digit hour (24 hour) 21
mm 2 digit minute 20
MM Month 10
MMM Short Month name Apr
MMMM Month name October
ss seconds 59
tt AM/PM PM
yy 2 digit year 07
yyyy 4 digit year 1983
: seperator, e.g. {0:hh:mm:ss} 09:20:59
/ seperator, e.g. {0:dd/MM/yyyy} 20/10/1983

Example using the specifier with data object

DateTime now = DateTime.Now;
Console.WriteLine(now.ToString("d"));

Friday, October 15, 2010

Download: SQL Server Sample Databases

SQL Server 2008R2 product sample databases are now available.
SQL Azure sample databases are now available.
SQL Server 2008 product sample databases are still available. If you are having difficulties with the current installer, please refer this Database Installer Help.
SQL Server 2005 product sample databases are still available.

For more help most sample databases and sample database business scenarios are documented on MSDN.

Monday, October 11, 2010

Zoom in/out with Visual Studio 2010

Visual Studio 2010 now supports the ability to zoom in and out of the text editor by using the mouse wheel. Ctrl + Mouse wheel up/down to Zoom in and Out. I love this feature for a couple of reasons:

  • Very nice when showing code to a group, such as during a demo to a large audience, or during team code reviews.
  • Makes it easy to pop in and out of your code to toggle between the “big picture” and “code level” views.

But what if you don’t have a mouse wheel? It turns out that there are keyboard shortcuts for this.

Functionality Command Keyboard Shortcut
Zoom in View.ZoomIn Ctrl+Shift+period
Zoom out View.ZoomOut Ctrl+Shift+comma

Friday, October 08, 2010

Disable User Account Control (UAC) For Administrators Only

If you can’t stand the User Account Control prompts, but you’d still like to retain a little bit of security, you can disable it for Administrator accounts only.

To configure this setting on Windows 7 / Vista Business and Ultimate, you can use the Local Security Policy configuration. Just type in secpol.msc into the Start menu search box and hit enter.

Brose down to Local Policies \ Security Options

image

Find the following in the list: “User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode” and double-click on it.

image

Change the setting to “Elevate without prompting”. You should be all done and good to go…

Note: Disabling UAC will lead to a less secure system, so better be warned :-)

Disabling User Account Control on Windows 7

Windows 7 makes it much easier to deal with UAC settings, and in fact you don’t have to completely disable UAC if you don’t want to. Just type UAC into the start menu or Control Panel search box or find how to go to UAC from my previous post.

image

Adjust the notification bar as per your choice. if you drag it all the way down to the bottom then it’ll be disabled entirely.

Note: Disabling UAC will lead to a less secure system, so better be warned :-)

User Account Control in Windows 7

User Account Control (UAC) helps defend your PC against hackers and malicious software. Any time a program wants to make a major change to your computer, UAC lets you know and asks for permission.

Introduced in Windows Vista, UAC is now less intrusive and more flexible. Fewer Windows 7 programs and tasks require your consent. If you have administrator privileges on your PC, you can also fine-tune UAC's notification settings in Control Panel. You can find this at Control Panel –> System and Security –> Action Center. Click on Change User Account Control Settings. (See Figure below) This window will allow user to choose when to be notified about changes in the computer.

uac_settings

Monday, October 04, 2010

JavaScript: Display Clock

Displaying a clock is very similar to making a countdown timer. All we have to do is to create a new date and get it's hours, minutes, and seconds.

Here is a example:

<!-- This span is where the clock will appear -->
<div id='clockDiv'></div>
<script type="text/javascript">
function clock() {
   var now = new Date();
   var outStr = now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();
   document.getElementById('clockDiv').innerHTML=outStr;
   setTimeout('clock()',1000);
}
clock();
</script>

Hope this helps :-)

JavaScript: Count down Timer

This is how creating Count down timer using JavaScript with Julian dates. This code below creates two Julian dates, now and newYear. By subtracting now from newYear we get an integer which represents the difference between the two dates.

Suppose you want to know your birthday in days, hours and minutes etc. This is how you can achieve using JavaScript.

<!-- This span is where the countdown timer will appear -->
<div id='countdown'></div>
<script type="text/javascript">
// Here's our countdown function.
function happyBirthDay() {
var now = new Date();
var newYear = new Date('October 20, '+(now.getFullYear()+1));
var diff=newYear-now;
var milliseconds=Math.floor(diff % 1000);   
    diff=diff/1000;            
var seconds=Math.floor(diff % 60);
    diff=diff/60;
var minutes=Math.floor(diff % 60);
    diff=diff/60;
var hours=Math.floor(diff % 24);
    diff=diff/24;
var days=Math.floor(diff);
// We'll build a display string instead of doing document.writeln
   var outStr = days + ' days, ' + hours+ ' hours, ' + minutes;
       outStr+= ' minutes, ' + seconds + ' seconds until your birthday!'; 
   // Insert our display string into the countdown span.
   document.getElementById('countdown').innerHTML=outStr;
   // call this function again in exactly 1 second.   
   setTimeout("happyBirthDay()",1000);
}
// call the countdown function (will start the timer)
happyBirthDay();   
</script>

Hope this helps!

Saturday, October 02, 2010

HTML Codes - Characters and symbols

I have found collection of information about HTML codes, ASCII Codes, URL Encoding, URL Decoding which is helpful.

Check this URL for more information.