« first day (2839 days earlier)      last day (2326 days later) » 

18:00
what editor do you use to write these programs?
sublime
ah
you should try an IDE
@Wietlol im on Mac. but ill try
programs that tell you exactly what is wrong and why, and give you a set of approaches on how to fix them
Can you help in mean time?
18:01
try netbeans, im not sure it runs on mac though
> for (bar=foo.length;bar>0; bar--){
bar here isnt defined anywhere afaik
be aware that your program will always fail because bar is assigned to foo.length and foo[bar] (which have the same length) is not good
also, i am not sure int.toCharArray() is what you want
very confused
foo is an int
yes
18:04
> foo.toCharArray();
what do you expect that does?
if foo is 42
{"4","2"}
in any case, what are you trying to do?
Yeah Java doesn't do that :D
in Java, you have to convert the int to a string, then you can get the char array from the string
this is a very common way of doing things
@Wietlol grrrrrrrrr. java
18:06
if JavaScript or PHP had such a thing, they would be even more unusable
but since you will always know the types in Java, Java can enforce this behavior
myArray = String.valueOf(foo).toCharArray();
i feel myIntArray is very unnecessary
2 more errors
Test.java:16: error: cannot find symbol
    		for (int bar=String.valueOf(foo).length;bar>0; bar--){
    		                                ^
  symbol:   variable length
  location: class String
@Wietlol well the hole script could be better
> in any case, what are you trying to do?
the assignment: "Write a program that stores all of the integers between 1000 and 9999 (inclusive) in
an array. The program should display all of the 4-digit palindromes."
18:10
sigh
and I thought I already knew the most stupid assignment
@Wietlol 90% of mine are similar to this
im like... WHY?!
why cant you just loop through them?
why do you have to put them in an array?
an array even
@Wietlol Because we have use arrays because thats the unit (I know)
String has the method length(). I agree with Wietlol (yes, yes, I do): Get an IDE. It will tell you stuff that won't compile instantly without you having to compile it while offering fixes. Most of the stuff can be found by googling as well (ie how to I get the length of a String in Java)
@Wietlol So you cannot use a sneaky thing where you put the palindromes together.
a palindrome of ints is very interesting though
lemme think
nah, converting them to a string is much faster
18:13
Heres the solution from teacher
@Wietlol that in response to teacher code?
Ew indeed.
lemme write something
@Wietlol ok thanks for help. I just want to make sure I understand not copy and paste.
18:17
ow, you wont understand
:(
B E A U tiful
ow you
18:21
:43458414 Understand this completely.
You put the thing in the thing and then do the thing with the things so you have a thing with another thing then you just print the thing.
Right?
yep
i take all numbers starting at 0 counting upwards
i skip all numbers while the value is less than 1000
(I could simply start at 1000, but ill do it this way just for funz)
I don't get it. I make a string and convert to char array no problem. Then I convert Int to String then convert that to char array its doesn't work.
i take all numbers while the value is less than or equal to 9999
then I collect them to a list
that list should be all 4 digit numbers
that list, I loop over, foreach value, I convert them to a string, then filter for palindromes, then print the values that passed the palindrome check
1 min ago, by JBis
I don't get it. I make a string and convert to char array no problem. Then I convert Int to String then convert that to char array its doesn't work.
code?
@Wietlol Your four digit numbers list stream is super long for no reason.
18:25
@geisterfurz007 ?
You can just use IntStream#range
i know
but I did it for funz
i wanted to show off Java9 JDK :D
which you dont have :p
@geisterfurz007
3 mins ago, by Wietlol
(I could simply start at 1000, but ill do it this way just for funz)
Ah.
12 hours ago, by geisterfurz007
Fancy! I am installing Java 10 :o
18:26
@Wietlol Java 9? Should have stoped at 1...
damnit
Only for one application and two lines of code.
@JBis why so?
plz help
2 mins ago, by JBis
@Wietlol https://paste.ofcode.org/ESZx9p64m2YivSMHYmvBES
Lemme guess...
18:28
int[] myIntArray;
implicit = null
@JBis yes, which has no value
you just specify you want to use such a variable somewhere in the future
but if it has no value, it is undefined in JS
in Java, the compiler is smart enough to know that it is going to be undefined
and in Java, we do not like undefined
so, you are not even allowed to run
so how do I define an empty array
doesn't like char[] myArray = [];
an array? no
JS arrays are ArrayList in Java
Java Array is different
18:30
grrr
you could use an ArrayList, but that is not your assignment
//lmgtfy !so how do I create an empty array java --ddg
so your assignment sucks
18:31
@geisterfurz007 maybe add "jaba"
dangit I am bad at google.
@Alisha how dare you suggest duck duck go
user8622974
@JBis How can I //help?
@JBis I specified it with --ddg because it has !so as shortcut to stackoverflow search.
18:31
@JBis you are not allowed to change the length of arrays in Java
JS now has Vectors
which are more like Arrays
im so lossed
but this is no problem for you, because you already know how large your array is going to be
lets start from the begiing.
you can simply use new int[length]
so you are telling me in Java you can't change then length of an array?
18:33
That is correct.
not of an array
Thats stupid.
nope
Java has List for that
ArrayList is the one that can do that
18:33
but I was able to add to an array before
not really,
I doubt that.
you simply changed a value in it
yea, that still doesnt work
oh
I get it
Aha moment
I never changed it
Good, good.
@Wietlol How is the tear production going?
18:36
but java doesn't allow me to redefine variables
well... I have good distraction now :D
so I can't define in a loop
@JBis redefine variables?
@Wietlol Hah! Procrastination for the win :D
like int i = 0; String i = "" ?
that sounds silly
18:37
All of a sudden I started playing guitar again when the alternative was doing the dishes :P
but i got a nice overview now
i kind of need a multiplicative recursive method that outputs a tree based structure of nested rule matches that will then be flattened to a stream of lists of match trees
which makes perfect sense
@JBis you still don't have myIntArray defined.
@Wietlol did you copy that from this noon?
@geisterfurz007 no
18:39
@Wietlol how??
I copied it from where I pasted it when I copied it from where I said it this noon
you need to make the array first
look at the teacher's "solution"
it first makes a new array
then it fills it
but I feel like I have defied and then set an array.
you just made a variable
you didnt make an array
like in JS
let arr; arr.push(5); this will break
@Wietlol wdym
you need to do let arr = [];
or var arr = [];
you just said var myIntArray;
you didnt actually make the array
18:42
@Wietlol I get it
almsot done
Test.java:16: error: cannot find symbol
    		for (int bar=eachInt.length;bar>0; bar--){
    		                    ^
  symbol:   variable length
  location: variable eachInt of type String
Test.java:20: error: cannot find symbol
    		if (eachInt.equals(reverse)) {
    		    ^
  symbol:   variable eachInt
  location: class Test
2 errors
is eachInt not an object?
it is just out of scope
eachInt is an object. Unlike in Javascript, you cannot get the length as attribute. You use length() for that.
your eachInt variable is created inside the loop, you cannot use it outside the loop
@Wietlol well fuck
i think your if statement should be inside the loop
18:45
@geisterfurz007 I have used .length before
to get the length of an array.
@JBis on arrays
not on strings
@Wietlol why does java have so many inconsistencies?
i think because it is older
if you like consistency, go for kotlin :D
so im not crazy to think js is bette
18:46
not really true
last error
JS has 17 "best" ways to do datetimes
talk about consistency
Test.java:16: error: cannot find symbol
    		for (int bar=eachInt.length;bar>0; bar--){
    		                    ^
  symbol:   variable length
  location: variable eachInt of type String
1 error
2 mins ago, by geisterfurz007
eachInt is an object. Unlike in Javascript, you cannot get the length as attribute. You use length() for that.
18:48
no
not like php
just like toCharArray()
ah
but then... length()
NO ERRORS
fuck yeah
in Java, you basically access everything by a method
obj.meth()
only arrays are always a bit off
18:49
hence why noone uses arrays
I like arrays (or do I mean lists)
prolly lists
arrays are old and carry a lot of bad design with them
but you cant really change that
the only thing they can do is make a wrapper for it similar to ArrayList
but then, why not just use an ArrayList instead?
so, people simply use arraylist
Why I'm not becoming a programer for a living: chat.stackoverflow.com/rooms/139/java
im going in to cyber security
18:51
is the Jaba chatroom why you are not becoming a programmer for a living?
so ill touch code
@Wietlol was referring to the entire convo we had. And that it took me 3 hours to understand.
everyone has to start somewhere
Wietlol started in his baby bed.
... except me, I already knew computer science when I was 3
18:52
apparently "final" is reserved
That is correct.
final is a keyword
its probably the best thing
It's essentially to make a variable -> const
except... it is so good, everything should be final
but that would become noise
so, I treat everything as if it is final, but do not actually write the keyword
you can also use it on methods and classes, but I rarely do that
in any case, off to my pattern matching engine !!!
Good luck and good night :)
18:54
no errors in compiling but didn't work when I run
@Wietlol Thanks for help
@geisterfurz007 Your leaving too?
can you just help with one more thing before?
@JBis you still have an array out of index exception
@Wietlol yep. What does that mean?
You try to access an index of an array that doesn't exist.
it means that you try to do myArray[91348129408120948109821094] when your array only has 3 items
(i might have exaggerated a bit)
18:56
which array?
int[] myIntArray = new int[9000];
myIntArray
[1, 2, 3] what is the length of that array?
54 mins ago, by Wietlol
be aware that your program will always fail because bar is assigned to foo.length and foo[bar] (which have the same length) is not good
@geisterfurz007 3...?
[0]=1;[1]=2;[2]=3;
What is the element at position 3 of that array?
ohh it means that way
so it should be 8999?
@Wietlol idk what that means
18:59
Yes. Because your array is 0-indexed, the last accessible element is 8999
myIntArray should be fine
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8999
	at Test.main(Test.java:11)
Yeah my bad; I was thinking about the wrong array.
The first loop is fine.
The third one with the chararray is borked.
19:01
for (int bar=eachInt.length;bar>0; bar--){
    reverse+=myArray[bar];
}
That one.
what's wrongg with it
Imagine you have the String "Hello"
What is the length of it?
Ok so we agree that bar in the first round of the loop is 5 in that case?
yes
19:04
Good. What is myArray in that case (given that it is "Hello".toCharArray())?
["H","e","l","l","o"]
With another l, but I will let that one count ;)
So the lenght of the array is the same as the length of the string which is 5.
Now what is element 5 of that array?
gimme a sec
@geisterfurz007 error
Good :)
So what should bar be if you want to access the last element of the array?
@geisterfurz007 4
19:09
Or relative to the length of the string?
-1
Correct.
fuck
I did that in my last script must have forgotten
no
-1
not fuck
19:10
ha!
do not try to fool my static analysis
great
thanks
brb
I won't! Good night o/
And still good luck Wierdlol <3
@geisterfurz007 THANKS FOR HELP
SO MUCH
BOTH OF YOU
No problem! I hope you don't mind me asking questions all the time but I think that is better than just telling you the answer.
19:17
@geisterfurz007 would I rather you tell me the answer? Yes. If you do will I be back within 5 min to ask another question? Yes.
Instead I ask a million questions now
but then im done
I know know Arrays, ArrayLists, how to convert between them, scopes, and much more.
lets start with a hashset
:p
== English == === Etymology === The oldest English-language use of the proverb has been found in Anne Isabella Thackeray Ritchie's (1837–1919) novel, Mrs. Dymond (1885), in a slightly different form: " […] if you give a man a fish he is hungry again in an hour. If you teach him to catch a fish you do him a good turn.Possibly a translation of the ancient Chinese saying 授人以魚不如授人以漁/授人以鱼不如授人以渔 (shòu rén yǐ yú bùrú shòu rén yǐ yú). Other attributions have been suggested, but no solid evidence has been produced. See the results of an exploration by Quote Investigator on https://quoteinvestiga...
@Wietlol I may need a bigger boat for that
Whatever ^^ I found that working the steps down why something doesn't work helps to understand underlying problem and helps at least me to remember and not do it again ^^
teach a man to fish and he wont be buying fish from you any more
@Wietlol what you want me to PayPal you?
19:20
the first fish is on the house
geis will PayPal me
@Wietlol well with trump in the house theres some extra tariffs on that fish
we dont deal with trump though
not until he has gone too far
then we shut him down
We are anoymous
and I am Wietlol
19:22
alright
I gtg do some work
adios
annoymouse?
Trump? You mean weird-looking president #45?
19:56
@JennaSloan Are you calling Obama weird because he's black?!?!?!?
racist
@Wietlol @geisterfurz007 Yay. Finished. Who's better? Teacher or mine? paste.ofcode.org/cZinmns3hVG53q6Qa3uAkw
@JBis No, because he's male
@JennaSloan 🤦🏻‍♂️
excuse me
🤦🏻‍♀️
> Donald Trump, is therefore the 45th president
lol
@Wietlol how you get the line?
The President of the United States is the elected head of state and head of government of the United States. The president leads the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces. The president is indirectly elected to a four-year term by the people through the Electoral College. Since the office was established in 1789, 44 men have served as president. The first, George Washington, won a unanimous vote of the Electoral College. Grover Cleveland served two non-consecutive terms in office, and is counted as the nation's 22nd and 24...
19:59
No I mean before what you type
@JBis i will look at your code if you look at mine
try "> text"
this is my code
Oh just blockquote

« first day (2839 days earlier)      last day (2326 days later) »