Wednesday, July 23, 2014

How can i find all matching values from other dataset based on current dataset field ? (SSRS 2008 R2)

You can find all matching values of another dataset by using LookupSet() function.

Syntax:
LookupSet(source_expression, destination_expression, result_expression, dataset)



How can i find a value from other dataset based on current dataset field ? (SSRS 2008 R2)

You can find a value of another dataset by using Lookup() function.

Syntax:
Lookup(source_expression, destination_expression, result_expression, dataset)



How can i show created by user in the report? or current logged in user in SSRS?

You can get current logged in user in SSRS by User!UserID property. This property gives you the user name of the person who is running the report.

How to check the time it takes to run a report in SSRS? SQL Server 2012

You can check that from executionLog3 table, if you do not have a dependency on an older view, for example ExecutionLog.

You can use Execution Log to find out how many milliseconds of processing time has spent on each processing phase.


Use ReportServer
select * from ExecutionLog3



Tuesday, July 22, 2014

How to apply style to all disabled buttons throughout the application? Asp.Net, CSS

To apply style to disabled button in Asp.net like this:

  .button:disabled
  { 
    color:gray;
    CURSOR: default;
  }


To apply style to button only in Asp.net like this:

  .button
  { 
    CURSOR:pointer; 
  }


Monday, July 21, 2014

What is, Why we need, How to implement IQueryable<T>? C#.Net

IQueryable provides ability to query against specific data.

Why we need? Let’s take a scenario. Assume that you have created one class which is returning all the customers and you want to give ability to query on those customers to the developers. As a Technical Leader, in BLL layer, you have created one repository class and given to the team. But you are not aware that on which page what type of filters they need. So the best solution is to give some power to developer, so that they can also query on that data.

Here is the simple example/implementation of IQueryable<T>. You can copy and paste in your visual studio to understand more.

        protected void Page_Load(object sender, EventArgs e)
        {

            using(CustomerRepository cr = new CustomerRepository())
            {

                IQueryable<Customer> fCust = cr.getCustomers()
                    .Where(c => c.City_Id > 2);

                foreach (var item in fCust)
                {
                    Response.Write(string.Format(
                        "<br>Customer {0}'s cityId is {1}",
                        item.Name, item.City_Id));
                }

            }
             
        }

        public class CustomerRepository : IDisposable
        {
            IQueryable<Customer> iCust;
            MyTestEntities db;

            public CustomerRepository()
            {
                db = new MyTestEntities();
            }

            public IQueryable<Customer> getCustomers()
            {
                iCust = (from Customer c in db.Customers 
                            select c);

                return iCust;
            }

            public void Dispose()
            {
                db.Dispose(); 
            }
        }


Friday, July 18, 2014

Thursday, July 17, 2014

What is HTML5?

HTML5 is the latest standard for HTML.

It has designed to deliver rich content without the need for additional plugins.  It supports everything from animation to graphics, music to movies, and can also be used to build complicated web applications.

HTML5 is compatible with a PC, or a Tablet, a Smartphone, or a Smart TV.

Wednesday, July 16, 2014

You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server. IIS, Asp.Net

I got following error :

HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

I have tried different solutions such as changing permission on folder, and than changing permission on IIS website to everyone etc...

But nothing works, Finally I have changed in "IIS->Authentication->Edit Anonymous Authentication to Application pool Identity instead of specific user". It worked perfectly.

IIS Screen shot is below for reference purpose:


How can I set the SRC attribute to an IFRAME with JQuery?

You can set the SRC attribute of the iFrame using JQuery like following:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<script>

     $(document).ready(function(){

          $("#btn").click(function () {
          
             $("#iframe").attr("src", "Home.aspx");
             return false;

          });

      });

</script>



Tuesday, July 15, 2014

Use "Dictionary" instead of "Hashtable" – Performance Tips for Asp.Net

Tip 6. Use Dictionary instead of Hashtable

Hashtable has less performance than Dictionary because of Boxing and Unboxing. Dictionary is strongly typed key/value pair – Dictionary(Of TKey, TValue). Comparing both as following:

        Dim objDictionary As New Dictionary(Of String, String)
        Dim objHashtable As New Hashtable

        Dim sw As New Stopwatch
        sw.Start()

        For index = 1 To 1000000 Step 1
            Dim str As String = index.ToString & "i"
            objDictionary.Add(str, "Mitesh")
        Next

        Response.Write("<br>Dictionary Add time: " _
                       & sw.ElapsedMilliseconds.ToString())
        sw.Stop()
        sw = Nothing


        sw = New Stopwatch
        sw.Start()

        For index = 1 To 1000000 Step 1
            Dim str As String = index.ToString & "i"
            objHashtable.Add(str, "Mitesh")
        Next

        Response.Write("<br>Hashtable Add time: " _
                       & sw.ElapsedMilliseconds.ToString())
        sw.Stop()
        sw = Nothing


        sw = New Stopwatch
        sw.Start()

        For Each s As String In objDictionary.Keys

        Next

        Response.Write("<br>Dictionary Loop time: " _
                       & sw.ElapsedMilliseconds.ToString())
        sw.Stop()
        sw = Nothing


        sw = New Stopwatch
        sw.Start()

        For Each s As String In objHashtable.Keys

        Next

        Response.Write("<br>Hashtable Loop time: " _
                       & sw.ElapsedMilliseconds.ToString())
        sw.Stop()
        sw = Nothing


Result will be :

Dictionary Add time: 278 ms
Hashtable Add time: 536 ms
Dictionary Loop time: 8 ms
Hashtable Loop time: 49 ms



There are other dictionary collections available like:

ConcurrentDictionary(Of TKey, TValue)
SortedDictionary(Of TKey, TValue)
ReadOnlyDictionary(Of TKey, TValue)
HybridDictionary
ListDictionary
OrderedDictionary
StringDictionary


React-select is very slow on larger list - Found solution - using react-window

 I had more than 4000 items in searchable dropdownlist. I have used react-select but it was very slow. finally I found complete solution to ...