|
sorry,
my question is how do u test sorting algorithms for stability by using % and / as predicate and why use % and /
like in merge sort ,u not suppose to swap the same element which its stable sort
but how do u prove its stable
thx
1
|
|
|
|
|
Hello,
I normally don't prove the stability of an algorithm with a test program. I prove the stability and correctness of my algorithm using math. It's difficult to explain and even harder to do, but if you can do it, it's an powefull tool in your toolbox. I'm just glad that I don't have to use it much..
A test program is there to help you resolve bugs in the implementation of your algorithm. Often, test programs are written for stress testing and preformance measuring.
If you want to prove your algoritm with a test program, you should have lots of data. You can choose the data carefully or use random data. The benefit of random data is that it mightsaves you a lot of work early in the process, but can cost you much more if you miss the hard-to-detect bug. Choosing your data carefully reduces the change that you miss a bug, but takes a lot of time early in the process. If you already verified the correctness of your algorithm, you should choose the random number approach and do a lot of stress testing (let your algorithm process HUGE amounts of data and see how it performs). If you want to debug your algorithm, you should carefully pick a sequence of data that you expect to give problems. These sequences can be very small.
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Without any code added for validations if I simply send IDOK on the sheet, i have it call IDOK on all its member pages which causes an assertion failure. But the problem is does not happen when one activate all pages of the property sheet before IDOK.
guesses are calling of UpdateData before the dialog is initialized might be causing the problem.
Could someone explain the working of CPropertySheet::AddPages()??
does it take care of initializing the dialog of its member pages?
Thanks in advance
|
|
|
|
|
The PropertyPages are not true 'windows' until you activate them or go to them using the tab or the next/back butons if it is a wizard. Otherwise, you just have the instance of the wrapper class, but no window exists yet.
You could check some of their member variables, such as m_hWnd to see if there is really a 'window' there before sending a property page any messages. Otherwise, you can declare a 'initialized' member variable for each property page and then set it to true in an OnInitDialog handler. Check this variable before sending a property page any messages.
|
|
|
|
|
thanks a lot, didn't know dat and never seen samples using this technique.
now d appl works fine. thanks again
|
|
|
|
|
thanks a lot for the info, the crash got resolved but now I am faced with a new issue.
I am initializing CDateTimeControl with current date on CPorpertyPage::InitDialog(). I have a random crash which appears and disappears with time, and it does not occur at my end.
Also the crash occurs when the exe is built at my end but does not occur when built at some other machine even when I comment out the code being executed on InitDialog().
Module:
File: i386\chkesp.c
Line: 42
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
the above is the error msg I get on a crash, cud u pls help me diagnose this prob?
|
|
|
|
|
In order to use common controls on a dialog box, you need to call InitCommonControlsEx or AFXInitCommonControls before you create the dialog box.
Make sure you do this in your main property sheet before any of the dialogs with the comon controls are created.
Ask someone who has a machine that crashes to verify the DLL containing the date-time picker is the same version as the one you have. If it is not, then you will have to make sure the correct version is on a system prior to running your program or prior to activiating the property pages with the date-time pickers on them. This might explain why you don't see the crash, and why anyone who builds it does not either.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Hi Everybody.................
Can any one of u please guide me
"How to run a project in service mode"
Thanku in Advance
Dilip
|
|
|
|
|
|
For a simplier an fast way use XYNTservice[^]
Good luck,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
thelip2005 wrote: "How to run a project in service mode"
navigate to this link
http://www.codeproject.com/system#service[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
in my CDHtmlDialog window I have a iframe which displays another webpage. The problem ist, that I don't receive any DHTML_EVENT_ONCLICK events since the iframe contains another IE window. My question is now how to connect the DHTML_EVENT_MAP of my main CDHtmlDialog with my iframe window so that I can react to any actions performed in the iframe as well as the main dialog.
any suggestions?
./regards
Florian
|
|
|
|
|
Hi All,
I want to get the printout of an access table but when i open it & print it, i only get the first record printed.What may be wrong? Here are the two lines for opening & printing that i am using:
oDoCmd.OpenTable(_variant_t("recipe"),0,1);
oDoCmd.PrintOut(1,_variant_t("1"),_variant_z("1"),1L,_variant_t("1"),_variant_t("1"));
May be the problem is because whenever the table is opened its first record is already selected by default.perhaps, all the records need to be selected. How can i do that. i am using vc++ 6.0 & ms-access 2000.
Please Help. it is urgent.
Regards,
Ankush Mehta
|
|
|
|
|
What is DoCmd ?
I mean what type of object is it
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
it is used in access automation.see object model documentation for automating ms office.
hierarchical object model is used for office automation.
see msdn for details.
Regards,
Ankush Mehta
Ankush Mehta,
Dewsoft Solutions,
Mumbai
|
|
|
|
|
Ankush Mehta wrote: oDoCmd.PrintOut(1,_variant_t("1"),_variant_z("1"),1L,_variant_t("1"),_variant_t("1"));
Your arguments are wrong for the Printout command.
acPrintAll == 0
acSelection == 1
acPages == 2
BTW, there shouldn’t be any need to recast (all though I’m not completely sure about that) as all of the arguments are integers.
Good luck...
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
sfdougl wrote: oDoCmd.PrintOut(1,_variant_t("1"),_variant_z("1"),1L,_variant_t("1"),_variant_t("1"));
Thanks, First argument must be zero(print all).But as per VBA documentation second & third arguments(from page, to page) should be omitted.This doesn't work out in VC++.Error is- error C2660: 'PrintOut' : function does not take 4 parameters.
We need to type cast since these are of type variant in vc++.
Any idea buddy 4 d solution.Can u possibly suggest me how to have the number of tables and their names in ms access database.
Thanks in anticipation,
Ankush Mehta
|
|
|
|
|
Ankush Mehta wrote: First argument must be zero(print all).
Yup that’s why I mentioned it; your first argument is 1 which is print selection, in other words the currently selected record. Change that argument to a 0.
Ankush Mehta wrote: per VBA documentation second & third arguments(from page, to page) should be omitted
Im no where near a complier to test this but if 1 is causing an error try -1.
Ankush Mehta wrote: Can u possibly suggest me how to have the number of tables and their names in ms access database.
You can query Acces for tables i.e.
SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Name) Like "Table Name"
or simply
SELECT MSysObjects.Name FROM MSysObjects
Hows that?
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
How can i query that using vc++?Please suggest.
Let me restate the problem.
I want to print an entire ms access table using vc++.Unfortunately, the code works fine for vb(in which if first argument of printout is 0, there is no need for second & third argument).The same thing in vc++ is not supported, it asks for all six arguments
DoCmd.PrintOut [printrange][, pagefrom] [,pageto][, printquality][, copies][, collatecopies]:
Ankush Mehta
|
|
|
|
|
Ankush Mehta wrote: Let me restate the problem.
I want to print an entire ms access table using vc++.
Does your app have to use office automaiton?
If so have you looked at CAccessReports class[^]
Alternatively I have always wanted to use this library Report Generator[^]
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
I developed a MDI Doc/View Application in MFC with Splitter windows(3 pans). Each view of pan contains item list in TreeView form. When any one of these pan had focus i couldn't get ToolTip from ToolBar. If i close the pan which contains the focus then I could get ToolTip. What could be the possible reason?
Direction regarding this is highly appreciated.
Thanks and regards,
Rajan
"I'mpossible = Impossible"
|
|
|
|
|
I've been tossing this one around for days and can't figure it out. I'm trying to dynamically load DLLs using the LoadLibrary/GetProcAddress method. I know I've loaded the library, but I can't get GetProcAddress to find the function. Here's the code.
<br />
private:<br />
typedef Object __gc * (__cdecl *Builder)();<br />
Builder build;<br />
HINSTANCE library;<br />
FARPROC holder;<br />
Object * wompi;<br />
<br />
DLLoader::DLLoader()<br />
{<br />
library = LoadLibrary(_T("LeetTrans"));<br />
if(library != NULL)<br />
{<br />
<br />
holder = GetProcAddress(library,_T("Build"));<br />
if (holder != NULL)<br />
{<br />
build = (Object __gc*(*)()) holder;<br />
wompi = build();<br />
}<br />
}<br />
}<br />
<br />
Object __gc * __cdecl Build()<br />
{<br />
LeetTrans * a = new LeetTrans();<br />
return a;<br />
}<br />
<br />
Object __gc * __cdecl Build();<br />
And finally, here's the stuff from the .DEF file in the DLL. I don't even know if I need this:
LIBRARY "LeetTrans"
EXPORTS
Build @1
I don't know what else to do. Anyone can even lead me in the right direction? Thank you in advance for any help.
|
|
|
|
|
holder = GetProcAddress(library,_T("Build"));
mention the function ordinal in place of _T("Build")
|
|
|
|
|
This could really work, but I don't know how to mention the ordinal in LPCSTR format so that GetProcAddress will understand it.
I'm SOOOOOOO close! Once I get this, I'm pretty sure the rest of the program will fall into place! Thanks to everyone for your help. Wow i've had too much caffeine.
|
|
|
|
|
Ok for starters drop the _T macro from the GetProcAddress call, function names in libraries aren't stored in Unicode - you'll just get compiler errors when you trying moving to a Unicode build.
Next try searching under the Visual Studio folder for a file called 'depends.exe' and open the DLL using it, it will show show you a list of all the functions exported by the library. Check the function is being exported with the name you think it should be, the chances are it's not and it's got a load of giberish trailing after it. If it does you will need to declare any functions you wish to export using the extern "C" keyword, if your not sure what it does check MSDN for more details[^] but it basically tells the compiler to export the function without mangling the export name - sorry thats a really bad explanation of what it's doing but i'm just entering my 28th hour of a serious coding session and running low on coffee
Gavin Taylor
w: http://www.gavintaylor.co.uk
|
|
|
|