|
Let's hope both the sending and receiving end is in the same process-space.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
guys, any clue if LZMA could be parallelized to be run in some way that makes it worth being run on a GPU rather than over a CPU?
The idea is to compress text.
Also: which would be better : ctw or lzma ?
thanks
|
|
|
|
|
Don't know much about compression algorithsm and somesuch but to make the GPU do things for you i would look into programmable pixel/vertex shaders, CUDA[^] and ATI Stream[^], maybe one of those can help you get started.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
thx man. There is already a bzip cuda project but none that uses LZMA
|
|
|
|
|
If it is opensource then i guess checking it out can help learn how you could use it for LZMA. Just note that -as far as i know- CUDA works only on (newer?) nVidia cards and ATI Stream on (also newer?) ATI cards, so if you write a CUDA-based LZMA compressor/decompressor, it won't work on a computer which has an ATI or some intel-integrated graphics system. Correct me if i am wrong though.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Makes lots of sense. Here its one sample ( regarding what you mean). I placed the words dot instead of the "." to avoid being considered spam
http://bzip2-cuda.github dot com/[^]
|
|
|
|
|
hi there i have discussed my problems about multi linked list thread
http://www.codeproject.com/Messages/3876300/implementing-multi-linked-list-correctly_.aspx
but i recognize that it coldn't solved. my problem was about implementing a multi linked list which your list implemented by more than one cases. for example by first name or last name. so it have two header and tail pointers. the adding and building the list operations are succesfully working. and there is not a problem when i delete a node by "first_name" and when i search him again, the output is "not found". but when i search him by his "last_name" (so i using header pointer of last name here) the output becomes "person exist". i hope i explain my problem understandable : ). so i appreciated if you can help me.
here is my structures
typedef struct node {
int birth_date;
int zipcode;
int phone_num;
char first_name[50];
char last_name[50];
char city[50];
char address[50];
char email_addr[50];
struct node* fn_next;
struct node* fn_pre;
struct node* ln_next;
struct node* ln_pre;
struct node* birdat_next;
struct node* birdat_pre;
} NODE;
typedef struct {
int fn_count;
int ln_count;
NODE* fn_head;
NODE* ln_head;
NODE* fn_tail;
NODE* ln_tail;
}LIST;
and here is the block i call adding functions for name and surname;
while ( !feof(myfile) ) {
NODE* pnew_stu;
if( !(pnew_stu = (NODE*) malloc(sizeof(NODE))) ) {
printf("ERROR NOT ENOUGH MEMORY!!!\n");
exit(100);
}
fscanf(myfile,"%s", &(pnew_stu->first_name) );
fscanf(myfile,"%s", &(pnew_stu->last_name) );
fscanf(myfile,"%s", &(pnew_stu->email_addr) );
fscanf(myfile,"%d", &(pnew_stu->phone_num) );
fscanf(myfile,"%s", &(pnew_stu->address) );
fscanf(myfile,"%s", &(pnew_stu->city) );
fscanf(myfile,"%d", &(pnew_stu->zipcode) );
add_fn_Node(list,pnew_stu);
add_ln_Node(list,pnew_stu);
}
and of course my add functions;
void add_fn_Node(LIST* list, NODE* pnew_stu) {
NODE* temp = list->fn_head;
if( list->fn_head == NULL ) {
pnew_stu->fn_next = list->fn_head;
pnew_stu->fn_pre = list->fn_head;
list->fn_head = pnew_stu;
list->fn_count = 1;
return;
}
else {
temp = list->fn_head;
if ( (strcmp( pnew_stu->first_name, temp->first_name )) <= 0 ) {
pnew_stu->fn_next = temp;
pnew_stu->fn_pre = temp->fn_pre;
temp->fn_pre = pnew_stu;
list->fn_head = pnew_stu;
list->fn_count++;
return;
}
else {
while ( temp->fn_next != NULL ) {
if ( (strcmp( pnew_stu->first_name, temp->first_name ) >= 0 ) && (strcmp( pnew_stu->first_name, temp->fn_next->first_name) < 0)) {
pnew_stu->fn_next = temp->fn_next;
pnew_stu->fn_pre = temp;
temp->fn_next->fn_pre = pnew_stu;
temp->fn_next = pnew_stu;
list->fn_count++;
return;
}
temp = temp->fn_next;
}
if ( temp->fn_next == NULL ) {
temp->fn_next = pnew_stu;
pnew_stu->fn_pre = temp;
pnew_stu->fn_next = NULL;
list->fn_tail = pnew_stu;
list->fn_count++;
return;
}
}
}
}
void add_ln_Node(LIST* list, NODE* pnew_stu) {
NODE* temp = list->ln_head;
if( list->ln_head == NULL ) {
pnew_stu->ln_next = list->ln_head;
pnew_stu->ln_pre = list->ln_head;
list->ln_head = pnew_stu;
list->ln_count = 1;
return;
}
else {
temp = list->ln_head;
if ( (strcmp( pnew_stu->last_name, temp->last_name )) <= 0 ) {
pnew_stu->ln_next = temp;
pnew_stu->ln_pre = temp->ln_pre;
temp->ln_pre = pnew_stu;
list->ln_head = pnew_stu;
list->ln_count++;
return;
}
else {
while ( temp->ln_next != NULL ) {
if ( (strcmp( pnew_stu->last_name, temp->last_name ) >= 0 ) && (strcmp( pnew_stu->last_name, temp->ln_next->last_name) < 0)) {
pnew_stu->ln_next = temp->ln_next;
pnew_stu->ln_pre = temp;
temp->ln_next->ln_pre = pnew_stu;
temp->ln_next = pnew_stu;
list->ln_count++;
return;
}
temp = temp->ln_next;
}
if ( temp->ln_next == NULL ) {
temp->ln_next = pnew_stu;
pnew_stu->ln_pre = temp;
pnew_stu->ln_next = NULL;
list->ln_tail = pnew_stu;
list->ln_count++;
return;
}
}
}
}
|
|
|
|
|
I'm sorry to say but the concept has been fundamentally flawed from the start. What you want is something that behaves like a single collection ("persons"), to which you can add and remove; and which you can iterate in a couple of ways (first name A-Z, last name A-Z, first name Z-A, last name Z-A).
So you should implement that as a single list, with the one ADD method and the one REMOVE method, not multiples of them. And your ADD, REMOVE and possible other methods should all take care of all the sort orders and links themselves all the time. So ADD should accept one new node and update all relevant link chains; REMOVE likewise.
As long as you don't do it that way, it will be open to abuse; as in your user calling add_fn_Node() and not calling add_ln_Node().
BTW: one more piece of advice. Assuming the nodes are small, I very much prefer not to have a LIST structure at all, I just use one more NODE item. That is, my list is a NODE, its next field points to the first node, and the forward link chain ends on the last node, which has a next value of null); likewise my list NODE's prev field points to the last node, and the backward link chain ends on the first node, which has a prev value of null. Doing it that way takes less code, as there are no special cases, a list never being empty! (it always contains itself, the list NODE, which you obviously have to skip when enumerating the real nodes).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
well mate i guess i will do with your suggested way. one ADD and Remove function. hope i can do it in time. and for your last suggestion it is perfect!! but i have corner cases.
|
|
|
|
|
i agree with Luc
i'd do it the following way to get it done quickly
1. Maintain a naturally ordered list of all the items
2. Have an ordered list each for surname and firstname; these lists simply reference the index into the ordered list
Adding is cheap, iterating is cheap, finding is cheap (b-chop), removal is 'difficult'
Add - add item to back of natural order list, qsort the item index into each of the ordered lists
Remove - find the item in either sorted list, mark the item in the ordered list as dead - you can't delete it or you'll ruin the indices
ie
Natural Order (includes ALL item data)
Sarah Connor
Jack Black
Pete Jones
Stan Smith
Surname Order (just index into Natural Order)
1
0
2
3
Firstname Order (just index into Natural Order)
2
1
0
3
|
|
|
|
|
i don't understand the operation you said "mark the item in the ordered list as dead - you can't delete it or you'll ruin the indices". how can i do this_?. i am using free(nameofptr) function to delete the node_?.
|
|
|
|
|
Missed a step in removal - sorry
You can remove references in the ordered lists, but you can't remove the real record in the natural list
Have a bool in the struct that signifies if it's a dead record, don't bother free'ing it until the end of the application - unless you're turning records over dramatically, that will be ok
|
|
|
|
|
Hi
I'm experiencing problem with a program written in Visual c++ 2010 which I have a hard time to get my head around, hence the vague title.
My current setup consist of three computers: one laptop with 32 bit windows 7 that I use to execute programs on two stationary acquisition computers (let call them computer1 and computer2) with 64 bits Windows 7 SP1. They are connected via to each other via a router but not to the internet.
The software I'm developing is used to collect images from a number of ccd-cameras and processing them before saving them to disk (locally on the acquisition computers). Up to this Thursday the setup worked fine and I was able to initiate an acquisition on computer 1 and 2 (actually I've been using a setup with only the laptop and computer1 for a while without a problem and I recently added computer 2 to the setup and it worked well during some initial tests).
But suddenly the programs didn't work when starting them from remote. When I tried to execute the programs locally on computer 1 and 2 I got a fatal error with the following problem details:
Problem signature:
Problem Event Name: BEX64
Application Name: InSPECTAcq.exe
Application Version: 0.0.0.0
Application Timestamp: 4d3835c6
Fault Module Name: MSVCR100.dll
Fault Module Version: 10.0.30319.1
Fault Module Timestamp: 4ba220dc
Exception Offset: 000000000007038c
Exception Code: c0000417
Exception Data: 0000000000000000
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1053
Additional Information 1: f503
Additional Information 2: f50339e4695bb8971ce0650d6fc2205f
Additional Information 3: 1b95
Additional Information 4: 1b9522b9b1d4e5399b7b8e17148306fd
So I decided to recompile it to see if I could make some sense of it all. When I debug I get an debug assertation failure and I pointed towards line 65 in dgbhook.c.
void __cdecl _CRT_DEBUGGER_HOOK(int _Reserved)
{
(_Reserved);
_debugger_hook_dummy = 0;
}
In the call stack looks like follows
InSPECT_Labview_2.exe!__crt_debugger_hook(int _Reserved) Line 65 C
InSPECT_Labview_2.exe!_call_reportfault(int nDbgHookCode, unsigned long dwExceptionCode, unsigned long dwExceptionFlags) Line 170 C++
InSPECT_Labview_2.exe!_invoke_watson(const wchar_t * pszExpression, const wchar_t * pszFunction, const wchar_t * pszFile, unsigned int nLine, unsigned __int64 pReserved) Line 156 C++
InSPECT_Labview_2.exe!_invalid_parameter(const wchar_t * pszExpression, const wchar_t * pszFunction, const wchar_t * pszFile, unsigned int nLine, unsigned __int64 pReserved) Line 110 + 0xf bytes C++
InSPECT_Labview_2.exe!_invalid_parameter_noinfo() Line 122 C++
> InSPECT_Labview_2.exe!fwrite(const void * buffer, unsigned __int64 size, unsigned __int64 count, _iobuf * stream) Line 77 + 0x1c bytes C
InSPECT_Labview_2.exe!doCentriodCalc(AcqParameters * acqPara, int iCurrentCam) Line 488 C++
InSPECT_Labview_2.exe!grabFrame(FlyCaptureVideoMode * VIDEOMODE, FlyCaptureFrameRate * FRAMERATE, AcqParameters * acqPara) Line 176 + 0xb bytes C++
InSPECT_Labview_2.exe!main(int argc, char * * argv) Line 78 C++
InSPECT_Labview_2.exe!__tmainCRTStartup() Line 278 + 0x12 bytes C
kernel32.dll!0000000076c1652d()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!0000000076d4c521()
It seems like the debugger has some problem with the fwrite function on line 488. It is part of a series of fwrite function that look like this.
fwrite(¤t_frame, sizeof(signed int), 1, cluster_file[iCurrentCam]);
fwrite(&cluster_dim, sizeof(signed int), 1, cluster_file[iCurrentCam]);
fwrite(&cluster_row_start, sizeof(signed int), 1, cluster_file[iCurrentCam]);
fwrite(&cluster_col_start, sizeof(signed int), 1, cluster_file[iCurrentCam]);
fwrite(¤t_frame, sizeof(signed int), 1, median_cluster_file[iCurrentCam]);
Line 488 fwrite(&cluster_dim, sizeof(signed int), 1, median_cluster_file[iCurrentCam]);
fwrite(&cluster_row_start, sizeof(signed int), 1, median_cluster_file[iCurrentCam]);
fwrite(&cluster_col_start, sizeof(signed int), 1, median_cluster_file[iCurrentCam]);
for(m = 0; m < cluster_dim; m++)
{
for(n = 0; n < cluster_dim; n++)
{
cluster_pixel_int = (signed int)original_array[iCurrentCam][cluster_row_start + m][cluster_col_start + n];
fwrite(&cluster_pixel_int, sizeof(signed int), 1, cluster_file[iCurrentCam]);
cluster_pixel_int = (signed int)smooth_array[cluster_row_start + m][cluster_col_start + n];
fwrite(&cluster_pixel_int, sizeof(signed int), 1, median_cluster_file[iCurrentCam]);
}
}
This problem occurred simultaneously on both computers. Since MSVCR100.dll was mentioned I downloaded the redistributable package and installed it from Microsofts web page but it didn't make any difference. So I then tried to compile my source code on the 32-bit laptop and then it works just fine (!), both to compile and debug aswell as running the executable. This makes me believe that the problem isn't related to my code but rather to the OS. I haven't made any updates to any and the computers OS or to VS studios, and the computers aren't connected to internet which I guess rules out automatic updates.
I would be thankful if someone could help me solve this (deadline on tuesday! ). This is my first post here at CP and if there is anything you want me to do different please let me know.
Best regards
/Mikael
|
|
|
|
|
I don't know, however Google tells me BEX64 is some kind of buffer overflow, and may be related to Data Execution Prevention[^]. As the linked MSDN says, DEP is a security feature, you could turn it off at your own risk.
Apart from that I can only suggest you check what cluster_dim is, and how it has been dimensioned.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for your suggestions.
I've tried turning the DEP off but I can't because the exe file is 64-bit.
For a short while I got my setup with laptop and one acquisition computer to work, but now its back to the same error message as before. I use PSexec to remotly start the executables and I haven't been able to confirm its compatibility with windows 7 x64 so I think that my next step is to install x32 bit versions on my two acquisition computers.
|
|
|
|
|
I got this exact exception by calling _wcslwr_s_l() (in place to lowercase) on memory returned from CommandLineToArgvW(). I fixed it by making my own copy of the value.
It is probably a bad idea to mess with memory returned from the Shell API.
Hope this helps!
Kelly MacInnis
|
|
|
|
|
Hi
I have an MFC Project, and what this project does is to allow a user to Open an in a number of different way, either a new email message, a new email message using a template or open an existing email message. The MFC is part of a much larger application and some of the data for selecting the correct email templates and opening an existing email comes from a web service.
My MFC Project works to a certain, I can get Outlook, I can get my Web Service with my email template, but when I reach the point of Open the Email either a new one, open or otherwise it fails. Here is my code snippet:
CString emailPath;
LPDISPATCH mailItem;
static BYTE params [] = VIS_BSTR VTS_VARIANT ;
m_outlook->(0x10a, DISPATCH_METHOD, VT_DISPATCH, (void*)&mailItem, params, emailPath, NULL) //falls over here!
outlookMailItem = new COleDispatchDriver(mailItem);
What I have done wrong?
Thanks
|
|
|
|
|
Member 2972992 wrote: //falls over
Who falls over, the programmer or the user?
If you want a serious answer then try posting a serious question. Explain what actually happens in your program:
- do you receive an error response, and if so what is its value
- do you get an exception, and if so ...
- does your program cause a system error, and if so ...
- ...
I trust you get the idea.
The best things in life are not things.
|
|
|
|
|
The Code is running in TstCon.Exe as attached process in VS2010 with break points at certain points. The exception is thrown by Outlook 2003. If I leave the parameters as they are, I get a Message box showing an Unhandled Exception with a lot of Hex Numbers in VS2010. If I change some of the parameters, to the ones shown below:
static BYTE params [] = VTS_I4 ;
InvokeHelper(0x10b //Everything else as before
Then I see the exception thrown as Outlook Error in the GUI of TstCon.Exe not in VS2010 on a breakpoint. There are two errors I get depending upon the value I have for the first parameter (either 0x10a or 0x10b) and keeping the params as VTS_I4 - one says "Unable to Open file xxxx [xxxx being a number]. Check the permissions or check to see the file exists." or "Could not complete the operation. One or more parameter values are not valid".
It is the program that is causing the error, which is rooted with one of the parameters not being correct, or needing a different parameter to open the open the email.
|
|
|
|
|
Both of these errors seem quite clear as to the problem, so you need to check your parameters against what is required in the MSDN documentation.
The best things in life are not things.
|
|
|
|
|
Hi
Thanks for replying & for helping me!
Would you mind giving me a steer where in MSDN massive library where I can find a list of all the parameters that is expected when opening an email with a template?
Thanks
|
|
|
|
|
Just go to MSDN and use the search box for the function that you are trying to use.
The best things in life are not things.
|
|
|
|
|
Thanks
I will have ago to see if I can find what I need, but do you mind if I can call on your help if I get stuck?
|
|
|
|
|
I am afraid I have not used this function myself, but here[^] is a link that may be of use.
The best things in life are not things.
|
|
|
|
|
what object is m_outlook and what method is 0x10a ?
I don't think your problem is with invokeHelper, I think it's with the underlying method in the m_outlook object
|
|
|
|
|