|
CString str = _T("O'Reily");
str.Replace(_T("'"), _T(" ")); Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
My current project (a VC++/MFC program) needs to do a very lenghty
computation. I want to use multiple PCs running together to shorten the processing time.
Could anyone please give me some idea on how to write this program? What kind of technique I need to use, and what computer structure should I use (peer to peer, or client server)?
I really need some hints to start. Thanks a lot!!!
|
|
|
|
|
How parallelisable is the computation?
If there are lots of interdependant calculations, then you'll probably be wasting your time.
And typically, restating the algorithm differently and storing different data can assist in reducing this sort of computation - could you use eager and lazy evaluation at different points in your program to reduce the over all time taken?
I think you need to describe what your computation does in some detail before people can assist more.
--
Ian Darling
|
|
|
|
|
There are not many interdependant calculations. Actually, i need to generate a very large 2D matrix. And each element in this matrix is computed by the same algorithm.
The problem is the data source is very large (millions of images). So what I am thinking is to seperate the data source and put subsets of the data onto different PCs. So each PC can run the program at the same time to generate a small part of the big matrix. After all the small matrixes complete, the program will combine them together.
Is it a feasible way? Can anyone give me more ideas? Thanks!
|
|
|
|
|
You should ensure that the algorithms and implementation are as efficient as possible. Also look at profiling the code. I happilly use Glowcode for this www.glowcode.com[^]
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
You need to use the keyword extern in front of your variable declarations in the header
file. Then declare them without the extern in one of your implementation files.
e.g.
extern HANDLE g_hAbortThreadEvent;
#include "Header.h"
...
HANDLE g_hAbortThreadEvent = NULL;
main ()
{
g_hAbortThreadEvent = CreateEvent (....);
....
DeleteObject (g_hAbortThreadEvent);
}
#include "Header.h"
...
dwWait = WaitForSingleEvent (g_hAbortThreadEvent, ...);
Make sense now? By "implementing" the variable in the header file, you were actually implementing
it in each .c file, hence the linker confusion.
Iain.
|
|
|
|
|
I've had problems mixing .C and .CPP functions in the past. Is there a good reason you can't just
rename rs232.c to rs232.cpp and compile it as a c++ file? That should hopefully get rid of your
problems. You could probably lose the "C" part of the extern, making it much simpler to keep
track of things.
Someone else may have inspiration better than mine thought.
Iain.
|
|
|
|
|
hi there
thanks for the time!
the problem i am facing is that i wanted to create a Dispatch parameter array..Once i have created a var of the type using "new", how can i create an array of a given size and be able to assign variables and vts???
here is the code:
This code throws bad memory exception after the method is invoked a couple of times )
void Spread::AddSelection(long nRow1, long nCol1, long nRow2, long nCol2)
{
DISPPARAMS DispParam;
EXCEPINFO excep;
UINT nArgErr;
DispParam1.cArgs = 4; //number of arguments
DispParam1.cNamedArgs = 0;// Number of named arguments.
DispParam1.rgdispidNamedArgs = NULL ; // Dispatch IDs of named arguments.
DispParam1.rgvarg = new VARIANTARG();
//here i create a new ptr, but how do i create an array which may have variables of different vts and make this pointer point to it?
DispParam1.rgvarg->vt = VT_ARRAY;
DispParam1.rgvarg[3].vt = VT_I4;
DispParam1.rgvarg[3].lVal = nRow1;
DispParam1.rgvarg[2].vt = VT_I4;
DispParam1.rgvarg[2].lVal = nCol1;
DispParam1.rgvarg[1].vt = VT_I4;
DispParam1.rgvarg[1].lVal = nRow2;
DispParam1.rgvarg[0].vt = VT_I4;
DispParam1.rgvarg[0].lVal = nCol2;
ISpread::Invoke(ID_AddSelection , IID_NULL , 0 , 1, &DispParam1, NULL , &excep, &nArgErr);
}
please help
thanks
regards
|
|
|
|
|
You're trying to set 4 parameters, but only allocating memory for 1. You need to allocation 4 structures, not 1:
DispParam1.rgvarg = new VARIANTARG[4]; Remember to call
delete [] DispParm1.rgvarg; after the Invoke() method call.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
thanks a lot for this timely help!
kindest regards
safee
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
How can I programmatically know when any machine on my network accesses my machine through a share or through C$, D$ using admin priviledges?
Is it possible to know the logged in username also?
Thanks in advance.
With best regards,
Sayan
With best regards,
Sayan
Email:sayanmukherjee@indiatimes.com
|
|
|
|
|
Sayan Mukherjee wrote:
Is it possible to know the logged in username also?
GetUserName() will return the currently logged in user on the local machine.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi
What about c:\>NET Session at the command prompt.
best wishes ...mil10
|
|
|
|
|
Hello,
I'm using VC++ 6.0 and I want to change the background color of my CTreeCtrl object. I don't know how . Can anybody help me?
thanks in advance.
|
|
|
|
|
CTreeCtrl::SetBkColor()
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
thanks
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I've just started programming in VC++ and I've encountered some problems.
I'm accessing an Access database using DAO. This database contains two fields; a hyperlink (Addr) and a description of this hyperlink (Desc).
I've done that like this:
[code]
void CClientListDlg::RefreshList()
{
COleVariant var;
var.ChangeType(VT_BSTR, NULL);
CString Desc,Addr;
m_Desc.DeleteAllItems();
db.Open("List.mdb");
recset.Open(AFX_DAO_USE_DEFAULT_TYPE,"SELECT * FROM Clients",NULL);
while(!recset.IsEOF())
{
int i = 0;
recset.GetFieldValue("Desc",var);
Desc = (LPCSTR)var.pbstrVal;
m_Desc.InsertItem(i,Desc,0);
recset.GetFieldValue("Addr",var);
Addr = (LPCSTR)var.pbstrVal;
m_Desc.SetItemText(0,1,Addr);
i = i++;
recset.MoveNext();
}
recset.Close();
db.Close();
}
[/code]
Is it possible to let VC++ show this hyperlink (Addr) clickable?
Also, is there a routine to make my prog search through the database, preferably in both fields?
Sorry about the newbie questions, but as I said, I'm new at this.
Thanks in advance for all your help!
Greetz,
[NL]G}{0$T
..: [ Once Busted - Twice As Shy ] :..
|
|
|
|
|
1. Yes; by adding a click handler (or possibly a double-click handler) to the listview, you could then launch IE from there (by ShellExecute or some such).
2. If you want to search, you'd modify the SQL used to open the recordset.
You can do this modifying one of the member variables of the CDaoRecordset, setting it to something like
Addr LIKE '%codeproject%'
which would return all the hlinks containing codeproject.
(% might need to be a * depending on your version of Access).
Steve S
[This signature space available for rent]
|
|
|
|
|
Thank you for your quick reply..
You're right, I should ShellExecute IE, but how can I use a variable link in the command?
I've tried:
[code]
void CClientListDlg::OnDblclkClients(NMHDR* pNMHDR, LRESULT* pResult)
{
(32 >= (int)ShellExecute(NULL, "open", ADDRE, NULL, NULL, SW_SHOWNORMAL));
*pResult = 0;
}
[/code]
But this does't seem to work. It VC tells me that ADDRE is not defined..
Any suggestions?
Greetz,
[NL]G}{0$T
..: [ Once Busted - Twice As Shy ] :..
|
|
|
|
|
Steve S wrote:
[This signature space available for rent]
How much?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hiya I am using remove function to remove a file i.e
remove( "\\myfile.pmx" );
which works fine but when the file is in a directory i.e
remove( "dir\\myfile.pmx" );
It doesn't remove it. Any ideas??
thanks
|
|
|
|
|
Did you try with the complete file path?
|
|
|
|
|
Hi all,
how to use extended MAPI as redemption.dll is used..please check http://www.dimastr.com/redemption/security.htm for more details..I want to make something like that..so that when I access any object of outlook to post some data it doesnt show me any error..anyone has any clue about it..any ideas or tutorials or pointers are highly appreciated..
Thanks a lot in advance..
Himanshu
|
|
|
|