Monday, 24 December 2012

'ipconfig' is not recognized as an internal or external command, operable program or batch file. OR 'format' is not recognized as an internal or external command, operable program or batch file.

When trying to run ipconfig from a cmd window (dos prompt), I receive the following error.  This applies for ipconfig, ping, telnet, format etc.

ERROR MESSAGE:
'ipconfig' is not recognized as an internal or external command, operable program or batch file.

SOLUTION:
Go to My Computer-> right click-> Properties->Advanced->Environment
Variables->System variables and locate Path Environment Variable. Add C:\windows\system32;C:\windows\; at the
end if it is not already there.

Be sure that the path for C:\windows\system32\ matches that on your computer C: drive.
Reopen cmd window and retry ipconfig, telnet, ping, format etc.

Friday, 21 December 2012

C Program to Display Number in Words OR Input a Number and Display it in Words

#include<stdio.h>
#include<conio.h>
void main()
{
   int num,a,x,y,z,w;
   clrscr();
   printf("Enter any Four Digit Number");
   scanf("%d",&num);
   a=num/1000;

    if (a == 1)
    {
        printf("One Thousand ");
    }
    else if (a == 2)
    {
        printf("Two Thousand ");
    }
    else if (a == 3)
    {
        printf("Three Thousand ");
    }
    else if (a == 4)
    {
        printf("Four Thousand ");
    }
    else if (a == 5)
    {
        printf("Five Thousand ");
    }
    else if (a == 6)
    {
        printf("Six thousand ");
    }
    else if (a == 7)
    {
        printf("Seven Thousand ");
    }
    else if (a == 8)
    {
        printf("Eight Thousand ");
    }
    else if (a == 9)
    {
        printf("Nine Thousand ");
    }

    y = num % 1000;
    if (y >= 100 && y < 200)
    {
        printf(" One Hundred ");
    }
    else if (y >= 200 && y < 300)
    {
        printf(" Two Hundred ");
    }
    else if (y >= 300 && y < 400)
    {
        printf(" Three Hundred ");
    }
    else if (y >= 400 && y < 500)
    {
        printf(" Four Hundred ");
    }
    else if (y >= 500 && y < 600)
    {
        printf(" Five Hundred ");
    }
    else if (y >= 600 && y < 700)
    {
        printf(" Six Hundred ");
    }
    else if (y >= 700 && y < 800)
    {
        printf(" Seven Hundred ");
    }
    else if (y >= 800 && y < 900)
    {
        printf(" Eight Hundred ");
    }
    else if (y >= 900 && y < 1000)
    {
       printf(" Nine Hundred ");
    }

    z = num % 100;
    w = z;
    if (z >= 20 && z < 30)
    {
        printf(" Twenty ");
    }
    else if (z >= 30 && z < 40)
    {
        printf(" Thirty ");
    }
    else if (z >= 40 && z < 50)
    {
        printf(" Forty ");
    }
    else if (z >= 50 && z < 60)
    {
        printf(" Fifty ");
    }
    else if (z >= 60 && z < 70)
    {
        printf(" Sixty ");
    }
    else if (z >= 70 && z < 80)
    {
        printf(" Seventy ");
    }
    else if (z >= 80 && z < 90)
    {
       printf(" Eighty ");
    }
    else if (z >= 90 && z < 100)
    {
        printf(" Ninety ");
    }
    else if (z >= 10 && z < 20)
    {
        w = z;
    }

    if (w == 10)
    {
        printf(" Ten ");
    }
    else if (w == 11)
    {
        printf(" Eleven ");
    }

    else if (w == 12)
    {
        printf(" Twelve ");
    }

    else if (w == 13)
    {
        printf(" Thirteen ");
    }
    else if (w == 14)
    {
        printf(" Forteen ");
    }
    else if (w == 15)
    {
       printf(" Fifteen ");
    }
    else if (w == 16)
    {
        printf(" Sixteen ");
    }
    else if (w == 17)
    {
        printf(" Seventeen ");
    }
    else if (w == 18)
    {
        printf(" Eighteen ");
    }
    else if (w == 19)
    {
        printf(" Nineteen ");
    }

    if (z < 10 || z >= 20)
    {
        x = z % 10;

        if (x == 1)
        {
        printf(" One ");
        }
        else if (x == 2)
        {
        printf(" Two ");
        }
        else if (x == 3)
        {
        printf(" Three ");
        }
        else if (x == 4)
        {
        printf(" Four ");
        }
        else if (x == 5)
        {
        printf(" Five ");
        }
        else if (x == 6)
        {
        printf(" Six ");
        }
        else if (x == 7)
        {
        printf(" Seven ");
        }
        else if (x == 8)
        {
        printf(" Eight ");
        }
        else if (x == 9)
        {
        printf(" Nine ");
        }
            else if(x== 0)
            {
               printf("Zero");
            }
    }
getch();

}


========OUTPUT===============
Like as:-----

1.


2.



3.




4.



5.

Monday, 17 December 2012

C Program to Display Number in Words OR Input a Number and Display it in Words

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
char *make_words(char *s, int ncomma);
char *insert_comma(long n, int *ncomma);
char *int2words(int n);
int a;
 
int main(void)
{
 
clrscr();

 printf("Enter number: ");
 scanf("%d",&a);
  printf("%d = %s\n",a,int2words(a));

 
  getch();
  return 0;
}

char *make_words(char *s, int ncomma)
{
  int i, len, rest = 0;
  char *p = NULL;
  static char zzz[256];
 
  static char *ones[] = {"one ","two ","three ","four ",
    "five ","six ","seven ","eight ","nine "};
  static char *tens[] = {"ten ","eleven ","twelve ","thirteen ",
    "fourteen ","fifteen ","sixteen ","seventeen ","eighteen ","nineteen "};
  static char *twenties[] = {"","twenty ","thirty ","forty ",
    "fifty ","sixty ","seventy ","eighty ","ninety "};
  static char *hundreds[] = {
    "hundred ","thousand ","million "};
 
  memset(zzz, '\0', 256);  // fill with nulls
  len = strlen(s);
  for(i = 0; i < len; i++)
  {
 
    if ((p = strchr((s[i] == ',') ? &s[++i] : &s[i], ',')) == NULL)
    {
      p = &s[strlen(s)];
    }
    if (s[i] == '0')
    {
      continue;  // skip one iteration
    }
    if ((rest = (p - &s[i])) != 0)
    {
      if (rest == 3)
      {
        strcat(zzz, ones[s[i] - '0' - 1]);
        strcat(zzz, hundreds[0]);

        if (len == 7 && s[2] == '0')  strcat(zzz, hundreds[1]);
        if (len == 11 && s[2] == '0')  strcat(zzz, hundreds[2]);
      }
      else if (rest == 2)
      {
        if (s[i] == '1')
        {
          strcat(zzz, tens[s[++i] - '0']);
          rest--;
        }
        else
        {
          strcat(zzz, twenties[s[i] - '0' - 1]);
        }
      }
      else
        strcat(zzz, ones[s[i] - '0' - 1]);
    }
    if (rest == 1 && ncomma != 0)
    {
      strcat(zzz, hundreds[ncomma--]);
    }
  }
  return zzz;
}
 

char *insert_comma(long n, int *ncomma)
{
  static char zzz[30];
  int i = 0;
  char *p = &zzz[sizeof(zzz)-1];
 
  *p = '\0';
  *ncomma = 0;
  do
  {
    if (i % 3 == 0 && i != 0)
    {
      *--p = ',';
      ++*ncomma;
    }
     *--p = (char)('0' + n % 10);
    n /= 10;
    i++;
  } while(n != 0);
  return p;
}
 
char *int2words(int n)
{
  int nc;
  char *ps, *zzz, *minus;
  char *buffer;
  buffer = (char *) malloc(256);
 
  // save any - sign
  if (n < 0)
  {
    minus = "minus";
    n = abs(n);
  }
  else
  {
    minus = "";
  }
 
  ps = insert_comma(n, &nc);

  zzz = make_words(ps, nc);
 
  sprintf(buffer,"%s %s", minus, zzz);
 
  return buffer;
  getch();
}



============OUTPUT================
1.


2.


3.

You Try It...................

Sunday, 16 December 2012

Failed to access IIS metabase. An unhandled exception occurred during the execution of the current web request. Please review the stack ...

Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:


[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3492170
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +163
System.Web.CachedPathData.GetConfigPathData(String configPath) +382
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3385679
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189


Version Information: Microsoft .NET Framework

________________________________________________________

Solution:
For my case, the reason hit above error is because.NET Framework was installed before IIS server. To solve the problem, register .NET framework to IIS will do.

How to do that? (please be aware that the sample using for.NET Framework V1.0)
Steps:
1. Click on Start -> Run





2. Type in cmd and click OK



3. Command prompt screen will appear. go to"C:\Windows\Microsoft.NET\Framework\
v2.0.50727" folder by using command cd C:\Windows\Microsoft.NET\Framework\v2.0.50727 and hit enter. Please refer screen below:




4. Type in
aspnet_regiis -i and hit enter.



5. Screen below will be shown and dotnet user installed.



aspnet_regiis -i

alternatively you can copy and paste this command into windows command prompt

%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i