This application Failed to start because *.dll was not found.Re-installing the application may fix this problem


Problem:

1) This error occurs when you are using application that may be corrupted by deleted the required DLL files from the program files /application dir/bin directory

2) This error occurs when you are developing some application that uses a third party or open source library

Solution:

     In windows put the required *.dll files under C:\WINDOWS\system32 directory , this error occurs because the IDE that you are using or the application that uses environmental settings (generic path) to run or get or access that *.dll file .If you use the windows system32 directory it is sufficient to run the application or development program good.

You can put your files under your debug directory if you are developing some application in IDE,it works on some cases only.

C/C++ IDE for windows linux and Macintosh Operating Sytems


C/C++ IDE Name
Free(Closed Source)
Free(Open Source)
Commercial
OS support

YES

NO

NO

Windows Family
---
YES
----
MS windows,Linux,Mac
---
YES
---
MS windows.Linux,Mac
---
YES
---
MS windows,linux,Mac
YES
----
---
MS windows,Linux
---
YES
---
MS windows,Linux,Ma
---
---
YES
MS windows

Microsoft Visual C++ Express IDE:




NetBeans C/C++ IDE:

Eclipse C/C++ IDE:


Code::Blocks C/C++ IDE:


Dev C/C++ IDE:





CodeLite C/C++ IDE

SNMP OID Validation in C:

SNMP Object Identifiers (OIDs)

Object identifier or OID is an identifier used to name an object (compare URN). Structurally, an OID consists of a node in a hierarchically-assigned namespace, formally defined using the ITU-T's ASN.1 standard. Successive numbers of the nodes, starting at the root of the tree, identify each node in the tree. Designers set up new nodes by registering them under the node's registration authority. The root of the tree contains the following three arcs:

* 0: ITU-T
* 1: ISO
* 2: joint-iso-itu-t

Samples:

Here is a sample structure of an OID:
Iso (1).org(3).dod(6).internet(1).private(4).transition(868).products(2).chassis(4).card(1).slotCps(2)­
.­cpsSlotSummary(1).cpsModuleTable(1).cpsModuleEntry(1).cpsModuleModel(3).3562.3
or
1.3.6.1.4.868.2.4.1.2.1.1.1.3.3562.3 



//Code :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE (!TRUE)
#endif
#define NUL 0

//commentout the following line to disable the debug prints
#define DEBUG_TRACE 1

#ifdef DEBUG_TRACE
#define TRACE_PRINT(x) printf x
#else
#define TRACE_PRINT(x) /*It does nothing */
#endif

/* Function Prototypes */
int validateNumbricOID(char *oidString);
int countDots(char *inString);
int splitString(const char *string,const char *delimiter ,char *bufs[]);
int IsNumeric(char *input);

int main()
{
    char oidString[255];
    while(TRUE)
    {
      printf("Enter OID String:");
      scanf("%s",oidString);
      if(validateNumbricOID(oidString))
      {
          printf("validated ...correct oid found\n");
      }
      else printf("validated...incorrect oid found\n");
    }

    return 0;
}

/***********************************************************************
* Name  : validateNumbricOID                                           *
*                                                                      *
* input : string or character array                                    *
*                                                                      *
* output: true or false                                                *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int validateNumbricOID(char *oidString)
{
    int ndots = 0,nvalues = 0,i;
    char *oidNumerics[255];
    char const *delimiter = ".";

    ndots = countDots(oidString);
    TRACE_PRINT(("Init Oid validation Process,Given OID : %s \n",oidString));
    TRACE_PRINT(("Number of dots found                  : %d \n",ndots));
    nvalues = splitString(oidString,delimiter,oidNumerics);
    if(nvalues > NUL)
    {
        for(i = 0; i < nvalues ; i++)
        {
            TRACE_PRINT(("nvalue    : %d \n",(int)oidNumerics[i]));
            TRACE_PRINT(("isNumeric : %d \n",IsNumeric(oidNumerics[i])));
            if(IsNumeric(oidNumerics[i])== 0)
            return FALSE;
        }
    }
    else return FALSE;
    TRACE_PRINT(("Number of numberics found : %d \n",nvalues));
    for(i = 0; i < nvalues ; i++)
    {
        free(oidNumerics[i]);
    }
    return TRUE;
}

/***********************************************************************
* Name  : countDots                                                    *
*                                                                      *
* input : input string                                                 *
*                                                                      *
* output: returns number of dots found                                 *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int countDots(char *inString)
{
    int i = 0,nDots = 0;
    for(i = 0; inString[i] != '\0'; i++)
    {
        if(inString[i] == '.')
        nDots++;
    }
    return nDots;
}

/***********************************************************************
* Name  : SplitString                                                  *
*                                                                      *
* input : input string to be splitted,delimiter                        *
*                                                                      *
* output: the splitted output strings                                  *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int splitString(const char *string,const char *delimiter ,char *bufs[])
{
    char *token,*inLine;
    int bufCnt = 0;
    inLine = strdup(string);
    token = strtok(inLine,delimiter);
    bufs[bufCnt] = strdup(token);
    while (token != NULL)
    {
        bufs[bufCnt++] = strdup(token);
        token = strtok(NULL,delimiter);
    }
    return bufCnt;
}

//From the XXXX code
int IsNumeric(char *input)
{
    int rc = TRUE;
    unsigned int i = 0;

    for(i = 0; i < strlen(input) ; i++)
    {
        if(!((input[i] >= '0') && (input[i] <= '9')))
            rc = FALSE;
    }
    return rc;
}









SNMP Engine ID validation in C:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE (!TRUE)
#endif
#define NUL 0

//commentout the following line to disable the debug prints
#define DEBUG_TRACE 1

#ifdef DEBUG_TRACE
#define TRACE_PRINT(x) printf x
#else
#define TRACE_PRINT(x) /*It does nothing */
#endif

enum DELIMITER_USER
{

    eDELIMITER_STOP = 0,
    eDELIMITER_COLON = 1,
    eDELIMITER_INVALID = -1,
};



/* Function Prototypes */
int validateEngineID(char *oidString);
int countSeperator(char *inString);
int splitString(const char *string,const char *delimiter ,char *bufs[]);
int IsNumeric(char *input);
int findDelimiter(char *input);
int IsHexaNumber(char *input);


int main()
{
    char engineIdString[64];
    while(TRUE)
    {
      printf("\nEnter Engine ID String:");
      scanf("%s",engineIdString);
      if(validateEngineID(engineIdString))
      {
          printf("validated ...correct engine ID found\n");
      }
      else printf("validated...incorrect engine ID found\n");
    }

    return 0;
}

/***********************************************************************
* Name  : validateEngineID                                             *
*                                                                      *
* input : string or character array                                    *
*                                                                      *
* output: true or false                                                *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int validateEngineID(char *engineIdString)
{
    int rc = TRUE;
    int nseperators = 0,nvalues = 0,i;
    char *engineIdNumerics[64];
    char const *delimiter[2]  = {".",":"};
    nseperators = countSeperator(engineIdString);
    TRACE_PRINT(("Init Oid validation Process,Given OID : %s \n",engineIdString));
    TRACE_PRINT(("Number of dots found                  : %d \n",nseperators));
    if(findDelimiter(engineIdString)!= eDELIMITER_INVALID )
    {
        printf("Find delimiter output:%d ,delimiter = %s\n",findDelimiter(engineIdString),delimiter[findDelimiter(engineIdString)]);
        nvalues = splitString(engineIdString,delimiter[findDelimiter(engineIdString)],engineIdNumerics);
        if(nvalues > NUL)
        {
            for(i = 0; i < nvalues ; i++)
            {
                TRACE_PRINT(("nvalue    : %d \n",(int)engineIdNumerics[i]));
                TRACE_PRINT(("isNumeric : %d \n",IsNumeric(engineIdNumerics[i])));
                if(IsHexaNumber(engineIdNumerics[i]) == 0)
                rc = FALSE;
            }
        }
        else rc = FALSE;
    }
    else rc = FALSE;
    TRACE_PRINT(("Number of numberics found : %d \n",nvalues));
    for(i = 0; i < nvalues ; i++)
    {
        free(engineIdNumerics[i]);
    }
    return rc;
}

/***********************************************************************
* Name  : countSeperator                                               *
*                                                                      *
* input : input string                                                 *
*                                                                      *
* output: returns number of seperators found                           *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int countSeperator(char *inString)
{
    int i = 0,nSeperators = 0;
    for(i = 0; inString[i] != '\0'; i++)
    {
        if(inString[i] == '.' || inString[i] == ':')
        nSeperators++;
    }
    return nSeperators;
}


/***********************************************************************
* Name  : SplitString                                                  *
*                                                                      *
* input : input string to be splitted,delimiter                        *
*                                                                      *
* output: the splitted output strings                                  *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int splitString(const char *string,const char *delimiter ,char *bufs[])
{
    char *token,*inLine;
    int bufCnt = 0;
    inLine = strdup(string);
    token = strtok(inLine,delimiter);
    bufs[bufCnt] = strdup(token);
    while (token != NULL)
    {
        bufs[bufCnt++] = strdup(token);
        token = strtok(NULL,delimiter);
    }
    return bufCnt;
}

//From the XXXX code
int IsNumeric(char *input)
{
    int rc = TRUE;
    unsigned int i = 0;

    for(i = 0; i < strlen(input) ; i++)
    {
        if(!((input[i] >= '0') && (input[i] <= '9')))
            rc = FALSE;
    }
    return rc;
}

/***********************************************************************
* Name  : IsHexaNumber                                                 *
*                                                                      *
* input : input string                                                 *
*                                                                      *
* output: true or false                                                *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
/* An hexadecimal digit is one of the following characters:
   0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
   */
int IsHexaNumber(char *input)
{
    int rc = TRUE;
    unsigned int i = 0;

    for(i = 0; i < strlen(input) ; i++)
    {
        if(!((input[i] >= '0') && (input[i] <= '9')) && !((input[i] >= 'A') && (input[i] <= 'F')) \
          && !((input[i] >= 'a') && (input[i] <= 'f')))
            rc = FALSE;
    }
    return rc;
}

/***********************************************************************
* Name  : findDelimiter                                                 *
*                                                                      *
* input : input string                                                 *
*                                                                      *
* output: delimiter enum output                                        *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int findDelimiter(char *input)
{
    int rc = eDELIMITER_INVALID, len = strlen(input),sCount = 0,cCount = 0,i = 0;

    for(i = 0; i < len ; i++)
    {
        if(input[i] == '.')
        {
            sCount++;

        }
        else if(input[i] == ':')
        {
            cCount++;
        }
    }
    if(cCount == 0 && sCount == 0)
    rc = eDELIMITER_INVALID;
    else if(cCount == 0)
    rc = eDELIMITER_STOP;
    else if(sCount == 0)
    rc = eDELIMITER_COLON;
    return rc;
}


It is very helpful to improve the postings if you give some comments on this post
Thanks -

Pointer interview questions

Question 1:



  What is a NULL pointer?
  Simply NULL pointer points to nowhere..

#include <stdlib.h>

/* NULL pointer macro */
#ifndef NULL_PTR
#define NULL_PTR (0)
#endif


int main()
{
    int i = 0; /* A pointer to integer */
    int *p2intNum = NULL_PTR;
    /* Now p2intNum points to nowhere and it could not be accessible (*p2intNum) could not accessible */
    printf("Address of p2intNum = %d ,p2intNum = %d \n",&p2intNum,p2intNum);
    /* Now allocate memory for that ptr and disply */
    p2intNum = (int *)malloc(10);
    for(i = 0; i < 10 ; i++)
    {
        printf("p2intNum[%d] = %d \n",i,*(++p2intNum));
    }
    free(p2intNum);
    return (getchar());
}
Question 2:
Explain about constant pointer and pointer to constant ? 
 const pointer / pointer to const  
 constant pointer:   
 Example:   
       const *int ptr;
      Constant pointer means that only the value is changeable but not the pointer.
  pointer to constant
   Example:
   const int *ptr;
        Pointer to constant means that only the pointer is modifiable but not the value which points to

//const pointer
void constPtr(int num)
{
    int* const ptr = &num;
    int *PtrAnother;
    int number=1000;
    printf("(ConstanctPointer):Before:The num value is:%d\n",*ptr);
    *ptr = number;
//ptr=PtrAnother; <- error :(you can change the value but not the pointer)
    printf("(ConstanctPointer):After :The num value is:%d\n",*ptr);
}
//pointer to a const
void pointer2const(int num)
{
    const int *ptr = &num;
    int *PtrAnother;
    int number=1000;
    PtrAnother=&number;
    printf("(Pointer2Constant):Before:The num value is:%d\n",*ptr);
//*ptr = 5; <- error (you can change ptr but not the value)
    ptr=PtrAnother;
    printf("(Pointer2Constant):After :The num value is:%d\n",*ptr);
}
Question 3:
What are function pointers ?
Answer
Like any other pointer type , we can able to define pointers to functions that can be assigned,placed in arrays,passed to functions,returned by functions etc.

Pointer types:

int *ptr   // pointer to an integer
float *ptr // pointer to float value
char *ptr  // pointer to char
int (*ptr)(int *)
/* ptr is a pointer to function that has int * as an argument and returns an integer */

Storage classes in C

Here is a example project to understand the storage classes in c

Download it here:

Storage classes in c example project

Sterio to mono conversion and vice versa in matlab



Function : strio2mono('wavfile.wav')

    This utility function converts the given stereo file in mono file and output file
wavfile_mono.wav will be created on the current working directory by default.

Function : mono2strio('wavfile.wav')

    This utility function converts the given mono file in to sterio file and output file
wavfile_sterio.wav will be created on the current working directory by default.

Fix Needed :

    The two sides of the mono2streio converted wav file should not be similar , As in
recorded streio files there should be some difference between the sampled data values.

comments and suggestions welcome

Code :
strio2mono('wavfile.wav')
 
 function stereo2mono(Filename) %---------------------------------------------- % STEREO WAV FILE INTO MONO FILE CONVERSION % Usage: % stereo2mono('urfilename.wav'); % Supports only for two channel wav files %----------------------------------------------     if(nargin == 0)         error('No input');     end     try       [AudioData,Fs,nBits] = wavread(Filename);     catch         error(['Cant read input wav file']);     end     index_AudioData = size(AudioData);     index = index_AudioData;     if(index ~= 2)         error('This is not a stereo file');     end     Audio_data_mono = AudioData(:,1); %side1     % Audio_data_stereo = AudioData; %side2(you can use this code also)(if u want to use this side, % comment the above line)     wavwrite(Audio_data_mono,Fs,nBits,[Filename,'_mono']);     disp(['WAV file ',Filename,'_mono.wav ',' .. is generated in current working directory']); end
 mono2strio('wavfile.wav')
function mono2stereo(Filename) %---------------------------------------------- % STEREO WAV FILE INTO MONO FILE CONVERSION % Usage: % mono2stereo('urfilename.wav'); % Creates only two channel output wav files %----------------------------------------------     if(nargin == 0)         error('No input');     end     try      [AudioData,Fs,nBits] = wavread(Filename);     catch         error('Cant read input wav file');     end      index_AudioData = size(AudioData);      index = index_AudioData;     if(index ~= 1)         error('This is not a mono file');     end     Audio_data_stereo(:,1) = AudioData; % side1     Audio_data_stereo(:,2) = AudioData; % side2     wavwrite(Audio_data_stereo,Fs,nBits,[Filename,'_stereo']);     disp(['WAV file ',Filename,'_stereo.wav',' is generated in current working directory']); end




Recommended DSP Maltab Books:

Calcalute Months difference

Here is the code which calculates the Entered dates month difference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* split the given string with given dilimiter */
int splitString(const char *string,const char *delimiter ,char *bufs[]);
#define MAX_COL_SIZE 1024
#define NUL 0
#define MAX_CHAR_DATE 10
#define true 1
enum TIME
{
    eDATE,
    eMONTH,
    eYEAR,
    eMONTHS_IN_YEAR = 12,
};

int main()
{
    char datePresent[MAX_CHAR_DATE]; //= {"31/6/2011"};
    char datePast[MAX_CHAR_DATE]; // = {"30/12/2010"};
    char *parsedOutputPresent[MAX_COL_SIZE];
    char *parsedOutputPast[MAX_COL_SIZE];
    int yearPre = 0,monthPre = 0,datePre = 0;
    int yearPst = 0,monthPst = 0,datePst = 0;
    const char *delimiter = "/";
    int monthsDifference = 0;
    while(true)
    {

        printf("Enter Present Date:(say 31/6/2011) :");
        scanf("%s",datePresent);
        printf("Enter Past Date :(say 30/12/2010): ");
        scanf("%s",datePast);
        splitString(datePresent,delimiter,parsedOutputPresent);
        splitString(datePast,delimiter,parsedOutputPast);
        /* FOR PRESENT TIME */
        yearPre  = atoi(parsedOutputPresent[eYEAR]);
        monthPre = atoi(parsedOutputPresent[eMONTH]);
        datePre  = atoi(parsedOutputPresent[eDATE]);
        /* FOR PAST TIME */
        yearPst  = atoi(parsedOutputPast[eYEAR]);
        monthPst = atoi(parsedOutputPast[eMONTH]);
        datePst  = atoi(parsedOutputPast[eDATE]);
        if((yearPre-yearPst)>= NUL && (monthPre - monthPst) >= NUL)
        {
        /* THE TIME DIFFERENCE */
        /* CASE 1:
             past month is gt  pre month */
        monthsDifference = ((yearPre - yearPst)* eMONTHS_IN_YEAR) + (monthPre - monthPst);
        printf("Past:%s  - Present:%s = %d months\n",datePast,datePresent,monthsDifference);

        /* THIS CASE OUTPUTS DIFF 18
         CASE 2:
            past month is lt  pre month
        strcpy(datePast,"31/12/2010");
        strcpy(datePresent,"30/6/2011");
        monthsDifference = ((yearPst - yearPre)* eMONTHS_IN_YEAR) + (monthPst - monthPre);
        printf("Past:%s  - Present:%s = %d months\n",datePast,datePresent,monthsDifference);
        */

        }
        else
        {
            printf("Invalid dates !..");
        }
    }
    return(getchar());
}

/***********************************************************************
* Name  : SplitString                                                  *
*                                                                      *
* input : input string to be splitted,delimiter                        *
*                                                                      *
* output: the splitted output strings                                  *
*                                                                      *
* Modification History :                                               *
*                                                                      *
*                                                                      *
************************************************************************/
int splitString(const char *string,const char *delimiter ,char *bufs[])
{
    char *token,*inLine;
    int bufCnt = 0;
    inLine = _strdup(string);
    token = strtok(inLine,delimiter);
    bufs[bufCnt] = _strdup(token);
    while (token != NULL)
    {
        bufs[bufCnt++] = _strdup(token);
        token = strtok(NULL,delimiter);
    }
    return bufCnt;
}


Peak finder in matlab

Here is some simple code which finds max(),min() peak coordinates and display it in matlab visual plot
function peak_finder(t,y)
%**************************************************************************
% Name  : www.cpfaq.blogspot.com
% Sub   : To find a maximum peak and a minimm peak in a plot 
% Input : x axis values ,y axis values
% Modified By  :
% © 2010-2011 Copyright www.cpfaq.blogspot.com.
%*************************************************************************
            % Error checking(Input)
            % Number of arguments check
            if nargin~=2
                errordlg('Enter Valid input arguments','peak_finder');
                  return;  % Returns from function 
            end
            % Length checking
            % Find the length of x axis values
            len_x=length(t);
            % Find the length of y axis values
            len_y=length(y);
            % Check out for error
            if len_x~=len_y
                errordlg('Length of both the variablers should be same','peak_finder');
                return;   % Returns from funtion
            end
            % End of error checking 
            % Find the maximum of y and its corresponding place 
            [y1,it1]=max(y);
            % To plot in a same figure          
            hold on;
            % Calculate the minimum value of y and its corresponding place
            [y2,it2]=min(y);
            % Plot the maximum value with graphics
            plot(t(it1),y1,'^', 'linewidth',1,...
                                'MarkerEdgeColor','k',...
                                'MarkerFaceColor','blue',...
                                'MarkerSize',10);
            % Plot the minimum value with graphics  
            plot(t(it2),y2,'^', 'linewidth',1,...
                                'MarkerEdgeColor','k',...
                                'MarkerFaceColor','g',...
                                'MarkerSize',10);
            % Add text to the max peak value
            text(t(it1),y1,sprintf('   R(%4.2f,%4.2f)',t(it1),y1),'color',[.09 .84 .38],'fontsize',10); 
            % Add text to the min peak value
            text(t(it2),y2,sprintf('   S(%4.2f,%4.2f)',t(it2),y2),'color',[.09 .84 .38],'fontsize',10);
            % Hold the figure in to off condition
            hold off;
            % End Of File
end    % End of funtion peak_finder
%************************************************************************** 

If you find this code useful .. and plz send 
the screenshots of matlab plot output to offshore_support@in.com .
#include <stdio.h>
#include <stdlib.h>

#pragma warning (disable:4305)

typedef struct peakCoordinates
{
    double xCoord;
    double yCoord;
} peakXYcoord;

/*********************************************************************************
*               ^
*               *
*          5.8  *                ^ Peak(2.3,5.8)
*               *                *
*               *               * *
*               *   *          *    *
*   (Y axis     * *   *       *       *
*    values)    **      *    *          * *
*   say magtude *        *   *              * * * *
*               *         * *
*             ************************************* >
*               *    X axis values ( say Time (in sec)
*                                (2.3)
*
***********************************************************************************/

/* Function Prototypes */
peakXYcoord *peakFinder(double xDataArr[],double yDataArr[],int len);
int findMaxLocation(double xDataArr[],int len);
/* End of function prototypes */

int main(int argc,char *argv[])
{
    peakXYcoord *peaks;
    int lenX,lenY;
    double xData[] = {1.0,2.0,13.0,8.0,22.0,13.4};         //Init with Raw data
    double yData[] = {3.0,2.0,4.0,0.0,1.0,12.0}; //Init with Raw data
    int len = (lenX = sizeof(xData)/sizeof(xData[0])) > (lenY = sizeof(yData)/sizeof(yData[0]))?lenX:lenY;
    peaks = peakFinder(xData,yData,len);
    printf("Peaks(%f,%f)\n",peaks->xCoord,peaks->yCoord);
    free(peaks);
    return(getchar());
}

peakXYcoord *peakFinder(double xDataArr[],double yDataArr[],int len)
{
    peakXYcoord *peakCoord =(peakXYcoord *) malloc(sizeof(peakXYcoord));
    peakCoord->yCoord = yDataArr[findMaxLocation(yDataArr,len)];
    peakCoord->xCoord = xDataArr[findMaxLocation(yDataArr,len)]; //see why yDataArr ?
    return peakCoord;
}

int findMaxLocation(double DataArr[],int len)
{
    int i = 0,j = 1,loc = 0;
    for(i = 0; i < len ; i++)
    {
        for(j = i+1 ; j < len ; j++)
        {
            if(DataArr[j] > DataArr[i])
            {
                loc = j;
            }
        }
    }
    return loc;
}
If you find this code useful .. and plz send 
the screenshots of matlab plot output to offshore_support@in.com .