May 17, 2015

Dynamically Hide/Show columns in SSRS Report

I was developing a SSRS report that fetches data from table that has 2 billion rows. Report had around 80+ columns displaying data. On the verge of acceptance testing client came up with a concern that the report is too big and he needs an option to control the number of columns that gets displayed in report for better viewing and exporting capabilities.

SSRS doesn't provide this feature out of the box, rather none of the reporting tool that I know of. I came across the following URL that helped me to achieve this functionality.

https://madhankumars.wordpress.com/2009/07/10/dynamically-addremove-columns-in-ssrs-reports-using-hideunhide/

But I had problem that, for example if column 2 & 4 had been hidden, there was a blank between column 1 & 3 since column 2 was hidden. Again, we ran in to problem.
That is in when following URL helped to over come the issue.

http://blogs.msdn.com/b/robertbruckner/archive/2010/05/02/report-design-shrinking-hidden-static-columns.aspx

But here too.. the width of the report still remains same, so there would be blank area in report, but at least it doesn't appear in export format (PDF, Excel or word).

MadanKumar Site excerpt

Illustration

                For this example, we can take Employee table. Create a report which has a data set that consists of all the available columns of Employee table.  The report layout will be like
 rep1
Go to the Report Parameters tab, apart from the parameter needed to your report; add a new parameter called ColumnsToDisplay. Check the Multi-Value checkbox to select multiple columns in the report results. In the Available Values, select Non-queried and enter the Label/Value pair for all the available columns. In the Default Values, enter the column names that you want to display by default in the report. The ColumnsToDisplay parameter will look like this
 rep2


Now, click on the Report Properties under the Reports tab in main menu. Add the following code under the code section.

Public Shared Function IsColumnSelected(ByRef objMultiValueParam() As Object, ByVal strColumnName As String) As Boolean
    ‘ return whether the passed column name is in the multi-value
    ‘ parameter array
    Return 0 < InStr(vbNullChar & Join(objMultiValueParam, vbNullChar) & _
        vbNullChar, vbNullChar & strColumnName & vbNullChar)
End Function

Your code window will look like this.
 rep3

We have to add expressions to the visibility property of every column to call this function to hide/unhide the column. Select the column and go to the property name Hidden under Visiblity  click the expression and add the following expression.
=Not Code.IsColumnSelected(Parameters!ColumnsToDisplay.Value, “EmpID“)
EmpId is the name of the column that you are selected; you need to specify the exact column name.

Your report layout will be look like this while applying expression
rep4

Your expression window will look like this
rep5
That’s it! Now run the report. Initially when the report is rendered, it will show the default columns EmpName, Shift, Address in the report.
The report will look like this
rep6
If the user want to see the other three columns of the employee say DOB, Phone and Passport No. The user has to select the corresponding columns from the drop down and click View report button.
Now the report will look like this
 rep7
The report can be exported to Excel or PDF or any supporting format.

Excerpt from Robert Bruckner blog

First I want to show what happens if you simply select a table column on the design surface, and set the Visibility.Hidden property based on a Boolean report parameter value:
TableColumn - Hide Contents Only - Design
In this case you simply hide the contents inside the table column, not the actual table column itself. As a result, the report rendering will preserve the space consumed by the column:
TableColumn - Hide Contents Only - Preview
Now, let’s instead hide the actual table column to shrink both the table width, as well as the report body as much as possible if the user selects to hide the middle name at runtime:
  1. On the report design surface, click on the small triangle and select "Advanced Mode" to show static members, as shown in the screenshot.
  2. In order to dynamically shrink the second table column, select the second static column in the grouping pane.
  3. The property grid should now show the properties for the static tablix member. Set the Visibility.Hidden expression based on the Boolean report parameter value:
TableColumn - Hide Entire Column - Design
As a result, the report rendering will now shrink the entire table width, as well as the report body (denoted by the black border line). In our example, the customer names heading textbox is then the widest report item and determines the final report body width at runtime:
TableColumn - Hide Entire Column - Preview

Account Mining

Acquiring business and sustaining is the oxygen for every organization out there.
A research states that most of the business (80%) comes in from existing customers (provided your performance was on par with expectations at least if not above).
Some of the learnings I gathered from the industry suggest following ways can help Account managers (AM) to mine new business.
1.       Feel Customers’ pain: As AM, you should have a list of at least 10 pain areas of your customer always and try to help them with your solutions. Always focus on customer’s problems rather that what you can offer. Keep visiting the customer often. Whenever he feels pain, you should be the first name that should come in customers’ mind for heal.
2.       Surround Sound: You need to keep looking for opportunities (surround sound) at client site. Some of the basic surround sounds that we can look for are :
a.       which other groups within the account you do not have the presence yet, which are the other custom/legacy systems that can be replaced by our products/modules,
b.      are there any new geographies where the customer has presence and we can leverage the current project work, who is supporting the current environment and how
c.       can you get involved there, what will be the support plan post go-live, who is the competition in the account and what are they working on, what are their weaknesses
d.       When can you pitch in to weed them out and the list of surround sound can go on and on.
3.       Inside Sound (Company Echo System): Often you hear from customers that many of the things they saw in the first corporate presentation remained as a presentation. I guess in our day to day rut we do not take our offerings to the customer unless specifically asked for (and at times even delay after asking). So while listening to the surround sound we should take the inside sound to the customer even before they ask for.
4.       Tapping without Mapping: Converting an opportunity to an order requires buy-in of multiple stakeholders in the client organization starting from the group who needs it to the group who funds it to the group who actually implements the system with us. Unless we maintain the mapping at all levels, all our tapping for new business will not yield positive results. We should get the right people from within the company (inside sound) to meet the right people at customer (surround sound) and keep the sounds going.
5.       Proper Contacts: Study shows that millions of dollars spent on the best written code gets unused because of lack of involvement from business. Irrespective of whether the business is more powerful or IT in the client organization, we should ensure that we have established the right connections in business from day one.
6.       Be Part of Customers’ family: "The family that eats together lives together" is a very old saying and if we extend this beyond our families we have actually seen that the team that eats together (at least once a month) with the customer lives together. On a serious note if we do not build the relationship (have lunch) and just stay technical, we will become lunch for the competition. This also calls for changing our lifestyle to a large extent on relishing local cuisines and not eating traditional all the time, exploring new restaurants, reading non-technical books, listening to local music/podcasts, watching movies, going to concerts/operas, following local sports (baseball in USA, Ice hockey in Finland etc...) and in fact even trying some local sports like skiing, football etc, reading local (client geography) newspaper and not always be glued to home news....all this is required to make each lunch meeting a memorable one for you as well as the customer and help build relationship beyond work.
7.       Keep working: collect and analyze client data Review periodically relevant client information. For example: Type of work done previously, Billing rates, vertical and geographical distribution of their business, GPM/Profits, Quality of work and Cost effectiveness. Do PEST, SWOT analysis.

Maintain following template always up to date. Some type of heat map
1) Name of the Account
2) Geographical Distribution of Customer Business
3) Industry Vertical
4) Present and past year revenue and profit
5) Present and past year IT expenses
 6) Services provided by vendor
7) Services they are in immediate need
9) Who are their competitors?
10) What is the current portfolio that vendor has with the customer
11) What are the domain support customer specifically require
15) What top level technology services other competitors of customer are following.
16) What is the relationship status with customer?
17) What is the relationship status of vendor’s competitors with customer

18) Some basic account base information like number of resources providing support to customer.

Happy hunting.

Situational Leadership

I am pursuing a course in Courseera about "Fundamentals of Management" and when I came across content on Situational Leadership became much interested.

In todays’ more agile world, Leaders need to possess multiple personalities (both bad and good) to strive and keep producing results. Most important one is “Emotional Intelligence (EI)”, defined as ability to manage ourselves and our relationships effectively. Basic four fundamental capabilities of EI include self-awareness, self-Management, Social awareness and Social skill.
According to research of Hay/McBer, there are six  unique different styles of Leadership qualities.

  1. 1.       Coercive leaders demand immediate compliance.
  2. 2.       Authoritative leaders mobilize people toward a vision.
  3. 3.       Affiliative leaders create emotional bonds and harmony.
  4. 4.       Democratic leaders build consensus through participation.
  5. 5.       Pacesetting leaders expect excellence and self-direction.
  6. 6.       Coaching leaders develop people for the future.



The research also states that, any leader mostly would have performed most of the mentioned qualities.

Here in where   need of “Situational Leadership (SL)” arise. A Leader need not be educated in premier institute or to be in top level of organization hierarchy. At every level of the organization we need Leaders, who have following qualities
  • ·         Prefer actions or approaches depend on the variables of the situation
  • ·         Consider past experiences and options before choosing the course of action
  • ·         Be flexible
  • ·         Ready to roll up sleeves and get hands dirty.
  • ·         Think out of way to achieve results, irrespective of what history has predicted with sense of accuracy about performance.


Suggested readings on SL:

July 6, 2014

Windows 2012 installation issue in VM player

When you tried to create a new VM using VM player 6.0.2 with Windows 2012 as the guest OS, you may get error while guest OS installation.
The error will tell "Microsfoft Terms not able find..." and installation can not continue.

Follow below steps:
1. When you create VM by clicking on "New VM" option in player., Uncheck the install OS from drive or USB option and select install OS later option.
2. After VM is created with specified Hardware configuration, configure CD/DVD drive to your OS media and start the installation.
3. You can see, OS gets installed with out any problem. It is a know bug in VM Player

Sharepoint 2013 Installation

Have been eager to work with Sharepoint since MOSS 2007. But just last week got a chance to start working..

I personally have heard lot of ghost stories about Sharepoint installations ever since 2007.. So I wanted to try it out my self. 

I tried installing and configuring it in two server platforms.. One with Windows 2008 R2 Standard edition and another in Windows 2012 Standard edition / Data Center Edition (As a VM in VM Player running in Windows 8.1)

Before I begin, a small note...
It is not possible to install Sharepoint 2013 in Windows 2012 R2, as MS is supposed to release SP1 / update 1 to Sharepoint 2013 which will enable it to install it in Windows 2012 R2 ( as of now). Please refer to MS article.. (In my case I had Core i3 II Gen, 8 gB RAM, 500 GB HDD @ 7200 RPM as host and allocated 100 GB HDD and 5 GB RAM to Guest in VM)

Once OS (either Windows 2008 R2 or Windows 2012) is installed. Please proceed as per following steps to install Sharepoint 2013 / Sharepoint Foundation 2013.

Note: You can't install Sharepoint 2013 / Sharepoint foundation 2013 in client operating systems. You will need server edition.

Part 1
  1. Install .NET 3.5 SP1 and .NET Framework 4.0.
  2. Configure Application Server Role and Web server role in the Windows.
    • Launch Server Manager
    • Click on “Add roles and features”.
    • On the “Before you begin” page, click “Next”.
    • Select “Role based or feature based installation” and click “Next”.
    • If it isn’t already selected, select “Select a server from the server pool”, and the server that you are currently working on. Then click “Next”.
    • On the “Select server roles” page, check “Application Server”, “Web Server (IIS)”, and (EDIT:) “IIS 6 Management Console” (under Web Server (IIS)->Management Tools->IIS 6 Management Compatibility->IIS 6 Management Console.). NOTE: When you check “Web Server (IIS)” or “IIS 6 Management Console”, another dialog will pop up, asking “Add features that are required for ?” Click on the “Add Features” button here. This will return you to the “Select Server Roles” page. After adding all 3 roles, click “Next”.
    • On the “Select features” page, expand “.NET Framework 4.5 Features” group by clicking on it. In here, check “ASP.NET 4.5″.
    • On the same page, check “Windows Identity Foundation 3.5″. Click “Next”.
    • On the “Application Server” page, click “Next”.
    • On the “Select role services” page, check “Web Server (IIS) Support” and click “Next”.
    • When the “Add features that are required for Web Server (IIS) Support?” dialog pops up, click on “Add Features”.
    • Click “Next” again to go to the next page.
    • From the “Web Server Role” page, click “Next”.
    • From “Select role services”, click “Next”.
    • On the “Confirm installation selections” page, I suggest that you check “Restart the destination server automatically if required”. (You’re going to need to reboot eventually anyway.)
    • Click “Install”.
    • Wait for feature installation to complete. When it does, you can click “close”. If the server doesn’t restart automatically, reboot it.
    Part 2
    1. Install Windows Updates (at least recommended) and restart the server.
    2. Download all following Prerequisite and keep it in a folder
      1. Microsoft .NET Framework 4.5
      2. Windows Management Framework 3.0 (CTP2)
      3. Microsoft SQL Server 2008 r2 Native Client
      4. Windows Identity Foundation (KB974405)
      5. Microsoft Sync Framework Runtime v1.0 SP1 (x64)
      6. Windows Server AppFabric
      7. Windows Identity Extensions
      8. Microsoft Information Protection and Control Client
      9. Microsoft WCF Data Services 5.0
      10. CU Package 1 for Microsoft AppFabric 1.1 for Windows Server (KB2671763)
    3. You can install all of the above except item # 6 and #10 in the prerequisite list by clicking on same.
    4. Once you have installed, mount your Sharepoint 2013 image (.ISO)
    5. Once you have mounted it, you can see "prerequisiteinstaller.exe" in the root folder of Sharepoint 2013 mounted drive.
    6. Run "Powershell" console.
    7. Type following command to install and start product configuration in sharepoint 2013.
      1. your prompt(SharePoint image location)> Prerequisiteinstaller.exe /AppFabric:"\setup.exe" /KB2671763:"\AppFabric1.1-RTM-KB2671763-x64-ENU.exe"
          • You may get error some times in that case just prefix the command with "./"
          • ./Prerequisiteinstaller.exe /AppFabric:"\setup.exe" /KB2671763:"\AppFabric1.1-RTM-KB2671763-x64-ENU.exe"
                                    The above will complete the Sharepoint 2013 pre-requisite installation and Product installation can be invoked or Pre-requisite installer will launch the product wizard.

                                    When you invoke product configuration wizard (SandBox installation mode), the server will launch the process and in all probablity it will fail in step 5 with following image.



                                    Follow below steps to resolve and re-run the wizard.

                                    1) If you are running SharePoint Foundation, navigate in the Windows File Explorer to C:\Program Files\Windows SharePoint Services\15.0\Data.  If you are running SharePoint Server, navigate to C:\Program Files\Microsoft Office Servers\15.0\Data\Office Server.
                                    2) You’ll see a folder in this directory called “Analytics_”, for example, “Analytics_939ab742-745f-456c-8623-fddca9b02334″ (your GUID will be different, of course).
                                    3) Right click on the folder and select “Properties”.
                                    4) Click on the “Sharing” tab, and then click on “Advanced Sharing…”.
                                    5) Check the “Share this folder” checkbox.  Leave the default share name.
                                    6) Click on the “Permissions” button near the bottom.
                                    7) Click the “Add..” button.
                                    8) In the white textbox on the bottom, type   “NETWORK SERVICE; WSS_ADMIN_WPG”.  Then click the “Check Names” button to make sure that the users resolve.
                                    9) Click OK.
                                    10) Select each user that you just added (NETWORK SERVICE and WSS_ADMIN_WPG), and check the “Full Control” checkbox in the “Allow” column.
                                    11) Click “OK” to save the permissions.
                                    12) Click “OK” to save the share settings.
                                    13) Click “Close” to exit the dialog box.

                                    After this step you can, see that Sharepoint 2013 installation will be successful and you can proceed to launch "Central Administration" site to configure required services.


                                    January 17, 2014

                                    Enterprise Library 6 Changes - Exception Handling and Logging Application blocks configuration

                                    I was developing a framework services project for my new assignment .. (getting hands dirty after a while .. :) ).. Seems that there is a change in the way we configure our helper classes to log and handle  exception

                                    For Logging:

                                    common approach to create a log entry using the following code-

                                    LogEntry entry = new LogEntry();
                                    entry.Message = "I am logging";
                                    Logger.Write(entry);

                                     works fine with Enterprise Library 5.0. But in 6.0 it gives the error "The LogWriter has not been set for the Logger static class. Set it invoking the Logger.SetLogWriter method" 

                                    Following snippet will fix the issue

                                    IConfigurationSource configurationSource = ConfigurationSourceFactory.Create();
                                    LogWriterFactory logWriterFactory = new LogWriterFactory(configurationSource);
                                    Logger.SetLogWriter(logWriterFactory.Create());
                                    LogEntry entry = new LogEntry();
                                    entry.Message = "I am logging";
                                    Logger.Write(entry)


                                    For Exception Handling

                                     public static bool HandleException(Exception exceptionToHandle)
                                            {
                                                IConfigurationSource config = ConfigurationSourceFactory.Create();
                                                ExceptionPolicyFactory factory = new ExceptionPolicyFactory(config);
                                                ExceptionPolicy.SetExceptionManager(factory.CreateManager());
                                                return ExceptionPolicy.HandleException(exceptionToHandle, 
                                                    "Policy");            
                                            }

                                    Don't forget to add reference to "System.Configuration" assembly to your project, else you will get error and add it in the "using" list.

                                    June 8, 2011

                                    Some useful SQL Queries on Date functions

                                    TO Calculate first day of month
                                    select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)

                                    First Day of Year
                                    select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)

                                    First Day of the Quarter
                                    select DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)

                                    Last day of Prior month
                                    select dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate() ), 0))

                                    Last Day of Prior Year
                                    select dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate() ), 0))

                                    Last day of current month
                                    select dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1, 0))

                                    Last Day of Current Year
                                    select dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate() )+1, 0))

                                    January 10, 2011

                                    Web Application Performance Best Practices

                                    Some of the thumb rules to flare better perfomance in web applications

                                    §Appropriate usage of Caching
                                    §Minimize HTTP Requests
                                    §Minification
                                    §Removed unwanted HTML / JS / CSS
                                    §Remove White Spaces
                                    §Place CSS at Top of the page
                                    §Move JS reference to the bottom of the page
                                    §Reduce Image Size
                                    §Cache Static content (Images / CSS / JS)
                                    §Enable HTTP Compression
                                    §Remove Duplicate Scripts

                                    •Use a Content Delivery Network
                                    •Add an Expires or a Cache-Control Header
                                    •Avoid CSS Expressions
                                    •Make JavaScript and CSS External
                                    •Remove Duplicate Scripts
                                    •Don’t scale images in HTML
                                    •Flush the Buffer Early
                                    •Reduce the Number of DOM Elements
                                    •Minimize the Number of iframes
                                    •No 404s
                                    •Minimize DOM Access
                                    •Optimize CSS Sprites
                                    •Keep Components under 25K

                                    Analysis Services 101

                                    Here is intro course to BI Analytics...

                                    1. Facts(Measures) is a summable numeric value
                                    2. Only events tracking in Fact table known as fasctless fact tables, in that case add column with value 1 to track them.
                                    3. Grain is the lowest possible level of information in fact, make it as lowest as possible. Atomic level.
                                    4. Facts are verb in Business process where as Dimesnions are nouns.
                                    5. Dimension shared across more than 1 business process is known as Conformed Dimension
                                    6. Surrogate keys (Meaningless , non-natural, artificial, ) is int value associayrf with each rown in dimesnion
                                    7. Dimensions with Changeable attribute is called Slowly Changing Dimesnions (SCDs)
                                    Type 1 SCDs overwrite old value
                                    Type 2 SCDs have new row for every new change
                                    Type 3 SCDs provide option of columns (not commonly followed and not scalable)
                                    8. Data Dimension classic example for role Playing Dimension... better to have surrogate keys in year-month0date format since 20050221(would help for partitioning)
                                    9.Dimension that doesn't have attributes are known as Degenerated Dimensions (e.g TransactionID)
                                    10.Discourage Snowflake schema, Analysis 2000 has little inclination towards it but not 2005
                                    11. Bridge table required when we have many-many dimensions, called Intermediate Fact Tables in Analysis Services 2005
                                    12. Fact Table types, Periodic Snapshot, transaction and accumulating snapshot

                                    DB Normalization in simple

                                    This is one of the most frequently used question..lot times we know the thing have difficulty in expressing it...thot would write a simple post for it...

                                    First Normal Form (1NF)
                                    • Eliminate duplicative columns from the same table.
                                    • Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).

                                    Second Normal Form (2NF)

                                    • Meet all the requirements of the first normal form.
                                    • Remove subsets of data that apply to multiple rows of a table and place them in separate tables. Create relationships between these new tables and their predecessors through the use of foreign keys.

                                    Third Normal Form (3NF)

                                    • Meet all the requirements of the second normal form.
                                    • Remove columns that are not dependent upon the primary key.

                                    Fourth Normal Form (4NF)

                                    • Meet all the requirements of the third normal form.
                                    • A relation is in 4NF if it has no multi-valued dependencies.

                                    Review your Architecture

                                    Last week I bumped in to a book "Enterprise Application Arch 2ed". I read abot reviewing S/W arch by some proven methodlogies..thot would blog for starters.. good read...

                                    Scenario-based evaluations are a powerful method for reviewing an architecture design. In a scenario-based evaluation, the focus is on the scenarios that are most important from the business perspective, and which have the greatest impact on the architecture. Consider using one of the following common review methodologies:

                                    Software Architecture Analysis Method (SAAM). SAAM was originally designed for assessing modifiability, but later was extended for reviewing architecture with respect to quality attributes such as modifiability, portability, extensibility, integratability, and functional coverage.

                                    Architecture Tradeoff Analysis Method (ATAM). ATAM is a refined and improved version of SAAM that helps you review architectural decisions with respect to the quality attributes requirements, and how well they satisfy particular quality goals.

                                    Active Design Review (ADR). ADR is best suited for incomplete or in-progress architectures. The main difference is that the review is more focused on a set of issues or individual sections of the architecture at a time, rather than performing a general review.

                                    Active Reviews of Intermediate Designs (ARID). ARID combines the ADR aspect of reviewing in-progress architecture with a focus on a set of issues, and the ATAM and SAAM approach of scenario-based review focused on quality attributes.

                                    Cost Benefit Analysis Method (CBAM). This CBAM focuses on analyzing the costs, benefits, and schedule implications of architectural decisions.

                                    Architecture Level Modifiability Analysis (ALMA). ALMA evaluates the modifiability of architecture for business information systems (BIS).

                                    Family Architecture Assessment Method (FAAM). FAAM evaluates information system family architectures for interoperability and extensibility.

                                    Refer this URL
                                    http://enggtech.wordpress.com/2010/05/13/software-architecture-qaw-add-atam-cbam-arid-and-sdlc/

                                    February 20, 2010

                                    Iterating over JSON object (string ) with jquery

                                    We had a scenario where in we need to search for particular object in collection. Whenever the user changes something in dropdown in ASP.NET we need to show some value in a label. If we take the drop down value to server it would take time.... so what we thot is we searialized the object using JavascriptSerializer in ASP.NET and converted to JSON string.. passsed to a javascript function to search.... (whenever dropdown changes)... I was literally amazed with the power of JSON and jquery combination... thot i would share with people in need.....

                                    Here is the JSON string...in Javascript...

                                    var obj = [{"Description":"No jquery pricing group may be used for Testing", "ID":1, "TempID":1, "CompareID":3}, {"Description":"No jquery pricing group may be used for Testing", "ID":2, "TempID":2, "CompareID":3}, {"Description":"No jquery pricing group may be used for Testing", "ID":3, "TempID":3, "CompareID":3}, {"Description":"No jquery pricing group may be used for Testing", "ID":4, "TempID":4, "CompareID":3}, {"Description":"No jquery pricing group may be used for Testing", "ID":5, "TempID":1, "CompareID":4}, {"Description":"Jquery required for pricing Testing", "ID":6, "TempID":2, "CompareID":4}, {"Description":"Jquery required for pricing Testing", "ID":7, "TempID":3, "CompareID":4}, {"Description":"Jquery required for pricing Testing", "ID":8, "TempID":4, "CompareID":4}, {"Description":"No jquery pricing group may be used for Testing", "ID":9, "TempID":1, "CompareID":5}, {"Description":"Jquery required for pricing Testing", "ID":10, "TempID":2, "CompareID":5}, {"Description":"Jquery required for pricing Testing", "ID":11, "TempID":3, "CompareID":5}, {"Description":"Jquery required for pricing Testing", "ID":12, "TempID":4, "CompareID":5}];

                                    We had a requirement to searhch the description for matching TempID and COmpareID...

                                    Our Javascript function was amazingly...

                                    function Myfunc(ID1,Exp1){jQuery.each(obj, function Test(x) { if (obj[x].TempID == ID1 && obj[x].CompareID == Exp1) //return obj[x].Description; alert(obj[x].Description);}); }

                                    This would have helped you to understand the power of jqeury

                                    January 16, 2010

                                    ASP.NET Dynamic User controls

                                    Today after long time...I moved to an assignment to work in ASP.NET after the gap of almost nealry 5 years. I started working on an Intranet Portal for a financial institution.

                                    We wanted to generate certain UIs dynamically, we chose different user controls will be loaded based on the user requirement. One thing I learned today is "Dynamic Controls Should be Loaded on Each PostBack" On every postback literally you need to load the controls again and again. If you want the control to have its Viewstate data preserved, adding the USercontrols to page (Parent) should happen before LoadViewstate event gets fired in the page life cycle.

                                    Normally the user controls will be added as Controls.Add(UsercontrolPath), where ocntrols is Place holder in the page/another user control.

                                    I will write more about this assignement that looks very interesting.

                                    January 5, 2009

                                    Meta Data Queries in SQL Server 2000

                                    -- Query to Find All User Tables

                                    SELECT * FROM SYSOBJECTS SOWHERE SO.XTYPE = 'U' ORDER BY SO.NAME

                                    -- Query to Find All User Views

                                    SELECT SO.NAME FROM SYSOBJECTS SOWHERE SO.XTYPE = 'V' ORDER BY SO.NAME

                                    --Query to Find all Procedures in the DB

                                    SELECT SO.NAME FROM SYSOBJECTS SOWHERE SO.XTYPE = 'P' ORDER BY SO.NAME

                                    --Query to Find all Triggers in the DB

                                    SELECT SO.NAME FROM SYSOBJECTS SOWHERE SO.XTYPE = 'TR' ORDER BY SO.NAME

                                    --Query to Find all User Defined Table Functions in the DB

                                    SELECT SO.NAME FROM SYSOBJECTS SOWHERE SO.XTYPE = 'TF' ORDER BY SO.NAME

                                    --Query to Find all User Defined Inline Functions in the DB

                                    SELECT SO.NAME FROM SYSOBJECTS SOWHERE SO.XTYPE = 'IF' ORDER BY SO.NAME

                                    --Query to Find all User Defined Scalar Functions in the DB

                                    SELECT SO.NAME FROM SYSOBJECTS SOWHERE SO.XTYPE = 'FN' ORDER BY SO.NAME

                                    Note.
                                    X.Type define the object type, the possible values are
                                    C = CHECK constraint
                                    D = Default or DEFAULT constraint
                                    F = FOREIGN KEY constraint
                                    L = Log
                                    FN = Scalar function
                                    IF = Inlined table-function
                                    P = Stored procedure
                                    PK = PRIMARY KEY constraint (type is K)
                                    RF = Replication filter stored procedure
                                    S = System table
                                    TF = Table function
                                    TR = Trigger
                                    U = User table
                                    UQ = UNIQUE constraint (type is K)
                                    V = View
                                    X = Extended stored procedure

                                    December 2, 2008

                                    SSIS - Script Component - Variables Access Error

                                    I was developing an SSIS package and I encountered the following problem.
                                    I had a OLE DB source that is providing me data from a SQL table in my data flow task. I had a script component following it. I am trying to concanctenate my one of the string column to a variable and trying to use it in other task.
                                    So I had my code like this in my inputprocessrow method.
                                    --------------------------------------------------------------------------------------
                                    While Row.NextRow
                                    myval = myval + " , " + Row.customer
                                    End While
                                    ----------------------------------------------------------------------------------------
                                    And i was trying to set the local variable value to my Pacakge variable collection and I encountered following error.
                                    "The collection of variables locked for read and write access is not available outside of Post Execute", which drove me mad.

                                    After googling for some time got this info.

                                    You need to have a PostExecute method and try assigning it there.

                                    -------------------------------------------------------------------------------------
                                    Public Overrides Sub PostExecute()
                                    Variables.Customers = myval
                                    MsgBox("Variable Values is " + Variables.Customers)
                                    MyBase.PostExecute()
                                    End Sub
                                    -------------------------------------------------------------------------

                                    July 10, 2008

                                    SQL Injection Tip

                                    Hope everyone is aware of SQL Injection attacks. For people who are new, it is something about intruding in to your SQL Server (DB) by passing some commands through a request.

                                    If the following (0x73656C656374206E616D652066726F6D207379732E6461746162617365733B) value is passed to the SQL Query, it will list all the DBs on the server. Something interesting. So whenever you get a request, check for it.

                                    June 17, 2008

                                    Service Broker - An Alternate to Messaging MS SQL Server

                                    1. Enable Service Broker in the DB.
                                    Use Master;
                                    Go
                                    ALTER DATABASE AdventureWorks SET ENABLE_BROKER;
                                    go

                                    2. Create Endpoint to send / receive messages from outside of SQL Server Instance.
                                    - Create Endpoint with Port number and authentication level
                                    Use Master;
                                    go
                                    CREATE ENDPOINT ExampleEndPoint
                                    STATE = STARTED
                                    AS TCP ( LISTENER_PORT = 3133)
                                    FOR SERVICE_BROKER (AUTHENTICATION = WINDOWS KERBEROS);
                                    go

                                    Once Service Broker in STARTED state it will send /receive Messages. To stop either deacticate / pause

                                    Use Master;
                                    Go
                                    ALTER ENDPOINT ExampleEndPoint
                                    STATE = STOPPEDl
                                    Go

                                    To start again
                                    Use Master;
                                    Go
                                    ALTER ENDPOINT ExampleEndPoint
                                    STATE = STARTED
                                    Go

                                    3. TO Forward Message from One instance to another you need to have service endpoint started and follow the below syntax to Enable /disable forwarding. The Size mentioned is in MB

                                    Use Master;
                                    go
                                    ALTER ENDPOINT ExampleEndPoint
                                    FOR SERVICE_BROKER (MESSAGE_FORWARDING = ENABLED, MESSAGE_FORWARD_SIZE = 15);
                                    go

                                    Use Master;
                                    go
                                    ALTER ENDPOINT ExampleEndPoint
                                    FOR SERVICE_BROKER (MESSAGE_FORWARDING = DISABLED);
                                    go

                                    4.Message Transport
                                    BABP (Binary Adjacent Broker Protocol) and Dialog Protocol.
                                    BABP - Basic message Transport, Bi-directional and multiplexed. Role to send messages.
                                    Dialog - handles end to end communication and message ordering as a one-time-only in order delivery system. authenitcation and encryption is responsibility.

                                    Steps to Create SErvice Borker:

                                    1. Define Message Type and Validation
                                    2. Define Contract
                                    3. Create 2 queues sender and receiver
                                    4. Create service and bind them to queue
                                    5. Begin the conversation by sending messages.

                                    April 29, 2008

                                    Interesting SQL Queries

                                    • Query to find Procedures that contains a particular string in MS SQL 2005
                                    select O.name from sysComments C join sysObjects O on O.id = C.id where O.xtype = 'P' and C.text like '%string%'

                                    • Query to find all the user-defined tables in a specified database
                                    USE db;
                                    GO
                                    SELECT *
                                    FROM sys.tables;
                                    GO
                                    • Query to find find all the tables and indexes that are partitioned
                                    USE db;
                                    GO
                                    SELECT SCHEMA_NAME(o.schema_id) AS schema_name,OBJECT_NAME(p.object_id) AS table_name,i.name AS index_name,p.partition_number,rows
                                    FROM sys.partitions AS p
                                    INNER JOIN sys.indexes AS i ON p.object_id = i.object_id AND p.index_id = i.index_id
                                    INNER JOIN sys.partition_schemes ps ON i.data_space_id=ps.data_space_id
                                    INNER JOIN sys.objects AS o ON o.object_id = i.object_id
                                    ORDER BY index_name, partition_number;
                                    GO


                                    • Query to find all the statistics on a specified object
                                    USE db ;
                                    GO
                                    SELECT name AS statistics_name, stats_id,auto_created,user_created,no_recompute
                                    FROM sys.stats
                                    WHERE object_id = OBJECT_ID('');
                                    GO


                                    • Query to find all the statistics and statistics columns on a specified object
                                    USE db;
                                    GO
                                    SELECT s.name AS statistics_name, c.name AS column_name, sc.stats_column_id
                                    FROM sys.stats AS s
                                    INNER JOIN sys.stats_columns AS sc
                                    ON s.object_id = sc.object_id AND s.stats_id = sc.stats_id
                                    INNER JOIN sys.columns AS c
                                    ON sc.object_id = c.object_id AND c.column_id = sc.column_id
                                    WHERE s.object_id = OBJECT_ID('');
                                    GO

                                    January 20, 2008

                                    Reporting Services 2005 Problems

                                    I was creating some SSRS reports (both in Server and local mode) as part of my project work and i need to admit that i had some tough times for some of the issues.


                                    • First of all I had issues in installing SSRS 2005 in my Windows Vista Premium OS and after googling it for some time, I came across a fact that IT IS NOT POSSIBLE TO INSTALL SSRS IN WINDOWS VISTA HOME PREMIUM edition. Refer following URL to install in other versions of vista.
                                      http://msdn2.microsoft.com/en-us/library/bb630430.aspx
                                    • I had some class object that would be created and needed to populate in reports. For example, I had Employee object that had his project details, which is collection of Project object. To display project details in the report, I should create subreport to display Project details and would embed that in main Employee Report.
                                    • When there is nested hierarchy of objects that needs to be displayed in Report, then there is syntax to be followed to do so. Let's take a scenario of Employee has Address object, Address object has City object that has name attribute. To display CityName in the Report, we need to follow syntax like "=Fields!Employee.Value.Address.City.Name". I lost some time in learning it.
                                    • Another is to display the particular field in the Report Header that would repeat in all pages. For example, there is Employee object that has Employee Id that needs to be printed in all the pages of Employee Report. It is not possible to refer the field in the Header directly. There are some roundabouts to do that. The way I chose is to Create a report parameter and set the value at run time to have it populated.
                                    • Very good resource for SSRS Tips.
                                      http://msdn2.microsoft.com/en-us/library/bb395166.aspx