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