Showing posts with label Difference Between Concepts. Show all posts
Showing posts with label Difference Between Concepts. Show all posts

Wednesday 7 December 2016

Difference Between Where and Having Clause



The WHERE clause does not work with aggregates like SUM,Count etc.

The SQL above will not work, because the where clause doesn’t work with aggregates – like sum, avg, max, etc.. Instead, what we will need to use is the having clause. The having clause was added to sql just so we could compare aggregates to other values – just how the ‘where’ clause can be used with non-aggregates. Now, the correct sql will look like this:

Many time i have seen code where Having and where clause are misused see Examples Below -

BAD SQL:
select employee, sum(bonus) from emp_bonus
group by employee where sum(bonus) > 1000;

GOOD SQL:
select employee, sum(bonus) from emp_bonus
group by employee having sum(bonus) > 1000;


Difference between having and where clause

So we can see that the difference between the having and where clause in sql is that the where clause can not be used with aggregates, but the having clause can. One way to think of it is that the having clause is an additional filter to the where clause.

Sql Standard Theory says WHERE Clause restricts the result set before returning rows and HAVING restricts the result set after retrieving all records.That's why WHERE is faster as compared to Having and that's why having is not used more commonly or always as that of Having so it should used in circumstances where it is necessary to use having and nothing else is possible like as in case we are using aggregate functions


Tuesday 6 December 2016

Difference Between System.Web and System.WebServer



System.web is the settings section for IIS6 and the built in cassini server (the test server in Visual Studio 2010 and before where you are targeting asp.net 3.5 or lower)

The system.webserver is a child of the configuration section that means in web.config file <system.webserver> tag is placed under
<configuration> Tag.

System.WebServer Tag is contained in web.config file in root directory of website. This file contains configuration that needs to be implemented on IIS for Current project. Configuration coded in <system.webserver> Tag are implemented on IIS and are only applied to Project or Webapplication to which corresponding web.config Belongs. This Tag Can Exist is one of below formats in your project's web.config file in root directory of Web Application.

Empty <system.webserver> Tag Under <configuration> Tag -

<configuration>
  <system.webServer>
  </system.webServer>
</configuration>

The system.web section is used in web.config file of Asp.net WebApplications for defining Server Configuration that are applicable for IIS 6, while the system.webserver version is used to configure IIS 7.0. IIS 7.0 includes a new ASP.NET pipeline and some configuration differences. you can check complete details on link below -

https://msdn.microsoft.com/en-us/library/bb763179.aspx


System.webserver is the Server Configuration section for IIS 7 and above, and the build in IIS Express server which is used in Visual Studio 2010 targeting asp.net 4 and any newer versions that are released in the future.

Sample of Web.config file Contains Both <system.web> and <system.webserver>

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="username" value="admin-heemanshu@564496"/>
<add key="password" value="@htennty50!334#"/>
</appSettings>

<connectionStrings/>

<system.web>
<!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions
            where data loss can occur.
            Set explicit="true" to force declaration of all variables.
        -->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>

<!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
               -->

<authentication mode="Windows"/>

<!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.-->
<customErrors mode="Off" defaultRedirect="GenericErrorPage.htm">
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
</system.web>
 
      <system.webServer>
       <rewrite>
        <rules>
          <rule name="Redirect" patternSyntax="ECMAScript" stopProcessing="true">
            <match url=".*" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^xyz.com$" />
            </conditions>
            <action type="Redirect" url="http://www.xyz.com/{R:0}" />
         </rule>
       </rules>
     </rewrite>
    </system.webServer>

</configuration>



Saturday 13 August 2016

Difference Between http get and jsonp


An HTTP GET request is what you get when you enter a URI in your browser or when you click on a link on a web page. Certain HTML elements, like also generate GET requests. GET requests a resource from the server. You can pass additional information to a server-side script by adding 'query parameters' after the script, such as Example Domain.
Say you're on domain www.example.com, and you want to make a request to domainwww.example.net. To do so, you need to cross domain boundaries, a no-no in most of browserland.
Enter JSONP. When you make your request to a server that is JSONP enabled, you pass a special parameter that tells the server a little bit about your page. That way, the server is able to nicely wrap up its response in a way that your page can handle.
For example, say the server expects a parameter called "callback" to enable its JSONP capabilities. Then your request would look like:
  1. http://www.example.net/sample.aspx?callback=mycallback
Without JSONP, this might return some basic JavaScript object, like so:
  1. { foo: 'bar' }
However, with JSONP, when the server receives the "callback" parameter, it wraps up the result a little differently, returning something like this:
  1. mycallback({ foo: 'bar' });
As you can see, it will now invoke the method you specified. So, in your page, you define the callback function:
  1. mycallback = function(data){ alert(data.foo); };
Major issue with JSONP
you lose a lot of control of the request that creates doubts in maintaining security

Thursday 11 August 2016

Angularjs Vs Jquery


Answer Angularjs Vs Jquery On Quora 
Angularjs Vs Jquery

jQuery will be used for things like higher level APIs, updating DOM elements, adding classes and wrapping XHR calls up nicely. Angular 1.x actually uses jQuery lite (jQLite) inside itself, or can use the full jQuery library if it's present before Angular at runtime. Using jQuery with Angular will unleash more power to Angular core as it knows you're using it, so it binds onto jQuery and passes you the full jQuery API instead of it's built-in jQLite.Remember that Angular is a data-binding MVVM framework, of which jQuery is not.

See The Major Benefits in Angular JS as Compared To Jquery

Below is Table List of Difference between jquery and Angularjs . See the Point search what that point means then analyze do you need the power or usage of that point in the project . On the basis of that Analyze Which one of them you need in your project

Difference between on and bind in jQuery


The .bind() method registers the event and event handler directly to the DOM element.This method is still very handy when wiring-up event handlers, but there are various performance concerns as are listed below.
Internally .bind() maps to .on() as per current version of Jquery .bind may be removed from future versions at any time. There is no reason to keep using .bind and every reason to prefer .on instead.
The .bind() method will attach the event handler to all of the anchors that are matched! That is not good. Not only is that expensive to implicitly iterate over all of those items to attach an event handler, but it is also wasteful since it is the same event handler over and over again.

Problems
  1. The method attaches the same event handler to every matched element in the selection.
  2. It doesn’t work for elements added dynamically that matches the same selector.
  3. There are performance concerns when dealing with a large selection.
  4. The attachment is done upfront which can have performance issues on page load.
The on() method as being “overloaded” with different signatures, which in turn changes how the event binding is wired-up. The .on method bring a lot of consistency to the API and hopefully makes things slightly less confusing.

Cons 1. Brings confusion because the behavior changes based on how you call the method.

Friday 15 July 2016

Grunt vs Gulp


  • Gulp and Grunt are both Automated Task Runner . Major Difference Between Gulp and Grunt Lies in How They Deal With Automation of Tasks Internally .

    Gulp Uses Node Streams For running different tasks and Grunt use temp files for the same work .
  • Grunt runns tasks using Temporary files which are disk I/O operations. Your SASS file is compiled and then written to a temporary file. The temporary file is used by the autoprefixer and then the final product is written to the destination file.

    Working of Grunt

    Gulp runs task all in main memory. Your SASS file is compiled in main memory, then the result is passed to the autoprefixer without being written to a file and the destination file is then written out.

    Working of Gulp
  • In-memory operations are faster as compared to disk writes which means that Gulp has a big speed advantage.
  • Speed Comparison Of Gulp Vs Grunt Can be Found Here - http://tech.tmw.co.uk/2014/01/speedtesting-gulp-and-grunt/
  • Speed Difference



    Source : http://tech.tmw.co.uk/2014/01/speedtesting-gulp-and-grunt/