Saturday, January 31, 2009
Introduction to Software Design Patterns
expect from Design Patterns?
Creational Patterns
Abstract Factory, Factory Method, Builder, Prototype, Singleton
Structural Patterns
Composite, Adaptor, Flyweight, Decorator, Proxy, Bridge, Facade
Behavioral Patterns
Command, Visitor, Chain Of Responsibility, Interpreter, Mediator,
Memento, Observer, State, Template Method, Strategy, Iterator
Enterprises Design Patterns
A) Presentation Tier Patterns
Intercepting Filter, Front Controller, Context Object,
Application Controller, View Helper, Composite View, Service to
Worker, Dispatcher View
B) Business Tier Patterns
Business Delegate, Service Locator, Session Façade, Application
Service, Business Object, Composite Entity, Transfer Object, Transfer
Object Assembler, Value List Handler
C) Integration Tier Patterns
Data Access Object, Service Activator, Domain Store, Web Service
Broker
Applying Design Patterns (Case-Studies)
A) Case Study based on Core Design Patterns : Super Market applications
B) Case study based on Enterprise Design Patterns : Online Shopping portal
Monday, January 26, 2009
Interrupt Services DOS, BIOS, EMS and Mouse
IBM PC Hardware Interrupt Table (in order of priority)
Interrupt Table as Implemented by System BIOS/DOS
INT 5 - Print Screen
INT 8 - System timer
INT 9 - Keyboard Interrupt (Hardware Handler)
INT 10 - Video BIOS Services
INT 10,0 - Set Video Mode
INT 10,1 - Set Cursor Type
INT 10,2 - Set Cursor Position
INT 10,3 - Read Cursor Position and Size
INT 10,4 - Read Light Pen Position
INT 10,5 - Select Active Display Page
INT 10,6 - Scroll Window Up
INT 10,7 - Scroll Window Down
INT 10,8 - Read Character and Attribute at Cursor Position
INT 10,9 - Write Character and Attribute at Cursor Position
INT 10,A - Write Character Only at Current Cursor Position
INT 10,B - Set Color Palette
INT 10,C - Write Graphics Pixel at Coordinate
INT 10,D - Read Graphics Pixel at Coordinate
INT 10,E - Write Text in Teletype Mode
INT 10,F - Get Video State
INT 10,10 - Set/Get Palette Registers (EGA/VGA)
INT 10,11 - Character Generator Routine (EGA/VGA)
INT 10,12 - Video Subsystem Configuration (EGA/VGA)
INT 10,13 - Write String (BIOS versions from 1/10/86)
INT 10,14 - Load LCD Character Font (convertible only)
INT 10,15 - Return Physical Display Parms (convertible)
INT 10,1A - Video Display Combination (VGA)
INT 10,1B - Video BIOS Functionality and State Information (MCGA/VGA)
Video BIOS Dynamic Functionality State Table (MCGA/VGA)
Video BIOS Static Functionality Table
INT 10,1C - Save/Restore Video State (VGA only)
INT 10,FE - Get DESQView/TopView Virtual Screen Regen Buffer
INT 10,FF - Update DESQView/TopView Virtual Screen Regen Buffer
INT 11 - BIOS Equipment Determination / BIOS Equipment Flags
INT 12 - Memory Size Determination
INT 13 - Diskette BIOS Services
For more information see the following topics:
INT 13,0 - Reset Disk System
INT 13,1 - Disk Status
INT 13,2 - Read Disk Sectors
INT 13,3 - Write Disk Sectors
INT 13,4 - Verify Disk Sectors
INT 13,5 - Format Disk Track
INT 13,6 - Format Track and Set Bad Sector Flags (XT & portable)
INT 13,7 - Format Drive Starting at Specified Track (XT & portable)
INT 13,8 - Get Current Drive Parameters (XT & newer)
INT 13,A - Read Long Sector (XT & newer)
INT 13,B - Write Long Sectors (XT & newer)
INT 13,C - Seek to Cylinder (XT & newer)
INT 13,D - Alternate Disk Reset (XT & newer)
INT 13,E - Read Sector Buffer (XT & portable only)
INT 13,F - Write Sector Buffer (XT & portable only)
INT 13,10 - Test for Drive Ready (XT & newer)
INT 13,11 - Recalibrate Drive (XT & newer)
INT 13,12 - Controller RAM Diagnostic (XT & portable only)
INT 13,13 - Drive Diagnostic (XT & portable only)
INT 13,14 - Controller Internal Diagnostic (XT & newer)
INT 13,15 - Read DASD Type (XT BIOS from 1/10/86 & newer)
INT 13,16 - Change of Disk Status (XT BIOS from 1/10/86 & newer)
INT 13,17 - Set DASD Type for Format (XT BIOS from 1/10/86 & newer)
INT 13,18 - Set Media Type for Format (BIOS date specific)
INT 13,19 - Park Fixed Disk Heads (AT & newer)
INT 13,1A - Format Unit (PS/2 model 50+)
INT 14 - BIOS Asynchronous Communications Services
BIOS Asynchronous Communications Services (Status)
INT 14,0 - Initialize Communications Port Parameters
INT 14,1 - Send Character to Communications Port
INT 14,2 - Receive Character from Communications Port
INT 14,3 - Get Serial Port Status
INT 14,4 - Serial Port Extended Initialization (PS/2 & later systems)
INT 14,5 - Extended Communication Port Control (PS/2 & later systems)
INT 15 - System BIOS Services
For more information see the following topics:
INT 15,0 - Turn Cassette Motor On (PC,PCjr only)
INT 15,1 - Turn Cassette Motor Off (PC,PCjr only)
INT 15,2 - Read Blocks from Cassette (PC,PCjr only)
INT 15,3 - Write Blocks to Cassette (PC,PCjr only)
INT 15,F - Format Periodic Interrupt (PS/2 only)
INT 15,20 - PRINT.
INT 15,21 - Power On Self Test (POST) Error Log (PS/2 except 30)
INT 15,40 - Read / Modify Profiles (convertible only)
INT 15,41 - Wait on External Event (convertible only)
INT 15,42 - Request System Power Off (convertible only)
INT 15,43 - Read System Status (convertible only)
INT 15,44 - (De)activate Internal Modem Power (convertible)
INT 15,4F - Keyboard Intercept (BIOS date specific)
INT 15,80 - Device Open
INT 15,81 - Device Close
INT 15,82 - Program Termination
INT 15,83 - Event Wait
INT 15,84 - Joy-Stick Support
INT 15,85 - System Request Key Pressed
INT 15,86 - Elapsed Time Wait (AT and PS/2)
INT 15,87 - Move Block to/from Extended Memory
INT 15,88 - Extended Memory Size Determination
INT 15,89 - Switch Processor to Protected Mode
INT 15,90 - Device Busy
INT 15,91 - Interrupt Complete
INT 15,C0 - Return System Configuration Parameters (PS/2 only)
INT 15,C1 - Return Extended BIOS Data Area Segment (PS/2 only)
INT 15,C2 - Pointing Device BIOS Interface (PS/2 only)
INT 15,C3 - Enable/Disable Watchdog Timer (PS/2)
INT 15,C4 - Programmable Option Select (PS/2)
INT 16 - Keyboard BIOS Services
For more information, see the following topics:
INT 16,0 - Wait for Keypress and Read Character
INT 16,1 - Get Keyboard Status
INT 16,2 - Read Keyboard Flags
INT 16,3 - Set Keyboard Typematic Rate (AT+)
INT 16,4 - Keyboard Click Adjustment (AT+)
INT 16,5 - Keyboard Buffer Write (AT+)
INT 16,10 - Extended Wait for Keypress and Read Character (AT+)
INT 16,11 - Extended Get Keyboard Status (AT+)
INT 16,12 - Extended Get Keyboard Status (AT+)
INT 17 - Printer BIOS Services
INT 17,0 - Print Character
INT 17,1 - Initialize Printer Port
INT 17,2 - Read Printer Port Status
INT 19 - Bootstrap Loader
INT 1A - System and Real Time Clock BIOS Services
INT 1A,0 - Read System Clock Counter
INT 1A,1 - Set System Clock Counter
INT 1A,2 - Read Time From Real Time Clock (XT 286,AT,PS/2)
INT 1A,3 - Set Time on Real Time Clock (XT 286,AT,PS/2)
INT 1A,4 - Read Real Time Clock Date (XT 286,AT,PS/2)
INT 1A,5 - Set Real Time Clock Date (XT 286,AT,PS/2)
INT 1A,6 - Set Real Time Clock Alarm (XT 286,AT,PS/2)
INT 1A,7 - Disable Real Time Clock Alarm (XT,AT,PS/2)
INT 1A,8 - Set RTC Activated Power On Mode (convertible)
INT 1A,9 - Read RTC Alarm Time and Status (convertible,PS/2)
INT 1A,A - Read System Day Counter (PS/2)
INT 1A,B - Set System Day Counter (PS/2)
INT 1A,80 - Setup Sound Multiplexer (PCjr only)
INT 1B - BIOS Ctrl-Break Handler Address
INT 1C - System Timer Tick (User Routine)
INT 1D - Video Initialization Parameter Table Vector
INT 1E - Disk Initialization Parameter Table Vector
INT 1F - Graphics Display Character Bit Map Table
DOS Interrupt Summary
INT 20 - Program Terminate
INT 21 - DOS Function Dispatcher
INT 21,0 - Program Terminate
INT 21,1 - Keyboard Input with Echo
INT 21,2 - Display Output
INT 21,3 - Wait for Auxiliary Device Input
INT 21,4 - Auxiliary Output
INT 21,5 - Printer Output
INT 21,6 - Direct Console I/O
INT 21,7 - Direct Console Input Without Echo
INT 21,8 - Console Input Without Echo
INT 21,9 - Print String
INT 21,A - Buffered Keyboard Input
INT 21,B - Check Standard Input Status
INT 21,C - Clear Keyboard Buffer and Invoke Keyboard Function
INT 21,D - Disk Reset
INT 21,E - Select Disk
INT 21,F - Open a File Using FCB
INT 21,10 - Close a File Using FCB
INT 21,11 - Search for First Entry Using FCB
INT 21,12 - Search for Next Entry Using FCB
INT 21,13 - Delete File Using FCB
INT 21,14 - Sequential Read Using FCB
INT 21,15 - Sequential Write Using FCB
INT 21,16 - Create a File Using FCB
INT 21,17 - Rename a File Using FCB
INT 21,19 - Get Current Default Drive
INT 21,1A - Set Disk Transfer Address (DTA)
INT 21,1B - Get Allocation Table Information
INT 21,1C - Get Allocation Table Info for Specified Drive
INT 21,1F - Get Pointer to Current Drive Parameter Table (Undocumented)
INT 21,21 - Random Read Using FCB
INT 21,22 - Random Write Using FCB
INT 21,23 - Get File Size Using FCB
INT 21,24 - Set Relative Record Field in FCB
INT 21,25 - Set Interrupt Vector
INT 21,26 - Create New Program Segment Prefix
INT 21,27 - Random Block Read Using FCB
INT 21,28 - Random Block Write Using FCB
INT 21,29 - Parse a Filename for FCB
INT 21,2A - Get Date
INT 21,2B - Set Date
INT 21,2C - Get Time
INT 21,2D - Set Time
INT 21,2E - Set/Reset Verify Switch
INT 21,2F - Get Disk Transfer Address (DTA)
INT 21,30 - Get DOS Version Number
INT 21,31 - Terminate Process and Remain Resident
INT 21,32 - Get Pointer to Drive Parameter Table (Undocumented)
INT 21,33 - Get/Set System Values (Ctl-Break/Boot Drive)
INT 21,34 - Get Address to DOS Critical Flag INDOS
INT 21,35 - Get Interrupt Vector
INT 21,36 - Get Disk Free Space
INT 21,37 - Get/Set Switch Character (Undocumented, DOS 2.
INT 21,38 - Get/Set Country Dependent Information
INT 21,39 - Create Subdirectory (mkdir)
INT 21,3A - Remove Subdirectory (rmdir)
INT 21,3B - Change Current Directory (chdir)
INT 21,3C - Create File Using Handle
INT 21,3D - Open File Using Handle
INT 21,3E - Close File Using Handle
INT 21,3F - Read From File or Device Using Handle
INT 21,40 - Write To File or Device Using Handle
INT 21,41 - Delete File
INT 21,42 - Move File Pointer Using Handle
INT 21,43 - Get/Set File Attributes
INT 21,44 - I/O Control for Devices (IOCTL)
INT 21,44,0 / IOCTL,0 - Get Device Information
INT 21,44,1 / IOCTL,1 - Set Device Information
Device Data Word
INT 21,44,2 / IOCTL,2 - Read From Character Device
INT 21,44,3 / IOCTL,3 - Write to Character Device
INT 21,44,4 / IOCTL,4 - Read from Block Device
INT 21,44,5 / IOCTL,5 - Write to Block Device
INT 21,44,6 / IOCTL,6 - Get Input Status
INT 21,44,7 / IOCTL,7 - Get Output Status
INT 21,44,8 / IOCTL,8 - Device Removable Query
INT 21,44,9 / IOCTL,9 - Device Local or Remote Query
INT 21,44,A / IOCTL,A - Handle Local or Remote Query
INT 21,44,B / IOCTL,B - Set Sharing Retry Count
INT 21,44,C / IOCTL,C - Generic I/O for Handles
INT 21,44,D / IOCTL,D - Generic I/O for Block Devices
INT 21,44,E / IOCTL,E - Get Logical Drive
INT 21,44,F / IOCTL,F - Set Logical Drive
INT 21,45 - Duplicate File Handle
INT 21,46 - Force Duplicate File Handle
INT 21,47 - Get Current Directory
INT 21,48 - Allocate Memory
INT 21,49 - Free Allocated Memory
INT 21,4A - Modify Allocated Memory Block (SETBLOCK)
INT 21,4B - EXEC/Load and Execute Program
INT 21,4C - Terminate Process With Return Code
INT 21,4D - Get Return Code of Sub-process
INT 21,4E - Find First Matching File
INT 21,4F - Find Next Matching File
INT 21,50 - Set Current Process ID (Undocumented DOS 2.
INT 21,51 - Get Current Process ID (Undocumented DOS 2.
INT 21,52 - Get Pointer to DOS "INVARS" (Undocumented)
INT 21,53 - Generate Drive Parameter Table (Undocumented)
INT 21,54 - Get Verify Setting
INT 21,55 - Create New PSP (Undocumented)
INT 21,56 - Rename File
INT 21,57 - Get/Set File Date and Time Using Handle
INT 21,58 - Get/Set Memory Allocation Strategy (Undocumented, DOS 3.
INT 21,59 - Get Extended Error Information (DOS 3.
INT 21,5A - Create Temporary File (DOS 3.
INT 21,5B - Create File (DOS 3.
INT 21,5C - Lock/Unlock File Access (DOS 3.
INT 21,5D - Critical Error Information (Undocumented, DOS 3.
INT 21,5E AL=0 Get Machine Name (DOS 3.
INT 21,5E AL=01 Set Machine Name (DOS 3.
INT 21,5E AL=02 Set Printer Setup (DOS 3.
INT 21,5E AL=03 Get Printer Setup (DOS 3.
INT 21,5E AL=04 Set Printer Mode (DOS 3.
INT 21,5E AL=05 Get Printer Mode (DOS 3.
INT 21,5F AL=00 Get Redirection Mode (DOS 3.
INT 21,5F AL=01 Set Redirection Mode (DOS 3.
INT 21,5F AL=02 Get Redirection List Entry (DOS 3.
INT 21,5F AL=03 Redirect Device (DOS 3.
INT 21,5F AL=04 Cancel Device Redirection (DOS 3.
INT 21,5F AL=05 Get Redirection List Extended Entry (DOS 4.
INT 21,5F AL=06 Get Redirection List (DOS 4.
INT 21,60 - Get Fully Qualified File Name (Undocumented 3.
INT 21,62 - Get PSP address (DOS 3.
INT 21,63 - Get Lead Byte Table (MSDOS 2.
INT 21,63 - Get Lead Byte Table (Asian DOS 3.
INT 21,64 - Set Device Driver Look Ahead (Undocumented)
INT 21,65 - Get Extended Country Information (DOS 3.
INT 21,66 - Get/Set Global Code Page (DOS 3.
INT 21,67 - Set Handle Count (DOS 3.
INT 21,68 - Flush Buffer Using Handle
INT 21,69 - Get/Set Disk Serial Number (Undocumented DOS 4+)
INT 21,6C - Extended Open/Create (DOS 4.
INT 21,F8 - Set OEM Int 21 Handler (functions F9-FF, Undocumented)
INT 22 - Program Terminate
INT 23 - Control-Break Exit Address
INT 24 - Critical Error Handler
INT 25 - Absolute Disk Read
Control Block Format (DOS 4.
INT 26 - Absolute Disk Write
Control Block Format (DOS 4.
INT 27 - Terminate and Stay Resident
INT 28 - DOS Idle Loop / Scheduler (Undocumented)
INT 29 - DOS Fast Character I/O (Undocumented 2.
INT 2A - DOS Network Critical Section and NETBIOS
INT 2A,0 - Network Installation Query
INT 2A,1 - Execute NETBIOS Request With No Error Retry
INT 2A,3 - Check if Direct I/O Allowed
INT 2A,4 - Execute NETBIOS Request
INT 2A,5 - Get Network Resource Information
INT 2A,6 - Network Print Stream Control
INT 2A,80 - Begin DOS Critical Section
INT 2A,81 - End DOS Critical Section
INT 2A,82 - End DOS Critical Sections 0 thru 7
INT 2A,84 - Keyboard Busy Loop
INT 2A,87 - Critical Section
INT 2E - Execute Command Using Base Level Command Interpreter (Undocumented DOS 2.
INT 2F - DOS Multiplex Interrupt
INT 2F,0 - DOS Multiplex Interrupt - Get Installed State
INT 2F,1 - Multiplex Interrupt - Submit file
INT 2F,2 - Multiplex Interrupt - Cancel file
INT 2F,3 - Multiplex Interrupt - Cancel all files
INT 2F,4 - Multiplex Interrupt - Pause / return status
INT 2F,5 - Multiplex Interrupt - End of Status
INT 2F,6 - PRINT.
INT 2F,8 - DRIVER.
INT 2F,2E - Setup Error Code Translation Tables (undoc.
INT 2F,80 - PRINT.
INT 33 - Mouse Function Calls
Mouse functions can be broken down into the following classes:
INT 33,0 - Mouse Reset/Get Mouse Installed Flag
INT 33,1 - Show Mouse Cursor
INT 33,2 - Hide Mouse Cursor
INT 33,3 - Get Mouse Position and Button Status
INT 33,4 - Set Mouse Cursor Position
INT 33,5 - Get Mouse Button Press Information
INT 33,6 - Get Mouse Button Release Information
INT 33,7 - Set Mouse Horizontal Min/Max Position
INT 33,8 - Set Mouse Vertical Min/Max Position
INT 33,9 - Set Mouse Graphics Cursor
INT 33,A - Set Mouse Text Cursor
INT 33,B - Read Mouse Motion Counters
INT 33,C - Set Mouse User Defined Subroutine and Input Mask
INT 33,D - Mouse Light Pen Emulation On
INT 33,E - Mouse Light Pen Emulation Off
INT 33,F - Set Mouse Mickey Pixel Ratio
INT 33,10 - Mouse Conditional OFF
INT 33,13 - Set Mouse Double Speed Threshold
INT 33,14 - Swap Interrupt Subroutines
INT 33,15 - Get Mouse Driver State and Memory Requirements
INT 33,16 - Save Mouse Driver State
INT 33,17 - Restore Mouse Driver State
INT 33,18 - Set alternate subroutine call mask and address
INT 33,19 - Get User Alternate Interrupt Address
INT 33,1A - Set Mouse Sensitivity
INT 33,1B - Get Mouse Sensitivity
INT 33,1C - Set Mouse Interrupt Rate (InPort only)
INT 33,1D - Set Mouse CRT Page
INT 33,1E - Get Mouse CRT Page
INT 33,1F - Disable Mouse Driver
INT 33,20 - Enable Mouse Driver
INT 33,21 - Reset Mouse Software
INT 33,22 - Set Language for Messages
INT 33,23 - Get Language Number
INT 33,24 - Get Driver Version, Mouse Type & IRQ Number
INT 4A - RTC Alarm Handler Vector
INT 67 - Expanded Memory Specification
INT 67,40 - Get EMM Status (LIM EMS 3.
INT 67,41 - Get Page Frame Base Address (LIM EMS 3.
INT 67,42 - Get Page Counts (LIM EMS 3.
INT 67,43 - Get Handle and Allocate Pages (LIM EMS 3.
INT 67,44 - Map Logical Page Into Physical Page Window (LIM EMS)
INT 67,45 - Release Handle and Memory Pages (LIM EMS)
INT 67,46 - Get EMM Version (LIM EMS)
INT 67,47 - Save Page Map Context (LIM EMS 3.
INT 67,48 - Restore Page Map Context (LIM EMS 3.
INT 67,49 - Get I/O Port Addresses (LIM EMS ¾ 3.
INT 67,4A - Get Logical to Physical Page Mapping (LIM EMS ¾ 3.
INT 67,4B - Get Handle Count (LIM EMS)
INT 67,4C - Get Page Count for Handle
INT 67,4D - Get Page Count for All Handles (LIM EMS)
INT 67,4E - Get/Set Page Map Context (LIM EMS 3.
INT 67,4F - Get/Set Partial Page Map (LIM EMS 4.
INT 67,50 - Map/Unmap Multiple Handle Pages (LIM EMS 4.
INT 67,51 - Reallocate Pages (LIM EMS 4.
INT 67,52 - Get/Set Handle Attributes
INT 67,53 Get/Set Handle Name
INT 67,54 - Get Handle Directory (LIM EMS 4.
INT 67,55 - Alter Page Map and Jump (LIM EMS 4.
INT 67,56 - Alter Page Map and Call (LIM EMS 4.
INT 67,57 - Move/Exchange Memory Region (LIM EMS 4.
INT 67,58 - Get Mappable Physical Address Array (LIM EMS 4.
INT 67,59 - Get Expanded Memory Hardware Information (LIM EMS 4.
INT 67,5A - Allocate Standard/Raw Pages (LIM EMS 4.
INT 67,5B - Alternate Map Register Set (LIM EMS 4.
INT 67,5C - Prepare Expanded Memory for Warm Boot (LIM EMS 4.
INT 67,5D - Enable/Disable OS Functions (LIM EMS 4.
INT 67,60 - LIM EMS Get Physical Window Array
INT 70 - Real Time Clock Interrupt (XT 286,AT,PS/2)
Friday, January 16, 2009
ASP.Net Session State Management
Web server?
IIS (Internet Information Service) running on a software port like 80 for Http and 443 for Https or any other port set bt the administrator, it can host more than one web site and each web site can hold more than one web application. Web server provides application pooling and hanldes all web request from the internet and forward it to respective web site's application pool for processing and response. IIS can host classic asp applications, asp.net applications, php applications, etc.
Application Pooling?
The Windows IIS web server, has application pools where different web applications or web sites can be pooled. When we say pooled it means it is loaded in the process, so the web requests are processed. Why pooling? becuase the application will handle multiple web requests, the application is loaded once, and remains in the pool for quite some time to process subsequent requests and when remains idel for too long it is unloded. The pooling helps better manage server resources, so the CPU and Memory is not consumed uselessly. An application pool can hold more than one web application, and IIS can have more than one application pools. Application pools it self is comprehensive topic and it provides many things to tune your web application performace.
Worker Process?
As we discussed above, application pooling is done in IIS, Worker Process is actually a program that executes in the system memory for a specific application pool, if we have three application pools and the pools are active than we will have three process running it the system memory, these are the processes which handle the requests and send response. The "w3wp.exe" program can be easily found in the task manager, this is the program running behind the application pool.
We can define more than one worker process in an application pool, by default we have one worker process in an application pool, this means there is only one queue for my web requests, so ten request will execute one at a time.
If i increase the number to 2, so now my application pool has 2 worker process, this means there are two queues for my web requests, so ten request will execute two at a time. Ofcourse the CPU time will be divied between the two worker processes, this means to many worker processes will cut down the overall response time if i have a moderate server, therefore it depends upon the hardware of the server that how many worker processes it can hold.
Each worker process has its own memory as well, so be carefull while configuring this number.
Now as we have a good background of the web server, application pooling and worker process, we can move forward to our actually topic, that is the Session Sate Management.
What is Session?
HTTP is a stateless protocol. Each request is serviced as it comes; after the request is processed, all of the data is discarded. No state is maintained across requests even from the same client.
However, it is very useful to maintain state across requests for certain solutions. ASP.NET enables you to maintain both application state and session state through use of application and session variables respectively.
Session is a way of persisting or storing client data on web server between subsequent request from the client. Here client is the browser or internet browsing application which is making requests to our web server.
Web server can host different web sites, each web site can maintain its own sessions, regardless of the web server. Sessions are maintained for sites, like we would want to track the users shopping cart temporarily until the user checks out, this can be done in the session of the client.
Sessions are stored in the system memory of the web server, and the memory is allocated by the "w3wp.exe" worker process program. Information stored in client session dont lose unless the session is destroyed on the server or the user signs out. We have timeout set for sessions, default is 20 minutes, if a session remains idle for more than 20 minutes it is automatically destroyed, this is becuase there is no user interaction, so the session remained inactive. As sessions are created it consumes system memory, and when sessions are destroyed the system memory is released. Session variables are automatically discarded after they are not used for the time-out setting that is specified in the Web.config file. On each request, the time out is reset. The variables are lost when the session is explicitly abandoned in the code.
Session ID:
When a session is initiated on first request, the server issues a unique session ID to the user. To persist the session ID, store it in an in-memory cookie (which is the default), or embed it within the request URL after the application name. To switch between cookie and cookieless session state, set the value of the cookieless parameter in the Web.config file to true or false.
1. Cookieless
2. Cookie
In cookieless mode, the server automatically inserts the session ID in the relative URLs only. An absolute URL is not modified, even if it points to the same ASP.NET application, which can cause the loss of session variables.
Session State:
Now what is session state, and why i am highlighting it? because knowning what is session is not enough, Asp.Net provides different ways to manager session state according to the requirements of the web applications. We can store session in following, this is configured through web configuration file of a web application:
InProc or Worker Process: In-Proc mode stores values in the memory of the ASP.NET worker process. Thus, this mode offers the fastest access to these values. However, when the ASP.NET worker process recycles, the state data is lost.
StateServer: Alternately, StateServer mode uses a stand-alone Microsoft Windows service to store session variables. Because this service is independent of Microsoft Internet Information Server (IIS), it can run on a separate server. You can use this mode for a load-balancing solution because multiple Web servers can share session variables. Although session variables are not lost if you restart IIS, performance is impacted when you cross process boundaries.
SqlServer: If you are greatly concerned about the persistence of session information, you can use SqlServer mode to leverage Microsoft SQL Server to ensure the highest level of reliability. SqlServer mode is similar to out-of-process mode, except that the session data is maintained in a SQL Server. SqlServer mode also enables you to utilize a state store that is located out of the IIS process and that can be located on the local computer or a remote server.
Configuring Session State:
You can configure session state in the
<configuration>
<system.web>
<sessionstate mode="InProc" timeout="20" cookieless="false"
stateconnectionstring="tcpip=127.0.0.1:42424"
sqlconnectionstring="data source=127.0.0.1;user id=username;
password=password">
</system.web>
</configuration>
Reference: Asp.Net State Management
Changing ASP.net Temporary Files Folder
One of my client was having problems with the small space on the C drive on a server machine which was hosting a ASP.net application. There were few errors in the server error about “No enough space”.Though I would say that in ideal situation it would be best to increase the space on the C: drive as most of the other Operating System related applications also reply on the free space on C: drive, when there is no other easy way of increasing the space on C: drive, administrator can relocate the temporary files folder created by ASP.net.
Please note that ASP.net create a compile version of the site and stores it in its default temporary ASP.net folder. This is usually %Windows Install Folder%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files (For ASP.Net 2.0). This folder can grow very fast in case web server has large ASP.net sites hosted on that server. Fortunately, ASP.net provides a simple way to change this location. This is stored in the web.config file and can defined in the Global web.config (placed at %Windows Install Folder%Microsoft.NET\Framework\v2.0.50727\CONFIG). To change this path add the new full folder path in the Compilation section of the configuration file. Here is a sample of how this looks like (this must be under System.Web section):
<compilation tempDirectory=“E:\ASP.Net Temporary Folder\” debug=“false“>
One can find the documentation of all different sections of ASP.net configuration file at:
http://msdn2.microsoft.com/en-us/library/b5ysx397(VS.71).aspx
In case when Internet is not available, or you just need a quick reference, there is also a small helpful file in the configuration folder. This file is named “web.config.comments” and is in the CONFIG folder of the ASP.net framework folder.
Thursday, January 8, 2009
How to Remove Linux Boot Loader?
Using Windows 98 CD:
Boot into Command Prompt and provide following command:
fdisk /MBR
Using Windows 2000, XP, 2003 CD:
Enter into "Recovery Console" by pressing "R", select your Windows installation and enter administrator password. Now provide following command:
fixmbr
Press "Y" to confirm and type Exit to exit from recovery console.
Using Windows Vista, Server 2008 DVD:
Boot using setup DVD and click on "Repair Computer" link, then click on "Command Prompt". Now navigate to your DVD drive using CD command and at last provide following command:
bootsect /nt60 SYS /mbr
Exit from Command prompt and restart your system.
2. The above commands will remove the Linux boot loader from startup and you'll be able to directly boot into Windows.
3. If you have not deleted Linux partitions, then you can delete them using "Disk Manager" tool in Windows.
Repairing Windows XP in Eight Commands
1. C: CD ..
2. C: ATTRIB -H C:\\boot.ini
3. C: ATTRIB -S C:\\boot.ini
4. C: ATRIB -R C:\\boot.ini
5. C: del boot.ini
6. C: BOOTCFG /Rebuild
7. C: CHKDSK /R /F
8. C: FIXBOOT
Hack to Remove/Uninstall Symantec Norton Antivirus (SAV) Client without Password
The client uninstallation password is different from the server group password, and it can be set by the administrator through the Symantec System Center for the client that is managed. If the client uninstallation password has not been set or changed specifically, it will still be the default password. Thus, first thing to try in order to successfully uninstall a Symantec Client Security program is by using the default password for the uninstalling clients, which is symantec.
In the cases where Symantec AntiVirus server has been taken down and no longer exist, or the client computer has no access to company network, or the default client uninstall password does not work, the following hack will enable you to remove Symantec Antivirus without using a password:
1. Open Registry Editor (regedit).
2. Navigate to the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\Administrator Only\Security\
3. Change the value for useVPuninstallpassword key from 1 to 0.
4. Exit Registry Editor and now you can uninstall Symantec AntiVirus Client.
The trick should work on most version of Symantec AntiVirus client or Norton AntiVirus Client, including version 7, 8, 9 or 10.
Free Disk Space By Making Windows Vista Service Pack 1 Permanent
To recover almost 1GB of space after you have installed Windows Vista service Pack 1, follow the simple steps listed below.
1. Open a command prompt window.
2. Type in the command “vsp1cln” (since this executable exists in system32 folder, it’s a global command and can be run from any folder) and hit Enter.
3. Read the instructions and type in “Y” and hit enter.
4. You should see Vista performing a clean up of old files, once it’s complete you should recover almost 1GB of disk space.
Wednesday, January 7, 2009
Execute code in both If and Else part
Like we have a condition as follows:
if (True) {
// code A
}
else {
// code B
}
Ideally any one code can be executed, if True than code A will be executed otherwise code B is executed. What if i want to execute both code A and code B?
Well, we know in C language, Visual basic and some other languages we have "goto" statement, "goto" statement is used to jump from one code line to another by passing any program flow, so we can do like this:
if ( True ) {
LABLE1:
// code A
goto LABEL2
}
else {
LABEL2:
// code B
}
What will happen if condition is True than code A is executed and in the next line we instruct it to jump to label "LABEL2" with "goto" statement, that’s it we have forced the program to work against the logical rule. That is why "goto" statement should not be used as it can violate the program rules and are difficult to debug as well.
Thursday, January 1, 2009
Comparison Of Dot Net, J2EE, PHP
A team of 2 developers rebuilt the “Sun Microsystems' Java Pet Store J2EE Blue Print Application” using .Net in 4 weeks with 25% of the code. When tested in a lab, the .Net application ran %1000 faster than a tuned version of the Java application.
The same Pet Store application was rebuilt by both Microsoft and Sun for an independent competition sponsored by The Middleware Company.
Below is a comparison of the results:
.Net 1.1 | J2EE | |
Lines of Code | 2,096 | 14,004 |
Time required for tuning and optimization prior to performance test | 2 man-weeks | 10 man-weeks |
Price/Performance Ratio – the cost per server divided by the maximum transactions per second the server could handle | $316 – in other words, for a Java application to handle the same amount of website traffic as a .Net application, an additional $989 would need to be spent on server hardware. | $1,305 |
Maximum Pages served per Second | 1,400 | 600 |
Maximum Number of Concurrent Users | 6,000 | 4,000 |
Maximum Number of Transactions per Second | 117 | 59 |
In general, .Net brings the power of an enterprise application into the cost range f a small and medium sized business by reducing the lines of code required. This reduction in code results in decreased development time, expensive development staff, maintenance and overall cost, while delivering superior website performance.
Feature | .Net | Java | Cold Fusion MX | PHP |
Compiled Code – Increases website speed (precompiled is the fastest) | Yes – both pre- compiled and dynamically compiled when a page is requested | Yes – both pre- compiled and dyn- amically compiled when a page is requested | Yes – dyn- amically compiled when a page is requested | No – a 3rd party accelerator can be used to increase performance but it is not installed on most shared hosting servers. |
Scripted Language – results in poor website performance | No | No | Somewhat | Yes – a 3rd party accelerator can be used to increase performance but it is not installed on most shared hosting servers. |
Object Oriented – Increases the ability for code reuse and provides enhanced features as well as reduced development time; since code is more reusable, results in fewer bugs that can be discovered by any client and fixed for everyone; encourages developers to write more maintainable code. | Yes | Yes | Somewhat | No |
Supported Development Languages – easier to find developers | C++, C#, Visual Basic.NET, Jscript.NET, Python, Perl, Java (J#), COBOL, Eiffel, Delphi – 25 languages supported currently | Java | CFML and CF Script | PHP |
Browser Specific HTML Rendering – different HTML is automatically sent to IE than to Netscape, reducing incompatibility issues | Yes | No | No | No |
Open Source | No | Yes | Somewhat | Yes |
Reference from Wikipedia:
Comparison of web application frameworks