I am using the scanner class to capture user input from the command line (strings only), as an alternative to my previous question.
The following seems to work fine, except the blank lines are not caught as they should by the second conditional. For example when I press enter, this should be captured as a blank line and the second condi...
I already made a scanner, now I'm supposed to make a parser. What's the difference?
...
I need to make a scanner in lex/flex to find tokens and a parser in yacc/bison to process those tokens based on the following grammar. When I was in the middle of making the scanner, it appeared to me that variables, functions, and arrays in this language can only have the name 'ID'. Am I misreading this yacc file?
/* C-Minus BNF Gram...
I'm trying to loop an exception, but for some reason its not giving me the option to re write my scanner file:
I don't know how to use BufferedReader so that's why I'm using this. Any clues?
Here's my standard class with my method
package arrayExceptionsWithInput;
import java.util.*;
public class GetThoseNumbersBaby {
int firstI...
Hi everyone,
I am using the following code:
while (invalidInput)
{
// ask the user to specify a number to update the times by
System.out.print("Specify an integer between 0 and 5: ");
if (in.hasNextInt())
{
// get the update value
updateValue = in.nextInt();
// check to see if it was within range
if (updateV...
I am trying to teach my camera to be a scanner: I take pictures of printed text and then convert them to bitmaps (and then to djvu and OCR'ed). I need to compute a threshold for which pixels should be white and which black, but I'm stymied by uneven illumination. For example if the pixels in the center are dark enough, I'm likely to wi...
What I want to do is ask the user for a number of strings to read into an array, and then ask the user to input that number of strings and read them into the array. When I run this code it never asks me for an input the first cycle of the first for-loop, just prints out "String #0: String #1: " and then I can input text. Why is that and ...
I'm trying to write a client and time server for an assignment and I'm having trouble getting the server to receive the second request from the client. The first request goes through fine without a hitch. then it just stalls. I'm actually pretty lost in this whole thing and rather uncomfortable with java still, so I have no idea what I'm...
Im used too using Scanner mainly and want too try using a buffered reader:
heres what i have so far
import java.util.*;
import java.io.*;
public class IceCreamCone
{
// variables
String flavour;
int numScoops;
Scanner flavourIceCream = new Scanner(System.in);
// constructor
public IceCreamCone()
{
}
// methods
public String getFlavou...
In Java there is a nice class called Scanner for reading strings and streams of a certain format to data-structures like integers, floats,... Is there any equivalent in Mono? In .Net there is a binary-reader, but it reads the data as binaries. I want a class that read the data by parsing it from a string.
EDIT: reaction on the current a...
What is the best way to extract the integer part of a string like
Hello123
How do you get the 123 part. You can sort of hack it using Java's Scanner, is there a better way?
...
To help customers troubleshoot VoIP, I was thinking of using www.nmap-online.com to scan their NAT router to check that their SIP client successfully punched the SIP/RTP ports open on their router.
As a test, I used Nmap Online to scan my own PC which is behind a NAT router, but although UDP5060 was not used, nmap still reported it bein...
lex and yacc are supposed to be used together.
Which ones is the scanner and which one is the parser?
Which one creates a scanner and which one creates a parser?
...
Hi.So I can easily accomplish task to find largest number and then if can be divided by three, print out. But do not know how to find second largest number from users sequence.
Thanks for any hints!
public class SecondLargest {
public static void main(String[] args) {
int max = 0;
Scanner scan = new Scanner(System.i...
I'm working on a JavaScript collator/compositor implemented in Java. It works, but there has to be a better way to implement it and I think a Lexer may be the way forward, but I'm a little fuzzy.
I've developed a meta syntax for the compositor which is a subset of the JavaScript language. As far as a typical JavaScript interpreter is c...
How do you set the delimiter for a scanner to either ; or new line?
I tried:
Scanner.useDelimiter(Pattern.compile("(\n)|;"));
But it doesn't work.
...
I read somewhere that the upload limit for php is about 2MBs. Does this still apply if I am asking a user to upload a file to the server to scan through and convert to a string? If so how do I get around this?
The application for this is a scanner type deal where users would be able to upload a code file, and this php application would...
I'm successfully using ImageCaptureCore to scan and save images. However, if the scanner hasn't been calibrated by some other app, the resulting image quality is very poor. I've found that the ImageCapture libraries have no methods to automagically create and save calibration data for the scanner.
How should scanner calibration be h...
How do you scan a file with java that isn't in the directory the java file is in?
For example: The java file is located at "C:\Files\JavaFiles\test.java" However, the file I want to scan is located at "C:\Data\DataPacket99\data.txt"
Note: I've already tried putting another java file in the "C:\Data" directory and using the test.java fi...
I am using java.util.Scanner for things such as nextInt(), and all was working fine as long as I was using a java.lang.Readable (one and only constructor argument). However, when I changed to using an InputStream instead, Scanner.nextInt() never returns. Do you know why?
My implementation of the InputStream looks like this:
private sta...