|
No. 1 is better in terms of performance.
You could give it read share access if any other program wishes to read the same file when it is kept open.
|
|
|
|
|
simon alec smith wrote: (2) Open then write the record then close the file for each order received
I always prefer (2) one, because if there is any crash, chances of data-loss is very much.
Secondly it also depend how frequently is data coming, if it quite fast, then option 1 also stands good.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
As the others have mentioned keeping the file open will be faster but second will be more secure if something goes wrong.
You might be able to get some of the the performance of keeping the file open with opening and closing it every time by opening the file unbuffered. This[^] has got loads of useful info about the pain in the neck this is to sector align buffers if you're on windows. You can do something similar on Linux with the open() system call.
It all depends on how much money's involved if something goes wrong and how much the customer is willing to pay for security. Another solution might be to open and close the file every transaction and make sure the powers that be spend the money they'd have spent on you engineering a software solution on more memory for the server to reduce the impact of repeated opens and closes.
Another option might be to try the double open trick that used to work years ago on some Unixen and DOS. You'll have to see if this does any good, I've not used it on any version of windows since Windows '95. What you do is open the file when the program starts. This makes a second opening really quick when you write a transaction. when you finish writing the transaction you close the file which flushes it to disk. Finally when the program terminates you close the original opening.
Cheers,
Ash
|
|
|
|
|
Ive successfully injected my .dll file, using the native API NtCreateThreadEx(), into the system process, such as lsass.exe. But its strange that my codes in the .dll file just dont work. However, if I inject it into user processes, such as explorer.exe, that .dll file can work perfectly. So I just cannot get around this prob. Can anyone help? Thanx in advance!
My developing environment is: VC2008 and Vista.
|
|
|
|
|
Under Vista and Windows 7, security was increased for this kind of thing.
|
|
|
|
|
Im wondering whether you could explain it to me in greater details .
|
|
|
|
|
|
Krauze wrote: Im wondering whether you could explain it to me in greater details .
Just imagine if it was easy to do what you want to do.
Now, I realise that you are a Saint who spends all winter bringing the homeless blankets and dinner, a regular Nobel peace prize winner [*], but I have an uncomfortable truth to give you...
Not all computer people are as nice as you. Some of them are even bad people. And not just CPallini either!
Iain.
[*] A special prize to whoever recognises where I stolereused these lyrics from.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
It has to be Leann Womack!
(Either I'm right and just know this kind of stuff, or Google is wrong)
|
|
|
|
|
You are correct. It really is a classic song! Full of perky jealousy!
I already owe you a beer - you really should leave that southern region and come up where the real folk live so I can buy you two.
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Now that's the type of message I would rate a 5.
Not due to the geographical insinuations.
Nor the musical references.
I don't really know, but it just appeals to me.
|
|
|
|
|
|
Why not fix this post so that only the relevant lines of code are shown? Everything else is just noise that gets in the way. Don't forget to wrap the code snippet in <pre> tags.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Sorry for the big code chunk. Now I am planning to use IWebBrowser2 com object to call JScript from MFC application. My problem definition in the previous post remains same. Can you please provide me the steps and possible code snippets to implement the same? I already have the MFC application built, now need to use IWebBrowser2 com object to call a JScript. Any help?
|
|
|
|
|
Please understand that some may view your question thusly:
Hello! I have one project to make a picture frame and paint a picture inside of it.
So far, I have bought the picture frame. This is very good. Now all I have to do is
paint the picture to go inside the frame.
Is there anybody who can provide me the steps and techniques required to paint this picture.
C'mon tiger, knuckle down and do some work!!
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi all,
I have a windows service which I am trying to run under local system account.
It fails with the "error 1053:did not respond in timely manner." This service runs well on Windows 2003 Server.
I found Service Hardening enhancemnets made in Windows 2008.
It states that if no privilges mentioned for that service means service has all the privilges available for that account.
It is given to support backward compatibility.
When I attach the service to application verifier tool it runs propely when I check LuaPriv.
Once a while when it failed when attached to Apllication Verifier it gave following error.
<avrf:message>Access was restricted to trusted users only.</avrf:message> <br />
<avrf:formatmessage>RegOpenKeyExA: Key (\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters) only grants requested 'KEY_SET_VALUE' to 'BUILTIN\Administrators, NT AUTHORITY\SYSTEM'</avrf:formatmessage>
The service is already running under Local System Accoun(NT AUTHORITY\SYSTEM).
Can someone give me hint or pointers to solve this problem?
I am really stucked here. I already googled for lot of information but no luck.
Thanks and Regards,
Mahesh R. Kulkarni
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Hi All,
Please give some inputs. I am waiting for some clues to move forward.
Regards,
Mahesh R. Kulkarni
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Give a look here[^]
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Hi,
I have a custom draw CListBox to be able to manage differing fonts, tab stops etc.
I have added a handler for a Selection change but, even though the event handler for the selection change is called, the selected item does not get highlighted.
I have set the flag true for Has Strings, Owner Draw is configured as variable, Selection is single, use tabstops and visible are set true.
Are there any other flags I need to set or items I need to configure to ensure that my selection is highlighted?
TIA
Tony
|
|
|
|
|
you have to draw the 'highlight' yourself.
|
|
|
|
|
As Chris said, you'll have to draw the selection yourself.
Look at the DRAWITEMSTRUCT sent to you by the WM_DRAWITEM message.
Then at the itemState member. Check for ODS_SELECTED flag.
Good luck,
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
|
hi,
i have a COLORREF itme.
i know how to convert it to RGB
but my Question is, if i can show the name of the color
Ex. RGB(255,0,0) --> Red
RGB(65-105-225 ) --> Royal Blue
Thanks'
|
|
|
|
|
You may use a std::map [^] for the purpose.
Of course you've to fill the map with proper values.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|