Win a copy of Terraform in Action this week in the Cloud forum!

Saikat Roy Mahasay

Greenhorn
+ Follow
since Jan 12, 2012
Saikat likes ...
Opera VI Editor Fedora
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Saikat Roy Mahasay

Tomcat does not run a telnet server on the shutdown port, so that won't work.



I do not know what tomcat runs on shutdown port, but it used to be possible to telnet to it and type shutdown. In fact this page shows some nice screenshots to demonstrate a solution to this potential problem

http://www.avajava.com/tutorials/lessons/how-do-i-prevent-people-from-shutting-down-my-tomcat.html
9 years ago
No, cron is the task scheduler for the Unix like systems. http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5 In windows, I believe there's a job scheduler, but please look it up in the net.

Either way, the idea is to provide the OS with a program or a script, and some scheduling information. The OS will check the time, and at appropriate time call the program to execute. Even if your webserer is down, the cron scheduled program will run.

Hope this helps.
Well, your requirement sounds like an independent thing. It does not need to run in the webserver or the client.

How about writing a standalone java program, and schedule it using a system scheduler like cron? In that case you do not need to worry about checking the time.
I think you could telnet to localhost 8005 from command prompt, and type SHUTDOWN<ENTER>. Also, I think I remember that this worked only in the physical box. Somehow, it didn't respond when I tried telnet-ing from another m/c. But I am not sure if I remember correctly.

Accessing http://localhost:8005/SHUTDOWN may not be same as this. You are sending a HTTP request to fetch a URL, rather than sending a command at the port.

I am not sure of the details of how HTTP differs from telnet but I am sure it does. Can somebody post a proper explanation ?
9 years ago
Javascript has a setTimeOut method that can defer calling a method by certain ms. But I am not sure if it serves your purpose. Could you please provide some more detail? Will it run once and check the time on some event ( like onLoad, maybe? ) and alert if it is 2PM , (do nothing otherwise)? or you would rather like a program to silently check every 10 seconds and come to life at 2 PM?

For the first case, it is not very hard, you need to check the Date object in javascript.

If, however, it is the second case, you need to juggle some actions with setTimeOut. Recursion can be one way. The function start on an event (onLoad?) and check client system time (like the first one) and act if the proper time is obtained; otherwise set a timeout for itself to be run after some time.


-- by the way, I do not think Jobs Discussion is the right place for this query.
Dude, the code that you wrote, works very well for multi-word Course description. I am not sure if I understand what's your query?
9 years ago
Did you try it outside NetBeans ? I tried to copy-paste and run your code in eclipse, and it sort of worked. At least I didn't get the ClassFormatError. I used java 1.6 and javamail-1.4.2.
9 years ago
I do not see you putting anything into the commandHash. Well there's a put, but it is in the constructor block ( the { ... } part right into a class is a constructor block) and it is not being called as you have not instantiated the StringSplit class.

So you have your first command "# A TPL HELLO WORLD PROGRAM" and your HashMap is empty. so your call to get returns a null, which naturally, you can't call the execute method on.

Even if you could initialize the class with a call to constructor, the HashMap will have only the EndStatement. And you still won't get any Directive from it. Hence, when you call execute on it, it will throw a NPE.

9 years ago
Hello Gabriel

The code you posted is not complete, and I could not get the first form from it. Here's a sugestion though :-

1. Add a bit of javascript in your code, like this:



2. Call this in the onClick of your button, by the way, I think you should make it a button instead of submit. I am not sure of this, but it seems counter-intuitive(and unlikely) that 2 forms can be submit concurrently.



Hope this helps.
Regards
Saikat
9 years ago
I think you want to submit the first form, rather than the second. The submit button in the provided code submits the second form. Hence your parameter is null.

You could try to change the submit to a button or link, and use javascript to submit the other form like or

All the best.
9 years ago