Cursor Disadvantages

A conventional idea every experienced developer projects is : CURSOR is evil. Recently, I had a situation where I had to look into different options for achieving a task and many have said Cursors would the best option.

I started researching more on Cursors, as I was bit confused on contradictory ideas about cursors. A cursor is a memory resident set of pointers that reference data in your result set which has the data from the base tables. Cursors have a bad reputation because they are typically used by every Junior SQL Developer in search of an easy solution and they do not perform well and they deplete systems resources.

I personally feel SQL Server by default have a direct performance degradation on the usage of cursors. SQL ServerEngine processes records or data in such a way it will have a performance impact when cursor is used.  All other parallel processes will suffer when cursor is in action and they are the SLOWEST way to access data as it operates by checking row by row operations. Cursors are 30 times slower than any other alternatives.

I adopted an alternative way to accomplish my task.

Then why is Cursor needed ? There are few scenarios where we can use Cursors:

  • When you need to fire a stored procedure once per row in a table. In other words, if we need to perform row-by-row operations rather than set based operations
  • Query optimizer helps in achieving Adaptability and Efficiency by adapting itself.
  • When row wise validations are needed for less data.

I will keep on adding any new observations about Cursors in next few days.

Happy Coding

Advertisements

PDC 09 Sessions

PDC 09 is unique workshop which provided first opportunity to learn about the future of the Microsoft developer platform from the people that make it happen. PDC content covers a range of Microsoft products, services and technologies with topics that focus on clients, services, servers, developers tools, developer frameworks, programming languages, and much more

PDC speakers are often the people at Microsoft that are actually building the products and services being discussed in the sessions. PDC09 attendees had a unique opportunity not only to hear from those who are building Microsoft products and services but also to talk and interact with them throughout the event.

Using Mike Swanson’s downloader and renamer

If you’d like to download all of the keynote and session content, download a recent build of cURL (~250K), and extract it to your folder-of-choice. Then, download PDC09Downloader.zip (1.49KB) and extract the PDC09Downloader.bat file to the same folder. From a command prompt, start PDC09Downloader by passing it one of the following parameters: WMVHIGH, WMV, MP4, PPTX. Then wait. For files that aren’t available, cURL will download a file that is around 221 bytes in size (if you change the extension to .htm and open it, you’ll see that the file is simply an HTML "not found" error page).

To rename the files, first, download the PDC09 Renamer batch file (4.52KB). Then, extract the PDC09Renamer.bat file to the folder that contains your downloaded files, and from a command prompt, type PDC09Renamer WMV to rename all of the .WMV files to the full session title. By changing the parameter, you can also rename your PPTX and MP4 files.

IE=EmulateIE7

Recently, we tried to test our site in IE8 and found all the styles in the page are not applied properly.We know that we can’t always get a cross-browser result, but that’s mostly because IE6 blows. However, if we write standards-based code, test it in a browser like Firefox that has pretty good standards support, and then make minor tweaks for the broken browsers, the development process is much easier.

After some research, we found that during the IE7 beta concerned sites that looked fine in IE6 but looked bad in IE7. The reason was that the sites had worked around IE6 issues with content that – when viewed with IE7’s improved Standards mode – looked bad.

Now, when a site hands IE8 content and asks for Standards mode, that content would expect IE7’s Standards mode and not appear or function correctly.  This creates a “get ready” call to action for site owners to ensure their content will continue to display seamlessly in IE8.

EmulateIE7 tells IE8 to display standards DOCTYPEs in IE7 Standards mode, and Quirks DOCTYPEs in Quirks mode. We believe this will be the preferred IE7 compatibility mode for most cases.

  • On a per-page basis, add a special HTML tag to each document, right after the <head> tag

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Using the IE=EmulateIE7 compatibility tag is a simple way for users to continue their current experience when browsing your site until you can update with more standards-compliant content.  Although adding this tag will prevent most display issues, you may also need to update your site to properly detect IE8.

To my surprise, all the Microsoft sites have this tag implemented !!!

Free PowerShell V1 Book From the Makers of PowerShell Plus

Dr Tobias Weltner has  been involved with Windows scripting for many many years.  He was very active in the VBScript and WMI communities and then an very early adopter of PowerShell.  He is on of the PowerShell MVPs and the inventor of the amazing PowerShell Plus.

Tobias is making waves again by releasing a FREE PowerShell book “Mastering PowerShell”.   This appears to be a very comprehensive book at 567 pages.   Here is the TOC:

Chapters
1. The PowerShell Console
2. Interactive PowerShell
3. Variables
4. Arrays and Hashtables
5. The PowerShell Pipeline
6. Using Objects
7. Conditions
8. Loops
9. Functions
10. Scripts
11. Finding and Avoiding Errors
12. Command Discovery and Scriptblocks
13. Text and Regular Expressions
14. XML
15. The File System
16. The Registry
17. Processes, Services, Event Logs
18. Windows Management Instrumentation
19. User Management
20. Your Own Cmdlets and Extensions

Note that the book is focused on PowerShell V1.

Enjoy!

OutOfMemoryException in .NET (on 32 bit)

When I got an out of memory exception in my early days of programming, I believed that there is no memory for the program or process to use.

Now, when I started using High end PCs with 4 gigabytes of RAM, I am facing the same problem.
I realize now that memory is not the case but the common language runtime(CLR) throws an OutOfMemoryException error if it cannot allocate physical memory or reserve sufficient virtual memory to fulfill allocation request.

I tried to understand two concepts before further going into the explanation, the operating system manages processes, and the operating system manages files on disk.

Each process can access as much as data storage it wants. It asks the operating system to create for it a certain amount of data storage, and the operating system does so.

I understand that even if we have 512 MB of memory of 8 GB when running a 32 bit operating system no one process is going to get more than 2GB of RAM. 

Eric Lippert has written a blog post on “Out Of Memory” Does Not Refer to Physical Memory. Click  here for the blog post.

Robert L. Bogue has written in more detail in his post , What does an OutOfMemoryException in .NET (on 32 bit) really mean? Click here for the post.

Happy Coding !!

Debugger problem “The breakpoint will not currently be hit. No symbols have been loaded for this document”

I just experienced the infamous “The breakpoint will not currently be hit”. After reading several posts in various websites in reference to this issue, I found few solutions which I thought of sharing :

  • Check if the debug=”true” in your aspx page.

Debug is disable

<%@ Page Language=”C#” MasterPageFile=”~/MainMasterPage.master” AutoEventWireup=”true” CodeFile=”Facility.aspx.cs” Inherits=”_Facility” debug=”false”%>

Debug is enable

<%@ Page Language=”C#” MasterPageFile=”~/MainMasterPage.master” AutoEventWireup=”true” CodeFile=”Facility.aspx.cs” Inherits=”_Facility” debug=”true”%>

  • Removing all the references in the project and re-inserting them taking care of the version used.
    Manually deleting the bin/release and bin/debug sub-directories in every project in the solution.
    De-installing and reinstalling .net framework (any version) and VS-2005
    Taking a close look at the target platform in the projects.
    Breakpoints Should come back !!It can be caused as the .PDB and the assembly of one of the controls would  not have been referenced at the     right place, resulting in a desync between the sources and binaries.
    By re-referencing all, and killing the bin subdirs problem will be solved.
  • Goto Tools menu and select Options; check the “Show advanced build configurations” checkbox.  Now the build configurations show in the Project Properties dialog;  display will be the Project Properties dialog (Project menu/Properties).  We can now see the Configuration dropdown box.  Select “Active(Debug)” item. Check the “Define DEBUG constant” checkbox.  Rebuilt the project.  Now there is a symbols file ([project].pdb) in the current output directory. When debugged, the symbols file is loaded and breakpoints will now hit.
  • Other options than can be tried are  1).  rebuilding the application many times. 2). completely deleting and redoing it from scratch (though thats not a good idea !!  ). 3).  Check whether the .pdb file is in the same location as the DLL with the same name and time. 4). Check whether project is running on the debug version of the DLL and associated files. 5).  ensured there was only one instance of the DLL, project, etc. on the machine. 6).  right clicked on a DLL that is within the Modules window, selected Symbol Settings, selected Debugging | Symbols and manually added the directory with the .pdb file – even though confirmed that this is the default location used by the project. 7).  checked that Enable Just My Code is not selected within the Symbol Settings | Debugging | General menu. 8).  tried placing the DLL in the C:\Windows32\ directory just to see if the Modules Window would “see” it. 9).  adjusting a few other things to match suggestions regarding optimization settings, etc. 10). selecting Load DLL exports within within the Symbol Settings | Debugging | Native menu (although I am not familiar with what this may actually be doing..needs some research in the weekend); this caused most of the DLL’s in the Modules window to have a listing of Exports Loaded, but did not appear to affect my issue in any way – again my DLL is not within the Modules window.
  • Select the Solution node in your Solution Explorer… Select Properties from the context menu… Select Multiple Startup Projects…For each project you want to debug, select Start from the action drop down.

Received a comment from Eric Long with an other solution: click here .

Microsoft Visual Studio Gallery – Products and Extensions for Visual Studio

Are you to looking to find products, extensions, and add-ins for Visual Studio.

 Microsoft Visual Studio Gallery

Your search ends at Microsoft Website. Microsoft is providing Gallery with

Tools  (Build, Coding, Data, Documentation, Modeling, Performance, Programming Languages, Reporting, Security, Setup & Deployment,Source Control, Team Development, Testing and  Web )

Controls (ASP.NET Controls, Silverlight Controls, Sharepoint Controls, Windows Forms Controls, WPF Controls and Framework & Libraries)

Templates (ASP.NET, Office , Mobile Device, Silverlight, SQL Server, WCF, Windows Forms, Workflow and WPF)

click here to access all the above mentioned  Tools, Controls and Templates.

Happy Coding !!!

 

 

Controls
  • ASP.NET Controls
    261
  • Silverlight Controls
    54
  • Sharepoint Controls
    36
  • Windows Forms Controls
    145
  • WPF Controls
    63
  • Framework & Libraries