Need help using split, how to get the number of inputs?
I am trying to write a program in which a user inputs several numbers, then the output is how many numbers were input. I am thinking that the best way to do this is to use split, however I am pretty new and can't get it quite down. Thanks
Sorry, I guess I didnt explain it correctly. The input would be something like this-
90 87 76 23 99
Here is what I have-
import java.util.*;
public class Scores {
public static void main(String args[]) {
int score;
System.out.println("Input UNC Basketball scores, each separated by a space.");
Scanner keyboard = new Scanner(System.in);
int count = args[0].trim().split(?\\s?).length;
}The int count line was given to me by someone, however I dont know how to get there. Thanks
Similar Messages
-
865PE NEO2 need help on findout how to get the memory set to dual and a bit of overclocking
hello everyone all`s it is i need some advice how to find out that my motherboard is set right and my memory is set to dual. at the moment i have my memory 3200 512ram in DIMM 1 A and in DIMM 3 B can anyone tell me if this is right for my motherboard (865PE NEO2 ) and can anyone tell me the best setting to have to overclock my system at the moment i have 2.5 proccesor overclocked to 2.7.
Your memory is in the correct location for Dual Channel.
Btw, providing us your full system and PSU specs will be better for us to give you directions. -
Hi all,
Can any one tell how to get the number of files(.EPS) count inside a folder when the folder path is specified in VC++ 6.0?
Thanks in Advance.
Regards
myriazI'm a little confused by the question, but it sounds like you're asking how to count the number of files with a particular extension in a given directory? That's not really an AI SDK question, but it's a fairly easy one to find if you google it. If you're trying to use Illustrator to do it, AI doesn't have a general purpose file API. It has a few functions to do some things that Illustrator needs, but I don't think enumerating directories is one of them.
-
Hi im having trouble with downloading an album off my computer. i have forgotten the security questions, but have already sent them to my email. could someone help me in how to get the answers?
Hello Carpets,
Thanks for the question. You can reset your security questions with your rescue email address, as outlined with this article:
Apple ID: All about Apple ID security questions
http://support.apple.com/kb/HT5665
If you do not see the option for resetting your questions with a rescue email address, see this excerpt:
Note: The option to send an email to reset your security questions and answers will not be available if a rescue email address is not provided. You will need to contact iTunes Store support in order to do so.
Rescue email address and how to reset Apple ID security questions
http://support.apple.com/kb/HT5312
Additional Information:
Apple ID: Contacting Apple for help with Apple ID account security
http://support.apple.com/kb/HT5699
Thanks,
Matt M. -
How to get the number of decimal places configured for a site column
Hi,
I have a column 'SampleNumCol' of type Number, the number of decimal places to be displayed is configured as 2.
The column conatins a value, but when retrieved programatically is displayed as 5.00000000 instead of 5.00.
I am retrieving this column using listitem.Properties[field.InternalName].
I need to trim the decimals based on number of decimal places configured for the site column.
How to get the number of decimal places configured for a site column?
Thanks in advance,
dhijitGet the field as SPFieldNumber and then check DisplayFormat which returns
SPNumberFormatTypes
SPFieldNumber numberField = list.Fields.GetFieldByInternalName("YourNumberFieldName") as SPFieldNumber;
SPNumberFormatTypes numFormatType = numberField.DisplayFormat; -
How to get the path of input type="file" tag
-- im using <input type="file"> tag to get an input file from a local host, it returns only the filename but not the complete path of the filename,,,
-- i need to know on how to get the compelete path /directory of the filename using <input type="file"> tag , or is there any other way to get an input file from a local host aside from <input type="file"> tag?
thankshttp://msdn.microsoft.com/workshop/author/dhtml/reference/objects/input_file.asp?frame=true
When a file is uploaded, the file name is also submitted. The path of the file is available only to the machine within the Local Machine security zone. The value property returns only the file name to machines outside the Local Machine security zone. See About URL Security Zones for more information on security zones.
i need to know on how to get the compelete path /directory of the filename
using <input type="file"> tag You can't. Its a security thing.
is there any other way to get an input file from a local host aside from <input type="file"> tag?No. Not using just html.
You could always go into activex components, but thats different again.
Cheers,
evnafets -
Indesign CS3: How to get the number of the current layer?
Hallo!
How to get the number of the current layer in a page?
Thanks,
Alois BlaimerInterfacePtr<ILayerList> layerList(documentUIDRef, UseDefaultIID()); <br /><br />int32 layerCount = layerList->GetCount();<br /><br />To findout layer name use<br /><br />IDocumentLayer* documentLayer = layerList->QueryLayer(layerIndex);<br /> <br />PMString layer=documentLayer->GetName();
-
How to get the number of columns in a result set???
hi everyone..
i am trying to establish a servlet applet communication....
my applet send the sql query to the servlet as serialised string and then the servlet executes the query...
Since i need to pass the result back to the applet, i thaught of passing the whole reult set to the applet..but that seems to be not possible..
so i thaught of storing my result set data in a vector and then pass the vector,but the first problem that i came across is that how to get the number of colums in a result set....
so is there a way to get the number of columns in a result set...???
and also i would like to know if it possible to send my whole result set to the applet bye serialization or by any method...???
thanx in advanceYou shouldn't do. It expenses resources (you should always close the ResultSet and the Statement as fast as possible). Simply gently process it into a Collection or Map of DTO's. Those are serializable.
-
How to get the number of elements in DB
Could you tell me how to get the number of elements in DB??
My code to get the number is below, but I think it is not efficient
DB->cursor(DB, NULL, &cursorp, 0);
while ((ret = cursorp->c_get(cursorp, &key, &data, DB_NEXT)) == 0)
count++;
--------------------------------------------------------------------------------------------------------------Hi,
The most efficient way to get a count from the database is using the DB->stat API (http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbstat.html)
The code will be something like:
DB *dbp;
DB_BTREE_STAT *statp;
int ret;
/* Print out the number of records in the database. */
if ((ret = dbp->stat(dbp, NULL, &statp, 0)) != 0) {
dbp->err(dbp, ret, "DB->stat");
goto err1;
printf("%s: database contains %lu records\n",
progname, (u_long)statp->bt_ndata);
free(statp);The code comes from the example included in the distribution at examples/c/ex_btrec.c
If the database isn't a btree, you should update to the appropriate statistics structure and field.
It's worth noting that retrieving the count is never a "cheap" operation. The count is not stored in the database - since doing so introduced a single point of contention that creates a bottle neck.
Regards,
Alex Gorrod
Oracle Berkeley DB -
How to get the number of messages consumed by a MDB ??
Hi all,
How to get the number of messages consumed by a MDB displayed in OEM in a Java Application ???
DMS ??? what use DMS ???
tanksok.
Well using DMS is one way to get at these sorts of stats in a programmatic manner.
There's a Java API you can use, or you could call out to the Spy servlet to query the DMS stats in either text or XML form.
I don't have an MDB published so I can't show you specifiically, but here's the sort of query you can use to extract the data.
http://localhost:8888/dms0/Spy?format=raw&table=oc4j_ejb_stateless_bean&recurse=children
Which produces a table of the TEXT form:
<DMSDUMP version='9.0.4' timestamp='1163456821185 (Tue Nov 14 08:57:01 CST 2006)' id='8888' name='OC4J'>
<statistics>
/oc4j [type=n/a]
/oc4j/default [type=oc4j_ear]
/oc4j/default/EJBs [type=oc4j_ejb]
/oc4j/default/EJBs/jmsrouter_ejb [type=oc4j_ejb_pkg]
/oc4j/default/EJBs/jmsrouter_ejb/AdminMgrBean [type=oc4j_ejb_stateless_bean]
pooled.count: 11 ops
pooled.maxValue: 1 count
pooled.minValue: 0 count
pooled.value: 0 count
ready.count: 11 ops
ready.maxValue: 1 count
ready.minValue: 0 count
ready.value: 0 count
session-type.value: Stateless
transaction-type.value: Bean
/oc4j/default/EJBs/jmsrouter_ejb/EnqueuerBean [type=oc4j_ejb_stateless_bean]
pooled.count: 11 ops
pooled.maxValue: 0 count
pooled.minValue: 0 count
pooled.value: 0 count
ready.count: 11 ops
ready.maxValue: 0 count
ready.minValue: 0 count
ready.value: 0 count
session-type.value: Stateless
transaction-type.value: Bean
/oc4j/default/EJBs/jmsrouter_ejb/TimerHandlerBean [type=oc4j_ejb_stateless_bean]
pooled.count: 11 ops
pooled.maxValue: 0 count
pooled.minValue: 0 count
pooled.value: 0 count
ready.count: 11 ops
ready.maxValue: 0 count
ready.minValue: 0 count
ready.value: 0 count
session-type.value: Stateless
transaction-type.value: Bean
</statistics>
</DMSDUMP>
Or produces an XML document of the form:
http://localhost:8888/dms0/Spy?format=xml&table=oc4j_ejb_stateless_bean&recurse=children
You can use the Spy console to find the table that contains the details for MDB and then take it from there.
This is not what you specifically want to do, but it does provide a good overview of how DMS is used.
http://www.oracle.com/technology/pub/notes/technote_dms.html
-steve- -
How to get the number of files currently open?
hi,
does any one know how to get the number of files currently open in windows OS?
e.g. lets say .txt files...
any comment will be really appreciated.
thanksAssuming that you don't want to actually do this from within Java code (which would obviously require native code), here's a utility that will give you a list of which file handles are opened by which processes (on Windows):
http://www.sysinternals.com/ntw2k/freeware/handle.shtml
- K -
How to get the number of bytes at TCP port
Hi all,
How to get the number of bytes to read at the TCp port...as someone had suggested in some forum we do read the number of bytes first and then pass this...
but we get a problem when we have FF data in this...because then it sends 2 FF data...and cause of this we skip the last data...is there any solution for the same?Hi
In LabVIEW you don't have the same property as in serail port.
You havn't "Byte at TCPIP port".
if you developp a protocol, one soltion, is to send the size to read.
Ingénieur d'Application / Développeur LabVIEW Certifié (CLD)
Application Engineer / LabVIEW Certified Developer (CLD) -
How To get the number of request's for a single Composite Application
Hi can any body tell how to get the number requst's for a single composite application.
Thanks
ManiHi,
There are lots of STATE is available for composite instances, like mentioned in the below query. I hope you will get answer from the below query.
SELECT (CASE WHEN STATE=1 THEN 'OPEN AND RUNNING'
WHEN STATE=2 THEN 'OPEN AND SUSPENDED'
WHEN STATE=3 THEN 'OPEN AND FAULTED'
WHEN STATE=4 THEN 'CLOSED AND PENDING'
WHEN STATE=5 THEN 'CLOSED AND COMPLETED'
WHEN STATE=6 THEN 'CLOSED AND FAULTED'
WHEN STATE=7 THEN 'CLOSED AND CANCELLED'
WHEN STATE=8 THEN 'CLOSED AND ABORTED'
WHEN STATE=9 THEN 'CLOSED AND STALE'
WHEN STATE=10 THEN 'NON-RECOVERABLE'
ELSE STATE || ''
END) AS STATE, component_name, COUNT(*) AS NUM_OF_CUBE_INST FROM CUBE_INSTANCE where composite_name='PASS THE COMPOSITE NAME HERE..........'
group by (CASE WHEN STATE=1 THEN 'OPEN AND RUNNING'
WHEN STATE=2 THEN 'OPEN AND SUSPENDED'
WHEN STATE=3 THEN 'OPEN AND FAULTED'
WHEN STATE=4 THEN 'CLOSED AND PENDING'
WHEN STATE=5 THEN 'CLOSED AND COMPLETED'
WHEN STATE=6 THEN 'CLOSED AND FAULTED'
WHEN STATE=7 THEN 'CLOSED AND CANCELLED'
WHEN STATE=8 THEN 'CLOSED AND ABORTED'
WHEN STATE=9 THEN 'CLOSED AND STALE'
WHEN STATE=10 THEN 'NON-RECOVERABLE'
ELSE STATE || ''
END), component_name;
Thanks,
Vijay -
HELP!! How to get the position of active windows in the desktop
How to get the position of active windows in the desktop
You mean, active windows other than the program you're running, or windows the program puts there? And a real desktop (like where MyComputer is), or a desktop pane?
-
How to get the number of rows in a DB-Cursor
When i open a database cursor i do not know how much rows are stored in the cursor. To solve this problem i have to send a 'select count(1) ...' to get the number of rows before i set up the cursor. I think that this is not very clever and could possibly cause performance problems. But i need the num of rows to show the percentage of processed rows. Is there any other way to get the num of rows? May be by checking the cursor directly?
Please help!
Thanx a lotIn order to find out how may rows are going to be processed, oracle has to visit every row. So with a cursor, there is no property that will accurately reflect the number of rows until you get to the last one. That said, you could use
select count(*) over() as row_count, <rest of your columns> FROM <your table>
which will give you the total row count agaist each row in the result set. There are performance penalties involved but they will be less than issuing the query twice, once to get the count and once to get the rows.
Have a look on asktom for some very usefull info about all this.
HTH
Maybe you are looking for
-
How can I put photos in the layers palette so I can put one over the other.
How can I take 3 photos that are in the project bin and place them in levels so that I can use portions of each photo, and layer them?
-
Dr. Brown's Services 2.0.2 Place-A-Matic 16 bit won't work
I love this extension!! I had to reinstall OS 10.5 because my old Epson printer won't work with 10.6, and now I can't get Dr. Brown's Services to work in CS4. I downloaded Dr. Brown and installed it. The command choices appear in the Bridge tool bar
-
Rendering and Exporting in Adobe Premiere CS3
Does rendering stops when the computer/laptop locks? And what's the fastest way to render a 13 min movie in Adobe Premiere.. Does Media Encoder help?
-
An unhandled win32 exception occurred in AdobeCaptivate.exe[2688]
In Adobe captivate4, when i try to copy a slide and paste, the error message "An unhandled win32 exception occurred in AdobeCaptivate.exe[2688]" is generated. And then when I click on No for the debugger, Captivate closes. If I click on Yes, then Vis
-
Deleting .mac and .me email address, iCloud
I'd like to delete my .mac and .me email address. I frankly don't use them enough and am happy with my other email services. I remember this was available on the mobile me site. I'd also like to delete my iCloud account. How do I accomplish these tas