« first day (2457 days earlier)      last day (2708 days later) » 

01:18
Starts working on something, battery dies after 10 minutes
 
1 hour later…
02:41
hi can somone help me with my java hw
it involves working with files
 
1 hour later…
04:00
"Your life does not get better by chance. It gets better by change." -Jim Rohn (source)
 
1 hour later…
05:14
o/
@Brogrammer whats going on?
well im having trouble writing to an output file
05:30
@Brogrammer what error are you getting
Exception in thread "main" java.lang.IllegalStateException: Scanner closed
i know i used close
but why should that matter
what scanner?
I dont see a scanner :D
what line is the exception thrown?
Exception in thread "main" java.lang.IllegalStateException: Scanner closed
at java.util.Scanner.ensureOpen(Scanner.java:1070)
at java.util.Scanner.findWithinHorizon(Scanner.java:1670)
at java.util.Scanner.nextLine(Scanner.java:1538)
at assignment8.Assignment8.main(Assignment8.java:70)
/Users/hdar2013/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53: Java returned: 1
 
1 hour later…
06:37
I will have a look soon @Brogrammer currently drinking coffee :D
07:12
i see @motaa
07:58
@motaa i think ur done with the coffee
ye soon :D typical weekend morning with the girlfriend
@Brogrammer look at line 60
at line 60 you close it
and then you try to use it again at line 70
oh no i already fixed that part
but i have a InputMismatchException
error
did you remove the line?
repoaste your code and you exception
08:03
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Scanner.java:864)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at assignment8.Assignment8.getRange(Assignment8.java:15)
at assignment8.Assignment8.main(Assignment8.java:30)
well what is your goal of the getRange method @Brogrammer
one intputs a number right?
it helps me format the output file
like if the width is 30
then each line in the formatted file will be 30 lngth
length
the problem here is that the scanner does not point to your integer
u mean tthe integer i got from getRange
change your getRange() to this paste.ofcode.org/32mFGdNziMPsJwsxGQWT2yi
sc.hasNextInt() --- capital N
08:20
it says boolean
cannot be converted into int
and i dont think getRange caused this issue that im having
because i havent used it for my result
well the stacktrace you pastes exactly tells us where is is
line 15 and 30
line 30 you call getRange()
line 15 you try to read an int
theres a red line over range = sc.nextInt());
Next
wait gotta refactor sth
ye
because now you have the problem what if there is no nextInt() how would you check for range <30 or >100
rgl
rgl
2
Q: first path isn't painted

rglI have made a custom view to paint over a bitmap. The problem is when try to paint the first touch don't show any thing and the color also changed in the next time , the second problem is that the when i save the image no thing is showed from the painted colores Here is my code: public class Dr...

can anyone help answering my question ?
so ur saying
what if the user doesnt input an integer
oh then theres no way to check the rnage
08:26
yep
ok then can you explain why the logic i had before was not effectiv
based on the error
you can init: int range = 0
i tried that
it doesnt like this line tho
range = sc.nextInt());
oh
remove that last semicolon
extra bracket
ya was about to say
i have this error now Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1540)
at assignment8.Assignment8.main(Assignment8.java:71)
08:28
and close your scanners
is this assignment about do/while loops? :D
LOL
its for files
and exceptions
for some reason he wanted do while
i personally didnt mind
which scanner
r u referring to
it makes sense in this assignment to use do/while
right because u try to see if the file exist and if not do it again
that sort of logic
but do i close the scanner in the getrange
you always want to execute some reoccuring code at least once
of course you do
now i have this
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1540)
at assignment8.Assignment8.main(Assignment8.java:38)
/Users/hdar2013/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 5 seconds)
what does nosuchelementexception mean
08:33
/javadoc NoSuchElementException
@motaa java.util.NoSuchElementException: Thrown by various accessor methods to indicate that the element being requested does not exist. @since JDK1.0
it doesnt like inputFileName = input.nextLine();
but i didnt close it before
and ik i have it defined already
you can change your getRange() method to this paste.ofcode.org/7F78SpqYTyB4EvcirRpQyu
same error
since scanner implements the autoclosable interface you scanner will automatically be closed when you use a try/with resource statement
ye that was not for your current problem :D
paste me your code again so I know what lines to check
08:37
this assignment is actually hard compared to my other 7 assignments that i got 100s on
tbh i was worried that i didnt create my output file right
in there you have a problem with your loop
ya it wont let me read in the outputname so im assuming
it has to do with this line i think
outputFileName = input.nextLine();
which goes back to scanners
well the problem here
when your getRange returns
it continues executing the rest
so again same with your getRange method
        if(input.hasNextLine())
        	inputFileName = input.nextLine();
        else
        	continue;
now you will get a nullpointerexception
at your while(!file.exists())
and you don't have to create tons of scanners
one suffises :)
08:56
oh yah thats a wast
omg
why is this assignment hard
especially it akes your code unnecessarily complex and hard to debug
what is the exact assignment?
In this assignment you'll write a simple text formatting program. It will read words from an input file and write them to an output file, removing extra whitespace and filling each line with as many words as will fit up to a maximum column width (similar to a column of text in a newspaper). The maximum column width, input text file name, and output text file name are entered interactively when the program starts..
i had the program create an input file
oh wait im srry
i lied
i made it copy the input .txt
i stored on my folder
and stored the contents in a string
but then all these exceptions keep coming up
ye it is a matter or structure
so the idea is... all words get stripped of whitespaces, newlines etc. and then glued together into a file with for example 30chars per line
ya
honestly that part isnt hard
but its just the output file is messing me up with these exceptions
well think a bit deeper of your assignment
dont go with the straight procedual idea without at least thinking about the oop approach
09:02
well
first i needed the range
i have got that
Prompt for the file name of the input text file. Use a File object to test that the file exists, and can be read. If so, open the file for reading using the Scanner class. Use a do-while loop to repeat these steps until a valid input file is entered.
i have asked for the input name
and tested to se if it exist or if it can be read
i did open it with the scanner class
i feel like deleting my code
and restarting
though its 5:04Am
what I meant, maybe think about a "global" scanner that treats every input, maybe your own one with some additional functionality. Think also maybe about states in you programm (f.ex. an Enum: InputState that represents where you actually are at in your inputs)
you Scanner would start with InputState.Range and when it is at that state you are not ready to go to the inputfile state
until you pass that state by entering a range between 30 and 100 and go to InputState.INPUT
in that state you handle your inpute file
if all states have passed you can go to a final state like DONE
ok thats good
also i commented out getRange
and i can read in the input again
i think i will start almost everything over
im gonna rewrite getrange
soemtimes that happens
so when should I close the scanner
this is one thing about java i dont like
input is an object
c# or c++ i dont have this issue
09:24
i think my issue is reusing the scanner
10:03
well close it when it should close
that is at the state when you are done reading input
at the line where you check for your inputfile.exist
use inputfile == null
then you pick another variable that will hold the file and check if that exists and can be read
if both is the case set your inputfile = the variable you just checked and though break the loop
@Brogrammer your file is just a plain textfile right?
when your file exists and so on, read in like this for example:
rawinput = new String(Files.readAllBytes(Paths.get(inputFile.getAbsolutePath())),Charset.defaultCharset());
replace all linebreaks and whitespaces:
rawinput = rawinput.replaceAll("\\s","");
then iterate over the string until string.length()/width < 1
where u always "crop" index 0 till width and put that into the printwriter
when ur loop breaks because length/width < 1 then u have less chars left than width which means it is your last line to write
note that "crop" means you remove from the initial string
so the original string becomes smaller
 
2 hours later…
12:41
hello
@Hans1984 Most developers prefer dogs to cats. (But not developers in Germany.)
lol
13:06
can someone explain me what is meant by this question?
13:28
Hello
@AfonsoMatos Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
Cool cool @OakBot
@AfonsoMatos Type /help to see all my commands.
Why isn't .toString called upon a class instance when concatenating with a string?
For example "The number is: " + bigDecimal is not the same as "The number is: " + bigDecimal.toString()
But they both compile! Why is that?
13:53
@AfonsoMatos because using the operator will make use of StringBuilder
actually it is using in both cases a stringbuilder
and btw. they both return the same thing :D
when concatenating String the compiler creates a StringBuilder, using its .append() method to concatenate by using their .toString() method.
and that works fine since every object has a toString() method inherited by Object
14:23
Consider a command line java application. One could test it against standard testcases by providing it input and comparing the output with standard o/p. I guess this is what they do for online competitions. But what can be done about GUI applications? Can they(or parts of them) be auto tested like this? basically, can you test certain functions of a GUI program for which you have the source as well?
Basically, the way one can test hundreds of CLI program by passing it testcases, I wonder if something similar can be done for GUI programs? Not necessarily the whole program, but certain functions of it.(all programs will have certain methods with same signature)
Thank you. @motaa
14:47
@AfonsoMatos additionally if the toString() method is not overriden it will return the memory address
*hashcode
it will return the hascode of the object :D
 
2 hours later…
16:30
@motaa That was actually what our college prof told us... Me: TRIGGERED
@geisterfurz007 :D
Oh boy! There is someone alive in the chats \o/
starts to annoy motaa
ye playing lol and watching lcs :D
which elo are you?
wodden 2? :>
g4 ;D
16:32
duh
I should play ranked :/
game just started :D nautilus jungle :D
I get nervous when I prepare a presentations struggling to find images or to do photophop -_-
 
2 hours later…
18:35
can someone tell me why I'm still getting an error when i try to make my output object
it still doesnt like outputFileName = inputState.next();
@Brogrammer What does the error say?
its throwing exceptions
but ik where the error lies
i just dont know how to fix it
What exceptions
Input file name
HW8_1.txt
Great Management Truths...


1. Have a plan.
Hip shooters die young.
Build your plans, and execute them in one straight, continuous line.

2. Be a realist.
Many plans might seem to lead to a happy never-never land of easy
profit growth and tranquility for all.
Don't allow yourself or others to smoke this pipe.

3. Start with customer needs.
Your inventory will turn over a lot faster if it contains what people need.
Better yet if its also something they want.

4. Use your common sense.
on compile already or when running?
18:43
i think its because im reassigning that variable to a different scanner object.
user8232051
hey @geisterfurz007
@AKASHDEEPKATIYAR Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
> Exception in thread "main" java.lang.IllegalStateException: Scanner closed
user8232051
hey @Brogrammer
You should look into that
user8232051
18:43
I am here for only talking if that's okay ??
Sure ^^ Chat here is mostly talk anyways
user8232051
I guess java developers here are not android developers , is that right ??
user8232051
I guess java developers here are not android developers , is that right ??
user8232051
okay
user8232051
18:47
I dont know much of java because I always wanted to get into android
user8232051
what about you ?
i found the error
i have to put Scanner inputState = new Scanner(System.in); inside each loop
so they dont refer each other
user8232051
seems like he's gone@Brogrammer
19:49
I'm back with my Java questions.
20:08
does anyone know how fast will I be able to learn Play framework?
@Yaroslav Welcome to the Java Chat, the room for Java enthusiasts! Please use a code snippet tool when posting code snippets. If you have an Android question, you're in the wrong place! And remember: this is not tech support! Thanks for visiting and have fun! :D
basically I have to implement some CRUD using Java Play framework
maybe someone knows good tutorials
 
3 hours later…

« first day (2457 days earlier)      last day (2708 days later) »