473,654 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing files in the Tick events when each write takes longer than the interval

I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not work
correctly.

How can I tell in the tick event if the previous file finished writing so I
can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?


What happens if the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are the
past ones simply missed?
Thanks


Aug 1 '08 #1
16 1456
On Aug 1, 9:33*am, "AAaron123" <aaaron...@road runner.comwrote :
I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not work
correctly.

How can I tell in the tick event if the previous file finished writing soI
can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?

What happens if *the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are the
past ones simply missed?

Thanks
You need to find a solution that doesn't rely on time, otherwise you
will spend the rest of the project's life debugging race conditions.

Is it possible to use a message queue to track the writes? The tick
event would write to the queue, and then the the changes could be
written out from the queue asynchronously.

Also, why not just keep the bitmap in memory and write it to a file
when the changes are done?

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Aug 1 '08 #2
what about thread?

"AAaron123" <aa*******@road runner.comwrote in message
news:e0******** ******@TK2MSFTN GP02.phx.gbl...
I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not work
correctly.

How can I tell in the tick event if the previous file finished writing so
I can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?


What happens if the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are
the past ones simply missed?
Thanks

Aug 1 '08 #3
Aaron,

Why not do the writing of the file assynchronous in a backgroundworke r.

The queue class will be a greath class to fullfil that.

Cor

"AAaron123" <aa*******@road runner.comschre ef in bericht
news:e0******** ******@TK2MSFTN GP02.phx.gbl...
>I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not work
correctly.

How can I tell in the tick event if the previous file finished writing so
I can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?


What happens if the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are
the past ones simply missed?
Thanks

Aug 1 '08 #4
Use a thread to write and check to see if the thread is still active??

Is that what you mean?
I'd have to learn how to do that but that would be a plus!

Thanks

"Gillard" <gillard_george s@@@@@@@@@hotma il.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
what about thread?

"AAaron123" <aa*******@road runner.comwrote in message
news:e0******** ******@TK2MSFTN GP02.phx.gbl...
>I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not work
correctly.

How can I tell in the tick event if the previous file finished writing so
I can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?


What happens if the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are
the past ones simply missed?
Thanks


Aug 1 '08 #5
do you write new image or it is the same image??

"AAaron123" <aa*******@road runner.comwrote in message
news:#6******** ******@TK2MSFTN GP04.phx.gbl...
Use a thread to write and check to see if the thread is still active??

Is that what you mean?
I'd have to learn how to do that but that would be a plus!

Thanks

"Gillard" <gillard_george s@@@@@@@@@hotma il.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>what about thread?

"AAaron123" <aa*******@road runner.comwrote in message
news:e0******* *******@TK2MSFT NGP02.phx.gbl.. .
>>I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not work
correctly.

How can I tell in the tick event if the previous file finished writing
so I can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?


What happens if the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are
the past ones simply missed?
Thanks


Aug 1 '08 #6

Not sure what you mean about the queue. I'd have to save the images and the
queue would write them?
Is that what you mean.

In my post I should have said: it is much like saving the frames of a movie.

Thanks
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:c9******** *************** ***********@26g 2000hsk.googleg roups.com...
On Aug 1, 9:33 am, "AAaron123" <aaaron...@road runner.comwrote :
I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not work
correctly.

How can I tell in the tick event if the previous file finished writing so
I
can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?

What happens if the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are
the
past ones simply missed?

Thanks
You need to find a solution that doesn't rely on time, otherwise you
will spend the rest of the project's life debugging race conditions.

Is it possible to use a message queue to track the writes? The tick
event would write to the queue, and then the the changes could be
written out from the queue asynchronously.

Also, why not just keep the bitmap in memory and write it to a file
when the changes are done?

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Aug 1 '08 #7
On Aug 1, 9:55*am, "AAaron123" <aaaron...@road runner.comwrote :
Not sure what you mean about the queue. I'd have to save the images and the
queue would write them?
Is that what you mean.

In my post I should have said: it is much like saving the frames of a movie.

Thanks

"rowe_newsgroup s" <rowe_em...@yah oo.comwrote in message

news:c9******** *************** ***********@26g 2000hsk.googleg roups.com...
On Aug 1, 9:33 am, "AAaron123" <aaaron...@road runner.comwrote :
I have a timer. At each tick, say 0.1 second, I write a file.
If it takes more than 0.1 second to write the file the app will not work
correctly.
How can I tell in the tick event if the previous file finished writing so
I
can skip writing at that time?
I write using the Bitmap.Save method.
Maybe I could Open, Write, Close synchronously??
Any ideas?
What happens if the Click event takes more that 0.3 seconds to exit.
Do the click events pile up and then come right after each other or are
the
past ones simply missed?
Thanks

You need to find a solution that doesn't rely on time, otherwise you
will spend the rest of the project's life debugging race conditions.

Is it possible to use a message queue to track the writes? The tick
event would write to the queue, and then the the changes could be
written out from the queue asynchronously.

Also, why not just keep the bitmap in memory and write it to a file
when the changes are done?

Thanks,

Seth Rowe [MVP]http://sethrowe.blogsp ot.com/
At first take, yes you would need to save each bitmap into the queue
and then write them to files asynchronously.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Aug 1 '08 #8
thanks
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:50******** *************** ***********@8g2 000hse.googlegr oups.com...
On Aug 1, 9:55 am, "AAaron123" <aaaron...@road runner.comwrote :
Not sure what you mean about the queue. I'd have to save the images and
the
queue would write them?
Is that what you mean.

In my post I should have said: it is much like saving the frames of a
movie.

Thanks

"rowe_newsgroup s" <rowe_em...@yah oo.comwrote in message

news:c9******** *************** ***********@26g 2000hsk.googleg roups.com...
On Aug 1, 9:33 am, "AAaron123" <aaaron...@road runner.comwrote :
I have a timer. At each tick, say 0.1 second, I write a file.
If it takes more than 0.1 second to write the file the app will not work
correctly.
How can I tell in the tick event if the previous file finished writing
so
I
can skip writing at that time?
I write using the Bitmap.Save method.
Maybe I could Open, Write, Close synchronously??
Any ideas?
What happens if the Click event takes more that 0.3 seconds to exit.
Do the click events pile up and then come right after each other or are
the
past ones simply missed?
Thanks

You need to find a solution that doesn't rely on time, otherwise you
will spend the rest of the project's life debugging race conditions.

Is it possible to use a message queue to track the writes? The tick
event would write to the queue, and then the the changes could be
written out from the queue asynchronously.

Also, why not just keep the bitmap in memory and write it to a file
when the changes are done?

Thanks,

Seth Rowe [MVP]http://sethrowe.blogsp ot.com/
At first take, yes you would need to save each bitmap into the queue
and then write them to files asynchronously.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Aug 1 '08 #9
sorry, I should have said. A changing image but some may repeat. Missing
some is OK.

So should I use a thread to write and check to see if the thread is still
active and only write if it is not active?
Thanks

"Gillard" <gillard_george s@@@@@@@@@hotma il.comwrote in message
news:Od******** ******@TK2MSFTN GP02.phx.gbl...
do you write new image or it is the same image??

"AAaron123" <aa*******@road runner.comwrote in message
news:#6******** ******@TK2MSFTN GP04.phx.gbl...
>Use a thread to write and check to see if the thread is still active??

Is that what you mean?
I'd have to learn how to do that but that would be a plus!

Thanks

"Gillard" <gillard_george s@@@@@@@@@hotma il.comwrote in message
news:%2******* *********@TK2MS FTNGP04.phx.gbl ...
>>what about thread?

"AAaron123" <aa*******@road runner.comwrote in message
news:e0****** ********@TK2MSF TNGP02.phx.gbl. ..
I have a timer. At each tick, say 0.1 second, I write a file.

If it takes more than 0.1 second to write the file the app will not
work correctly.

How can I tell in the tick event if the previous file finished writing
so I can skip writing at that time?

I write using the Bitmap.Save method.

Maybe I could Open, Write, Close synchronously??

Any ideas?


What happens if the Click event takes more that 0.3 seconds to exit.

Do the click events pile up and then come right after each other or are
the past ones simply missed?
Thanks



Aug 1 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1663
by: elziko | last post by:
I have an object (Object1) that instantiates another class (Object2) in a seperate thread. It must be in its own thread for an ActiveX control it hosts to work. From Object1 I can get to all the methods of the ActiveX control in Object2 which is fine. However, I need to get some information back from Object2 as its state changes. How would I go about informing Object1 of events that occur in the ActiveX control? At the moment I'm...
4
3329
by: Dan | last post by:
Hi, I have a timer on a form (System.Windows.Forms.Timer - Framework 1.1) that is set to 60 seconds as sort an of inactivity monitor. If 60 seconds have elapsed without any user activity I want the form to close. I stop/start the timer at button clicks and keydown events etc of the various controls on the form. Users have reported the form closing in the middle of them typing or immediately after opening the form (but only rarely)....
9
7235
by: Brett | last post by:
I have a timer enabled on a form with an interval of 200. I place a break point on the first line in the timer tick event, which is a try. After a few events go on, the timer seems to stop. My break point is no longer hit. In the debugger, the timer shows enabled and the interval is still set. Any ideas what may be happening or something else I can check? Thanks, Brett
7
2613
by: hazz | last post by:
What happens if I set the timer interval for a period that is less than the time it will take to process the loop below? Right now my application is returning just a few items in an arraylist to process but the process should scale to 100 or even 1000 loops. If the functions contained within the loop, some of which go out to web services, take an indeterminate amount of time, how do I design my windows service so that if the code takes...
1
1424
by: Philip Wagenaar | last post by:
Hello, I am writing an application that processes xml files that are stored in a folder. The application picks up the files in a folder, processes them and then deletes them. What is the best approach on loading the xml files from the folder into my application? At the moment I am using the System.IO.FileSystemWatcher to monitor files
5
5132
by: Philip Wagenaar | last post by:
I have a Windows Form application that monitors a directory using the System.IO.FileSystemWatcher. On the event created I run a sub that sends an xml file over http to a service. When I copy 7000 files in the directory to be monitored only 123 are sent to the service. What might be going wrong?
16
2891
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener will stay alive. Is this correct? If this is correct, I've got a problem. Let's say I've got an object Customer that has an PurchaseList (Collection) of Purchase objects. Now, these Purchase objects were pulled from a datasource Datasource. The...
5
2764
by: Daniel | last post by:
Hey guys When you hook an event (c# 2.0 syntax): myEvent += MyMethodToFire; You need to also unsubscribe it to avoid a resource leak so that the object it is in gets garbage collected like so : myEvent -= MyMethodToFire; That's all fine, but when you use visual studio to create events for objects it never creates an unsubscribing reference, so is it puting in resource leaks? Or is this being cleared somewhere that i am not seeing?
9
7287
by: appelsinagurk | last post by:
Hi I'm fairly new to .Net programming so I'll try to explain my problem as easy as I can, and in advanced sorry for my poor english. I've got some spare hours where I work, so I've decided to spend them learning C# .Net. I've done some smaller programming assignments and decided now to try a larger program. I'm trying to create a basic game where you the "hero" meets "villains" and monsters in an arena. I want the fighting to be like...
0
8375
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.