|
I think that wasn't meant for me; maybe it is your reply to Abhinav S?
|
|
|
|
|
I think that wasn't meant for me; maybe it is your reply to Abhinav S?
Indeed ! sorry for the mistake
|
|
|
|
|
Luc Pattyn wrote: then in your code skip the days that you don't want
Ew. So how do you test it on those days? Or what if you change your mind?
|
|
|
|
|
Hello
The idea of Luc was very simple (as most of good idea)
Let say that I have a settings file giving the needed days (this is the case)
When the application start it will check that files and decide to run the process or close
So if the Windows scheduller start the application every days the task will only start for the needed days
An independent UI (Web Page) can change the setting file at any time
The Idea was great but unfortunately not for this case because the User can also choose the starting time
|
|
|
|
|
I disagree; I don't think the application should be responsible for its own scheduling.
And if you later have to develop other similar applications, you would likely wind up with a bunch of duplicate code.
Having the scheduling handled outside the application allows it to be shared among any number of applications.
And Windows already has a built-in Scheduler that will do what you want; why not use it?
|
|
|
|
|
Use a Windows Scheduled Task to schedule for only those days and times you want it to run.
|
|
|
|
|
Ok
Have a look on the environnement
The application should run on a server
ONE user uses an interface (web page) on a remote machine to set up the days an time he wants to get some rapport
The question is what would be the best way to automaticaly set up the Windows scheduller on the server when the user changes his mind ?
|
|
|
|
|
Well that's a whole other situation than what you described in the original post.
And in that case, I agree with a Windows Service that executes the task when specified. I have written such a scheduler. Tasks were scheduled in a database via whatever client (I used WinForms). I will further state that I stopped using my task scheduler when I made my report scheduler.
baranils wrote: to get some rapport
I'll assume you mean report. Are the reports generated by Crystal or another report system? If so, I suggest a Service that executes the report more directly, without some other executable in between.
|
|
|
|
|
Hello PIEBALDconsult
Well that's a whole other situation than what you described in the original post.
Not really :
My need is to schedulle to run a C# application once a day for some days of the week
And I provide an UI to set those days
As I said my C# application do the job (getting date, create report)
My application can also read the xml setings file created by the UI
I can of course run my application as a service but I see some advantage to keep it as an exe file and try to les Windows schedulle it
1- As long as it only needs to run maximum once a day it is not efficient to let a servis running all the time
2- With an exe we keep the ability to manualy launch som "extra run" if needed
|
|
|
|
|
Don't think so small. If this project is a success they'll ask you to write other such reports that may have to run more than once a day or on demand.
It'll be easier in the long run if you provide such flexibility from the start.
|
|
|
|
|
Yes of course,
I agree with you, but practicaly I'll still be happy to understand how to setup the windows scheduller programatically
Maybe by simply execute taskschd.exe using System.Diagnostics.Process.Start?
|
|
|
|
|
baranils wrote: execute taskschd.exe
That's how I've done it in the past. But there oughta be a better way.
|
|
|
|
|
PIEBALDconsult wrote: That's how I've done it in the past. But there oughta be a better way.
Do you know some ?
|
|
|
|
|
No, and I just found this[^].
|
|
|
|
|
I wrote some code for that and use it in a windows service:
Scheduling Future Dates [^]
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Thank you John !
I'll have a look on that
|
|
|
|
|
I am trying to transmit about 75Kbytes of image data at 115200 baud. Ideally it should take about 5 secs. But this code seems to loop forever. Am I missing something obvious here?
#define rows 288
#define cols 352
for (j=rows-2; j>=0; j-=2)
{
for (i = (j*cols); i<((j*cols)+cols); i++)
{
cam_output = ram_read(i*4);
SendBuffer[0] = (cam_output >> 24) & 0xff;
SendBuffer[1] = (cam_output >> 16) & 0xff;
SendBuffer[2] = (cam_output >> 8) & 0xff;
uart_send(&SendBuffer, 3);
}
}
void uart_send(u8 *DataBufferPtr, unsigned int NumBytes)
{
int i;
for (i=0; i<NumBytes; i++)
{
XUartLite_SendByte(XPAR_UARTLITE_0_BASEADDR, *(DataBufferPtr+i));
}
}
Regards,
Karthik
|
|
|
|
|
Hi,
that is not C# code, so you're in the wrong forum.
your code does not look good
I'm not going to study it in any detail, unless you put it inside PRE tags (you can still edit your message)
is the other side receiving anything? how much?
does your code ever finish (say within calculated time * 10)?
|
|
|
|
|
@Luc: On the other side, my image file keeps growing > 1.8MB. The code never finishes.
|
|
|
|
|
so look at what is in the file; there should be 288/2 * 352 * 3 = about 150KB:
- are the first 150KB what you expect? if not, is there a pattern in the differences?
- what's there after 150KB?
this is call debugging: observe, observe closer, when something isn't what it seems, look at an earlier point, bring the last good point and the first bad point closer together, until you know where it goes wrong, then fix it.
|
|
|
|
|
Yes, I did check the image. It was garbled. Then I realized my mistake in the calculation of rows and cols... it should be 144 x 176.
But that didnt solve the infinite loop until i was able to debug on hardware. I noticed j decreased to 0 and then increased back to the highest (32bit) value. Realized the mistake of making j unsigned int .
Loop ends now
Thank you!
|
|
|
|
|
Some compilers warn when a test is bound to always result in the same value; apparently yours didn't then.
I always use my compiler at the highest warning level, and massage the code until it emits zero warnings!
|
|
|
|
|
True. I am compiling this in the Xilinx SDK.
|
|
|
|
|
Starting with the fact that your code does not compile as it stands, I have got it to run through in a couple of minutes; obviously without the data transfer. I guess you should check that the data is actually getting transmitted OK.
[edit]Also note this is C++ so should be in that forum[/edit]
|
|
|
|
|
hi,
Simple question. I'm trying to get the xml in an XmlDocument variable into a string. Seems like its a tough thing and I tried the OuterText property but it gives me encoded text like : >< So, does anybody have a decent solution to this.
Thanks
Gideon
|
|
|
|