Thursday 11 October 2018

What is the Magic Table in Sql server ?

What is the Magic Table in Sql server ?

Ans :- Magic table are the temporary object created by server internally to hold recently  inserted value in case of inserted or hold the deleted value in case of deleted or to hold the updated value in case of updated.


Let suppose if we want to create trigger on the table on insert or delete. so on insertion of a record into that table the inserted table will be created automatically by the sql server database, on deletion of record from the table the deleted table will be created automatically by the database

so these 2 table inserted and deleted are called magic table.

these table are not a physical table these are only internal table.




Tuesday 9 October 2018

Most commonly asked interview question on ,net and angular 2

Comman interview question for .net and angular 2



Hi friends here i am providing the list of the some question that are commonly asked for every .net and angular 2 developer for the 2-3 years of experience

1. FirstorDefault in Linq
2. Difference between design principle and design patterns
3. Viewchild in angular 2
4. Difference between promise and subscribe & observables
5. How to change layout page dynamically in view
Q1 . Difference between common.js and system.js in ES2015
Q2 . How can we replace the http service with custom service.
Q3 . Optional parameters in javascript
Q4 . Function overloading in typescript.
Q5 . Difference between observables and promise.
Q6 . Enable experimental metadata support in angular
Q7 . Generics in typescript.
Q8 . Oninit and OnDestroy.
Q9 . @Injectable in angular
Q10 . Default access specifier in typescript.
Q11 . Routing guard in angular.
Q12 . Pipe and async pipes in angular.
Q13 . Declaration files in typescript.
Q14 . Inheritance in typescript.
Q15 . Interface in typescript.
Q16 . How can we expose input & output properties for a component so that they consumed by other components
Q17 . RXJS map,switchingmap,mergemap,from,of,zip,empty,throw.
Q18 . Uniontype & tuple in javascript
Q19 . Interceptor.
Q20 . Routing resolver.
Q21 . Custom pipes
Q22 . optional and default parametres in javascript?
Q23 what is canActive and resolver in angular?
Q24 Benefit of using Angular route Resolver?
Q25 What is auth Guard ?
Q26 Why the company required MVC pattern with angular?
Q27 what is async pipe in angular?
Q28 what is template string?  -- template string is used which lets define the multiline string
     Eg:
    @Component({
  selector: 'joke',
  template: `
  <h1>What did the cheese say when it looked in the mirror?</h1>
 <p>Halloumi (hello me)</p>
  `
})


c#
Q29 How to make generic class that should have parameter less constructor?


Q30 What is the Extension method in C#?
Q31 How to invoke directives in angular?
Q32 What is service and factory in angular?
Q33 What is var keyword in c#?

Q34 What is the difference between string and StringBuilder?
Q35 what is the use of observable and the promise and why we use observable instead we have promise
Q36. why function is there is sql if we have stored procedure in that?

Friday 5 October 2018

Can't bind to 'formGroup' since it isn't a known property of 'form'.

Can't bind to 'formGroup' since it isn't a known property of 'form'. 


this error is because both
formGroup and formControl  directive are belongs to reactive forms module and you have not import this ReactiveFormModule in your's Angular application so this type of error occurred.


Import this module in your's app.module like this.



import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { CreateEmployeeComponent } from './employee/create-employee/create-employee.component';
import { ListEmployeeComponent } from './employee/list-employee/list-employee.component';
import { AppRoutingModule } from './/app-routing.module';

@NgModule({
declarations: [
AppComponent,
CreateEmployeeComponent,
ListEmployeeComponent
],
imports: [
BrowserModule,
AppRoutingModule,
ReactiveFormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Thursday 4 October 2018

router-outlet is not a known element

'router-outlet' is not a known element


If you getting this type of error in your's angular project when you configure your router module file.

then just check the routing module file and check the import and export array.

you must be declare the RouterModule in your's export array.

In my case app.routing module file 


@NgModule({
imports: [
RouterModule.forRoot(appRoutes),
],
exports: [
RouterModule
]

Wednesday 26 September 2018

How to find duplicate column values with number of occurance in table

Hi user
below i am showing how to get duplicate record from the table with number of the occurrence in that column


suppose that i have two table one is employee and other one have emp_details

employee table have the master data like employee id ,name and other info and emp_details table have secondary information like address and salary so now my question in this to find out the salary that have duplicate entry


so according to my table structure i have following data in employee table

Emp id
FirstName
Last Name
Emp code
Position
location
1
Neeraj
Upadhyay
GCS-1795
Software Developer
Noida
2
Akhilesh
Upadhyay
GCS-1796
Software Developer
Delhi
3
Ashish
Bhisht
GCS-1797
Software Developer
Sawai madhopur
1002
Akash
Srivastava
GCS-1798
Software Developer
Kota
1003
Dikhsa
Rawat
GCS-1799
Software Developer
Naguar
1004
Vaishali
Gupta
GCS-1800
Software Developer
Aligarh


now the data in emp_details table
Emp_id
Address
Salary
1
behind old laxman mandir bharatpur rajasthan
50000
2
WZ-85 Todapur New delhi
50000
3
kerapati mohalla bharatpur
40000
1002
A-154/A sector 63 noida
55000
1003
india habitat center lodhi road new delhi
35000


So now we find the duplicate salary in both the table
so we execute following code


select salary,count(*) as duplicate from Employee inner join emp_details
on Employee.EmployeeID=Emp_details.emp_id
group by salary
having (COUNT(*)>1)

Saturday 15 September 2018

What is the ref and Out keyword in C#?

consider the following program to understand the out and ref keyword of C#

using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace simplevalue
{
    class Progra {
      static void Addvalue(int val)
        {
             val++
        }
      static
 void Main(string[] args)
       {
            int
 value = 10;
            Addvalue(value);
            Console.WriteLine(value);
            Console.Read();
        }
    }
}


in the above program the output of the above program is 10. because we provide the value variable to 10 after that we provide this value to Addvalue() function and in that they increment the value by 1 and become 11. but this value is never carried out to this function because we copy the value variable not reference to the variable. this is default working of the C# language .
we preferred this type of output in most of the scenario but in some cases where we want to modify the variable then we use ref and out keyword for this.

The out and ref keyword are looks quite similar in nature. Both parameters are used to return back some value to the caller of the function. But still there is a small but important difference between them. Both of the parameter type has been kept in the C# language for specific scenario.

Out keyword:
The out parameter can be used to return the values in the same variable  as a parameter of the method. Any changes made to the parameter will be reflected in the variable.
The out keyword causes arguments to be ed by reference. This is similar to the ref keyword, except that ref requires that the variable be initialized before being ed. To use an out parameter, both the method definition and the calling method must explicitly use the out keyword. 

example:
 static void Main(string[] args)
        {
            int value;
            AddValue( out value);
            Console.WriteLine(value);

            Console.Read();
        }
        static void AddValue(out int val)
        {
            val = 20; 
        }

ref keyword: 
The ref keyword on a method parameter causes a method to refer to the same variable that was ed as an input parameter for the same method. If you do any changes to the variable, they will be reflected in the variable.
The ref keyword is similer to out keyword but ref requires that the variable be initialized before being ed.
 
For example
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace outexample
{
    class Program    {
        static void value(ref int val)
        {
           val = 20;
        }
    static
 void Main(string[] args)
        {
            int value;
            value(ref value);
            Console.WriteLine(value);     
           Console.Read();
        }
    }
}

Thursday 13 September 2018

What is the Hoisting?
         Hoisting in javascript? and what is different this as server side technology?

In javascript Hosting is that where we can use any variable or method before declaring it.
In any server side technology it is very essential to declare any variable and method before using that.
The javascript compiler moves all the declaration of the variable and function at top so there is not an error to this.


Hoisting is only possible to declare the variable not in it's initialization means according to following example let we explain this line:


alert('x = ' + x); // display x = undefined
        
var x = 1;

Wednesday 8 August 2018

what is 

differences between Angular 2 components vs. directives


In angular 2 component is special type of directives that have a view whereas directive is a decorator 
which have no views.
component is used to break up the application into smaller components whereas directive is used to
design reusable component.
Component can be used to define pipe whereas directive never use to define pipe.
Components can be present per DOM element. Whereas, Directive is used to add behavior to an existing DOM element.

Sunday 15 April 2018

If you get this type of following errors :



Can't bind to 'ngModel' since it isn't a known property of 'input' ” 


You just import the FormsModule in your's module file and also add the reference in imports array so that you can not get this type of error again



import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { SimpleComponent } from './simple/simple.component';


@NgModule({
declarations: [
AppComponent,
SimpleComponent
],
imports: [
BrowserModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})



Friday 30 March 2018

Fixing the "ng is not recognized" Error in Angular

Problem: When trying to run an Angular project using the "ng serve" command, you encounter an error that says "ng: The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Solution: To resolve this error, open the command prompt and type "npm -i -g @angular/cli" to install the Angular CLI globally. Once the installation is complete, navigate to the project directory and run the project using "ng serve" command. This should allow you to run your Angular project without encountering the "ng is not recognized" error.

Tuesday 16 May 2017

what is difference between ienumerable and iqueryable?

ienumerable and iqueryable both are played with collection of data. they do exact same thing.

but there is most of the difference between them.
 
when we talk about ienumerable there is a collection. means that it works on in object. For example if we are work on collection then ienumerable is working fine because it collect all data from database to client browser first and after that filteration will be applied

For example if we want to fetch first 3 records  from the database whose gender is male
then ienumerable first fetch all data from db and after that it apply filteration. thatswhy it is slow in comparision to iqueryable.


and if we talk about iqueryable then it works on network related data. this apply all filteration on server side and after that it fetch data from there thatswhy it is fast.  

Tuesday 29 November 2016

Dear Indians, As we all aware about the population of India it increase every year and in coming years india become big population country. in some past day news we all heard about the pollution news of Delhi. All Dietitian are afraid about the air Pollution, Air pollution in Delhi’s National Capital Region (NCR) is comprised of a complex mix of pollution from human activities (vehicle emissions, industry, construction and residential fuel burning) as well as natural sources like dust and sea salt. The heavy concentration of particulate matter is greatly affected by meteorological conditions –in the winter, cool air causes “inversions” that stagnant the air and trap pollution close to the ground. Air flow patterns from Afghanistan and Pakistan pick up emissions as they move over the densely urbanized regions of Punjab and Haryana where farmers burn the straw in their fields and pull this pollution into Delhi. Pre-monsoon dust storms also contribute to air pollution in the region. So for this pollution all citizen having problem in breathing. Here i am suggest to you about the ayurvedic treatment about this type of breating problem because if you ignore this problem for a long time it become a serious issue in your's comming life. Use Use KasaKeshri here i am also attach the customer review that are using kesa keshri
You can also contact on this number-9910567004 and 8003698602 if you want to try this medicine.

Wednesday 23 November 2016

Dear Indian,
      Last day the speech of Our PM shri narender modi is really a very heart touching and he is the first PM that cries in assembly he fight the corruption, he take very really good decision about demonetization. I think this is a very good way because everywhere in our country in this day every one people out of four are talking about this daring decision of our PM. or this is really very good because before this demonetization when we read newspaper, watching news channel every where is news about corruption, theft, snitching and terrorism but after  8 November this type of news are gone away from the news channel and new era is coming.

Friday 23 October 2015

how to call ajax with Jquery using Asp.net

how to call ajax with Jquery using Asp.net
Hello friends here i am show you a example how to ajax call using asp.net server side code:


Many of the times the interviewer asked the question that how to call how to call server side method as a client side in Asp.net.

so the answer is using jquery we can use server side method via client side:
here is example for this.


first of all create a sample web application in visual studio

1. visual studio 2012->new project - web application .


now on default.aspx page write the following code in body tag.


<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
        <input id="btnGetTime" type="button" value="Show Current Time" onclick="ShowCurrentTime()" />


after that call the jquery within head section like this ..


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function ShowCurrentTime()
        {
            $.ajax({
                type: "POST",
                url: "WebForm1.aspx/GetCurrentTime",
                data: '{name:"' + $("#<%=txtUserName.ClientID%>")[0].value + '"}',
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                failure: function (responce) {
                    alert(responce.d);
                }
            });
        }
        function OnSuccess(responce) {
            alert(responce.d);
        }
    </script>

you can see easily the above code
in the first line we reference the jquery file user can also download this jquery and reference it to locally.

now in function ShowCurrentTime() we make ajax call here $.ajax is signature for call ajax method

here type may be post or get according to user requirement.

now it is main part on default.aspx.cs page make method to as webmethod which is necessary to call server method on client side

 [System.Web.Services.WebMethod]
        public static string GetCurrentTime(string name)
        {
            return " Hello " + name + Environment.NewLine + "The Current Time is :" + DateTime.Now.ToString();
        }


You can test this demo and enjoy..

Tuesday 6 October 2015

How to count the occurence of a string counted without using for loop in a sentence.

Here we use a simple way to count the string occurence in a sample string without using for loop.



first of all we use a name space using System.Text.RegularExpressions

then take a sample string here i take this


string s="One reason people lie is to achieve personal power. Achieving personal power is helpful for someone who pretends to be more confident than he really is. For example, one of my friends threw a party at his house last month. He asked me to come to his party and bring a date. However, I didn’t have a girlfriend. One of my other friends, who had a date to go to the party with, asked me about my date. I didn’t want to be embarrassed, so I claimed that I had a lot of work to do. I said I could easily find a date even better than his if I wanted to. I also told him that his date was ugly. I achieved power to help me feel confident; however, I embarrassed my friend and his date. Although this lie helped me at the time, since then it has made me look down on myself."

Now the code for counting the purticular string


int count=Regex.Matches(s.ToUpper(), "THE").Count;

and now print on console like this

Console.WriteLine(count);

Thursday 17 September 2015

How to Remove Comma Character from the Last of string.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>remove last comma from string jquery</title>
    <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('.btnRemove').click(function (event) {
                var strVal = $.trim($('.txtValue').val());
                var lastChar = strVal.slice(-1);
                if (lastChar == ',') {
                    strVal = strVal.slice(0, -1);
                }
                $("#result").text(strVal);
            });
        });
    </script> 
</head>
<body>
    <div>
        <table>
            <tr>
                <td>
                    <input type="text" class="txtValue" value="I am Neeraj upadhyay, " />
                </td>
                <td>
                    <button class="btnRemove">Remove</button>
                </td>
            </tr>
            <tr>
                <td>
                    <div id="result" style="color:red;"></div>
                </td>
            </tr>  
    </div>
</body>
</html>

AdSense

The Ultimate Guide to Interceptors: Understanding Their Power and Functionality

  The Ultimate Guide to Interceptors: Understanding Their Power and Functionality An interceptor is a service that can intercept HTTP reques...

Follow