Hi everybody, Currently i am thinking how to program a PC Booking/Reservation System for an office of 100 PCs where user login is controled by Windows Active Directory. I have little idea about AD login control, anybody can tell me where to start? Thanks JW DJ
DengJW
Posts
-
Access Active Directory to Control PC User Logon? -
How to code to stop a printer driver?Hi, ALl I am having a problem with a Printer running on Window XP... The computer would run into :((BLUE SCREEN during shutting down if the Printer had been turned before shutdown? One solution is to uload or stop the printer driver before shutdown. My questions are: 1) how to write a program that can stop or unload the printer driver? 2) how to let XP automatically unload the driver instead of manually just before shutdown? Your help and contribution appreciated! JW DJ
-
will this be compiler(M$ cl) bug or Memory leakage?Microsoft Compiler Ver 12.00.8168 from VC++ 6. I could not reproduce the problem either. So I guess the chance would be high that I accidently uncommented both
ans = (f()) >= 0 ? (f()) : -(f());
andans = unsafe(f());
. So far, I could not think out other reasons. DJ -
will this be compiler(M$ cl) bug or Memory leakage?#include
#define unsafe(i) \
( (i) >= 0 ? (i) : -(i) )inline
int safe(int i)
{
return i >= 0 ? i : -i;
}
int f() {cout << "Called f()!" << endl; return 0;};
void userCode(int x)
{
int ans;
ans = unsafe(x++); // Error! x is incremented twice
cout << "[1] "<< x << endl;
// ans = (f()) >= 0 ? (f()) : -(f());
ans = unsafe(f()); // Danger! f() is called twice
cout << "[2] "<< x << endl;ans = safe(x++); // Correct! x is incremented once
cout << "[3] "<< x << endl;
ans = safe(f()); // Correct! f() is called once
cout << "[4] "<< x << endl;
}void main(void)
{
userCode(100);
}I was doing a test code for inline functions comparison to macros. The original code was shown as above, things seemed normal as the result showed two times of
f()
calls. The result looked like:[1] 102
Called f();
Called f();
[2] 102
[3] 103
Called f();
[4] 103However, after I tried to call
ans = (f()) >= 0 ? (f()) : -(f());
instead ofans = unsafe(f());
, I got a result of callingf()
FOUR times instead of TWO times as supposed. In this tread, I failed to attach a image of the result, which looked like:[1] 102
Called f();
Called f();
Called f();
Called f();
[2] 102
[3] 103
Called f();
[4] 103I ran the program twice both of times I got calling
f()
FOUR times, nevertheless, I could repeat the result after I re-compiled the program again with the original code. Could this be a compiler bug? DJ -
what wrong with this function template?thanks for your quick reply. DJ
-
what wrong with this function template?thanks. my concern is why
int max(int, int)
not working butfloat max(float, float)
working. What I had tested was funtion templates, not max/min funtion. So I renamed the function name to confuse less. The following codes work:#include
template T TFun(T a, T b)
{
if (a > b)
return(a);
else
return(b);
}
float TFun(float, float);
//int TFun(int, int);
void main(void)
{
std::cout << "The TFunimum of 100 and 200 is " <<
TFun(100, 200) << '\n';
std::cout << "The TFunimum of 5.4321 and 1.2345 is " <<
TFun(5.4321, 1.2345) << '\n';
}DJ
-
what wrong with this function template?What I have tried to test was how to use Function Template, then I copied a segment of codes from a book. If I left
float TFun(float, float)
uncommented, the code works well; however, if I leftint TFun(int, int)
uncommented, the code did not work. That is the problem I could not figure out.#include
template T TFun(T a, T b)
{
if (a > b)
return(a);
else
return(b);
}
float TFun(float, float);
//int TFun(int, int);
void main(void)
{
std::cout << "The TFunimum of 100 and 200 is " <<
TFun(100, 200) << '\n';std::cout << "The TFunimum of 5.4321 and 1.2345 is " << TFun(5.4321, 1.2345) << '\\n';
}
DJ
-
what wrong with this function template?but if I just comment out int
maxf(int, int);
, the code works. Moreover, if I comment out floatmaxf(float, float);
, the code works too. DJ -
what wrong with this function template?thanks a lots. now this code works:
#include <iostream> template T max(T a, T b) { if (a > b) return(a); else return(b); } //float max(float, float); //int max(int, int); void main(void) { std::cout << "The maximum of 100 and 200 is " << max(100, 200) << '\n'; std::cout << "The maximum of 5.4321 and 1.2345 is " << max(5.4321, 1.2345) << '\n'; }
but why the definition of two functions, which have been commented out, not working? BTW, I intended to make use of function template instead of max/min functions. DJ -
what wrong with this function template?The purpose of this test code is to make use of function template, instead of max funtion, which happened to be here. HOwever, if comment out [int max(int, int);], leave [float max(float, float); ], the code works well. Seems something wrong to the int type? DJ
-
what wrong with this function template?#include template T max(T a, T b) { if (a > b) return(a); else return(b); } float max(float, float); int max(int, int); void main(void) { cout << "The maximum of 100 and 200 is " << max(100, 200) << endl; cout << "The maximum of 5.4321 and 1.2345 is " << max(5.4321, 1.2345) << endl; } --------------------Configuration: Max_Temp - Win32 Debug-------------------- Linking... Max_Temp.obj : error LNK2001: unresolved external symbol "int __cdecl max(int,int)" (?max@@YAHHH@Z) Debug/Max_Temp.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. The problem seems with 'int max(int, int);'; after comment this line, no linking error DJ
-
what are differences when using RasDial and InternetDial?Maybe the question is what are differences between RAS (remote access service) and Internet dialup connection on WIndows platform? DJ
-
Modem dialup to retrieve data from SQL 2000 Server...Thanks a lots. The problem was caused by some OS modules corrupted in Win 2k. I changed to another SQL server on a third machine, now I can access via SQL Query Analyzer and my program. DJ
-
Though here is C++ but I have a database problem?Thanks a lots. The problem was caused by some OS modules corrupted in Win 2k. I changed to another SQL server on a third machine, now I can access via SQL Query Analyzer and my program. JW DJ
-
Though here is C++ but I have a database problem?But what I had done was to dial up directly into the DB Server from the PC client. and from either side, I can ping successfully to each other. SO there is no firewall between the PC client and The DB Server. Any suggestion? JW DJ
-
Modem dialup to retrieve data from SQL 2000 Server...I tried the IP address in SQL QUERY Analyzer. It did not work either. I am trying to access using code: sDSN = "Provider=sqloledb;" &_ "Data Source=TEST\SEAN;" &_ "Initial Catalog=test;" & _ "User Id=sa;" &_ "Password=password" \ thanks DJ
-
Modem dialup to retrieve data from SQL 2000 Server...thanks John, But the problem is after a dialup connection established between the PC Client and the DB Server, I could not login through The SQL Query Analyzer which resides on the PC side also. Error message says the DB ( on the DB Server) does not exist or access denied. COuld this be that the OS running on DB Server is Pro instead of win 2k Server? Any other ideas? JW DJ
-
Though here is C++ but I have a database problem?Sorry I forgot the problem description itself. The problem is that after the PC client and DB Server (currently SQL 2000 sever running on WIndows 2k Pro) were connected via a dialin service, from the PC site I can not see the DB on the DB Server, nor could I login to the SQL residing on DB Server of course. ANy idea, again? JW DJ
-
Modem dialup to retrieve data from SQL 2000 Server...thank you Mr.Prakash, The concern is the project budget instead of the connection speed as data will not be that big. You also are welcome to read the next message posted by me about this issue. JW DJ
-
use modem dialup to retrieve data from SQL 2000 Server...I am programming a program to use modem dialup to retrieve data from SQL 2000 Server... What would be a good solution for the connection betweeb a client PC and the server running SQL Server 2000? JW DJ