|
|
|
I want to block some domain names in dns server.
Server os is linux 2.6.
Anybody give me some hint ?
Thanks.
|
|
|
|
|
Hi,
Your thread title says block but the thread body says redirect. Which is it?
Do you need to do this with code? If not you could redirect/block with the /etc/hosts file on the gateway DNS server.
For example to block the code project from /etc/hosts just add:
127.0.0.1 www.codeproject.com
Most properly configured DNS servers will check the hosts file before performing the query.
Best Wishes,
-David Delaune
|
|
|
|
|
Hello World
I was wondering if someone could explain STEP BY STEP how pointers work. I know what they are but I'm having trouble conceptualizing different situations. For example, What does each of these do?
1. pointer1 = pointer2->next;
2. pointer4 = pointer1;
3. pointer4-> data = pointer1->data;
4. pointer4->next->data = pointer1->data
I dont really understand what "->" does or what it means. I also don't quite understand the concept of "next";. I would be so grateful if someone could break it down to the basics for me because I'm trying to move ahead in my data structures class but really can't wrap my brain around this.
Thanks in advance,
Jennifer
|
|
|
|
|
This looks like a question about linked list; a linked list is a simple data structure (http://en.wikipedia.org/wiki/Linked_list[^])
A list is a series of node, each node contains 2 things, some data and a pointer to the next node.
1. pointer2 is the current node, and next is the pointer (or better, address) of the the next node in the list.
2. pointer4 will point to the same address that pointer1 (it's just a simple variable assignation) (and in that case, pointer1 and pointer4 will point to the same thing).
3. it says that the data in the node pointer4 will point to the data of pointer1 (in that case, same data)
4. just weird... (saturday evening, and bad headache).
I find that if you start drawing (pen and paper) box with the data and the pointer on paper it makes things clearer.
good luck.
Watched code never compiles.
|
|
|
|
|
|
I work in VC6, on my job I have installed SDK 2003, at home I haven't ... my question is : there is a way to compiler knowing if is SDK installed or not ? I mean an #define SOMETHING or anything else ? Thnak you.
|
|
|
|
|
I think the version defines (WIN32_WINNT etc) will determine what features you can use. There is nothing specific that will identify the presence of the SDK.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi,
You can check for the existence of the platform SDK by checking for the VER_PRODUCTBUILD definition. It is defined in the ntverp.h header.
For VC6 it would be something like:
#if !defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 3790
#pragma message ("Error: You need the Microsoft Platform SDK!")
#endif
Best Wishes,
-David Delaune
|
|
|
|
|
Seems to work well at my home, but I want to try it on my job too ... I will tell you further what's going on ... thank you very much all of you guys !
|
|
|
|
|
Heh,
Flaviu2 wrote: Seems to work well at my home, but I want to try it on my job too
Of course it's going to work correctly at your job too. That's how I have been detecting if the platform SDK is installed since about 2003. I was tired of sending source code to other software engineers... and having them e-mail me back complaining that the code would not compile. So I added that little preprocessor statement... however... with a much more creative message!
Best Wishes,
-David Delaune
|
|
|
|
|
the following code will not draw vertical lines..but when i comment out the part (top) of the code that draws the other set if lines it is able to draw the vertical lines ...im quite new to programming. am i missing something ? please help!!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <conio.h>
#include <graphics.h>
void main()
{
int gd,gm;
char ch;
float y,x,m,incx,r,cx,cy,angle;
float x1,y1,x2,y2,incy;
gd=DETECT;
initgraph(&gd,&gm,"c:\\borlandc\\bgi");
printf("Enter value of X1:");
scanf("%f", &x1);
printf("Enter value of Y1:");
scanf("%f", &y1);
printf("Enter value of X2:");
scanf("%f", &x2);
printf("Enter value of Y2:");
scanf("%f", &y2);
//this part will draw horizontal, +ve and -ve gradient lines
do{
y=( (y2-y1)/(x2-x1) ) * incx+y1;
x=x1+incx++;
putpixel((int)x,479-(int)y,YELLOW);
} while(x<x2);
if((x2>x1)&&(y2>=y1))
{
incx=1;
}
if((x2<x1)&&(y2<=y1))
do {
y=( (y2-y1)/(x2-x1) ) * incx+y1;
x=x1+incx--;
putpixel((int)x,479-(int)y,YELLOW);
} while(x>x2);
//this part of the code will draw vertical lines
do {
x=( (x2-x1)/(y2-y1) ) * incy+x1;
y=y1+incy++;
putpixel((int)x,479-(int)y,YELLOW);
} while(y<y2);
if((x2==x1)&&(y2>y1))
{
incy=1;
}
else
do{
x=( (x2-x1)/(y2-y1) ) * incy+x1;
y=y1+incy--;
putpixel((int)x,479-(int)y,YELLOW);
} while(y>y2);
ch=getch();
closegraph();
}<code></code>
|
|
|
|
|
193344 wrote: the following code will not draw vertical lines..but when i comment out the part (top) of the code that draws the other set if lines it is able to draw the vertical lines
It sounds as though the variables in the "top" part are influencing the variables in the "bottom" part. Use your debugger to step through the code to see if all of the variables are what you think they should be.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
193344 wrote: y=( (y2-y1)/(x2-x1) ) * incx+y1;
this line will always be executed at least once, as it sits inside a do-while loop, without any precondition. And for vertical lines, x1 equals x2, so the division will fail.
Your code isn't very well structured; what you should do is provide a general line drawing implementation, and one (or more) specialized ones; then have conditional tests organized such that exactly one implementation gets executed, depending on the input values.
|
|
|
|
|
Below is what my driver looks like I'm trying to read/write data from a singly linked list to random access file in c++ but thus far I'm unable to do so....any help in solving this problem would greatly appreciated.
#include"List.h"
#include "Employer.h"
void InitialEmployerRan()
{
int count; //counter for loop
int me=20; //max number of employees
ofstream RanFile("Employer.dat",ios::out |ios::binary);
if (RanFile)
{
//Enter the total number of employees
cout <<"\nEnter maximum number of emplyees ";
cin >> me;
//create an object with default data
Employer obj;
//Initialise employees file with me records
for(count = 0; count < me; ++count)
{
RanFile.write(reinterpret_cast <const char="" *="">(&obj),sizeof(Employer));
}
} else
{
cerr <<"file was not fond";
}
}
//display program instruction to user
void instruction()
{
cout <<"Enter ont of the following:\n"
<<"1 to insert at front\n"
<<"2 to delete from front\n";
}//end function instruction
template<typename t="">
void TestList(List<t> &listObject)
{
instruction();//display instruction
int choice;//store user choice
T value;
Employer emp;
string fname,lname,address,pos,Cname,email ;
int cel, hom, id;
do{
cout <<"enterchoice";
cin >> choice;
system("cls");
switch(choice)
{
case 1:
cout<<"Enter Data: "<<endl;
="" cout<<"id:";
="" fflush(stdin);
="" cin="">> id;
cout <<"\nEnter employeer's first name ";
fflush(stdin);
cin >> fname;
fflush(stdin);
cout <<"\nEnter employeer's last name ";
fflush(stdin);
cin >> lname;
cout <<"\nEnter employeer's jop Title ";
fflush(stdin);
getline(cin,pos) ;
cout <<"\nEnter employeer's email ";
fflush(stdin);
cin >> email;
cout << "\nEnter name of company";
fflush(stdin);
getline(cin,Cname);
cout << "\nEnter employeer addreess";
fflush(stdin);
getline(cin,address);
cout <<"Enter Employer cell number ";
fflush(stdin);
cin>>cel;
cout <<"Enter Empolyer home number ";
fflush(stdin);
cin>>hom;
listObject.insertInFront(Employer(fname,lname,address,pos,Cname,email ,cel,hom,id));
//listObject.print();
break;
case 2:
if(listObject.removeFromFront(value))
cout << value <<" remove from list\n";
listObject.print();
break;
}
}while(choice < 3);
CreateList(listObject,id);
DisplayEmployeeRan(listObject);
}
template<typename p="">
void CreateList(List &listObject2,int i)
{
Employer emp;
fstream RanFile("Employer.dat",ios::in | ios::out |ios::binary);
if (RanFile)
{
while(!listObject2.isEmpty())
{
RanFile.seekp(sizeof(Employer) * (i- 1));
RanFile.write(reinterpret_cast< const char *>(&emp),sizeof(Employer));
cout<<"file was updated";
break;
}
}
else
{
cerr<<"Error the file was not found";
}
}
template<typename t="">
void DisplayEmployeeRan(List<t> &listObject3)
{
char ans; //answer to store 'y' or 'n'
Employer emp;
int in;
ifstream RanFile("Employer.dat",ios::in |ios::binary);
if (RanFile)
{
while ( !listObject3.isEmpty( ))
{
cout <<"\nEnter employee's id number to"<< " display ";
cin >> in;
RanFile.seekg(sizeof(Employer) *(in - 1));
RanFile.read(reinterpret_cast<char *=""> (&emp),sizeof(Employer));
//if not eof show data
if(! RanFile.eof())
{
//Display the processed
// info for the employee
listObject3.print();
} cout << "Display another "<<"employee's information? [y/n] ";
fflush(stdin);
ans = ' ';
while (ans != 'y' && ans != 'Y'
&& ans != 'n' && ans != 'N')
{
ans = _getch();
} cout << endl;
if (ans == 'n' || ans == 'N')
{
exit(1);
}
}
} else
{
cout <<"Error - random files could not be opened.";
}
}
int main()
{
// InitialEmployerRan();
List <employer> EmpList;
TestList(EmpList);
system("Pause");
return 0;
}
|
|
|
|
|
djgmad wrote: ...but thus far I'm unable to do so
Which means what exactly? Which part specifically are you having trouble with? Focus on just that part, and remove, or comment out, other irrelevant code.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I'm having problem with both writing and reading the linked list to the file. To be honest I don't know which is giving me be problem writing or reading...Any help in creating codes that read and write to and from a liked list would be appreciated.
//code used for writing to the linked list
template<typename t="">
void DisplayEmployeeRan(List<t> &listObject3)
{
char ans; //answer to store 'y' or 'n'
Employer emp;
int in;
ifstream RanFile("Employer.dat",ios::in |ios::binary);
if (RanFile)
{
while ( !listObject3.isEmpty( ))
{
cout <<"\nEnter employee's id number to"<< " display ";
cin >> in;
RanFile.seekg(sizeof(Employer) *(in - 1));
RanFile.read(reinterpret_cast<char *=""> (&emp),sizeof(Employer));
//if not eof show data
if(! RanFile.eof())
{
//Display the processed
// info for the employee
listObject3.print();
}
cout << "Display another "<<"employee's information? [y/n] ";
fflush(stdin);
ans = ' ';
while (ans != 'y' && ans != 'Y'&& ans != 'n' && ans != 'N')
{
ans = _getch();
}
cout << endl;
if (ans == 'n' || ans == 'N')
{
exit(1);
}
}
}
else
{
cout <<"Error - random files could not be opened.";
}
}
|
|
|
|
|
djgmad wrote: I'm having problem with both writing and reading the linked list to the file. To be honest I don't know which is giving me be problem writing or reading...Any help in creating codes that read and write to and from a liked list would be appreciated.
Use the debugger to single step through your code to see what it is doing. Always break larger problems down into smaller ones.
djgmad wrote: ifstream RanFile("Employer.dat",ios::in |ios::binary);
if (RanFile)
This is not likely what you intended to do since RanFile will be non-zero whether the file was opened or not.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
You could start by formatting your code properly by the use of <pre> tags; click the code button. Then try explaining exactly which part of the code has the problem and what that problem is.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I'm having problem with both writing and reading the linked list to the file. To be honest I don't know which is giving me be problem writing or reading...Any help in creating codes that read and write to and from a liked list would be appreciated.
//code used for writing to the linked list
template<typename t="">
void DisplayEmployeeRan(List<t> &listObject3)
{
char ans; //answer to store 'y' or 'n'
Employer emp;
int in;
ifstream RanFile("Employer.dat",ios::in |ios::binary);
if (RanFile)
{
while ( !listObject3.isEmpty( ))
{
cout <<"\nEnter employee's id number to"<< " display ";
cin >> in;
RanFile.seekg(sizeof(Employer) *(in - 1));
RanFile.read(reinterpret_cast<char *=""> (&emp),sizeof(Employer));
//if not eof show data
if(! RanFile.eof())
{
//Display the processed
// info for the employee
listObject3.print();
}
cout << "Display another "<<"employee's information? [y/n] ";
fflush(stdin);
ans = ' ';
while (ans != 'y' && ans != 'Y'&& ans != 'n' && ans != 'N')
{
ans = _getch();
}
cout << endl;
if (ans == 'n' || ans == 'N')
{
exit(1);
}
}
}
else
{
cout <<"Error - random files could not be opened.";
}
}
|
|
|
|
|
Please edit your message and format the code properly as previously suggested. Unformatted code like the above is not easy to read.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
See here. It may not be exactly what you are looking for, but it might point you down the right path.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
> Hello., I followed your wave recoding and playing code from this Voice Recording/Playing back using simple classes[^]
>> That helps me a lot
>> Now i want to write buffer data to a wave file
>> Can any one tell me how to write a wave file from buffer
|
|
|
|