|
hello,
So I have written a little application in VC++, and I access a dBase files via ODBC. My development machine has a Win2k OS. I copy all .dbf and all .dbt files from my machine to another one with a WinXP OS.
When I start my application on both machines, I have discrepencies in the number of records returned by my SELECT statement even if the files are totally identical :
it seems than I receive deleted records on the XP machine. When I look at table used with FoxPro on my Win2k machine,all extra records have a black square -I assume this means deleted row? - at the beginning of the row) and that these deleted records are not returned on Win2k machine ...
1) does it look like an already known problem ?
2) on Win2k machine, the MSJET40.dll must be issued from a SP5 when i look at its version#: I wanted to upgrade it to the latest version SP8, but when I try to launch the upgrade exe, I receive an error message that tells me that I must at least be with SP3 ... How is this check performed ?
3) Is there a difference between MSJET on Win2k and winXP ?
Any information or solution is welcome ...
DD
|
|
|
|
|
Most likely the difference is due to the ODBC DSN settings. The Advanced options allow for inclusion or exclusion of deleted records. Check your DSN settings and make sure that they are identical on both machines.
onwards and upwards...
|
|
|
|
|
Hello,
yes, how stupid I am !!
you are totally right, I modified this option on my Win2k station and forget to say to do so when configuring the WinXP station.
Thanks
DD
|
|
|
|
|
My application (Windows service) should wait for new XML files arriving in a specified directory (those files are uploaded there by EXTERNAL FTP process) and process them. To do this I use notification mechanism based on "ReadDirectoryChangesW" API with "FILE_NOTIFY_CHANGE_FILE_NAME" flag. After receiving a new notification and filtering out everything except for "FILE_ACTION_ADDED" one, I start file processing (having a name of newly created file from notification) with MSXML parser.
And here's the problematic place:
If arriving XML file is big enough and "IXMLDOMDocument:load()" method gets called (from notification handler) before file is written down to the disk completelly, this call to load() method fails to complete the operation in the following ways:
- If "async" property of XMLDOMDocument was set to "FALSE", it just returns "FALSE" as a result.
- If "async" property was set to be "TRUE" - it returns immediatelly with TRUE, but every subsequent call to XMLDOMDocument (to getelement or whatever) fails with E_PENDING result. I tried to use "onreadychangestate" event notification mechanism to handle this asyncronous loading, but it always receives only "LOADING", "LOADED" and "INTERACTIVE" (1, 2 and 3) state change notifications and never receives "COMPLETED" (4) notification (and as a result it never lets me call any other methods on the document successfully).
Question(s):
1) is there any way to correctly handle this "SUPER_ASYNCRONOUS" load behaviour at the level of MSXML object.
2) if 1-st option is not possible - is there any way to WAIT in notification handler for the file to be completelly written down to the disk (by external process) before calling MSXML Document::load() method. Here I mean some "appropriate" solution with WaitFor..., async I/O notification handler or something like this - NOT JUST "Sleep( 10000 )" and 100 more attempts to try to load() in a loop.
Andrey
|
|
|
|
|
Hi Andrey,
Isn't the problem that the FTP download hasn't necessarilly completed when you get the initial notification? If so is there a way to check when the file is closed and trigger your MSXML action then. Another option would be to check if any processes have the file open and wait untill none do. Finally monitor the file size and when it stops changing trigger the action. This would be the least reliable.
Hope that helps.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Neville,
that's absolutely right - notification about creation of the file arrives earlier than file is uploaded completelly. But I thought, setting "async" property of XMLDocument to be "TRUE" should handle this scenario (from what I read from Documentation). What I could see from "practice" is it handles correctly only parsing "asyncronously", assuming file was completely written on the disk before. So, I agree with your suggestions, actually I thought about something like this, but:
1) I do not think last option is reliable because it depends of flushing of I/O buffers and will take some tricks to implement (which I think might make it very vulnerable)
2) For 1-st and 2-nd options (which for me sound very similar) I was not able to find "details"/"appropriate Win32 API" how to implement it. The uploading process is external, so I do not have an ability to check directly if file handle was closed.
Indirectly -
Neville Franks wrote:
to check if any processes have the file open and wait untill none do
- what functionality should be used to do this - attempt to CreateFile() with SHARE_EXCLUSIVE mode untill success? Is there any way to wait for file to be released by other process in some "Win32 API Wait()-function"?
Now I see only this solution:
for( int i = 0; i < MAX_OPEN_ATTEMPTS; ++i )
{
bool bOpen = OpenFile( EXCLUSIVE_MODE );
if( bOpen )
break;
Sleep( 1000 );
}
which I do not like because of some hardcoded Sleep statements and possible multiple attempts to open a file in an exclusive mode?
Thank you very much for your responce and I would appreciate if you have any other suggestions/comments.
Best regards,
Andrey
|
|
|
|
|
Hi Andrey,
I can't comment on MSXML I'm afraid as I have never used it. I use pugXml here on CP. Bit that won't help with this problem.
Check for exclusive file access is the approach I would take. However for this to work you have to know whether the FTP process uses exclusive access otherwise this may not work.
If it does then I would simply launch a thread which waited untill it could get exclusive access, which hopefully indicates the FTP process has finished. The thread would then trigger the MSXML parse. I can recommend ThreadLibrary which I use in ED, amongst lots of other thread code. See: http://www.codeproject.com/threads/threadlibrary.asp[^]
If none of this works have a look over at: http://www.sysinternals.com[^] Filemon v6.07 and Handle v2.10
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
#include "stdafx.h"
char lpBuffer[256]
{
GetPrivateProfileString()
"FYP.doc", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpDefault - in case file does not exist this is default
lpBuffer, // LPCTSTR lpReturnedString
256, // DWORD nSize
"File.ini" // LPCTSTR lpFileName
WritePrivateProfileString()
"FYP.doc", // LPCTSTR lpAppName
"MyKey1", // LPCTSTR lpKeyName
"0", // LPCTSTR lpString - whatever you want to save
"File.ini" // LPCTSTR lpFileName
}
return 0;
I got two error<br />
1)error C2239: unexpected token '{' following declaration of 'lpBuffer'<br />
2)error C2143: syntax error : missing ';' before 'return'<br />
<br />
Can someone help me debug these two error thanks
|
|
|
|
|
This code makes no sense.
lpBuffer[256] needs a semi-colon
What are the braces for?
Where's the function name?
Why are the strings not in the function calls?
The functions calls have no semi-colons.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
man... that's a weird piece of code!
Just 2 errors for this code snippet is amazing... so be happy
sorry... couldn't resist!
Regards, mYkel
|
|
|
|
|
In VC6 (SP5), when I do:
namespace minsk
{
void f();
};
using minsk::f;
using namespace misk;
void bar()
{
f();
}
I get "ambiguous call to overloaded function"
Is this standard compliant, or a VC6 issue?
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
using namespace f;
What is this for? Do you have a namespace f? I believe the proper call should be
using namespace minsk;
John
|
|
|
|
|
sorry - it is a 'using namespace minsk;'
(was a typo in the original post...)
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
In the edited version you should not need this line as it is redundant:
using minsk::f;
Is the function f() defined in any other namespace or the global namespace?
John
|
|
|
|
|
John M. Drescher wrote:
Is the function f() defined in any other namespace or the global namespace?
No
(I made an "empty" Windows console application to test that)
The problem occurs only if both using statements are there - but unfortunately, I almost can't avoid that.
it's amout std::min and std::max
I've got a library that tries to override the #define min / max in windef.h by using #defining NOMINMAX and using std::min; using std::max
This works well - until there's a .cpp (or a function) that a) says using namespace std and b) uses min and/or max
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
|
m mistake it is a 'using namespace minsk;'
(so VC seems to see two "paths" to the function)
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
Hi peterchen, from what you said this arose in connection with redefining std::min and std::max . Does this very example also fail? I mean, does the program
namespace minsk{
void f(){}
}
using minsk::f;
using namespace misk;
void bar(){
f();
}
int main()
{
bar();
return 0;
} fail? (I cannot check it myself, don't have my IDE handy.)
Also, could you post the entire error message?
PS. The semicolon after the closing namespace brace is unnecesary.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
yep, it fails. Error Message is
error C2668: 'f' : ambiguous call to overloaded function
I used an Windows Console Application / Empty Project, added a single .cpp and the following code:
namespace minsk
{
void f();
};
using minsk::f;
using namespace minsk;
int main()
{
f();
return 0;
}
so there is just this, nothing else (and standard project settings).
I can work around my problem for the current build environment, just it would be good to know if this is "normal" or just a VC6 bug
Flirt harder, I'm a coder.
mlog || Agile Programming | doxygen
|
|
|
|
|
I'm almost certain this is a VC6 bug. I can check tomorrow.
Meanwhile, the following workaround may prove good for you (although tou said you already had a solution):
namespace minsk
{
void f(){}
}
#ifdef f
#undef f
#endif
#define f ::minsk::f
using namespace minsk; Good luck!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can I get the date stamp of my running executable?
Ray
|
|
|
|
|
GetModuleFilename()
CFile::GetStatus()
- Examine the
m_ctime member /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I use the date stamp of my executable as the version number, which I append to the title of my main window. Here's how I get the info:
static char appVersion[30];<br />
<br />
void AteUtility_InitAppVersion (HINSTANCE hInstance)<br />
{<br />
char szFileName[MAX_PATH];<br />
char szFileTitle[MAX_PATH];<br />
WIN32_FIND_DATA fileData;<br />
FILETIME localModTime;<br />
SYSTEMTIME systemTime;<br />
<br />
GetModuleFileName (hInstance, szFileName, MAX_PATH);<br />
<br />
GetFileTitle (szFileName, szFileTitle, MAX_PATH);<br />
<br />
FindFirstFile (szFileName, &fileData);<br />
<br />
FileTimeToLocalFileTime (&fileData.ftLastWriteTime, &localModTime);<br />
FileTimeToSystemTime (&localModTime, &systemTime);<br />
<br />
sprintf(appVersion, "Version: %4.4d.%2.2d.%2.2d.%2.2d.%2.2d", systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wMinute);<br />
}
Hope this helps!
'til next we type...
HAVE FUN!! -- Jesse
|
|
|
|
|
I got this error of cv.lib not being able to open
What should i open the lib with?
Thanks
|
|
|
|
|
I can only guess, but it sounds like either the "cv.lib" doesn't exist,
means you don't have the library, or the path to the lib is not correct.
Perhaps you copied the sources from another machine and now Visual Studio
doesn't find the lib anymore.
Search your disk for the lib and enter the path to it... and everything
should work fine.
Regards, mYkel
|
|
|
|