Pause statement in java?
I was wondering if there is code in java to "pause" a program, just like C has getch() or system(pause) etc. ?
Because in my program I need to prompt user if he/she wants to continue.
-thanks
System.out.print("Do you wish to continue (y/n)?");
char c = (char) System.in.read();
System.out.println("\nContinuing on...");
Similar Messages
-
How to Dynamically construct the conditional IF statement in java
Is there a way to dynamically construct a conditional IF statement in java?
For example:
Suppose i have a 2D array like:
Array[the actual values to search for][the column number in the table to perform the search on].
e.g.
Array {
{"x"} , {1},
{"y"} , {2},
{"z"} , {3},
}How can i construct the if statement like:
Looping over table rows (tableRow) {
Looping over array {
IF ( {"x"}. equals( tableModel.getValueAt( tableRow, {1}) &&
{"y"}. equals( tableModel.getValueAt( tableRow, {2}) &&
{"z"}. equals( tableModel.getValueAt( tableRow, {3}) )
return true;
}The array can grow or shrink based on the values in it so therefore IF statement will grow or shrink. How can i achieve it?
If not then how can i achieve this?My understanding (feeble at best) is that a sieries of && elements will be evaluated in order until the first false value is encountered. So, in an "if a && b && c" statement where b is false c will never be evaluated and the conditional executable will not run. Is that what you mean?
Yes, logical expressions will not evaluate unnecessary operands. So you can safely write the following, for instance, without getting an error,
if ((anArray != null) && (anArray.length > 0)) { ... }because the second operand of the '&&' will never be evaluated if 'anArray' is null.
Also, is there a difference between & and &&?
& is a bitwise operator, && is a boolean operator. -
Is there an equivalent statement in Java for this PL/SQL stmt?
Hi,
I want to know if there is an equivalent statement
in java for this PL/SQL statement:
IF strTok IN('COM-1','COM-2','COM-3') Then
/* Do Something */
End If;
I tried using : // This is giving me errors..
if (strTok.equals(("COM-1") || ("COM-2") || ("COM-3") ) )
/* Do Something */
The above Java code is giving me errors.
Any Help to reduce the number of steps for comparison
is appreciated.
thanks in adv
SharathSomething like
if (strTok.equals("COM-1") ||
strTok.equals("COM-2") ||
strTok.equals("COM-3") )Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Is there a goto statement in java??
is ther a goto statement in java
if yes how is it
and if no wat we use instead of it , if we want to redirect to control flow??
thanking you
rose!!!But he did not say it with three exclamation
points!!!
yes, I'm trying to restrict my usage of the exclamation mark as part of my attempts to be more even tempered (which aren't succeeding that well, but I may just need more practice). -
How to execute a SELECT statement in java??
Hello !!
In my java program , i need to delete a record of number X, so
i accept the number X from the keyboard
Then before deleting it
i want the program to show me the name, age of the record which has the number X
How to do thishello kylas
actually i didnt get why this program example?? wats
its executing ??? Look at reply #3 in your other thread:
http://forum.java.sun.com/thread.jspa?threadID=713289&messageID=4126346
Notice the similarity? You've now asked "How to delete a record in Java" and "how to execute a select statement in java". You may have noticed that, aside from the SQL and the call to execute and executeUpdate (for delete) it's the same code. This is because you don't so much do these things in Java, you do them in SQL. The Java code simply asks the Driver to execute whatever SQL you write. So, I really hope your next post isn't "how do I execute an UPDATE statement in Java".
Good Luck
Lee -
Been having some issues with nodes basically dropping out of clusters config.
Error showing was
"Cluster Shared Volume 'Volume1' ('Data') has entered a paused state because of '(c000020c)'. All I/O will temporarily be queued until a path to the volume is reestablished."
All nodes (Poweredge 420) connected a Dell MD3200 shared SAS storage.
Nodes point to Virtual 2012 R2 DC's
Upon running validation with just two nodes, get the same errors over and over again.
Bemused!
List Software Updates
Description: List software updates that have been applied on each node.
An error occurred while executing the test.
An error occurred while getting information about the software updates installed on the nodes.
One or more errors occurred.
Creating an instance of the COM component with CLSID {4142DD5D-3472-4370-8641-DE7856431FB0} from the IClassFactory failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
and
List Disks
Description: List all disks visible to one or more nodes. If a subset of disks is specified for validation, list only disks in the subset.
An error occurred while executing the test.
Storage cannot be validated at this time. Node 'zhyperv2.KISLNET.LOCAL' could not be initialized for validation testing. Possible causes for this are that another validation test is being run from another management client, or a previous validation test was
unexpectedly terminated. If a previous validation test was unexpectedly terminated, the best corrective action is to restart the node and try again.
Access is denied
The event viewer on one of the hosts shows
Cluster node 'zhyperv2' lost communication with cluster node 'zhyperv1'. Network communication was reestablished. This could be due to communication temporarily being blocked by a firewall or connection security policy update. If the problem persists
and network communication are not reestablished, the cluster service on one or more nodes will stop. If that happens, run the Validate a Configuration wizard to check your network configuration. Additionally, check for hardware or software errors related
to the network adapters on this node, and check for failures in any other network components to which the node is connected such as hubs, switches, or bridges.
The Cluster service is shutting down because quorum was lost. This could be due to the loss of network connectivity between some or all nodes in the cluster, or a failover of the witness disk.
Run the Validate a Configuration wizard to check your network configuration. If the condition persists, check for hardware or software errors related to the network adapter. Also check for failures in any other network components to which the node is connected
such as hubs, switches, or bridges.
Only other warning is because the 4 nic ports in each node server are teamed on one ip address split over two switches - I am not concernd about this and could if required split then pairs, I think this is a red herring????Hi,
Such events happen because of the following reason:
1- Client for Microsoft Networks and File and Printer Sharing for Microsoft Networks not enabled on all network interfaces. Check this KB article: http://support.microsoft.com/kb/2008795
. Please make sure these two protocols are enabled on all cluster networks
2- Network connectivity issue can cause this event as well. Please make sure the network cabling/Cards/Switches are correctly configured and working as expected
3- Connectivity issue with the storage can also cause this event. Please make sure all the nodes are connected to storage. Check HBA/Cabling connectivity to SAN. Make sure
that the SAN drivers are up-to-date.
4- Antivirus may interrupt network communication and cause this failure. Please exclude CSV volumes from being scanned by AV: http://social.technet.microsoft.com/wiki/contents/articles/953.microsoft-anti-virus-exclusion-list.aspx
5- Disable TCP Chimney related settings on all cluster nodes. http://support.microsoft.com/kb/951037
6- Please check the Network Binding Order (http://social.technet.microsoft.com/Forums/windowsserver/en-US/2535c73a-a347-4152-be7a-ea7b24159520/hyperv-r2-csv-cluster-recommended-binding-order?forum=windowsserver2008r2highavailability)
7- Firewall Rules For All Inbound and Outbound For Cluster and Hyper-V for all the Profiles
8- Update NIC Driver/Firmware.
9- Check Compatibility of the NIC with Windows Server 2012R2
10- Set-NetAdapterRss - Resources and Tools for IT Professionals | TechNet : http://technet.microsoft.com/en-us/library/jj130863.aspx
11- Check the Following Article http://social.technet.microsoft.com/Forums/windowsserver/en-US/e06fede9-931c-4dee-8379-4fd985e20f0a/hypervvmswitch-eventid-106
12- General Updates to be applied on the nodes :
Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2 update rollup: November 2013 : http://support.microsoft.com/kb/2887595
Windows 8.1 and Windows Server 2012 R2 General Availability Update Rollup :
http://support.microsoft.com/kb/2883200
Hope this helps.
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Trying to understand the PAUSE statement
I am trying to use the following code:
SET SERVEROUTPUT ON VERIFY OFF
ACCEPT i_name PROMPT 'Enter your name: '
DECLARE
v_name VARCHAR2(30) := '&i_name';
BEGIN
dbms_output.put_line('This is right before the PAUSE.');
PAUSE 'Adjust paper and press RETURN to continue.';
dbms_output.put_line('Your name is: ' || v_name);
END;
/But I am receiving these errors:
ORA-06550: line 5, column 8:
PLS-00103: Encountered the symbol "Adjust paper and press RETURN to continue."
when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "Adjust paper and press RETURN to
continue." to continue.Am I allowed to use the PAUSE statement within the PL/SQL block, or does it have to be before the DECLARE statement?
If I am allowed to use it within the block, then why am I receiving an error? I tried both with and without the semicolon at the end of the PAUSE statement.
On this site: http://download.oracle.com/docs/cd/A87860_01/doc/server.817/a82950/ch8.htm#1001319 it has the following example:
SET PAUSE OFF
PAUSE Adjust paper and press RETURN to continue.
SELECT ...But why would you turn the pause OFF? And then when do you turn it ON? Also, that example seems to conflict with the advice listed here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12040.htm#i2699261
Which says: "You need to first, SET PAUSE text, and then SET PAUSE ON if you want text to appear each time SQL*Plus pauses."Pause is a sqlplus command so, no you cannot use it in a PL/SQL block. It is used to stop the display from scolling, generally after pagesize lines. It can also be used, as in the example you posted to stop the display and give some feedback to the user.
The set pause off command will make sqlplus display all the output without stopping. The explicit pause <text> is a command that stop the display. You can set pause on so the display will stop after every pagesize lines. You can also do something like set pause Press any key to see more and the display will pause after pagesize lines anf disply the text in the set pause command as a prompt.
You do know that this is all documented in the SQL Plus Users Guide right?
John -
INSERT statement in Java and MS Access
Hi all,
can anyone please tell me how to insert data to an MS Access table using JSP i tried INSERT statement of java but it is getting errors saying INSERT statement is wrong. I have no idea about MS access insert statement. i am totally tired of this. Please someone help me.Hello,
MS Sql can cause problems where it goes off standard, however I dont think insert is any different.
INSERT INTO table_name (column1, column2) VALUES (variable1, variable2)
Make sure your table and column names are exactly right, Java is case sensitive, so make sure the case is correct also.
The other common error is if you have a required field in the database that is not populated by your program, so, if for instance there was a column3 in the table for the above example, which was a required field, the sql would fail as there is no data being entered for column3. -
Convert SQL statements to JAVA Code ?
Using SQL queries Can I convert SQL statements to JAVA Code ?
Edited by: user11238895 on Jun 7, 2009 10:54 PM
Edited by: user11238895 on Jun 7, 2009 11:12 PMMe very new to Oracle.
can we convert SQL Queries to JAVA Code using simple built in SQL queries ?
Which SWISS SQL Tool does [Converting SQL Queries to JAVA Code] -
How to isolate the Sql Statement from Java Code
Hi
I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
Suppose the developer has these four Statements
Select ename,empno,sal,job from emp;
select empno,ename,mgr from emp;
select deptno,dname from dept;
select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
Can Anybody guide me how to write this Stored type of Store procedure.
Thankshttp://www.google.com/search?q=java+windows+registry
Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this. -
how do i pause the state of my application running in palm when the user hits the home button or any other buttons not from my application?
kinda like halfway using the app, user wants to view the menubar, or goes to the home page of palm to use other applications without properly selecting exit from my application.
thanks.Sorry, there's no pause state. Since only one application can be running at one time on the Palm the application cannot be placed in the pause state. What I have done is save the state to an RMS database and look for that on startup of the application.
-
Our Sun "hibernates" quite often we use our sun primairly for HPOV.
When it "hybernates" We do not receive alarms and traps from our Global Network.
I need to stop HPOV
When I do so i get the following response.
"The system is in an paused state. 'ovstop' will still proceed.
I believe this "paused state" is causing our HPOV to stop receiving alarms etc..
Does anyone have any idea why this system is in a paused state, and how I can stop that!!!
ThanX PatrickHello,
Please try the below mentioned steps that should resolve the issue.
Power Off the Computer.
While the printer is ON, remove the ink cartridges and the papers
While the printer is ON, unplug the power cord from back of the printer and also unplug any other cable from the back of the printer ( like USB/Ethernet/Fax cables)
Wait for 60 seconds.
Plug in the power cord to the printer. If printer does not power on automatically then hit the ON button.
Install the cartridges when prompted.
When the printer is steady only then connect the USB cable.
Regards,
Jabzi
Give Kudos to say "thanks" by clicking on the "thumps Up icon" .
Click "Accept as Solution" if it solved your problem, so others can find it.
Although I am an HP employee, I am speaking for myself and not for HP. -
TS1702 Why are my apps updates and apps remaining in the "waiting" and "pause" state?
I get update notices for my apps but when I click to update my apps remain in the "waiting" and "Pause" state.
I have tried powering down my phone and restarting it to see if that will resovle the problem but it's not correcting the problem.
I have deleted several apps just to remove them.
Anyone have any suggestions?
Glam33Try tapping the App, so that it changes to Paused instead of Waiting, then tap it again to resume the install.
Make sure you don't have any paused downloads in other apps either, like the iTunes Store.
You can also try resetting or restoring the iPhone.
And, if that doesn't do it, try contacting Apple through Express Lane. -
Can someone explain these statements abt Java?
Can someone explain these statements abt Java:
+"The lesson for language designers is that *invocations of class and instance method* should look different from each other.+
+One way to future this goal is to *disallow the use of expressions as qualifiers* for static methods.+
+A second way to distinguish static and instance method invocations is to *use different operators*, as C++ does.+
+A third alternative is to finesse the issue by *dispensing with the concept of static methods altogether*, as Smalltalk does."+
esp those parts in bold, preferable with examples in explanationThanks!yeeen wrote:
Can someone explain these statements abt Java:
+"The lesson for language designers is that *invocations of class and instance method* should look different from each other.+
static versus non-static methods.
public class Foo
public static void aClassMethod() { System.out.println("I'm a class method for " + Foo.class.getName());
public void anInstanceMethod() { { System.out.println("I'm an instance method for " + Foo.class.getName());
public static void main(String [] args)
Foo.aClassMethod();
Foo f = new Foo();
f.anInstanceMethod();
}>
+One way to future this goal is to *disallow the use of expressions as qualifiers* for static methods.+I don't know what this means.
+A second way to distinguish static and instance method invocations is to *use different operators*, as C++ does.+I know C++, but I don't know what this means.
+A third alternative is to finesse the issue by *dispensing with the concept of static methods altogether*, as Smalltalk does."+I don't know Smalltalk.
% -
Parent Concurrent Program executes rest of the logic before PAUSED STATE.
Procedure parent_cp (errbuf out nocopy varchar2, retcode out nocopy varchar2) IS
ret number;
i number;
BEGIN
fnd_msg_pub.initialize;
BEGIN ---Block A
req_data := fnd_conc_global.request_data;
if (req_data is not null) then
i := to_number(req_data);
if (i < 5 ) then
errbuf := 'Done!';
retcode := 0 ;
return;
end if;
else
i := 1;
end if;
for i in 1 .. 4 loop
ret := fnd_request.submit_request('CZ', 'Child','Delete Localized Text - Child Number : ' ||TO_CHAR(vChildNo), NULL,TRUE, vChildMdlRange);
fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => to_char(vChildNo)) ;
IF (ret = 0 ) THEN
errbuf := fnd_Message.get;
retcode := 2;
ELSE
errbuf := 'Sub-Request submitted!';
retcode := 0 ;
END IF;
END LOOP;
END;
BEGIN ---block B
dbms_output.put_line(' Block after submitting Child CP ');
END;
END parent_cp;
when i execute the above Parent CP ,it submitted 4 Child CPs and Parent CP went into Pause state. Before Parent CP went into Pause state it executed the Block B.
My Requirement is it should execute the block B after completion of all child CPs.
Please suggest how to achieve the above requirement.
Thanks,
Murali.Procedure parent_cp (errbuf out nocopy varchar2, retcode out nocopy varchar2) IS
ret number;
i number;
BEGIN
fnd_msg_pub.initialize;
BEGIN ---Block A
req_data := fnd_conc_global.request_data;
if (req_data is not null) then
i := to_number(req_data);
if (i < 5 ) then
errbuf := 'Done!';
retcode := 0 ;
return;
end if;
else
i := 1;
end if;
for j in 1 .. 4 loop
vRequestId(j) := fnd_request.submit_request('CZ', 'Child','Delete Localized Text - Child Number : ' ||TO_CHAR(vChildNo), NULL,TRUE, vChildMdlRange);
fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => to_char(vChildNo)) ;
IF (vRequestId(j) = 0 ) THEN
errbuf := fnd_Message.get;
retcode := 2;
ELSE
errbuf := 'Sub-Request submitted!';
retcode := 0 ;
END IF;
END LOOP;
END;
BEGIN ---block B
For j in vRequestId.FIRST..vRequestId.LAST LOOP
fnd_file.put_line(fnd_file.log,' reuest' || vRequestId(j));
vrequeststatus := fnd_concurrent.get_request_status(vRequestId(j),
NULL,
NULL,
phase,
status,
dev_phase ,
dev_status ,
message );
WHILE (dev_phase != 'COMPLETE') LOOP
fnd_file.put_line(fnd_file.log,' while loop' || vRequestId(j));
vrequeststatus := fnd_concurrent.wait_for_request(vRequestId(j),
60,
10,
phase ,
status ,
dev_phase ,
dev_status ,
message );
END LOOP;
END LOOP;
dbms_output.put_line(' Block after submitting Child CP ');
END;
END parent_cp;
The above procedure was the Parent CP. Here the problem is in fnd_request.submit_request('CZ', 'Child','Delete Localized Text - Child Number : ' ||TO_CHAR(vChildNo), NULL,TRUE, vChildMdlRange); i have given sub_request as True and used fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => to_char(vChildNo)) ; to make parent CP to pause it.
It submits 4 child CPs as expected but the phase as INACTIVE and status NO MANAGER and PARENT CP was always in running state.
If i make sub_request parameter of fnd_request.sub_request to FALSE . It submits 4 child CPs as expected with the phase as PENDING and status NORMAL and PARENT CP was always in running state. But child cps are never changing the Phase as RUNNING. It is always in PENDING STATE.
Please suggest how to use fnd_conc_global.set_req_globals and fnd_concurrent.wait_for_request together.
Maybe you are looking for
-
Any examples or open-source code for a Swing photo gallery app?
I need a thumbnail viewer that can quickly load and manage 100s of images. It should load images from a List of URLs using threads, let the user navigate through 100s of images efficiently, select a photo by double-clicking, manage memory efficiently
-
IPhone 5's will not connect to windows 7
Ok so i've been trying to figure this out for about 4 days now. This is my problem. I bought a brand new iPhone 5s. When I connect it to my Windows 7 64bit computer it says the driver was not installed. I've tried just about everything to resolve the
-
How do I change the background color of text in Pages quickly?
I know that I can highight the words with my cursor, then press the little "a" in the toolbar, then select the color I want. However, I have to hihglight a ton of separate sentences in documents that have a few hundred pages. Is there a shortcut for
-
MTOM support in BPEL is a problem
I have created a simple BPEL process which accepts a string and base64string. I enable oracle/wsmtom_policy in the composite xml and enabled MTOM encoding to true. This enables MTOM for the BPEL process. I upload the composite into WebLogic. Now I cr
-
The buttons at the right top corner of firefox that are used to close all programs disappeared. What can I do?