« first day (2036 days earlier)      last day (1521 days later) » 

12:00 AM
@ConorO'Brien idk >_> I'd try to write one but I gotta learn Java rn to finish HW
 
@Downgoat k, gl
 
So write one in Java :P
 
I'll need to see one from the best first ;)
 
You'll have to find the best first. It's surely not me.
 
even restricting the domain to this room?
 
12:02 AM
> `- Resource leak: '<unassigned Closeable value>' is never
closed`
question: what does this mean?
It's on a line where I hvae a int n = new Scanner(System.in).nextInt()
 
You never closed the scanner
It's an ide warning
Not java
 
yay more verbosity!
 
You have to close files in any language...
 
If this is for homework, I'd probably avoid chaining nextInt(). Assign the Scanner to a variable.
 
;_; y has CS class become about programming
@Geobits yeah, I had to do that so I could close it anyway
 
12:05 AM
I was going to get to that, but yes :P
 
@ConorO'Brien I thought function curry(func) { args = []; f = function(a) { args.push(a); if(args.length == func.length) return f; else return func.apply(args) }; return f; } would work
But it returns NaN for some reason and I almost vomited writing it so I'm not going to try to finish it
I think you can probably figure it out from there
 
I get NaN too :/
 
Oh, oops
I got the if the wrong way around
 
thanks for being willing to sacrifice your vomit :P
 
is it possible to do something like this in Java?:
 
12:07 AM
I was trying to do recursive, iterative might help
 
public class Main {
	private static int read() {
		return 1
	}

	public static void main(String[] args) {

		System.out.print("What prime to print? ");

		int n = this.read();

	}
}
 
Strange, the func.apply doesn't work
@Downgoat Yes, use a scanner
 
By this I mean to use a function
I know how to use canner
I can't use this in a static context so how else to make a function?
 
Also this.read() isn't right
You meant Main.read()
Since it's static
It's a class method
 
:/ it works in JS
 
12:08 AM
Not an instance method
@Downgoat Why would it work in JS?
It shouldn't
this refers to the current instance. There is no current instance
You can also just do read(), by the way.
It's smart enough to figure it out
@ConorO'Brien func.apply doesn't seem to be working (even with the conditionals correct)
Always returns NaN
 
I don't think I've closed a Scanner in my life.
 
@quartata weiiird
 
function curry(func) { args = []; f = function(a) { args.push(a); if(args.length == func.length) return func.apply(args); else return f}; return f; } is what I meant the first time
@feersum I always do. Maybe I'm just weird.
I mean, I usually have other code in finally anyways so it doesn't hurt
 
@quartata your method is unsafe. args is declared globally and will not stand multiple calls
 
Lexical scoping?
I thought JavaScript was good with that
Wait, what the fuck
It's in a function
It should be fine
 
12:12 AM
well
let's say let a = curry((a, b) => a + b)
 
Ugh, you're right. Fuck JS. Just stick a let in front of it or whatever.
You get the idea. I didn't really want to make it actually work
 
console.log(a(3)); console.log(a(3)); still modifies the args
 
Right, it's supposed to
 
then it's done wrong :P
the args become [3, 3]
 
Oh, OK I see what you mean
 
12:13 AM
yeah
 
Just move the args inside f
 
I think I can take it from here, thanks! :D
 
That was a mistake
 
@quartata then args would be overriden each time the function is called?
 
One second
Does JavaScript pass arrays by value?
 
12:16 AM
reference
 
what kind of language passes arrays by value
 
you can hack value with arr.slice()
 
@ASCII-only I don't know JS, I didn't want to make any assumptions
 
@ASCII-only java. java is strongly pass-by-value ;_;
 
12:19 AM
okay, basically JS is normal though, meaning only primitives are passed by value
@Downgoat no how
java is exactly the same as JS
 
wait wat rly
 
@Downgoat Only primitives are passed by value
 
i like how java and JS share lots of similarities but i very much am disliking the complexity >_>
 
yeah, primitives meaning types with a lowercase first letter
@Downgoat complexity?
 
can i only create function in class?
;_; java y u gotta be so OO
 
12:20 AM
yeah
 
@Downgoat Yes, of course
 
same as C#
just put them in main()
uh, main class
 
so if I don't know a class's name I'm screwed?
 
?
you can use reflection hacks to get class by name
 
:O does Java have varargs??
 
12:22 AM
yes
if you mean ...args
 
@Downgoat Screwed how? If you're trying to write a function, the class name is the name of the class you're in.
 
const curry = (func) => {
    let _rec = (a, args = []) => {
        args.push(a);
        if (args.length == func.length) {
            return func(...args);
        }
        else return n => _rec(n, args);
    };
    return n => _rec(n);
}
@quartata got it working
 
@ASCII-only yeah
halp how to fix "NullPointerException"
better question: what is equivilent of null pointer exception in JS
 
Assign something to the null variable
 
Uncaught TypeError: Cannot read property 'click' of null
 
12:29 AM
@NathanMerrill ohhhhhhhhh
Question: I have an ArrayList<Integer> if I get an integer from that array list. Will it return itself or a copy of the integer?
 
that's complicated
treat it as a copy
but you are planning on doing .equals, just do ==
 
what is difference between List, ArrayList, and LinkedList?
 
List is the abstract type
 
oh
 
aka, it says "all lists should be able to do X and Y"
 
12:35 AM
i know what abstract types are
 
sorry, not sure what terminology is Java specific :)
 
@NathanMerrill its fine >_> I am very dumb at java/complex OO so feel free to assume i am like a 2 year old playing with a keyboard.
 
@Downgoat also, AP CS for me was quite boring. They likely have made the course harder since then, but I doubt you'll have any trouble with the algorithms taught
and maybe you'll grow to like java :)
 
@Downgoat wait you aren't a 2yo goat playing with a keyboard?
 
12:41 AM
@NathanMerrill I hope so. it's most popular language
@ConorO'Brien ಠ_ಠ
is anyone here in AP CS atm?
 
I'm in AP CS P :P
 
I just wanna know what to expect >_>
 
lots of java. also, the teacher doesn't have to know java.
 
e.g. will they teach Java/OO programming or Computer Science >_>_>_>_>_>_
idk
 
you know OO programming a bit
they teach comp sci in there
 
12:44 AM
They'll probably teach you just enough to not be prepared if you ever actually land a job using java.
2
 
22
20
222-882-..281//////////////////
sorry about that
kid got to keyboard
5
 
I wish my kid was young enough for that to be believable. I have to blame it on the dog.
 
you should get a cat for these things
 
Yeah, cats definitely don't have a reputation for getting on keyboards >_>
 
that's what I meant
you need a cat for the keyboard
 
12:48 AM
I like to type on mine from time to time though :/
 
get multiple keyboards
 
@Downgoat take a AP CS practice test
 
or teach it code golf
 
that'll let you know what they'll teach
 
wait what is AP in normal countries
 
12:49 AM
@ASCII-only advanced placement
 
@NathanMerrill oh good idea
 
@ASCII-only Err, normal countries? I thought the USA was normal.
 
wait
wat US has a program for this? :O
 
@El'endiaStarman The education system? Define "normal" :P
 
@ASCII-only yup
 
12:51 AM
plus i probably should have chosen CS, tooo late to change though ;_;
 
@NathanMerrill oh my the practice test looks easy
 
@Downgoat like what?
 
"Choose random word from arraylist of strings"
 
CMC: take the exam as @Downgoat feeds us the questions using one language of your choice. shortest sum of program lengths wins :P
 
Well, you have a bit of experience doing random challenges, so yeah ;)
 
12:53 AM
> a bit
> 213 answers
a bit of an understatement :P
 
Well at least you're humble about it :P
 
@ConorO'Brien ;_; im gonna loose cause we gotta use java ;_;_;_;
brb convicing AP board to use cheddar
 
gl with that.
 
damnit i don't know anything more golfy than js without having a code page in fromt of me
 
I think you need to decide on a file extension before they'll consider using it :P
 
12:54 AM
@Downgoat Python would be much better.
 
@ConorO'Brien no most unit tests/most robust wins
 
@El'endiaStarman python code is not very readable though
syntax is also not super-straight forward
 
@El'endiaStarman depends on the type of questions
 
If anything, that would actually be the one language they switch to because it's started to replace Java in beginner programming classes.
 
though it has been dubbed easiest language iirc
 
12:55 AM
@Downgoat how
 
@ASCII-only right
 
this is CS, not PPCG
 
@ASCII-only 1 if true else 0 is just the wrong order, it should be if true then 1 else 2
they are also a lot of other things
 
@ASCII-only this is ppcg. CMC
 
basically it was as-if python was designed as half-golfing lang
 
12:56 AM
@Downgoat ruby does it like that :p
and more so
 
@Downgoat what golfing lang has and, or and not
 
Can we all create an agreement to stop using Java, so it can die out and I can take my CS class without needing to know a incredibly verbose language
@ASCII-only why does it have such a hate of braces and parens
Python code just doesn't seem clean tho
 
@Downgoat because they are evil
 
it could of been a much better language if whitespace didn't have semantic meaning
 
^
dynamic whitespace just looks ugly imo
or whatever its called
 
12:59 AM
@Downgoat no i can't use native code to write android apps
@Downgoat F# makes its indentation have semantic meaning
you pretty much have to align your statements lerfectly for it to work
 
CMC: what does the following program output? (Don't cheat!)
int i;
for(i=0;i<10;i++)i=i; //does nothing
System.out.println(i); //after the loop
(the "does nothing" part really does nothing)
 
python's required usage of whitespace makes it easier to read.. I agree, having a parser depend on whitespace is generally a bad thing, but it does improve readability
 
@ASCII-only who said f sharp is super readable
 
10?
 
@NathanMerrill really? I should be able to whitespace my program so things can line up. Python doesn't let me do that
 
1:01 AM
@ASCII-only bingo
 
@Downgoat ?
 
@Downgoat what do you want to line up? arguments?
that works fine
 
okay, can someone please aid me in making my Java program to find the first n primes:
 
I've done it lots of times
 
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	private static int prompt(String text) {
		System.out.print(text + " ");

		Scanner stdin = new Scanner(System.in);
		int out = stdin.nextInt();
		stdin.close();

		return out;
	}

	private static void output(ArrayList<Integer> result) {
		System.out.println(result);
	}

	public static void main(String[] args) {
		int n = Main.prompt("How many primes to print?");

		ArrayList<Integer> out = new ArrayList<Integer>();

		out.add(2);
it gives some crazy output
 
1:02 AM
@LeakyNun how was that hard
 
what crazy error?
 
@ASCII-only alright
 
errors actually mean things in Java
 
same as everywhere
 
@NathanMerrill if I have a large expression for example. I want to split it into multiple lines, and whitespace up certain operators so they line up
@NathanMerrill sorry, not error, it looks like its overflowing
 
1:03 AM
@Downgoat you can use `\` for that
 
-2147483647, -2147483646, -2147483645, -2147483644, -2147483643
 
@Downgoat use BigInteger
 
why would i need a biginteger to store 13
 
@Dennis could you pull reticular?
 
...or long
 
1:04 AM
^
13 is a big integer tho
 
@Downgoat how did 13 overflow
 
no, my program is borked so something is overflowing for somer eason
 
@ConorO'Brien Done.
 
thanks!
 
@ConorO'Brien Yeah, this is what I was planning on doing but I forgot how to do keyword args like that to make it pretty
 
1:05 AM
@quartata kewl.
 
@Downgoat One is backed by an array, the other is backed by a linked list
Hence the names
List is the interface
 
wait sorry, I have no idea what prime means
@quartata List is actually an abstract class ;)
 
Are people talking about Java now?
 
@Downgoat Fair warning: AP CS is boring as shit. The actual test is mostly about "read this code and figure out the control flow" and "how many ways can we trick you about pass-by-value vs pass-by-reference." If you get some minimal Java knowledge and take a lot of practice tests you'll have no problems with it
 
@quartata .________. it is highest level CS class at my school....
 
1:07 AM
Yeah, I know.
 
okay brb graduating, then finishing java leraning
 
In Australia there is no AP
 
It barely qualifies as computer science, IMO. You'll find no algorithm questions on the A.
There is a free response section where you have to write code, but what they ask you is usually pretty easy.
 
@quartata D:
 
Just write neatly and follow basic OO paradigms
 
1:09 AM
there is a "intro to computer science class" and all they do is go through codeacadamy's python course :|
 
@Downgoat There used to be an AB that was much more interesting.
I think they got rid of it.
 
;_; @they y u do dis
 
and one of the teachers is apparently basically a talking textbook, and you can do well in any of the few programming assignments by submitting a working program i think
also here you have to use VB and WinForms
 
I'm so so sorry.
 
All I remember from my CS course was cracking open the Karel the Robot package we were using to learn, and turning my robot purple
 
1:10 AM
@Downgoat yeah, it's an intro
@quartata luckily i never chose to do it
 
@ASCII-only but programming =\= computer science
 
yeah, it's mostly concepts
 
			while (cur++ > 0) {
				// All evens > 2 are not prime
				if (cur % 2 != 0 && n % cur == 0) {
					break;
				}
			}

			out.add(cur);
 
that is one of like 1 or 2 programming assignments in the entire two years
 
cur is overflowing (because it increments until negative), and always gets added to the list no matter what anyway.
 
1:12 AM
@Geobits yup, relized that >_>
 
wait how is negative > 0 though
oh
just break when cur becomes negative
and yse long, then you should be fine
 
Well, unless I'm seeing something wrong, you definitely shouldn't be testing n%cur in the first place, since all n is is the number of primes.
 
halp where should i put a decimal resource in android
 
values?
 
yeah which xml
 
1:20 AM
You can put them in their own xml file in /values AFAIK
mydecimals.xml if you're a terrible person
It doesn't look for values resources by file name, but by tag.
 
@Downgoat your problem is not the code: its your naming of variables
 
Hi guys I have a question:
Would it be appropriate to change [this challenge](http://codegolf.stackexchange.com/questions/71976/residue-number-system) from Code-Golf to a simple Code-Challenge, where the first valid answer wins? There is only one answer that might be valid, and it isn't golfed.
 
so generics are kinda like "type arguments" to a class?
 
@Liam we generally don't like code-challenge with first-posted as winning criterion
(I wish we did, but that's another argument)
 
@NathanMerrill I know, but I really think code-golf is a terrible choice. The challenge has been around for half a year. There's only one answer and I'm not sure if it satisfies the challenge requirements (because Mathematica is kind of confusing).
 
1:32 AM
@Geobits also what's the best practice for accessing resources in non-Activity classes?
 
Usually by passing in a context to get the resourcemanager.
 
can i keep a reference to the resource?
 
You should be able to. Just be careful not to leak refs. It gets to be a bit of a pain at times, tbh.
 
how do i tell when refs are leaking?
if i use resources of applicationcontext it should be fine, right?
 
Well, mainly it's contexts that get leaked, by holding onto activities and such after they're gone.
I'm not sure applicationcontext is best practice for this, but it does get used that way.
The resources shouldn't leak the context itself though, since that should be handled by the resourcemanager.
 
1:36 AM
@Downgoat In essence.
 
@Liam I often try pretty hard with these challenges to come up with a different scoring criterion. That said, I think its too late to change it now
 
@Downgoat By the way, please don't actually try to golf your code on the test
You will most certainly get a 0 on the free response
 
@NathanMerrill Yeah I get it... I just really don't want to golf my solution when its done... it's really long. The problem is a lot harder than I expected it to be.
 
1
Q: Sylvester's sequence

Wheat WizardSylvester's sequence, OEIS A000058, is an integer sequence defined as follows: Each member is the product of all previous members plus one. The first member of the sequence is 2. Task Create the smallest program possible that takes an n and calculates the nth term of Sylvester's Sequence. St...

 
@ConorO'Brien There's only usually 3-4 questions on the free response and all of them require you to make a class in a very specific way so that won't really work for all languages
 
1:39 AM
@quartata aw
revised challenge: random choice from thing
 
from random import*;choice
@ConorO'Brien Yeah, like I said the test is boring as shit
 
@quartata oh well. at least I know AP CS Principles will be interesting. final exam is any (app?) written in any language
 
@Downgoat Hey, on the bright side, it used to be Pascal.
Be glad you don't have to do that
 
is there an online basic emulator thing
like, reliable to the first basic
 
Dartmouth BASIC?
Hm
 
1:46 AM
Does it have to be the first one? There are plenty of BASICs
 
@Liam just remove whitespace and call it good :)
 
Probably not. It was 1965
 
@Geobits I'm talking about the one with line numbers if that helps
 
Haha that's the plan.... maybe some function renaming
 
@ConorO'Brien Well a lot of those do that....
But the first version of BASIC, Dartmouth BASIC, is mostly likely lost to the ages
 
1:47 AM
All the early ones used line numbers
 
I mean, the source is still there
But it's written in obscure assembly I'm sure
Probably PDP-10 or something equally hideous
 
If you just want to play around with the language, this should be good enough.
 
something like this
 
Yeah, AppleSoft Basic is relatively close so.
 
I'm sure google found many more when I searched "online basic interpreter", but that was the first one I clicked on.
I lost my love for old basic when I discovered QBasic though :D
 
1:49 AM
This is the problem with bringing back software from the 60s. If you're lucky it's written in Lisp but even then it's usually got a nice lovely layer of ancient assembly drizzled upon it
If you're really lucky it might be in Fortran, but more than likely you'll be finding ancient pieces of assembly with weird idiomatic optimizations
 
we need people to maintain these old languages. What if we discover alien spaceships only to find out they run on BASIC, and we no longer have anything to write or run the code with?
 
Ha.
Usually things written in old languages are OK. It's really assembly that's the problem
Like, we still have plenty of interpreters for Cobol and BASIC and the like.
(In this case Dartmouth BASIC was something that was never really all that public anyways)
@El'endiaStarman Regarding the tree: I've been fiddling around with some better edit distance things, when I've finished with that I'll probably upload what I've been playing with to GH
 
@ConorO'Brien what about cats?
 
@EᴀsᴛᴇʀʟʏIʀᴋ ~ are good for keyboards
 
2:21 AM
I just saw the trash chatroom
It made me laugh
 
Not often I get to post something like this:
> Java 7, 46 bytes
 
Mods have access to Trashcan which is private but we have to settle for Trash
 
It's hilarious, except you "invited me to join trash" :(
 
I got that invitation once :D
 
:D
Is it supposed to be a not so subtle insult?
 
2:24 AM
Definitely not subtle
 
I was talking in Beep Boop Maggot to the bots, and I guess when they moved the bot garbage, my talks with the bots got moved and it "invited me" to continue discussing there.
@quartata I think you could theoretically golf your code on the test, they should credit you, but they will likely toss your paper
 
0
A: Sandbox for Proposed Challenges

NonlinearFruitQuixels - Quantum Pixels Introduction A quixel is a quantum pixel. Similar to a classical pixel, it is represented with 3 integer values (Red, Green, Blue). However, quixels are in a super position of these 3 states instead of a combination. This super position only lasts until the quixel is ob...

 
@RohanJhunjhunwala Actually, it was to move some garbage from someone else. You got caught in the crossfire, sorry
 
@quartata oh ok
It's an interesting method of getting rid of trash
 
Oh, is beep boop maggot active again?
 
2:29 AM
(Or a trash user)
 
> The last message was posted 3 hours ago.

  Beep Boop Maggot

Bot testing
 
btw that snadbox question is pretty interesting.
Except for the requirement of randomness eliminates some languages
 
Lacking randomness should eliminate those languages from existing :P
 
@Geobits I take it your not a fan of brainf*** (I'm not either)
 
If I can't simulate a simple die roll without rolling my own PRNG, I'm not a fan of it.
 
2:32 AM
Yeah, that makes sense
Chat goats gone mad
 
It wasn't ever quite sane to begin with imo.
 
@Geobits its a code-golf?
oh, you didn't post it
 
What's a code golf?
 
nevermind, I'll add a comment
the quixel challenge
 
Oh, yeah. All you really have to do is take in an array and output another one with weighted random. The IO spec is very loose. No "image processing" really required.
So it should work well as a golf.
 
2:40 AM
@Geobits do you accept prng's that need a seed (it may be worth mentioning in the spec if you can take a seed) (It doesn't matter to me for Java and SILOS, but some languages may use a deterministic prng that gets seeded (perhaps from user input))
 
It's not my challenge, but IIRC our defaults for "random" would accept that.
 
@Geobits oh I thought it was your challenge
 
I guess everyone does :P
 
0
A: Sandbox for Proposed Challenges

WallyWestLucas Vs. The Garage Door Remote Lucas (my 15 month old son) likes to play with the garage remote. There are two buttons on this remote, one for the left garage door, and one for the right garage door. Both buttons work in the same manner; press once to get the door to start opening, press again...

 

« first day (2036 days earlier)      last day (1521 days later) »