|
Thanks, you are great henchook.
Rohit
|
|
|
|
|
Hi !
I'm thinking about using a CVS (I know there is a free one), but I'm wondering how it is to work with such a tool...
We'll be 4 people working on the same project (but on different classes), with Visual Studio 6. I guess the files will be stored on the server, but what happens when I want to compile my class, and test the whole project ? Are the files built on the server and the executable run on the server as well, or do I have a copy of the files on my local disk ?
Does any one have some experience with such a tool ?
Thanks !
Jerome
|
|
|
|
|
I used PVCS for a brief time (11+ years ago), moved to Microsoft Delta (it was either free or extremely cheap at that time), and most recently Microsoft Visual SourceSafe.
The files are stored in a proprietary format. If you are working on a team environment, this will most likely be a common folder out on some server. Each person installs their own copy of the software, and opens the same VSS database (it's actually just an INI file that has all the goodies about the underlying hierarchy). A VSS admin will add users and assign rights as necessary.
Typically, you will check out files or a whole project (to your own development area), make the appropriate changes, and check everything back in. The next person that comes along will check out the files s/he needs, makes the appropriate changes, and checks everything back in. If a file is checked out, no other person can check out that file (note: there are exceptions to this).
I personally don't store DLL, EXE or HLP files in VSS as they can easily be rebuilt and storing binary files takes up a lot of space.
Once a file has two or more versions, only the delta is stored. This keeps disk usage to a minimum. If you had a 10KB file and added a few lines to it, VSS will only store those lines that were added, rather than making a duplicate copy of the original 10KB plus the added lines. Its "differences" feature is used to see what was changed between version A and version B of a file. You can retrieve any version of a file with ease.
In some situations, a file can be checked out by more than one person. When the second person goes to check the file back in, VSS will go through some sort of intelligent merge. I've never used this feature so I cannot elaborate on it.
|
|
|
|
|
Dear All,
I am developing an application in MFC VC++ Version 6.0 for Windows 2000. Is there any API provided for finding extension name from a given path (except using CFile class)
eg.
c:\rfolder\mfolder\xyz.txt
OR
C:\Documents and Settings\Administrator.TEST\Cookies.txt
In both the above cases txt is the extension name
Feel free to ask any further queries in this regards,
Thanks
Rohit Dhamija
|
|
|
|
|
splitpath()
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
|
Dear friend,
splitpath solved my purpose,That was very useful.
Thanks a lot.
Rohit
|
|
|
|
|
How about searching the given string(file path) for the last occurrence of char ".", and anything on right side of that "." is considered the file extension?
|
|
|
|
|
Dear Abin,
How can you tell conclude that
C:\Documents and Settings\Administrator.DOMAIN
is a folder name or a file name from your algo ????
(Its a folder name having . on right side )
.............
I found a method
if(FILE_ATTRIBUTE_DIRECTORY == GetFileAttributes("c:\\Documents and Settings\\Administrator.TEST"))
{
cout<<"folder";
}
else
cout<<"file";
..............
Rohit
|
|
|
|
|
uh oh... Yeah your right.. hehe. But does "splitpath" work in this case?
|
|
|
|
|
Hi,
Yes abin,
I used _splitpath to find extension like this
char ext[MAX_EXT];
if(FILE_ATTRIBUTE_DIRECTORY == GetFileAttributes(buf.FileName))
/*buf.filename may contain file or folder, i donot know in advance*/
{
......//folder
....
}
else
{
//file
_splitpath( buf.FileName, NULL, NULL, NULL, ext );
//ext will contain the extension name
}
I suppose this is the correct way..Please send your useful suggestions .
Rohit
|
|
|
|
|
I have a VC++ Dialog application that creates a COM object and also spawns a thread using the AfxBeginThread Call.
from within my thread I do a PostMessage to my main thread to perform a function of the com object which usually crashes from within the thread . My code works perfect in the debug configuration
When i wanted to build the release version . My code is crashing after the point where I perfom POstmessage . 7 in 10 times my code crashes , remaining 3 times it works as expected . I really am not able to figure out what the error is . I have turned off optimizations(disable debug)for the release and still nothing is different .
The exact windows message while crashing is this :
the instruction at "0x(some address) " referenced memory at "0x(some address)". the memory could not be written !
Is there a way I can trap some error in the debug version . My debug version reports of one first chance exception . I really couldnt figure why that came ?
If someone has had experience with such cases it would be great if u can advise .
Thanks
|
|
|
|
|
Are you linking a debug library with your release build?
Matt Newman Sonork: 100:11179
"Whoa, that ruled! What function key do I gotta press to get that to happen again?" - Strong Bad
|
|
|
|
|
no i am doing it seperately . it crashes during the release build
|
|
|
|
|
Sounds like an uninitialized variable or stepping outside the bounds of an array somewhere, particularly since it seems nondeterministic.
- Mike
|
|
|
|
|
How did you handle the message in your main window? Some requirements differ in debug mode than in release mode. For example:
#define WM_MY_MSG WM_APP + 1000
class CMyWindow : public CWhatever
{
protected:
afx_msg LRESULT OnMyMsg(WPARAM wParam, LPARAM lParam);
};</code>
Please let us know if this solves your problem.
|
|
|
|
|
I dont have words to thank you . what you suggested seems to work .
Thanks a million . Out of curiousity , how does one come to realize such VC++ trivia ?
i really would have broken my head figuring this one out . Thanks all of u .
|
|
|
|
|
how does one come to realize such VC++ trivia ?
i really would have broken my head figuring this one out .
Only figured it out after I broke mine.
Just kidding. I remember a year back I got exactly same problem as yours and I failed to figure it out by myself after weeks of researching, so i came to codeproject and posted my question in this forum, someone, I forgot his name(I do feel sorry about forgetting his name), posted the answer which immediately solved my problem. Hehe, it's funny the same story happens again today just so that now you be the asker and I be the answerer, life looks like a circle sometimes no?
|
|
|
|
|
Hi,
I'm trying (unsuccessfully so far) to use VS .NET 2003 to write an ANSI C++ program. I'm trying to write a set of Gui classes ground-up (well, SDL-up anyway). Problem is, when I create my classes in VS.NET, with such well-used names as CWindow, CButton etc, I'm told that the classes already exist, and am disallowed from creating them myself.
Now, I know MFC/WTL whatever has these classes, but how do I get VS to ignore those classes, which I don't want, and create mine instead?
If I have to remove libraries, and can do so on a project basis, that's fine.
Any help appreciated.
Phaedrus
|
|
|
|
|
In fact, I can't believe the result myself. But from my simple test, i found the matrix with 1024 alike is much slowly in memory access than 1023 or 1025.
I dont know the real reason.
My test program is very simple. My aim is test the memory copy cost in a matrix.
There are three parameters to used, M for the size of matrix, N for the rows or columns try to copy, and Z is make the program run longer to get a stable result.
#include <stdio.h>
#include <time.h>
#include <memory.h>
#include <stdlib.h>
void main(int argc, char** argv)
{
int M,N,Z;
M = atoi(argv[1]);
N = atoi(argv[2]);
Z = atoi(argv[3]);
char *buf, *buf2;
buf = new char[M*M];
memset(buf, 1, M*M);
buf2 = new char[M*M];
memset(buf2, 2, M*M);
int i,j,k;
clock_t a = clock();
for (k=0; k<Z; k++)
memcpy(buf2, buf, N*M);
clock_t b = clock();
for (k=0; k<Z; k++)
{
for (i=0; i<M; i++)
memcpy(&buf2[i*M], &buf[i*M], N);
}
clock_t c = clock();
printf("cost1 %ld const2 %ld\n", b-a, c-b);
}
The result I got:
Z is always 100000
M N Cost1 Cost2
1023 3 47 6000
1024 3 62 22750
1025 3 47 6516
2047 3 110 28000
2048 3 94 57093
2049 3 94 45187
You can see the weird result, 1024, 2048 has the worst performance against the smaller or bigger number.
I always use the power of 2 as matrix's side, but the test show i am wrong.
But any guru can tell what's the exact reason inside?
|
|
|
|
|
From what I see here:
for (k=0; k<Z; k++)<br />
{<br />
for (i=0; i<M; i++)<br />
memcpy(&buf2[i*M], &buf[i*M], N);<br />
}
majority of time you are just copying 3 bytes (assuming N=3) and not 1023,1024 and etc...
On first iteration however, I would think you spend more time multiplying N*M and considering that N=3 in no case you get power of 2...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
The problem is not whether the script can be speed up or not. My script is just a speed tester.
The main trouble in the second loop.
Why 1024 perform much worse than 1023 and 1025 in the same program, even 1025 is bigger than 1024?
Any idea?
|
|
|
|
|
Why 1024 perform much worse than 1023 and 1025 in the same program, even 1025 is bigger than 1024?
You are not allocating 1024 bytes on the Heap and you are not copying 1024 bytes. So, what exactly you want to test?
If speed of memcpy -- then I'll give you an answer: the shorter the better -- just check the code: nothing specific to pow of 2...
If you assume that allocation with size 1024 would be alligned at 1024 address: wrong again -- that is true for HeapAlloc -- you are using new, which is default malloc that in reality is your requested size + 4 bytes in front to be returned by _msize()...
Now I agree, that getting non-linear results seems weird.
However, are you running any kind of optimization?...
I would recommend trying to decrease Z, while making N=M -- see what happens...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
In fact, i am working on a tiled image application, each tile sometime need several rows or columns of data in nearby tile. This is the reason i write the tester.
In this situation, you will find 1024 is not a good selection, even you create a matrix with side of 1025 (but not use the extended 1 pixel) will work better than exactly 1024.
I think i didn't turn on any special optimization. Just use the default release option as console in vs7. I also copy my tester to other pc. The result is almost the same.
PS. my Os is win2k, CPU is P4 1.7G, Memory 512M
|
|
|
|
|
I have an edit box. I click Properties, then Border
and the border of the edit box goes away. The problem
is, the text in the box now appears way in the upper
left corner. Is there any way to not have a border
and make the text start down just a pixel or 2 (and
maybe to the right by 1-pixel)???
Please any response anyone can give me will be greatly
appreciated.
Sincerly,
Danielle (an overworked graduate student)
|
|
|
|
|