|
I think it should be the other way round - if it fails, you should leak because you should call e1->Delete() in the catch handler.
MS does something a little odd in AfxThrowDBException - it creates the exception on the heap then throws a pointer to it.
|
|
|
|
|
Hi all,
In old windows versions exist an activex which called Kodak imaging ...
That contains some controls on image - scanner and ...
Could you tell me where i can download it from ?
yes, i want to download the Kodak activex ...
other question, can you tell me good activex about working with scanners ???
Thanks.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I am working on an NT service. One of my classes is used mostly for read-only lookups into a stl map. Probably 70% of the calls made to this class are read-only requests and change no data members. The other 30% add or remove members from the intenal map object.
This class is called by as many as 200 threads and is used quite a bit. Currently I have it coded so that it locks the entire class during each function call regardless of whether or not that function does an update.
Anyway, I have spent a couple of hours searching the web for an open-source implementation of a read many, write once locking mechinism. I have developed a class to facilitate this and its almost done, but I thought before I bothered to finish it I would check here.
the question:
Does anyone know where I can get a pre-packaged Read/write locking class?
Thanks,
Matt Gullett
PS. If I have to finish my class I will post it to Code Project.
|
|
|
|
|
Matt Gullett wrote:
Does anyone know where I can get a pre-packaged Read/write locking class?
I just saw one whilst flipping through Richter's Advanced Windows. I'm not near the CD now, but search MSDN, the code might be up there. He called it SWMRG (single writer multiple reader guard).
--Mike--
Buy me stuff!
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Thanks for the reply.
So far, no luck with MSDN but I am trying google now.
|
|
|
|
|
I'm afraid you won't find anything useful on google (at least I didn't).
The only good (non writer-starving) solution for Windows is the one given in the 4th edition of the Richter's book. Of course, with pthreads and condition variables it is much easier to implement RW locks; maybe you can look for a pthreads library for Windows.
I vote pro drink
|
|
|
|
|
We use the very cool open source library ACE (see http://deuce.doc.wustl.edu/) for this kind of thing. If all you need is a read/write lock, it is overkill, but you might get some ideas from the source. I am sure that you can find one on the net somewhere, take a look at the links section on the C/C++ users journal web site (www.cuj.com) or cetus-links (http://www.cetus-links.com/).
Since you have such a large percentage of writers, a better approach would be to use multiple maps and distribute the data evenly across the maps. For example, if your key is a string you can hash it and mod by the number of maps to figure out which one the data belongs to. Each map would have its own critical section structure which you would lock before you read or write to that map.
If your data set is predictable, you can build a function that results in even distribution of the data across the maps. If your data set is not predictable, use a large number of maps and a good hash function to minimize contention.
Chris Hafey
|
|
|
|
|
There was an article about this in the May 2002 issue of C/C++ User's Journal. www.cuj.com.
|
|
|
|
|
ok... "doesnt matter by opinion of what is over my head" i am wondering if there is any really good books that go over the following info:
~How to represent data
~data abstraction
~programming concepts
~Algerithms
~Searching, sorting - abstract data types
Titles of the books are great, links are cool, opinions are best "with titles "
Thanks for the help "and opinions"
~SilverShalkin
|
|
|
|
|
There are a lot of good books out there... i hope to read them someday
A couple that i feel helped me quite a bit:
The C Programming Language Brian
W. Kernighan and Dennis M. Ritchie
Starting Forth Leo Brodie
No the last one has nothing to do with C or C++. It is still a very good book.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
SilverShalkin wrote:
How to represent data
Surely the current trendy answer to that is XML
SilverShalkin wrote:
programming concepts
What do you mean ?
SilverShalkin wrote:
Algerithms
For both algorithms and data representation, you probably should start with a book on the STL, rather than reinvent the whell. I have an O'Reilly book called Mastering Algorithms in C that I am glad I read, but I won't do any of it, because the STL does it for me. The C++ Programming Language by Bjarne Stroustrup has a good intro to STL, otherwise, STL Tutorial and Reference from Addison Wesley is a good place to start.
SilverShalkin wrote:
Searching, sorting - abstract data types
Again, you should be using the STL, but Mastering algorithms in C is a good book to help you understand what it is doing for you.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
introduction to algorithms by thomas cormen et al is a seminal work imho
code complete by steve mcconnell is a must have as well
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Thanks,... ill go and check them out...
Mastering Algorithms in c
Introduction to Algorithms
Code Complete
And read up on STL.
Thanks!
~SilverShalkin
|
|
|
|
|
There is a good book called C++ Plus Data Structures... it covers all of what you've asked about above but it doesn't go into massive detail.
SilverShalkin wrote:
~Algerithms
~Searching, sorting - abstract data types
Try the STL...
Now taking suggestionsfor a new sig. please email me all suggestions.
|
|
|
|
|
Writing Solid Code
Code Complete
Michael
Communication is the first step towards enlightenment.
|
|
|
|
|
I've created a managed C++ web service.
Whenever I try to 'run' it, it pops open an IE window, and instead of opening the file, it tries to download it.
If I click 'open', it the opens up the file in VS.NET. It is one line, reading:
<%@ WebService Class=StarKingdomsForceCalc.Class1 %>
Why is it doing this?
And what do I need to do to fix it?
I've tried uninstalling/reinstalling IIS, and rerunning the Windows Component Update... it seems like no matter HOW MANY times I run it, these three are always in the list:
Microsoft Frontpage 2000 Web Extensions Client
Setup Runtime Files
Microsoft .NET Framework
I've installed these repeatedly, but they always come up...
What can I do??
Thanks!
Adam Clauss
cabadam@tamu.edu
|
|
|
|
|
Hi, just a quick (and probably very stupid) question about mcisendstring...
I am using these commands to play an AVI file:
mciSendString("open c:\\test.avi" type avivideo alias testvid,NULL,0,NULL);
mciSendString("play testvid fullscreen",NULL,0,NULL);
It plays the video with sound, but the video is distorted and looks as though it is only 256-color rather than 16-bit or whatever - ie. it looks terrible. Is this to do with the palette, or dithering, or something? Is there a way I can change the settings so it plays properly?
I know this is probably a very basic question, but I would be very grateful if anybody could tell me what I'm doing wrong.
Many thanks,
Keith
|
|
|
|
|
Without seeing the video it's hard to say. My guess from reading your description of the error and looking at the code is that you have a video that was shot at a certain resolution and you're trying to display it in fullscreen and it's becoming distorted as a result. To test my theory, remove the fullscreen part of the command being sent to the second call of mciSendString. If the video shows up in a small window, but with a much better clarity then I'm right.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Hi, thanks a lot for your reply, but I don't think this is the problem. I have played the AVI full screen via Windows Media Player and other apps and it looks fine; it's not the resolution, but the colours. As though it's being forced into 8-bit mode or something like that. I've never used the mciSendString instructions before, so I don't know if you need to select better drivers or force it into 16-bit or something like that?
Again, thanks for any help.
All the best,
Keith
|
|
|
|
|
In that case, you might want to check out the MCIWndSetPalette function.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
How to capture the debug output of your system?
In short, I am trying to write something like DebugView (from
sysinternals.com) or TraceWin (Paul Delascia) kind of thing.
Any help will be appriciated.
Thx,
|
|
|
|
|
|
Hello,
I need to visualize a graph - simple nodes (rectangles or bitmaps) that are connected by an edge (line). It must be possible to move the nodes and the edges have to update to the new position of their target/Source node.
It's like an organization chart. How should I do that? Try to extend CListView? If so, how can I achieve that items in ICON Mode are moevable (as they are in the windows explorer)?
Any help apreciated!
Best regards,
Alexander
|
|
|
|
|
Hello, everyone!
I have a very complicated question (it seems to be one for me): I want to write a program in MFC (not ATL!) which behaves similar to the visual basic forms designer. I want to select different activex controls of my system, place them dynamically on a CView derived class and eventually want to embed vbscript to drive them. So i created a standard mdi application with activex support. Using the view class there is no problem to insert an activex control with CreateControl(...), it will be displayed and seems to be activated in-place, so far, so good. How can I disable/enable the control in the meaning of runtime / designtime mode? How to get events from the control? Up to now I was not able to find any description how to implement such a feature! There was something said about ambient properties, but how? Does anybody have an idea, how to do this?
|
|
|
|
|
Run-Time Check Failure #2 - Stack around the variable 'strReturn' was corrupted.
The following code bloack is giving me this error.
char *ProcessOBeginning(char *word, int *change)
{
char *Position = strpbrk(word,"oO");
if(Position)
if(isBeginning(Position,word))
{
if(isupper(Position[0]))
{
char strReturn[] = "O";
word = strcat(strReturn,word);
}
else
{
char strReturn[] = "o";
word = strcat(strReturn,word);
}
}
return word;
}
I think that it has todo with strReturn being allocated but I am not allowed to use memory management funcs for my project.
Steve
Not all who wander are lost...
|
|
|
|