Winforms app as Scheduled task - winforms

I've got a winforms app that I developed to do batch processing on tens of thousands of students, now we're trying to run it nightly as a scheduled task.
I personally find it useful to be able to login to the box and see how it's processing by looking at the GUI, though the standard way it to convert it into a commandline app.(which radically limits the amount of screen realestae I can use for loggin messages)
Can I run the app as a schedueld task, the IT Guy whos scheduling says it's not running because it's a winform app. Are there any tricks needed to get it to run well, or am I forced to rewrite it as a commandline app with it's 80 char width limit.
Basicaly I just echo the log file to the screen in realtime to make debugging issues easier. So the gui is output only.
Its' running as the currently loggedin user, but the issue is that it does not run if the user is not currently logged in on the box,so when we leave for the night it fails to run.
Thanks,
Eric-

You need to make sure it is running as the currently logged in account. If it runs as 'system' I don't think it will show up correctly.
I have one of these myself... and despise it. It only exists because I haven't had a chance to rewrite it into a proper service. Don't forget there are more ways to log than just outputting to the console. ;)

Related

Minimize a program on start up

I have a program which I'm struggling to get opened and minimized through a script (Platform: Windows 7 Pro). I have tried startup /minimize, I've tried sendkeys. I think the problem is that when the program is open and you press Alt+Spacabar+n, the Minimize option is greyed out.
Some background: the application needs to stay open at all times for us to send data down from our servers. The users tend to close the application if it just opens on their screens (without minimizing). It can't be run as a service because the users also need to use application in the foreground at certain times. I can't have 2 instances of it running in Task Manager because it causes issues in the software.
Any help or suggestions would be greatly appreciated. Thank you.
That sounds like it is by developer design, as if they removed the minimize ability on purpose. If it is an in-house app a simple edit/recompile of the source could alleviate the issue. If it is third party, discuss with vendor, ideally they could add a notification icon in the clock area keeping the app open while minimized.

Shell concept in cakephp

I am novice in cakephp.Please explain me the concept to shells in cake php and how it is helpful in web development?
I have read http://book.cakephp.org/2.0/en/console-and-shells.html.But still I am not getting the idea of shells in relevance to web development.
Shells are relevant. You can basically write any shell command and script you need. There are other shells like the migration shell coming with the migrations plugin.
I've seen silly attempts were people used cron and wget to call an URL to execute a task every X minutes. That's the perfect example where a shell is the proper solution.
There are plenty of use cases for shells, queuing (emails for example), data conversion, data import... Everything that runs for a long time or checks something like the queuing can be done as a shell. Shells can be also utility or development tools as well. You can even control with the "nice" command how much CPU load a program is allowed to use.
So for example if you have audio or video conversion after upload this should run in the background. The shell task will look for new uploads and when it finds some convert the data in the desired format and never use up more than 20% CPU load for example and by this it won't make the site unresponsive by using 100% CPU load.
If you are new to CakePHP, I'll suggest to check 'bake' console command. ( http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html ).
It can help you to generate models, controllers, views, migrations and many others.
It's a powerful tool that will save you a lot of time. When you are generating the model using 'bake' command, it will automatically detect all the tables in your database, work out the database relationship and you can also define the validation for each field.
Here is video tutorial on YouTube http://www.youtube.com/watch?v=Kfu58OozDrM

Refactoring a Google App Engine datastore

In my datastore I had a few hundred entities of kind PlayerStatistic that I wanted to rename to GamePlayRecord. On the dev server it was easy to do this by writing a small script in the Interactive Console. However there is no Interactive Console once the app has been deployed.
Instead, I copied that script into a file and linked the file in app.yaml. I deployed the script, intending to run it once and then delete it. However, I ran into another problem, which is that the script ran for over 30 seconds. The script would always get cut off before it could complete.
My solution ended up being rewriting the script so that it creates and deletes the entities one at a time. That way, even when it timed out, the script could continue where it left off. Since I only have a few hundred entities this took about 5 refreshes.
Is there a better way to run one-time refactoring scripts on Google App Engine? Is there a good way to get around the 30 second limit in order to run these refactoring scripts?
Use the task queue.
Tasks can run for more much longer than web requests. You can also split up the work into many tasks, so they will run parallel and finish faster. When you finish the task, you can programmatically insert a new task, so the whole process is automated and you don't need to manually refresh.
appengine-mapreduce is a good way to do datastore refactoring. It takes care of a lot of the messy details that you would have to grapple with when writing task code by hand.

How to test an application is working frequently by performing a fundamental action (non interactively)

We want to test a connection to an application as a feature of a program we are developing, but to go further with this, we want to actually do a sort of diagnostic test to ensure that the app is working and not just take the service status as gospel (the main windows service running does not mean the app is working fully). However, this app has no api exposed by it, and the forms may be designed in C++ as the app is a mix of many languages (C# is just one of them).
One way to do this is by UI automation and then programatically perform the necessary UI actions to test the app works by performing a fundamental action which uses all the prerequisites like a domain-joined account, etc. However, is there a way to do this non interactively so the forms of the app don't actually show up? If not, is there another way to solve this problem?
Thanks
With no exposed API, you are stuck with automation.
Take a look at autoit. It excels at doing these types of tasks. If it's vbesque script isn't for you it has a DLL interface for use in your favorite language. It is free.
Check it out.
Here are some ideas
Headless UI
You should investigate if this application can be run in a "headless" mode, i.e. without a visible UI. Alot of applications have this option even though it might not always be obivous.
UI Automation
Some tools for UI Automation:
* Microsoft UI Automationbr
* HP QuickTest Proffesional
* AutoIt v3
Analyis Log, If there is one
You could investigate if the application you are connection to writes a log.
* 14:14 Status:OK Activity:Routed 24 messages (or whatever it does) Uptime:2h12m
* 14:15 Status:OK Activity:No Activity Uptime:2h13m
* 14:16 Status:OK Activity:Routed 12 messages, 2 failed see error.log for details Uptime:2h14m
If it does, then you can write a diagnostics script that reads the log, analyses Status, Activity, Uptime and raise flags for any strange behaviour.
Hope this helps!

Scheduling a RichCopy Jobs

Anyone use the timer feature of RichCopy? I have a job that works fine when I manually start the job. However, when I schedule the job and click run, the app appears to be waiting for the scheduled time to elapse yet never fires. Interesting enough when I stop the job the copy starts.
Anyone have any experience with using RichCopy timer?
IanB
Try created a batch file with command line options. Then use windows scheduler to launch the batch.
OMBG (Bill Gates) You need to read and get security policy and the respect it has to place on a hierarchy of upstream objects and credentials. Well that's the MS answer and attitude...
The reality is if you are working with server OSs you need to understand their security & policy frameworks, and how to debug them :). If your process loses the necessary file permissions or rights (2 different things) you should ask: "Hot damn, why didn't I fix that in the config/setup". People that blast the vendor/project (or even ####&$! MS) are just blinding themselves to the solution/s.
In most cases this kind of issue is due to Windows' AD removing the rights of a Local administrator User to run a scheduled task. It is a common security setting in corporate networks (implemented with glee by Domain Admins to upset developers) though it is really a default setting these days. It happens because the machine updates against an upstream policy (after you've scheduled a task) and decides that all of a sudden it won't trust you to run it (even though previously it let you set it up). In a perfect world it wouldn't let you set it up in the first place, but that isn't the way policy applies in Windows... (####&$! MS). LOL
Wow it only took 5 months to get an answer! (but here they are for the next person at least!)

Resources