|
|
In effect much of my coding is based on such articles , and of course on MSDN too ...
But seems like there's something at a lower level to be analized ....
|
|
|
|
|
Hello everyone,
I have several physical file and I want to use file map (MapViewOfFileEx) to map the file into memory to improve performance. Each file is about several hundred M bytes. All the memory mapped files are kept open during my application.
The mapping is successful, but the strange thing is,
1. the performance to access the files which are opened at first is very fast;
2. the performance to access the files which are opened later is slower and slower (the performance to access the 10th file is very bad).
Any ideas to improve performance?
thanks in advance,
George
|
|
|
|
|
Buy memory.
Probably memory is swapped again to disk.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
More RAM is the only true religion when it comes to this sort of performance. If you have plenty and aren't getting the performance anyway then try fiddling the size of something called Non-Paged Pool. This is memory that doesn't get swapped out, ever, so be careful. I've seen this trick used on a dedicated system to allow a 2GHz Pentium 4 to do 16 simultaneous audio transforms and recordings off a bunch of 100MB Ethernet cards while serving the audio over the Web. Is that my PCI bus I can smell burning
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
All,
I have a doubt whether two different threads can be working on a same socket descriptor(handle in windows terminology)?
Please go through the following scenario:
We have one device which supports TCP/IP:
1. Responds to the requests
2. Sends notifications, incase any events
Can I have two threads one for continuesly wait to receive the notifications & response and another for sending the requests to the panel?
Could someone please provide (link will suffice)a good design for this class.
Best Regards,
Pratap
|
|
|
|
|
Raj Prathap wrote: Can I have two threads one for continuesly wait to receive the notifications & response and another for sending the requests
You can read from the socket in one thread and write to the socket in a different thread. I think that is what you mean and Yes you can.
|
|
|
|
|
Read with one thread and write with another is fine with one proviso. If you're unfortunate enough to be using MFC Sockets then don't pass the handles (Which are actaully Window Handles) between threads lest they suddenly and magically become invalid. It can be done but you'll need to root around in the MS Docs to find how to do it safely. If you're writing this sort of thing you might want to check out IO Completion Ports, a bit mind bending but they can make multithreaded socket apps a lot slicker.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi all,
I am working on a 3D game and have recently bought a book which is dedicated to collision detection. The book is very good and covers a lot of different topics. However, it completly lost me when it said "Barycentric Coordinates"...the book doesn't describe them, and I am having difficulties finding anything which I can understand via Google.
So if anybody here is able to explain that would be great!!
1. What are barycentric coordinates?
2. Are they just for 3D graphics?
3. When to use them?
4. How to use them?
I guess I'm after an idiots guide to barycentric coordinates. If it helps, I understand vectors, matrices, trig, and a lot of other A-Level maths. But barycentric coordinates are way beyond me
Thanks!
Lea Hayes
|
|
|
|
|
lhayes00 wrote: 1. What are barycentric coordinates?
I think it refers to the coordinates relative to center of mass of the system ( well barycentre conceptually differs from center of mass, but it doesn't probably matter here).
See for instance
http://en.wikipedia.org/wiki/Center_of_mass[^].
lhayes00 wrote: 2. Are they just for 3D graphics?
No.
lhayes00 wrote: 3. When to use them?
Using CM coords usually simplify motion equations.
lhayes00 wrote: 4. How to use them?
You have to:
(1) calculate the position of the center-of-mass of the system (say CM ).
(2) express all the coords relatively to CM .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
|
lhayes00 wrote: Thanks for the link. Via that wiki link I found the one below. How are there 3 ordinates per coordinate on this 2D triangle?
(please reformulate)
However maybe that Barycentric Coordinates really refers to the following, rather specialized concept
http://mathworld.wolfram.com/BarycentricCoordinates.html[^]
You can also try to ask the guys of the Graphics forum.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi,
In my application, I have to use a rich edit control which will only accept numeric values. It should not allow the user to enter the text i.e the when the user presses any alphabets..rich edit should not display.
Any pointers would be greatly appreciated.
|
|
|
|
|
Hi
Go to richedircontrol properties..change readonly property false...
#sanroop#
|
|
|
|
|
johnalek wrote: change readonly property
|
|
|
|
|
Then it would not be possible for the user to enter anything in the rich edit control through the keyboard if it's a control with Read Only Property set to true.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: Then it would not be possible for the user to enter anything in the rich edit control through the keyboard if it's a control with Read Only Property set to true.
While johnalek's suggestion had nothing to do with the OP's question, an edit control whose Read-Only property is set to False means it can be interacted with via the keyboard.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
ReadOnly or Number!?
|
|
|
|
|
Probably you need something like this:
void CMyDlgDlg::OnEnChangeRichedit21()
{
CString str;
m_richedit.GetWindowText (str);
bool flag = false;
for ( int i = 0 ; i < str.GetLength () ; i++)
{
if(str.GetAt (i) >= '0' && str.GetAt (i) <= '9')
{
flag = true;
}
else
{
m_richedit.SetWindowText (lastCorrectText);
flag = false;
break;
}
}
if(flag)
lastCorrectText = str.Left(i+1);
m_richedit.SetSel(-1,-1);
}
Optimize the code for ur use now. I haven't tested it but hope that it works
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
It seems you set Number style for RichEdit of property window or with code?
|
|
|
|
|
Setting the ESNUMBER style is a great solution, but (at least it happens in the CEdit) then you won't be able to use floating point values like 12.3 or 12,3.
If you need to use floating point values the only thing I can think of is to extend the RicheditControl implementing a new class and implement a filter like _AnShUmAn_ has told you.
Hope this helps.
Best regards,
|
|
|
|
|
Hi
iam doing Chat application with out language pack installation .In this when i paste chinese characters in rtf .
And sending from rtf to Html chinese characters r converting pair of 8-bit codepoints. i need help how to convert pair of 8-bit codepoints to decimal value ...plz tell...
#sanroop#
|
|
|
|
|
Does it mean that you need to convert a byte pair to an int?
you can do this the following way
BYTE byte[N];
int k;
...
int i = byte[2*k] + byte[2*k+1] * 256;
or
where <code>k</code> is the pair number.
...
int i = byte[2*k+1] + byte[2*k] * 256;
depending on encoding order.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
class Exception{};
//warning C4290: C++ Exception Specification ignored
void ExceptionSepcification()throw(Exception)
{
throw Exception();
}
void WithOutExceptionSepcification()
{
throw Exception();
}
void main()
{
try
{
ExceptionSepcification();
//Or call
WithOutExceptionSepcification();
}
catch(Exception& e)
{
cout<<"Exception caught";
}
}
Both the Function ExceptionSepcification and WithOutExceptionSepcification throws Exception.
The what does the throw in Below statement makes difference
void ExceptionSepcification()throw(Exception)
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|